Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Rework vaultDetails logic #271

Merged
merged 27 commits into from
Apr 24, 2024
Merged

Conversation

infeo
Copy link
Member

@infeo infeo commented Apr 19, 2024

This PR reworks/fixes the logic in vault details.

Changes:

  • vaultRole property is extended by a new value (NONE). An admin can access all vaults, but does not have the MEMBER role. This prevents errors done in future changes and keeps the model clean.
  • vaultDetails component emits now license updates, such that the license alert is displayed in the vault list, if on the server side the license changes
  • aligned translations key names used in the vaultDetails component
  • renamed RecoveryKeyDialog to DisplayRecoveryKeyDialog to be aligned with other dialog components
  • reworked license conditions
    • use new license/user-info endpoint
    • if the license is violated (aka expired or exceeded), only block grantAccess and addMember
  • seperated action bar into 4 containers
    • vault is a legaceVault and someone needs to claim ownership
    • vault is archived
    • vault recovery is required
    • other/regular vault
  • if vault is archived, you can still edit existing members (upgrade/downgrade/remove)
  • make dialogs dependent only on required properties and the "show" variable

Summary by CodeRabbit

  • New Features

    • Introduced new user interface actions for claiming ownership and recovering vault access in the vault management section.
  • Enhancements

    • Improved role-based conditions and actions in the VaultDetails component for better user experience based on user roles and license status.
    • Added functionality to track and display accessible vaults in the VaultList component.
  • Bug Fixes

    • Updated error messaging to more accurately reflect license violation scenarios.
  • Refactor

    • Reorganized button actions and conditions in the vault components to align with updated role and license status logic.
  • Documentation

    • Updated text keys in the localization files to enhance clarity and accuracy in user-facing messages.

@infeo infeo requested review from SailReal and tobihagemann April 19, 2024 15:25
Copy link

coderabbitai bot commented Apr 19, 2024

Walkthrough

The update primarily enhances the management and interaction with vaults in a software application. It revises roles, introduces license status checks, and improves error messaging, ensuring a more intuitive and compliant user experience.

Changes

File Path Change Summary
frontend/.../VaultDetails.vue Refactored role conditions, added license violation checks, and reorganized button actions.
frontend/.../VaultList.vue Added new computed properties for role and license status handling.
frontend/src/i18n/de-DE.json Renamed actions related to vault management for clarity.
frontend/src/i18n/en-US.json Updated text keys for vault actions and error messages.

Possibly related issues

🐇💻
A tiny hop in code, a giant leap in usability,
Refactored roles and licenses in harmony.
Vault doors open with a clearer key,
Errors whisper softly, as clear as can be.
Cheers to the devs, from a rabbit so merry! 🎉🥕


Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 2dd4d53 and 4be8991.
Files selected for processing (4)
  • frontend/src/components/VaultDetails.vue (14 hunks)
  • frontend/src/components/VaultList.vue (5 hunks)
  • frontend/src/i18n/de-DE.json (2 hunks)
  • frontend/src/i18n/en-US.json (2 hunks)
Files skipped from review as they are similar to previous changes (4)
  • frontend/src/components/VaultDetails.vue
  • frontend/src/components/VaultList.vue
  • frontend/src/i18n/de-DE.json
  • frontend/src/i18n/en-US.json

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

frontend/src/components/VaultDetails.vue Show resolved Hide resolved
@infeo infeo requested a review from overheadhunter April 22, 2024 10:02
Copy link
Member

@tobihagemann tobihagemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just did a code review for now. Is my assumption right that you didn't really change anything in the UI? Or is there a noteworthy change?

frontend/src/components/VaultDetails.vue Outdated Show resolved Hide resolved
frontend/src/i18n/en-US.json Outdated Show resolved Hide resolved
frontend/src/components/VaultDetails.vue Outdated Show resolved Hide resolved
Co-authored-by: Tobias Hagemann <[email protected]>
@infeo
Copy link
Member Author

infeo commented Apr 22, 2024

Is my assumption right that you didn't really change anything in the UI?

Nothing apparently visible. As wrote in the opening comment, i cleaned the license logic, such that only grant access and addMember are blocked. All other features are enabled.

Copy link
Member

@overheadhunter overheadhunter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't test, so take this review with a grain of salt. Code change lgtm though.

Copy link
Member

@SailReal SailReal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this change but I still need to run some tests...

Only I do not really understand the reason behind the change from RecoveryKeyDialog to DisplayRecoveryKeyDialog? For me a dialog is already something to display? Things get wild at the latest with showDisplayRecoveryKeyDialog 😅

@infeo
Copy link
Member Author

infeo commented Apr 23, 2024

Only I do not really understand the reason behind the change from RecoveryKeyDialog to DisplayRecoveryKeyDialog?

If you are looking at the other *Dialog names, you notices a general scheme of "[Verb][Noun(s)]Dialog": A dialog does something with an object, aka it has an intention/action. A "RecoveryKeyDialog" breaks with this scheme, because it is not clear what the intention of the dialog is. SHould it change th recoveryKey? Should it display it?

I just fitted it into the scheme and from my perspective, it is now clearer and additionally easier to distinc from the recoverVaultDialog.

@infeo infeo requested a review from tobihagemann April 23, 2024 09:25
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Out of diff range and nitpick comments (1)
frontend/src/components/VaultDetails.vue (1)

63-68: Consider adding a confirmation dialog before changing a member's role to 'OWNER'.

Copy link
Member

@SailReal SailReal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In

const vaultKeyJwe = await backend.vaults.accessToken(props.vaultId, true);

when the license has expired, the backend returns a 402 for /vaults/${vaultId}/access-token?evenIfArchived=true and is mapped to a PaymentRequiredError which is caught in this method, but results in no vaultKeys being set, and in turn the Show Recovery Key button cannot show the DisplayRecoveryKeyDialog but does nothing due to

<DisplayRecoveryKeyDialog v-if="displayingRecoveryKey && vault && vaultKeys" ref="displayRecoveryKeyDialog" :vault="vault" :vault-keys="vaultKeys" @close="displayingRecoveryKey = false" />

We should not show this button if vaultKeys is missing.

image

@infeo
Copy link
Member Author

infeo commented Apr 23, 2024

@SailReal Thanks for the finding. I fixed it in 2dd4d53 creating an own div for actions possible, when the license is violated.

@infeo infeo requested a review from SailReal April 23, 2024 21:28
@infeo infeo merged commit dac175f into develop Apr 24, 2024
4 checks passed
@infeo infeo deleted the feature/fix-vault-details-logic branch April 24, 2024 14:48
@infeo infeo added this to the next milestone Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants