Skip to content

Commit

Permalink
Vault description is nullable in backend
Browse files Browse the repository at this point in the history
  • Loading branch information
SailReal committed Nov 9, 2023
1 parent d35611b commit ac96cfc
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions frontend/src/common/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ axiosAuth.interceptors.request.use(async request => {
export type VaultDto = {
id: string;
name: string;
description: string;
description?: string;
archived: boolean;
creationTime: Date;
masterkey?: string;
Expand Down Expand Up @@ -242,7 +242,7 @@ class VaultService {
.then(response => response.data).catch(err => rethrowAndConvertIfExpected(err, 403));
}

public async createOrUpdateVault(vaultId: string, name: string, description: string, archived: boolean): Promise<VaultDto> {
public async createOrUpdateVault(vaultId: string, name: string, archived: boolean, description?: string): Promise<VaultDto> {
const body: VaultDto = { id: vaultId, name: name, description: description, archived: archived, creationTime: new Date() };
return axiosAuth.put(`/vaults/${vaultId}`, body)
.then(response => response.data)
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/ArchiveVaultDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async function archiveVault() {
onArchiveVaultError.value = null;
const v = props.vault;
try {
const vaultDto = await backend.vaults.createOrUpdateVault(v.id, v.name, v.description, true );
const vaultDto = await backend.vaults.createOrUpdateVault(v.id, v.name, true, v.description);
emit('archived', vaultDto);
open.value = false;
} catch (error) {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/CreateVault.vue
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ const onDownloadTemplateError = ref<Error | null>(null);
const state = ref(State.Initial);
const processing = ref(false);
const vaultName = ref('');
const vaultDescription = ref('');
const vaultDescription = ref<string | undefined>();
const copiedRecoveryKey = ref(false);
const debouncedCopyFinish = debounce(() => copiedRecoveryKey.value = false, 2000);
const confirmRecoveryKey = ref(false);
Expand Down Expand Up @@ -294,7 +294,7 @@ async function createVault() {
const vaultId = crypto.randomUUID();
vaultConfig.value = await VaultConfig.create(vaultId, vaultKeys.value);
const ownerJwe = await vaultKeys.value.encryptForUser(base64.parse(owner.publicKey));
await backend.vaults.createOrUpdateVault(vaultId, vaultName.value, vaultDescription.value, false);
await backend.vaults.createOrUpdateVault(vaultId, vaultName.value, false, vaultDescription.value);
await backend.vaults.grantAccess(vaultId, owner.id, ownerJwe);
state.value = State.Finished;
} catch (error) {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/EditVaultMetadataDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const form = ref<HTMLFormElement>();
const onUpdateVaultMetadataError = ref<Error|null>();
const vaultName = ref('');
const vaultDescription = ref('');
const vaultDescription = ref<string | undefined>();
const props = defineProps<{
vault: VaultDto
Expand Down Expand Up @@ -112,7 +112,7 @@ async function updateVaultMetadata() {
throw new FormValidationFailedError();
}
const vault = props.vault;
const updatedVault = await backend.vaults.createOrUpdateVault(vault.id, vaultName.value, vaultDescription.value, vault.archived, vault.masterkey, vault.iterations, vault.salt, vault.authPublicKey, vault.authPrivateKey);
const updatedVault = await backend.vaults.createOrUpdateVault(vault.id, vaultName.value, vault.archived, vaultDescription.value);
emit('updated', updatedVault);
open.value = false;
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/ReactivateVaultDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async function reactivateVault() {
onReactivateVaultError.value = null;
const v = props.vault;
try {
const vaultDto = await backend.vaults.createOrUpdateVault(v.id, v.name, v.description, false, v.masterkey, v.iterations, v.salt, v.authPublicKey, v.authPrivateKey );
const vaultDto = await backend.vaults.createOrUpdateVault(v.id, v.name, false, v.description);
emit('reactivated', vaultDto);
open.value = false;
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/VaultDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<div>
<h3 class="font-medium text-gray-900">{{ t('vaultDetails.description.header') }}</h3>
<div class="mt-2 flex items-center justify-between">
<p v-if="vault.description.length > 0" class="text-sm text-gray-500">{{ vault.description }}</p>
<p v-if="vault.description && vault.description.length > 0" class="text-sm text-gray-500">{{ vault.description }}</p>
<p v-else class="text-sm text-gray-500 italic">{{ t('vaultDetails.description.empty') }}</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/VaultList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<div v-if="ownedVaults?.some(ownedVault => ownedVault.id == vault.id)" class="inline-flex items-center rounded-md bg-gray-50 px-2 py-1 text-xs font-medium text-gray-600 ring-1 ring-inset ring-gray-500/10">{{ t('vaultList.badge.owner') }}</div>
<div v-if="vault.archived" class="inline-flex items-center rounded-md bg-yellow-400/10 px-2 py-1 text-xs font-medium text-yellow-500 ring-1 ring-inset ring-yellow-400/20">{{ t('vaultList.badge.archived') }}</div>
</div>
<p v-if="vault.description.length > 0" class="truncate text-sm text-gray-500 mt-2">{{ vault.description }}</p>
<p v-if="vault.description && vault.description.length > 0" class="truncate text-sm text-gray-500 mt-2">{{ vault.description }}</p>
</div>
<div class="ml-5 shrink-0">
<ChevronRightIcon class="h-5 w-5 text-gray-400" aria-hidden="true" />
Expand Down

0 comments on commit ac96cfc

Please sign in to comment.