diff --git a/app/app.vue b/app/app.vue index c607ce3..a174b2e 100644 --- a/app/app.vue +++ b/app/app.vue @@ -52,15 +52,24 @@ {{ errorMessage }}

+ + @@ -81,6 +90,8 @@ import { ref, computed, watch, onMounted } from 'vue' import { Popup, PopupSize } from '~/utils/popup' import UploadPopup from '~/components/popup/UploadPopup.vue' +import BulkDeletePopup from '~/components/popup/BulkDeletePopup.vue' +import BulkMovePopup from '~/components/popup/BulkMovePopup.vue' import type { S3Bucket, S3Object } from '~/utils/s3xml' useHead({ title: 'r9t · Object Storage' }) @@ -94,6 +105,7 @@ const buckets = ref([]) const objects = ref([]) const selectedBucket = ref(null) const selectedObject = ref(null) +const selectedKeys = ref>(new Set()) const search = ref('') const loadingObjects = ref(false) const errorMessage = ref(null) @@ -111,6 +123,7 @@ const filteredObjects = computed(() => { function selectBucket(name: string) { selectedBucket.value = name selectedObject.value = null + selectedKeys.value = new Set() } function notify(message: string) { @@ -123,6 +136,11 @@ function mockAction() { } function handleObjectDeleted() { + if (selectedObject.value) { + const next = new Set(selectedKeys.value) + next.delete(selectedObject.value.key) + selectedKeys.value = next + } selectedObject.value = null notify('Objekt gelöscht.') if (selectedBucket.value) { @@ -130,6 +148,46 @@ function handleObjectDeleted() { } } +function openBulkDeletePopup() { + if (!selectedBucket.value || !selectedKeys.value.size) { + return + } + const keys = Array.from(selectedKeys.value) + usePopup().open( + Popup.component(BulkDeletePopup) + .setConfig({ + heading: 'Objekte löschen', + size: PopupSize.MEDIUM, + closeOnOverlayClick: false, + callback: () => { + selectedKeys.value = new Set() + loadObjects(selectedBucket.value!) + }, + }) + .setPayload({ bucket: selectedBucket.value, keys }), + ) +} + +function openBulkMovePopup() { + if (!selectedBucket.value || !selectedKeys.value.size) { + return + } + const keys = Array.from(selectedKeys.value) + usePopup().open( + Popup.component(BulkMovePopup) + .setConfig({ + heading: 'Objekte verschieben', + size: PopupSize.MEDIUM, + closeOnOverlayClick: false, + callback: () => { + selectedKeys.value = new Set() + loadObjects(selectedBucket.value!) + }, + }) + .setPayload({ bucket: selectedBucket.value, keys }), + ) +} + function openUploadPopup() { if (!selectedBucket.value) { return diff --git a/app/components/BulkActionBar.vue b/app/components/BulkActionBar.vue new file mode 100644 index 0000000..be5f020 --- /dev/null +++ b/app/components/BulkActionBar.vue @@ -0,0 +1,42 @@ + + + diff --git a/app/components/ObjectTable.vue b/app/components/ObjectTable.vue index 855c756..9ab4814 100644 --- a/app/components/ObjectTable.vue +++ b/app/components/ObjectTable.vue @@ -3,6 +3,16 @@ + @@ -17,7 +27,7 @@
+ + KEY