From 94568d93c525ad0f8ed33b9e56a7532432e96ad6 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Mon, 4 Mar 2024 16:09:49 +0100 Subject: [PATCH 01/25] refactor button bar in vault details: * add upgradeToOwner button * group in different divs --- frontend/src/components/VaultDetails.vue | 142 ++++++++++++++--------- frontend/src/components/VaultList.vue | 19 ++- frontend/src/i18n/en-US.json | 1 + 3 files changed, 104 insertions(+), 58 deletions(-) diff --git a/frontend/src/components/VaultDetails.vue b/frontend/src/components/VaultDetails.vue index 6967ec96..3d9fa41f 100644 --- a/frontend/src/components/VaultDetails.vue +++ b/frontend/src/components/VaultDetails.vue @@ -1,5 +1,5 @@ -
  • +
  • + - -
    -

    {{ t('vaultDetails.actions.title') }}

    + +
    +

    {{ t('vaultDetails.actions.title') }}

    + + +
    + +
    + + +
    + + + + + + +
    -

    + +

    +

    {{ t('vaultDetails.error.paymentRequired') }}

    + + + + +
    + + +
    +
    +
    +
    +

    {{ t('vaultDetails.recoverVault.title') }}

    +
    +

    {{ t('vaultDetails.recoverVault.description') }}

    + + +
    -
    + +
    + +
    - - - -
    - -
    - - -
    -
    -
    - -
    - - -
    - -
    -
    -
    -
    -

    {{ t('vaultDetails.recoverVault.title') }}

    + + + + + + + + + +
    -

    {{ t('vaultDetails.recoverVault.description') }}

    - -
    @@ -185,6 +216,7 @@ From 8e5db222ad966483a105f7f6f3348e5177269a6a Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 19 Apr 2024 17:35:48 +0200 Subject: [PATCH 18/25] upgrade license if the vault is unarchived --- frontend/src/components/VaultDetails.vue | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/VaultDetails.vue b/frontend/src/components/VaultDetails.vue index 86aac463..7f13b650 100644 --- a/frontend/src/components/VaultDetails.vue +++ b/frontend/src/components/VaultDetails.vue @@ -190,7 +190,7 @@ - + @@ -294,8 +294,7 @@ async function fetchOwnerData() { vaultRecoveryRequired.value = true; } else if (error instanceof PaymentRequiredError) { //refetch license - license.value = await backend.license.getUserInfo(); - emit('licenseStatusUpdated', license.value); + await refreshLicense(); } else { console.error('Retrieving ownership failed.', error); onFetchError.value = error instanceof Error ? error : new Error('Unknown Error'); @@ -444,6 +443,11 @@ function permissionGranted() { usersRequiringAccessGrant.value = []; } +async function refreshLicense() { + license.value = await backend.license.getUserInfo(); + emit('licenseStatusUpdated', license.value); +} + function refreshVault(updatedVault: VaultDto) { vault.value = updatedVault; emit('vaultUpdated', updatedVault); @@ -489,8 +493,7 @@ async function removeMember(memberId: string) { if (!licenseViolated.value) { usersRequiringAccessGrant.value = await backend.vaults.getUsersRequiringAccessGrant(props.vaultId); } else { - license.value = await backend.license.getUserInfo(); - emit('licenseStatusUpdated', license.value); + await refreshLicense(); } } catch (error) { console.error('Removing member access failed.', error); From 30d40311f6e2ce4e2f8a0b7063096f7e278c9068 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Mon, 22 Apr 2024 10:53:22 +0200 Subject: [PATCH 19/25] Use string litaral types for vaultRole property Co-authored-by: Sebastian Stenzel --- frontend/src/components/VaultDetails.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/VaultDetails.vue b/frontend/src/components/VaultDetails.vue index 7f13b650..203f7ff8 100644 --- a/frontend/src/components/VaultDetails.vue +++ b/frontend/src/components/VaultDetails.vue @@ -220,7 +220,7 @@ const { t, d } = useI18n({ useScope: 'global' }); const props = defineProps<{ vaultId: string, - vaultRole: string, + vaultRole: 'OWNER' | 'MEMBER' | 'NONE', }>(); const emit = defineEmits<{ From 79d980d37177daab6df0ff4cc75b24a85da2d41b Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Mon, 22 Apr 2024 16:17:42 +0200 Subject: [PATCH 20/25] Apply suggestions from review Co-authored-by: Tobias Hagemann --- frontend/src/components/VaultDetails.vue | 2 +- frontend/src/i18n/en-US.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/VaultDetails.vue b/frontend/src/components/VaultDetails.vue index 203f7ff8..7334974b 100644 --- a/frontend/src/components/VaultDetails.vue +++ b/frontend/src/components/VaultDetails.vue @@ -111,7 +111,7 @@
    -
    +

    {{ t('vaultDetails.actions.title') }}

    diff --git a/frontend/src/i18n/en-US.json b/frontend/src/i18n/en-US.json index a309fada..02d4c3ac 100644 --- a/frontend/src/i18n/en-US.json +++ b/frontend/src/i18n/en-US.json @@ -222,7 +222,7 @@ "vaultDetails.actions.displayRecoveryKey": "Show Recovery Key", "vaultDetails.actions.archiveVault": "Archive Vault", "vaultDetails.actions.reactivateVault": "Reactivate Vault", - "vaultDetails.actions.claimOwnership": "Become Vault Owner", + "vaultDetails.actions.claimOwnership": "Claim Ownership", "vaultDetails.actions.recoverVault": "Recover Vault Access", "vaultDetails.error.licenseViolated": "Your Cryptomator Hub license has expired or you exceeded the number of licensed seats. Please inform a Hub administrator renew or upgrade the license.", "vaultDetails.recoverVault.title": "You have Reset Your Account!", From e4204c450f20c6797560e8dc53b0aa82340bcdc5 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 23 Apr 2024 11:24:47 +0200 Subject: [PATCH 21/25] use vaultRole type when opening vaultDetails component --- frontend/src/components/VaultDetails.vue | 2 +- frontend/src/components/VaultList.vue | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/VaultDetails.vue b/frontend/src/components/VaultDetails.vue index 7334974b..9b6bab29 100644 --- a/frontend/src/components/VaultDetails.vue +++ b/frontend/src/components/VaultDetails.vue @@ -220,7 +220,7 @@ const { t, d } = useI18n({ useScope: 'global' }); const props = defineProps<{ vaultId: string, - vaultRole: 'OWNER' | 'MEMBER' | 'NONE', + vaultRole: VaultRole | 'NONE', }>(); const emit = defineEmits<{ diff --git a/frontend/src/components/VaultList.vue b/frontend/src/components/VaultList.vue index 4608ec39..1383ab58 100644 --- a/frontend/src/components/VaultList.vue +++ b/frontend/src/components/VaultList.vue @@ -121,7 +121,7 @@ import { CheckIcon, ChevronRightIcon, ChevronUpDownIcon } from '@heroicons/vue/2 import { computed, nextTick, onMounted, ref, watch } from 'vue'; import { useI18n } from 'vue-i18n'; import auth from '../common/auth'; -import backend, { VaultDto, LicenseUserInfoDto } from '../common/backend'; +import backend, { VaultDto, LicenseUserInfoDto, VaultRole } from '../common/backend'; import FetchError from './FetchError.vue'; import SlideOver from './SlideOver.vue'; import VaultDetails from './VaultDetails.vue'; @@ -137,7 +137,7 @@ const accessibleVaults = ref(); const ownedVaults = ref(); const selectedVault = ref(null); -const roleOfSelectedVault = computed(() => { +const roleOfSelectedVault = computed(() => { if (ownedVaults.value?.some(ownedVault => ownedVault.id == selectedVault.value?.id)) { return 'OWNER'; } else if (accessibleVaults.value?.some(accessibleVault => accessibleVault.id == selectedVault.value?.id)) { From 3a7a132dd8749b674bf031f51dc90daf5326ac78 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 23 Apr 2024 11:24:58 +0200 Subject: [PATCH 22/25] simplify --- frontend/src/components/VaultDetails.vue | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/frontend/src/components/VaultDetails.vue b/frontend/src/components/VaultDetails.vue index 9b6bab29..a1b2d91a 100644 --- a/frontend/src/components/VaultDetails.vue +++ b/frontend/src/components/VaultDetails.vue @@ -191,7 +191,7 @@ - +