feat: Bulk-Aktionen für Objekte (Auswählen, Löschen, Verschieben)
- Checkboxen in der Objekttabelle inkl. Select-All pro Bucket-Ansicht - BulkActionBar zeigt Anzahl Auswahl + Aktionen (Verschieben/Löschen/Aufheben) - BulkDeletePopup: löscht ausgewählte Objekte einzeln, mit Retry bei Teilfehlern - BulkMovePopup: verschiebt in beliebigen Zielbucket/-pfad via Server-Side-Copy + Delete - sigv4: signS3Copy für x-amz-copy-source PUT-Requests, Header werden jetzt sortiert statt auf Insertion-Order zu vertrauen - useS3Client: copyObject/moveObject ergänzt Move ist client-seitig Copy+Delete, da S3 kein natives Rename/Move kennt.
This commit is contained in:
+58
@@ -52,15 +52,24 @@
|
||||
{{ errorMessage }}
|
||||
</p>
|
||||
|
||||
<BulkActionBar
|
||||
:count="selectedKeys.size"
|
||||
@move="openBulkMovePopup"
|
||||
@delete="openBulkDeletePopup"
|
||||
@clear="selectedKeys = new Set()"
|
||||
/>
|
||||
|
||||
<ObjectTable
|
||||
:objects="filteredObjects"
|
||||
:loading="loadingObjects"
|
||||
:has-search="search.length > 0"
|
||||
:search-term="search"
|
||||
:error="objectsError"
|
||||
:selected-keys="selectedKeys"
|
||||
@select="selectedObject = $event"
|
||||
@upload="openUploadPopup"
|
||||
@retry="retryLoadObjects"
|
||||
@update:selected-keys="selectedKeys = $event"
|
||||
/>
|
||||
</main>
|
||||
|
||||
@@ -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<S3Bucket[]>([])
|
||||
const objects = ref<S3Object[]>([])
|
||||
const selectedBucket = ref<string | null>(null)
|
||||
const selectedObject = ref<S3Object | null>(null)
|
||||
const selectedKeys = ref<Set<string>>(new Set())
|
||||
const search = ref('')
|
||||
const loadingObjects = ref(false)
|
||||
const errorMessage = ref<string | null>(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
|
||||
|
||||
Reference in New Issue
Block a user