@sfxcode/nuxt-ui-mongocamp 1.1.3 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -9
- package/dist/module.d.mts +22 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +41 -5
- package/dist/runtime/components/MongocampAccount.vue +21 -20
- package/dist/runtime/components/MongocampBucketFiles.d.vue.ts +6 -0
- package/dist/runtime/components/MongocampBucketFiles.vue +364 -0
- package/dist/runtime/components/MongocampBucketFiles.vue.d.ts +6 -0
- package/dist/runtime/components/MongocampCollectionData.vue +36 -35
- package/dist/runtime/components/MongocampCollectionInfos.vue +37 -36
- package/dist/runtime/components/MongocampCollections.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampCollections.vue +38 -28
- package/dist/runtime/components/MongocampCollections.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampDatabases.vue +13 -12
- package/dist/runtime/components/MongocampJobs.vue +43 -45
- package/dist/runtime/components/MongocampLogin.d.vue.ts +4 -1
- package/dist/runtime/components/MongocampLogin.vue +13 -9
- package/dist/runtime/components/MongocampLogin.vue.d.ts +4 -1
- package/dist/runtime/components/MongocampRoleGrants.vue +30 -28
- package/dist/runtime/components/MongocampRoles.vue +30 -31
- package/dist/runtime/components/MongocampUsers.vue +35 -36
- package/dist/runtime/components/MongocampVersion.vue +3 -1
- package/dist/runtime/composables/useMongocampAccount.js +6 -5
- package/dist/runtime/composables/useMongocampAdmin.js +2 -2
- package/dist/runtime/composables/useMongocampBucket.d.ts +20 -1
- package/dist/runtime/composables/useMongocampBucket.js +62 -13
- package/dist/runtime/composables/useMongocampClientApi.d.ts +13 -0
- package/dist/runtime/composables/useMongocampClientApi.js +8 -0
- package/dist/runtime/composables/useMongocampIndex.js +2 -2
- package/dist/runtime/composables/useMongocampJobs.js +2 -2
- package/dist/runtime/composables/useMongocampProxyApi.d.ts +13 -0
- package/dist/runtime/composables/useMongocampProxyApi.js +9 -0
- package/dist/runtime/composables/useMongocampRoles.d.ts +2 -0
- package/dist/runtime/composables/useMongocampRoles.js +4 -2
- package/dist/runtime/composables/useMongocampSystem.js +2 -2
- package/dist/runtime/locales/de.json +265 -0
- package/dist/runtime/locales/en.json +265 -0
- package/dist/runtime/plugin.js +8 -8
- package/dist/runtime/server/handlers/mongocampProxy.d.ts +2 -0
- package/dist/runtime/server/handlers/mongocampProxy.js +45 -0
- package/dist/runtime/utils/createProxyMongocampApis.d.ts +15 -0
- package/dist/runtime/utils/createProxyMongocampApis.js +28 -0
- package/package.json +13 -6
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, h, reactive, ref, resolveComponent, watch } from "vue";
|
|
3
|
-
import {
|
|
3
|
+
import { useI18n, useMongocampClientApi, useMongocampIndex, useMongocampSchema, useToast } from "#imports";
|
|
4
4
|
const props = defineProps({
|
|
5
5
|
collectionName: { type: String, required: true },
|
|
6
6
|
sampleSize: { type: Number, required: false, default: 500 }
|
|
7
7
|
});
|
|
8
|
-
const {
|
|
8
|
+
const { t } = useI18n();
|
|
9
|
+
const { collectionApi, documentApi } = useMongocampClientApi();
|
|
9
10
|
const { schemaFromSamples, schemaToTsInterface } = useMongocampSchema();
|
|
10
11
|
const { listIndexes, createIndex, createUniqueIndex, createTextIndex, createExpiringIndex, deleteIndex } = useMongocampIndex();
|
|
11
12
|
const UBadge = resolveComponent("UBadge");
|
|
@@ -61,16 +62,16 @@ const tsInterface = computed(() => schemaToTsInterface(columnDefinitions.value,
|
|
|
61
62
|
const toast = useToast();
|
|
62
63
|
async function copySchemaAsTs() {
|
|
63
64
|
await navigator.clipboard.writeText(tsInterface.value);
|
|
64
|
-
toast.add({ title: "
|
|
65
|
+
toast.add({ title: t("nuxtUiMongocamp.collectionInfos.copiedTitle"), description: t("nuxtUiMongocamp.collectionInfos.copiedDescription"), color: "success" });
|
|
65
66
|
}
|
|
66
67
|
const schemaTableColumns = [
|
|
67
68
|
{
|
|
68
69
|
accessorKey: "field",
|
|
69
|
-
header: "
|
|
70
|
+
header: t("nuxtUiMongocamp.collectionInfos.columnField")
|
|
70
71
|
},
|
|
71
72
|
{
|
|
72
73
|
accessorKey: "type",
|
|
73
|
-
header: "
|
|
74
|
+
header: t("nuxtUiMongocamp.collectionInfos.columnType"),
|
|
74
75
|
cell: ({ row }) => h(UBadge, {
|
|
75
76
|
label: row.original.type,
|
|
76
77
|
color: TYPE_COLORS[row.original.type] ?? "neutral",
|
|
@@ -79,7 +80,7 @@ const schemaTableColumns = [
|
|
|
79
80
|
},
|
|
80
81
|
{
|
|
81
82
|
accessorKey: "required",
|
|
82
|
-
header: "
|
|
83
|
+
header: t("nuxtUiMongocamp.collectionInfos.columnInAllSamples"),
|
|
83
84
|
cell: ({ row }) => row.original.required ? h(UIcon, { name: "i-lucide-check", class: "size-4 text-success" }) : h("span", { class: "text-dimmed" }, "\u2014")
|
|
84
85
|
}
|
|
85
86
|
];
|
|
@@ -100,27 +101,27 @@ const createIndexSchema = reactive([
|
|
|
100
101
|
{
|
|
101
102
|
$formkit: "nuxtUIInput",
|
|
102
103
|
name: "fieldName",
|
|
103
|
-
label: "
|
|
104
|
+
label: t("nuxtUiMongocamp.collectionInfos.fieldName"),
|
|
104
105
|
validation: "required"
|
|
105
106
|
},
|
|
106
107
|
{
|
|
107
108
|
$formkit: "nuxtUISwitch",
|
|
108
109
|
name: "sortAscending",
|
|
109
|
-
label: "
|
|
110
|
+
label: t("nuxtUiMongocamp.collectionInfos.ascending")
|
|
110
111
|
},
|
|
111
112
|
{
|
|
112
113
|
$formkit: "nuxtUISelectMenu",
|
|
113
114
|
id: "indexType",
|
|
114
115
|
name: "indexType",
|
|
115
|
-
label: "
|
|
116
|
+
label: t("nuxtUiMongocamp.collectionInfos.indexType"),
|
|
116
117
|
options: ["standard", "unique", "text", "expiring"],
|
|
117
118
|
validation: "required"
|
|
118
119
|
},
|
|
119
120
|
{
|
|
120
121
|
$formkit: "nuxtUIInput",
|
|
121
122
|
name: "duration",
|
|
122
|
-
label: "
|
|
123
|
-
help: "
|
|
123
|
+
label: t("nuxtUiMongocamp.collectionInfos.expireAfter"),
|
|
124
|
+
help: t("nuxtUiMongocamp.collectionInfos.expireAfterHelp"),
|
|
124
125
|
if: "$get(indexType).value === 'expiring'"
|
|
125
126
|
}
|
|
126
127
|
]);
|
|
@@ -153,7 +154,7 @@ async function handleCreateIndex() {
|
|
|
153
154
|
isCreateIndexModalOpen.value = false;
|
|
154
155
|
await fetchIndexes();
|
|
155
156
|
} catch (e) {
|
|
156
|
-
createIndexError.value = e instanceof Error ? e.message : "
|
|
157
|
+
createIndexError.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.collectionInfos.errorCreateIndex");
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
const isDeleteIndexModalOpen = ref(false);
|
|
@@ -172,7 +173,7 @@ async function handleDeleteIndex() {
|
|
|
172
173
|
isDeleteIndexModalOpen.value = false;
|
|
173
174
|
await fetchIndexes();
|
|
174
175
|
} catch (e) {
|
|
175
|
-
deleteIndexError.value = e instanceof Error ? e.message : "
|
|
176
|
+
deleteIndexError.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.collectionInfos.errorDeleteIndex");
|
|
176
177
|
}
|
|
177
178
|
}
|
|
178
179
|
const INDEX_FLAG_BADGES = [
|
|
@@ -183,32 +184,32 @@ const INDEX_FLAG_BADGES = [
|
|
|
183
184
|
const indexTableColumns = [
|
|
184
185
|
{
|
|
185
186
|
accessorKey: "name",
|
|
186
|
-
header: "
|
|
187
|
+
header: t("nuxtUiMongocamp.collectionInfos.columnIndex")
|
|
187
188
|
},
|
|
188
189
|
{
|
|
189
190
|
accessorKey: "keys",
|
|
190
|
-
header: "
|
|
191
|
+
header: t("nuxtUiMongocamp.collectionInfos.columnKeys"),
|
|
191
192
|
cell: ({ row }) => h("span", { class: "font-mono text-xs" }, row.original.keys)
|
|
192
193
|
},
|
|
193
194
|
{
|
|
194
195
|
id: "flags",
|
|
195
|
-
header: "
|
|
196
|
+
header: t("nuxtUiMongocamp.collectionInfos.columnType"),
|
|
196
197
|
cell: ({ row }) => h("div", { class: "flex gap-1" }, INDEX_FLAG_BADGES.filter((flag) => row.original[flag.key]).map((flag) => h(UBadge, { label: flag.label, color: flag.color, variant: "subtle", size: "sm" })))
|
|
197
198
|
},
|
|
198
199
|
{
|
|
199
200
|
accessorKey: "sizeKb",
|
|
200
|
-
header: "
|
|
201
|
+
header: t("nuxtUiMongocamp.collectionInfos.columnSizeKb")
|
|
201
202
|
},
|
|
202
203
|
{
|
|
203
204
|
id: "actions",
|
|
204
205
|
header: "",
|
|
205
206
|
cell: ({ row }) => row.original.name === "_id_" ? null : h("div", { class: "flex justify-end" }, [
|
|
206
|
-
withTooltip("
|
|
207
|
+
withTooltip(t("nuxtUiMongocamp.collectionInfos.deleteIndexTooltip"), h(UButton, {
|
|
207
208
|
"icon": "i-lucide-trash-2",
|
|
208
209
|
"color": "error",
|
|
209
210
|
"variant": "ghost",
|
|
210
211
|
"size": "sm",
|
|
211
|
-
"aria-label": "
|
|
212
|
+
"aria-label": t("nuxtUiMongocamp.collectionInfos.deleteIndexTooltip"),
|
|
212
213
|
"onClick": () => confirmDeleteIndex(row.original.name)
|
|
213
214
|
}))
|
|
214
215
|
])
|
|
@@ -228,7 +229,7 @@ const indexTableColumns = [
|
|
|
228
229
|
>
|
|
229
230
|
<UCard>
|
|
230
231
|
<div class="text-sm text-gray-500 dark:text-gray-400">
|
|
231
|
-
|
|
232
|
+
{{ t("nuxtUiMongocamp.collectionInfos.documents") }}
|
|
232
233
|
</div>
|
|
233
234
|
<div class="text-2xl font-semibold">
|
|
234
235
|
{{ info.count }}
|
|
@@ -236,7 +237,7 @@ const indexTableColumns = [
|
|
|
236
237
|
</UCard>
|
|
237
238
|
<UCard>
|
|
238
239
|
<div class="text-sm text-gray-500 dark:text-gray-400">
|
|
239
|
-
|
|
240
|
+
{{ t("nuxtUiMongocamp.collectionInfos.dataSize") }}
|
|
240
241
|
</div>
|
|
241
242
|
<div class="text-2xl font-semibold">
|
|
242
243
|
{{ Math.round(info.size / 1024) }} KB
|
|
@@ -244,7 +245,7 @@ const indexTableColumns = [
|
|
|
244
245
|
</UCard>
|
|
245
246
|
<UCard>
|
|
246
247
|
<div class="text-sm text-gray-500 dark:text-gray-400">
|
|
247
|
-
|
|
248
|
+
{{ t("nuxtUiMongocamp.collectionInfos.storageSize") }}
|
|
248
249
|
</div>
|
|
249
250
|
<div class="text-2xl font-semibold">
|
|
250
251
|
{{ Math.round(info.storageSize / 1024) }} KB
|
|
@@ -252,7 +253,7 @@ const indexTableColumns = [
|
|
|
252
253
|
</UCard>
|
|
253
254
|
<UCard>
|
|
254
255
|
<div class="text-sm text-gray-500 dark:text-gray-400">
|
|
255
|
-
|
|
256
|
+
{{ t("nuxtUiMongocamp.collectionInfos.avgDocSize") }}
|
|
256
257
|
</div>
|
|
257
258
|
<div class="text-2xl font-semibold">
|
|
258
259
|
{{ Math.round(info.avgObjSize) }} B
|
|
@@ -260,7 +261,7 @@ const indexTableColumns = [
|
|
|
260
261
|
</UCard>
|
|
261
262
|
<UCard>
|
|
262
263
|
<div class="text-sm text-gray-500 dark:text-gray-400">
|
|
263
|
-
|
|
264
|
+
{{ t("nuxtUiMongocamp.collectionInfos.indexes") }}
|
|
264
265
|
</div>
|
|
265
266
|
<div class="text-2xl font-semibold">
|
|
266
267
|
{{ info.nindexes }}
|
|
@@ -268,7 +269,7 @@ const indexTableColumns = [
|
|
|
268
269
|
</UCard>
|
|
269
270
|
<UCard>
|
|
270
271
|
<div class="text-sm text-gray-500 dark:text-gray-400">
|
|
271
|
-
|
|
272
|
+
{{ t("nuxtUiMongocamp.collectionInfos.indexSize") }}
|
|
272
273
|
</div>
|
|
273
274
|
<div class="text-2xl font-semibold">
|
|
274
275
|
{{ Math.round(info.totalIndexSize / 1024) }} KB
|
|
@@ -283,9 +284,9 @@ const indexTableColumns = [
|
|
|
283
284
|
name="i-lucide-list-tree"
|
|
284
285
|
class="size-4 text-(--ui-primary)"
|
|
285
286
|
/>
|
|
286
|
-
<span class="font-semibold">
|
|
287
|
+
<span class="font-semibold">{{ t("nuxtUiMongocamp.collectionInfos.indexes") }}</span>
|
|
287
288
|
<UBadge
|
|
288
|
-
:label="
|
|
289
|
+
:label="t('nuxtUiMongocamp.collectionInfos.indexesCount', { count: indexRows.length })"
|
|
289
290
|
variant="subtle"
|
|
290
291
|
color="neutral"
|
|
291
292
|
size="sm"
|
|
@@ -293,7 +294,7 @@ const indexTableColumns = [
|
|
|
293
294
|
</div>
|
|
294
295
|
<UButton
|
|
295
296
|
icon="i-lucide-plus"
|
|
296
|
-
label="
|
|
297
|
+
:label="t('nuxtUiMongocamp.collectionInfos.createIndex')"
|
|
297
298
|
color="neutral"
|
|
298
299
|
variant="ghost"
|
|
299
300
|
size="sm"
|
|
@@ -317,7 +318,7 @@ const indexTableColumns = [
|
|
|
317
318
|
/>
|
|
318
319
|
<span class="font-semibold">{{ schemaTitle }}</span>
|
|
319
320
|
<UBadge
|
|
320
|
-
:label="
|
|
321
|
+
:label="t('nuxtUiMongocamp.collectionInfos.fieldsCount', { count: schemaRows.length })"
|
|
321
322
|
variant="subtle"
|
|
322
323
|
color="neutral"
|
|
323
324
|
size="sm"
|
|
@@ -325,7 +326,7 @@ const indexTableColumns = [
|
|
|
325
326
|
</div>
|
|
326
327
|
<UButton
|
|
327
328
|
icon="i-lucide-copy"
|
|
328
|
-
label="
|
|
329
|
+
:label="t('nuxtUiMongocamp.collectionInfos.copyAsTs')"
|
|
329
330
|
color="neutral"
|
|
330
331
|
variant="ghost"
|
|
331
332
|
size="sm"
|
|
@@ -341,13 +342,13 @@ const indexTableColumns = [
|
|
|
341
342
|
|
|
342
343
|
<UModal
|
|
343
344
|
v-model:open="isCreateIndexModalOpen"
|
|
344
|
-
title="
|
|
345
|
+
:title="t('nuxtUiMongocamp.collectionInfos.createIndexTitle')"
|
|
345
346
|
>
|
|
346
347
|
<template #body>
|
|
347
348
|
<FUDataEdit
|
|
348
349
|
:data="newIndex"
|
|
349
350
|
:schema="createIndexSchema"
|
|
350
|
-
submit-label="
|
|
351
|
+
:submit-label="t('nuxtUiMongocamp.collectionInfos.createIndex')"
|
|
351
352
|
submit-icon="i-lucide-plus"
|
|
352
353
|
@data-saved="handleCreateIndex"
|
|
353
354
|
/>
|
|
@@ -362,11 +363,11 @@ const indexTableColumns = [
|
|
|
362
363
|
|
|
363
364
|
<UModal
|
|
364
365
|
v-model:open="isDeleteIndexModalOpen"
|
|
365
|
-
title="
|
|
366
|
+
:title="t('nuxtUiMongocamp.collectionInfos.deleteIndexTitle')"
|
|
366
367
|
:ui="{ footer: 'justify-end' }"
|
|
367
368
|
>
|
|
368
369
|
<template #body>
|
|
369
|
-
<p>
|
|
370
|
+
<p>{{ t("nuxtUiMongocamp.collectionInfos.confirmDeleteIndex", { indexName: indexToDelete }) }}</p>
|
|
370
371
|
<p
|
|
371
372
|
v-if="deleteIndexError"
|
|
372
373
|
class="mt-2 text-sm text-error-500"
|
|
@@ -376,13 +377,13 @@ const indexTableColumns = [
|
|
|
376
377
|
</template>
|
|
377
378
|
<template #footer>
|
|
378
379
|
<UButton
|
|
379
|
-
label="
|
|
380
|
+
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
380
381
|
color="neutral"
|
|
381
382
|
variant="ghost"
|
|
382
383
|
@click="isDeleteIndexModalOpen = false"
|
|
383
384
|
/>
|
|
384
385
|
<UButton
|
|
385
|
-
label="
|
|
386
|
+
:label="t('nuxtUiMongocamp.common.delete')"
|
|
386
387
|
color="error"
|
|
387
388
|
icon="i-lucide-trash-2"
|
|
388
389
|
@click="handleDeleteIndex"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
infoPath?: string;
|
|
3
3
|
dataPath?: string;
|
|
4
|
+
bucketFilesPath?: string;
|
|
4
5
|
};
|
|
5
6
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
7
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { h, ref, resolveComponent } from "vue";
|
|
3
|
-
import {
|
|
3
|
+
import { useI18n, useMongocampClientApi, useMongocampBucket } from "#imports";
|
|
4
4
|
const props = defineProps({
|
|
5
5
|
infoPath: { type: String, required: false },
|
|
6
|
-
dataPath: { type: String, required: false }
|
|
6
|
+
dataPath: { type: String, required: false },
|
|
7
|
+
bucketFilesPath: { type: String, required: false }
|
|
7
8
|
});
|
|
8
|
-
const {
|
|
9
|
+
const { t } = useI18n();
|
|
10
|
+
const { collectionApi } = useMongocampClientApi();
|
|
9
11
|
const { isBucketCollection, bucketNameFor, bucketActionInFlight, clearBucket, deleteBucket } = useMongocampBucket();
|
|
10
12
|
const collections = ref([]);
|
|
11
13
|
const loading = ref(false);
|
|
@@ -75,64 +77,72 @@ function sortHeader(column, label) {
|
|
|
75
77
|
const columns = [
|
|
76
78
|
{
|
|
77
79
|
accessorKey: "name",
|
|
78
|
-
header: ({ column }) => sortHeader(column, "
|
|
80
|
+
header: ({ column }) => sortHeader(column, t("nuxtUiMongocamp.collections.columnCollection")),
|
|
79
81
|
cell: ({ row }) => h("div", { class: "flex items-center gap-2" }, [
|
|
80
82
|
h("span", row.original.name),
|
|
81
|
-
isBucketCollection(row.original.name) ? h(UBadge, { label: "
|
|
83
|
+
isBucketCollection(row.original.name) ? h(UBadge, { label: t("nuxtUiMongocamp.collections.bucketBadge"), color: "neutral", variant: "subtle", size: "sm" }) : null
|
|
82
84
|
])
|
|
83
85
|
},
|
|
84
86
|
{
|
|
85
87
|
accessorKey: "count",
|
|
86
|
-
header: ({ column }) => sortHeader(column, "
|
|
88
|
+
header: ({ column }) => sortHeader(column, t("nuxtUiMongocamp.collections.columnDocuments"))
|
|
87
89
|
},
|
|
88
90
|
{
|
|
89
91
|
accessorKey: "sizekb",
|
|
90
|
-
header: ({ column }) => sortHeader(column,
|
|
92
|
+
header: ({ column }) => sortHeader(column, t("nuxtUiMongocamp.collections.columnSize"))
|
|
91
93
|
},
|
|
92
94
|
{
|
|
93
95
|
accessorKey: "indexCount",
|
|
94
|
-
header: ({ column }) => sortHeader(column, "
|
|
96
|
+
header: ({ column }) => sortHeader(column, t("nuxtUiMongocamp.collections.columnIndexes"))
|
|
95
97
|
},
|
|
96
98
|
{
|
|
97
99
|
id: "actions",
|
|
98
100
|
header: "",
|
|
99
101
|
cell: ({ row }) => {
|
|
100
102
|
const buttons = [
|
|
101
|
-
withTooltip("
|
|
103
|
+
withTooltip(t("nuxtUiMongocamp.collections.infoTooltip"), h(UButton, {
|
|
102
104
|
"icon": "i-lucide-info",
|
|
103
105
|
"color": "neutral",
|
|
104
106
|
"variant": "ghost",
|
|
105
107
|
"size": "sm",
|
|
106
|
-
"aria-label": "
|
|
108
|
+
"aria-label": t("nuxtUiMongocamp.collections.infoTooltip"),
|
|
107
109
|
"to": `${props.infoPath ?? "/secured/admin/collections"}/${row.original.name}`
|
|
108
110
|
})),
|
|
109
|
-
withTooltip("
|
|
111
|
+
withTooltip(t("nuxtUiMongocamp.collections.dataTooltip"), h(UButton, {
|
|
110
112
|
"icon": "i-lucide-table",
|
|
111
113
|
"color": "neutral",
|
|
112
114
|
"variant": "ghost",
|
|
113
115
|
"size": "sm",
|
|
114
|
-
"aria-label": "
|
|
116
|
+
"aria-label": t("nuxtUiMongocamp.collections.dataTooltip"),
|
|
115
117
|
"to": `${props.dataPath ?? "/secured/admin/collections"}/${row.original.name}/data`
|
|
116
118
|
}))
|
|
117
119
|
];
|
|
118
120
|
if (isBucketCollection(row.original.name)) {
|
|
119
121
|
const bucketName = bucketNameFor(row.original.name);
|
|
120
122
|
buttons.push(
|
|
121
|
-
withTooltip("
|
|
123
|
+
withTooltip(t("nuxtUiMongocamp.collections.browseFilesTooltip"), h(UButton, {
|
|
124
|
+
"icon": "i-lucide-folder-open",
|
|
125
|
+
"color": "neutral",
|
|
126
|
+
"variant": "ghost",
|
|
127
|
+
"size": "sm",
|
|
128
|
+
"aria-label": t("nuxtUiMongocamp.collections.browseFilesTooltip"),
|
|
129
|
+
"to": `${props.bucketFilesPath ?? "/secured/admin/buckets"}/${bucketName}`
|
|
130
|
+
})),
|
|
131
|
+
withTooltip(t("nuxtUiMongocamp.collections.clearBucketTooltip"), h(UButton, {
|
|
122
132
|
"icon": "i-lucide-eraser",
|
|
123
133
|
"color": "warning",
|
|
124
134
|
"variant": "ghost",
|
|
125
135
|
"size": "sm",
|
|
126
|
-
"aria-label": "
|
|
136
|
+
"aria-label": t("nuxtUiMongocamp.collections.clearBucketTooltip"),
|
|
127
137
|
"loading": bucketActionInFlight.value.has(bucketName),
|
|
128
138
|
"onClick": () => confirmClearBucket(bucketName)
|
|
129
139
|
})),
|
|
130
|
-
withTooltip("
|
|
140
|
+
withTooltip(t("nuxtUiMongocamp.collections.deleteBucketTooltip"), h(UButton, {
|
|
131
141
|
"icon": "i-lucide-trash-2",
|
|
132
142
|
"color": "error",
|
|
133
143
|
"variant": "ghost",
|
|
134
144
|
"size": "sm",
|
|
135
|
-
"aria-label": "
|
|
145
|
+
"aria-label": t("nuxtUiMongocamp.collections.deleteBucketTooltip"),
|
|
136
146
|
"loading": bucketActionInFlight.value.has(bucketName),
|
|
137
147
|
"onClick": () => confirmDeleteBucket(bucketName)
|
|
138
148
|
}))
|
|
@@ -149,23 +159,23 @@ fetchCollections();
|
|
|
149
159
|
<div class="flex flex-col gap-4">
|
|
150
160
|
<div class="flex items-center justify-between gap-4">
|
|
151
161
|
<h2 class="text-xl font-semibold">
|
|
152
|
-
|
|
162
|
+
{{ t("nuxtUiMongocamp.collections.heading") }}
|
|
153
163
|
</h2>
|
|
154
164
|
<div class="flex flex-1 items-center gap-2">
|
|
155
165
|
<UInput
|
|
156
166
|
v-model="globalFilter"
|
|
157
167
|
icon="i-lucide-search"
|
|
158
|
-
placeholder="
|
|
168
|
+
:placeholder="t('nuxtUiMongocamp.collections.filterPlaceholder')"
|
|
159
169
|
size="sm"
|
|
160
170
|
class="flex-1 max-w-xs"
|
|
161
171
|
/>
|
|
162
|
-
<UTooltip text="
|
|
172
|
+
<UTooltip :text="t('nuxtUiMongocamp.common.refresh')">
|
|
163
173
|
<UButton
|
|
164
174
|
icon="i-lucide-refresh-cw"
|
|
165
175
|
color="neutral"
|
|
166
176
|
variant="ghost"
|
|
167
177
|
:loading="loading"
|
|
168
|
-
aria-label="
|
|
178
|
+
:aria-label="t('nuxtUiMongocamp.common.refresh')"
|
|
169
179
|
@click="fetchCollections"
|
|
170
180
|
/>
|
|
171
181
|
</UTooltip>
|
|
@@ -182,21 +192,21 @@ fetchCollections();
|
|
|
182
192
|
|
|
183
193
|
<UModal
|
|
184
194
|
v-model:open="isClearBucketModalOpen"
|
|
185
|
-
title="
|
|
195
|
+
:title="t('nuxtUiMongocamp.collections.clearBucketTitle')"
|
|
186
196
|
:ui="{ footer: 'justify-end' }"
|
|
187
197
|
>
|
|
188
198
|
<template #body>
|
|
189
|
-
<p>
|
|
199
|
+
<p>{{ t("nuxtUiMongocamp.collections.confirmClearBucket", { bucketName: bucketToClear }) }}</p>
|
|
190
200
|
</template>
|
|
191
201
|
<template #footer>
|
|
192
202
|
<UButton
|
|
193
|
-
label="
|
|
203
|
+
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
194
204
|
color="neutral"
|
|
195
205
|
variant="ghost"
|
|
196
206
|
@click="isClearBucketModalOpen = false"
|
|
197
207
|
/>
|
|
198
208
|
<UButton
|
|
199
|
-
label="
|
|
209
|
+
:label="t('nuxtUiMongocamp.collections.clearBucketTitle')"
|
|
200
210
|
color="warning"
|
|
201
211
|
icon="i-lucide-eraser"
|
|
202
212
|
@click="handleClearBucket"
|
|
@@ -206,21 +216,21 @@ fetchCollections();
|
|
|
206
216
|
|
|
207
217
|
<UModal
|
|
208
218
|
v-model:open="isDeleteBucketModalOpen"
|
|
209
|
-
title="
|
|
219
|
+
:title="t('nuxtUiMongocamp.collections.deleteBucketTitle')"
|
|
210
220
|
:ui="{ footer: 'justify-end' }"
|
|
211
221
|
>
|
|
212
222
|
<template #body>
|
|
213
|
-
<p>
|
|
223
|
+
<p>{{ t("nuxtUiMongocamp.collections.confirmDeleteBucket", { bucketName: bucketToDelete }) }}</p>
|
|
214
224
|
</template>
|
|
215
225
|
<template #footer>
|
|
216
226
|
<UButton
|
|
217
|
-
label="
|
|
227
|
+
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
218
228
|
color="neutral"
|
|
219
229
|
variant="ghost"
|
|
220
230
|
@click="isDeleteBucketModalOpen = false"
|
|
221
231
|
/>
|
|
222
232
|
<UButton
|
|
223
|
-
label="
|
|
233
|
+
:label="t('nuxtUiMongocamp.collections.deleteBucketTitle')"
|
|
224
234
|
color="error"
|
|
225
235
|
icon="i-lucide-trash-2"
|
|
226
236
|
@click="handleDeleteBucket"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
infoPath?: string;
|
|
3
3
|
dataPath?: string;
|
|
4
|
+
bucketFilesPath?: string;
|
|
4
5
|
};
|
|
5
6
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
7
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { h, ref, resolveComponent } from "vue";
|
|
3
|
-
import { useMongocampSystem } from "#imports";
|
|
3
|
+
import { useI18n, useMongocampSystem } from "#imports";
|
|
4
|
+
const { t } = useI18n();
|
|
4
5
|
const { getDatabaseInfos, listCollectionsByDatabase } = useMongocampSystem();
|
|
5
6
|
const databases = ref([]);
|
|
6
7
|
const loading = ref(false);
|
|
@@ -24,7 +25,7 @@ async function fetchDatabases() {
|
|
|
24
25
|
);
|
|
25
26
|
databases.value = rows;
|
|
26
27
|
} catch (e) {
|
|
27
|
-
errorMessage.value = e instanceof Error ? e.message : "
|
|
28
|
+
errorMessage.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.databases.errorLoad");
|
|
28
29
|
} finally {
|
|
29
30
|
loading.value = false;
|
|
30
31
|
}
|
|
@@ -45,21 +46,21 @@ function sortHeader(column, label) {
|
|
|
45
46
|
const columns = [
|
|
46
47
|
{
|
|
47
48
|
accessorKey: "name",
|
|
48
|
-
header: ({ column }) => sortHeader(column, "
|
|
49
|
+
header: ({ column }) => sortHeader(column, t("nuxtUiMongocamp.databases.columnDatabase"))
|
|
49
50
|
},
|
|
50
51
|
{
|
|
51
52
|
accessorKey: "sizeKb",
|
|
52
|
-
header: ({ column }) => sortHeader(column,
|
|
53
|
+
header: ({ column }) => sortHeader(column, t("nuxtUiMongocamp.databases.columnSize"))
|
|
53
54
|
},
|
|
54
55
|
{
|
|
55
56
|
accessorKey: "collectionCount",
|
|
56
|
-
header: "
|
|
57
|
+
header: t("nuxtUiMongocamp.databases.columnCollections"),
|
|
57
58
|
cell: ({ row }) => h(UBadge, { label: String(row.original.collectionCount), color: "primary", variant: "subtle" })
|
|
58
59
|
},
|
|
59
60
|
{
|
|
60
61
|
accessorKey: "empty",
|
|
61
|
-
header: "
|
|
62
|
-
cell: ({ row }) => row.original.empty ? h(UBadge, { label: "
|
|
62
|
+
header: t("nuxtUiMongocamp.databases.columnEmpty"),
|
|
63
|
+
cell: ({ row }) => row.original.empty ? h(UBadge, { label: t("nuxtUiMongocamp.databases.emptyBadge"), color: "neutral", variant: "subtle" }) : h("span", { class: "text-dimmed" }, "\u2014")
|
|
63
64
|
}
|
|
64
65
|
];
|
|
65
66
|
fetchDatabases();
|
|
@@ -69,15 +70,15 @@ fetchDatabases();
|
|
|
69
70
|
<div class="flex flex-col gap-4">
|
|
70
71
|
<div class="flex items-center justify-between gap-4">
|
|
71
72
|
<h2 class="text-xl font-semibold">
|
|
72
|
-
|
|
73
|
+
{{ t("nuxtUiMongocamp.databases.heading") }}
|
|
73
74
|
</h2>
|
|
74
|
-
<UTooltip text="
|
|
75
|
+
<UTooltip :text="t('nuxtUiMongocamp.common.refresh')">
|
|
75
76
|
<UButton
|
|
76
77
|
icon="i-lucide-refresh-cw"
|
|
77
78
|
color="neutral"
|
|
78
79
|
variant="ghost"
|
|
79
80
|
:loading="loading"
|
|
80
|
-
aria-label="
|
|
81
|
+
:aria-label="t('nuxtUiMongocamp.common.refresh')"
|
|
81
82
|
@click="fetchDatabases"
|
|
82
83
|
/>
|
|
83
84
|
</UTooltip>
|
|
@@ -88,12 +89,12 @@ fetchDatabases();
|
|
|
88
89
|
color="error"
|
|
89
90
|
variant="subtle"
|
|
90
91
|
icon="i-lucide-circle-alert"
|
|
91
|
-
title="
|
|
92
|
+
:title="t('nuxtUiMongocamp.databases.loadFailedTitle')"
|
|
92
93
|
:description="errorMessage"
|
|
93
94
|
>
|
|
94
95
|
<template #actions>
|
|
95
96
|
<UButton
|
|
96
|
-
label="
|
|
97
|
+
:label="t('nuxtUiMongocamp.common.retry')"
|
|
97
98
|
color="error"
|
|
98
99
|
variant="subtle"
|
|
99
100
|
icon="i-lucide-refresh-cw"
|