MongocampBucketFiles
A dedicated file browser for one GridFS bucket: paginated, filterable, sortable table of the bucket's files (with clean FileInformation data — filename, size, upload date, metadata — no extended-JSON unwrapping needed), plus upload, download, delete, and rename/edit-metadata actions.
This is a second, purpose-built way to browse a bucket's files, alongside MongocampCollectionData's existing generic raw-document view of the <bucket>.files/<bucket>.chunks collections — that view is unchanged and still works; this component adds a cleaner, action-rich alternative scoped to a single bucket.
Usage
<script setup>
const route = useRoute()
const bucketName = route.params.bucket_name
</script>
<template>
<MongocampBucketFiles :bucket-name="bucketName" />
</template>Typically reached via MongocampCollections's "Browse files" action on a bucket row (its bucketFilesPath prop, default /secured/admin/buckets) — the module doesn't own routing itself, so you provide the page that renders this component for a given bucket_name route param, matching the same pattern MongocampRoles' grantsPath uses for role grants.
Props
| Prop | Type | Description |
|---|---|---|
bucketName | string | The GridFS bucket to browse (no .files/.chunks suffix — the bare bucket name) |
Columns
| Column | Description |
|---|---|
| Filename | Sortable |
| Size | Sortable by the underlying byte length; displayed human-readable (B/KB/MB/GB/TB) |
| Uploaded | Sortable by uploadDate; displayed via toLocaleString() |
| Metadata | A "N keys" button opening a read-only JSON view when the file has metadata, — otherwise |
| — | Download / rename / delete action buttons |
Filtering, sorting, pagination
The filter input searches filename via a Lucene like expression (debounced, same convention as MongocampCollectionData). Sorting and pagination both refetch through useMongocampBucket's listFiles, which reads the total row count from the x-pagination-count-rows response header.
Actions
- Download — reuses
useMongocampBucket'sdownloadFile, tracked viadownloadingFileIds - Rename / edit metadata — opens a
FUDataEditform (filename input + anuxtUIRepeaterof key/value pairs for metadata) and saves viaupdateFileInformation - Delete — behind a confirmation modal, calls
deleteFile - Upload — toolbar button reusing
uploadFile, refetches the table on success
All four actions are tracked via useMongocampBucket's own loading-state refs (downloadingFileIds, fileActionInFlight, uploading) and show success/error toasts from the composable itself — the component doesn't duplicate that feedback.
Related
useMongocampBucket—listFiles/deleteFile/updateFileInformation/downloadFile/uploadFileMongocampCollections— thebucketFilesPath-linked entry pointMongocampCollectionData— the generic raw-document view that still covers<bucket>.files/<bucket>.chunkscollections directly