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

Add Navigation to Delete button #219

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions frontend/src/components/bucket/BucketTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const showPermissions = async (bucketId: string, bucketName: string) => {
};

const confirmDeleteBucket = (bucketId: string) => {
focusedElement.value = document.activeElement;
confirm.require({
message:
'Are you sure you want to delete this folder in BCBox? \
Expand All @@ -73,7 +74,9 @@ const confirmDeleteBucket = (bucketId: string) => {
header: 'Delete folder',
acceptLabel: 'Confirm',
rejectLabel: 'Cancel',
accept: () => deleteBucket(bucketId)
accept: () => deleteBucket(bucketId),
onHide: () => onDialogHide(),
reject: () => onDialogHide()
});
};

Expand Down Expand Up @@ -344,7 +347,6 @@ watch(getBuckets, () => {
class="p-button-lg p-button-text p-button-danger"
aria-label="Delete folder"
@click="confirmDeleteBucket(node.data.bucketId)"
@keyup.enter="confirmDeleteBucket(node.data.bucketId)"
>
<font-awesome-icon icon="fa-solid fa-trash" />
</Button>
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/components/object/DeleteObjectButton.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<script setup lang="ts">
import { storeToRefs } from 'pinia';
import { ref } from 'vue';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';

import { Button, Dialog, useConfirm } from '@/lib/primevue';
import { useObjectStore } from '@/store/objectStore';
import { useNavStore, useObjectStore } from '@/store';
import { ButtonMode } from '@/utils/enums';
import { onDialogHide } from '@/utils/utils';

// Props
type Props = {
Expand All @@ -23,6 +25,7 @@ const emit = defineEmits(['on-deleted-success', 'on-deleted-error']);

// Store
const objectStore = useObjectStore();
const { focusedElement } = storeToRefs(useNavStore());

// State
const displayNoFileDialog = ref(false);
Expand All @@ -31,6 +34,7 @@ const displayNoFileDialog = ref(false);
const confirm = useConfirm();

const confirmDelete = () => {
focusedElement.value = document.activeElement;
if (props.ids.length) {
const item = props.versionId ? 'version' : 'object';
const msgContext = props.ids.length > 1 ? `the selected ${props.ids.length} ${item}s` : `this ${item}`;
Expand All @@ -46,7 +50,9 @@ const confirmDelete = () => {
.then(() => emit('on-deleted-success', props.versionId))
.catch(() => {});
});
}
},
onHide: () => onDialogHide(),
reject: () => onDialogHide()
});
} else {
displayNoFileDialog.value = true;
Expand Down
Loading