Bulk-Move für Objects

Mehrfachauswahl in der Objekttabelle (Checkboxen + Alle-auswählen),
neues Popup zum Verschieben in einen anderen Bucket, Move via
Copy+Delete gegen die bestehende S3-Schnittstelle. sigv4 kann jetzt
zusätzliche Header signieren (x-amz-copy-source), sonst nix am
Backend angefasst wie gewünscht.
This commit is contained in:
2026-09-12 21:32:41 +02:00
parent 02e5b1f4e4
commit 33c3670ba7
5 changed files with 273 additions and 7 deletions
+74
View File
@@ -28,6 +28,25 @@
</div>
<div class="flex items-center gap-2">
<div v-if="selectedKeys.size" class="flex items-center gap-2 rounded-md border border-border bg-surface-raised px-2.5 py-1.5">
<span class="text-sm text-muted">{{ selectedKeys.size }} ausgewählt</span>
<button
type="button"
class="flex items-center gap-1.5 rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white transition-opacity hover:opacity-90"
@click="openMovePopup"
>
<span class="material-symbols-outlined !text-[18px]">drive_file_move</span>
Verschieben
</button>
<button
type="button"
class="text-muted transition-colors hover:text-text"
title="Auswahl aufheben"
@click="clearSelection"
>
<span class="material-symbols-outlined !text-[18px]">close</span>
</button>
</div>
<div class="flex items-center gap-2 rounded-md border border-border bg-surface px-2.5 py-1.5">
<span class="material-symbols-outlined !text-[16px] text-muted">search</span>
<input
@@ -58,9 +77,12 @@
:has-search="search.length > 0"
:search-term="search"
:error="objectsError"
:selected-keys="selectedKeys"
@select="selectedObject = $event"
@upload="openUploadPopup"
@retry="retryLoadObjects"
@toggle="toggleSelection"
@toggle-all="toggleSelectAll"
/>
</main>
@@ -81,6 +103,7 @@
import { ref, computed, watch, onMounted } from 'vue'
import { Popup, PopupSize } from '~/utils/popup'
import UploadPopup from '~/components/popup/UploadPopup.vue'
import MoveObjectsPopup, { type MoveObjectsPayload } from '~/components/popup/MoveObjectsPopup.vue'
import type { S3Bucket, S3Object } from '~/utils/s3xml'
useHead({ title: 'r9t · Object Storage' })
@@ -99,6 +122,7 @@ const loadingObjects = ref(false)
const errorMessage = ref<string | null>(null)
const objectsError = ref<string | null>(null)
const toastMessage = ref<string | null>(null)
const selectedKeys = ref<Set<string>>(new Set())
const filteredObjects = computed(() => {
if (!search.value) {
@@ -111,6 +135,28 @@ const filteredObjects = computed(() => {
function selectBucket(name: string) {
selectedBucket.value = name
selectedObject.value = null
clearSelection()
}
function toggleSelection(key: string) {
const next = new Set(selectedKeys.value)
if (next.has(key)) {
next.delete(key)
}
else {
next.add(key)
}
selectedKeys.value = next
}
function toggleSelectAll() {
const allSelected = filteredObjects.value.length > 0
&& filteredObjects.value.every((object) => selectedKeys.value.has(object.key))
selectedKeys.value = allSelected ? new Set() : new Set(filteredObjects.value.map((object) => object.key))
}
function clearSelection() {
selectedKeys.value = new Set()
}
function notify(message: string) {
@@ -141,6 +187,34 @@ function openUploadPopup() {
)
}
function openMovePopup() {
if (!selectedBucket.value || !selectedKeys.value.size) {
return
}
usePopup().open(
Popup.component<MoveObjectsPayload>(MoveObjectsPopup)
.setConfig({
heading: 'Objekte verschieben',
size: PopupSize.MEDIUM,
closeOnOverlayClick: false,
callback: (payload) => handleObjectsMoved(payload as string[]),
})
.setPayload({ sourceBucket: selectedBucket.value, keys: [...selectedKeys.value], buckets: buckets.value }),
)
}
function handleObjectsMoved(movedKeys: string[]) {
const next = new Set(selectedKeys.value)
for (const key of movedKeys) {
next.delete(key)
}
selectedKeys.value = next
notify(movedKeys.length === 1 ? 'Objekt verschoben.' : `${movedKeys.length} Objekte verschoben.`)
if (selectedBucket.value) {
loadObjects(selectedBucket.value)
}
}
async function loadBuckets() {
errorMessage.value = null
try {