Skip to content

Commit

Permalink
Merge pull request #147 from bcgov/SC3378
Browse files Browse the repository at this point in the history
Add clarification to version update action for non-versioned buckets
  • Loading branch information
jujaga authored Nov 17, 2023
2 parents 45a0aa0 + 69bfe78 commit 4d1f7eb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
10 changes: 8 additions & 2 deletions frontend/src/components/object/ObjectUploadBasic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ref } from 'vue';
import { ObjectMetadataTagForm } from '@/components/object';
import { Button, Dialog, useConfirm, useToast } from '@/lib/primevue';
import { useAppStore, useMetadataStore, useObjectStore, useTagStore } from '@/store';
import { useAppStore, useMetadataStore, useObjectStore, useTagStore, useVersionStore } from '@/store';
import type { Ref } from 'vue';
import type { ObjectMetadataTagFormType } from '@/components/object/ObjectMetadataTagForm.vue';
Expand All @@ -24,6 +24,7 @@ const appStore = useAppStore();
const metadataStore = useMetadataStore();
const objectStore = useObjectStore();
const tagStore = useTagStore();
const versionStore = useVersionStore();
// State
const fileInput: Ref<any> = ref(null);
Expand All @@ -41,8 +42,13 @@ const confirm = useConfirm();
const toast = useToast();
const confirmUpdate = () => {
let confirmMessage = 'Please confirm that you want to upload a new version.';
if (versionStore.findS3VersionByObjectId(props.objectId) === null) {
confirmMessage = 'This is a non-versioned bucket. ' +
'Uploading a new version will overwrite the current version.';
}
confirm.require({
message: 'Please confirm that you want to upload a new version.',
message: confirmMessage,
header: 'Upload new version',
acceptLabel: 'Confirm',
rejectLabel: 'Cancel',
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/store/versionStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ export const useVersionStore = defineStore('version', () => {
function findVersionsByObjectId(objectId: string) {
return state.versions.value.filter((x: Version) => x.objectId === objectId);
}

function findS3VersionByObjectId(objectId: string) {
return state.versions.value.filter((x: Version) => x.objectId === objectId)[0]?.s3VersionId;
}
return {
// State
...state,
Expand All @@ -143,7 +145,8 @@ export const useVersionStore = defineStore('version', () => {
findMetadataValue,
findTaggingByVersionId,
findVersionById,
findVersionsByObjectId
findVersionsByObjectId,
findS3VersionByObjectId,
};
});

Expand Down

0 comments on commit 4d1f7eb

Please sign in to comment.