@sfxcode/nuxt-ui-mongocamp 1.1.4 → 1.2.1
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 +8 -4
- 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.vue +34 -32
- package/dist/runtime/components/MongocampCollectionData.vue +36 -35
- package/dist/runtime/components/MongocampCollectionInfos.vue +37 -36
- package/dist/runtime/components/MongocampCollections.vue +30 -29
- 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.js +20 -19
- 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 +11 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { h, ref, resolveComponent, watch } from "vue";
|
|
3
|
-
import {
|
|
3
|
+
import { useI18n, useMongocampClientApi } from "#imports";
|
|
4
4
|
import useMongocampCollection from "../composables/useMongocampCollection";
|
|
5
5
|
import { useMongocampBucket } from "../composables/useMongocampBucket";
|
|
6
6
|
import { unwrapExtendedJson, wrapExtendedJson } from "../composables/useMongocampExtendedJson";
|
|
@@ -9,7 +9,8 @@ import { useMongocampQuery } from "../composables/useMongocampQuery";
|
|
|
9
9
|
const props = defineProps({
|
|
10
10
|
collectionName: { type: String, required: true }
|
|
11
11
|
});
|
|
12
|
-
const {
|
|
12
|
+
const { t } = useI18n();
|
|
13
|
+
const { documentApi } = useMongocampClientApi();
|
|
13
14
|
const { pagination, total } = useMongocampCollection();
|
|
14
15
|
const { isBucketCollection, fileIdForRow, downloadingFileIds, uploading, downloadFile, uploadFile } = useMongocampBucket();
|
|
15
16
|
const { ensureMetaData } = useMongocampDocument();
|
|
@@ -94,7 +95,7 @@ async function handleSave() {
|
|
|
94
95
|
try {
|
|
95
96
|
payload = JSON.parse(editJson.value);
|
|
96
97
|
} catch {
|
|
97
|
-
editError.value = "
|
|
98
|
+
editError.value = t("nuxtUiMongocamp.collectionData.invalidJson");
|
|
98
99
|
return;
|
|
99
100
|
}
|
|
100
101
|
}
|
|
@@ -111,7 +112,7 @@ async function handleSave() {
|
|
|
111
112
|
isEditModalOpen.value = false;
|
|
112
113
|
await fetchDocuments();
|
|
113
114
|
} catch (e) {
|
|
114
|
-
editError.value = e instanceof Error ? e.message : "
|
|
115
|
+
editError.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.collectionData.errorSave");
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
async function handleDelete() {
|
|
@@ -122,7 +123,7 @@ async function handleDelete() {
|
|
|
122
123
|
isDeleteModalOpen.value = false;
|
|
123
124
|
await fetchDocuments();
|
|
124
125
|
} catch (e) {
|
|
125
|
-
deleteError.value = e instanceof Error ? e.message : "
|
|
126
|
+
deleteError.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.collectionData.errorDelete");
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
function makeActionsColumn() {
|
|
@@ -134,32 +135,32 @@ function makeActionsColumn() {
|
|
|
134
135
|
if (isBucketCollection(props.collectionName)) {
|
|
135
136
|
const fileId = fileIdForRow(props.collectionName, row.original);
|
|
136
137
|
if (fileId) {
|
|
137
|
-
buttons.push(withTooltip("
|
|
138
|
+
buttons.push(withTooltip(t("nuxtUiMongocamp.collectionData.downloadFileTooltip"), h(UButton, {
|
|
138
139
|
"icon": "i-lucide-download",
|
|
139
140
|
"color": "neutral",
|
|
140
141
|
"variant": "ghost",
|
|
141
142
|
"size": "sm",
|
|
142
|
-
"aria-label": "
|
|
143
|
+
"aria-label": t("nuxtUiMongocamp.collectionData.downloadFileTooltip"),
|
|
143
144
|
"loading": downloadingFileIds.value.has(fileId),
|
|
144
145
|
"onClick": () => downloadFile(props.collectionName, fileId)
|
|
145
146
|
})));
|
|
146
147
|
}
|
|
147
148
|
}
|
|
148
149
|
buttons.push(
|
|
149
|
-
withTooltip("
|
|
150
|
+
withTooltip(t("nuxtUiMongocamp.collectionData.editDocumentTooltip"), h(UButton, {
|
|
150
151
|
"icon": "i-lucide-pencil",
|
|
151
152
|
"color": "neutral",
|
|
152
153
|
"variant": "ghost",
|
|
153
154
|
"size": "sm",
|
|
154
|
-
"aria-label": "
|
|
155
|
+
"aria-label": t("nuxtUiMongocamp.collectionData.editDocumentTooltip"),
|
|
155
156
|
"onClick": () => openEdit(row.original)
|
|
156
157
|
})),
|
|
157
|
-
withTooltip("
|
|
158
|
+
withTooltip(t("nuxtUiMongocamp.collectionData.deleteDocumentTooltip"), h(UButton, {
|
|
158
159
|
"icon": "i-lucide-trash-2",
|
|
159
160
|
"color": "error",
|
|
160
161
|
"variant": "ghost",
|
|
161
162
|
"size": "sm",
|
|
162
|
-
"aria-label": "
|
|
163
|
+
"aria-label": t("nuxtUiMongocamp.collectionData.deleteDocumentTooltip"),
|
|
163
164
|
"onClick": () => confirmDelete(row.original)
|
|
164
165
|
}))
|
|
165
166
|
);
|
|
@@ -193,9 +194,9 @@ function openDetail(value) {
|
|
|
193
194
|
detailOpen.value = true;
|
|
194
195
|
}
|
|
195
196
|
function buildLuceneFilter(term) {
|
|
196
|
-
const
|
|
197
|
-
if (!
|
|
198
|
-
return or(...filterableColumns.value.map((col) => like(col,
|
|
197
|
+
const trimmed = term.trim();
|
|
198
|
+
if (!trimmed || filterableColumns.value.length === 0) return void 0;
|
|
199
|
+
return or(...filterableColumns.value.map((col) => like(col, trimmed))) || void 0;
|
|
199
200
|
}
|
|
200
201
|
function onFilterInput() {
|
|
201
202
|
clearTimeout(filterTimer);
|
|
@@ -268,26 +269,26 @@ function makeCell(key, type) {
|
|
|
268
269
|
const rows = [];
|
|
269
270
|
if (obj.created) {
|
|
270
271
|
rows.push(h("div", [
|
|
271
|
-
h("span", { class: "text-dimmed" }, "
|
|
272
|
+
h("span", { class: "text-dimmed" }, t("nuxtUiMongocamp.collectionData.createdByPrefix")),
|
|
272
273
|
h("span", toDateDisplay(obj.created))
|
|
273
274
|
]));
|
|
274
275
|
}
|
|
275
276
|
if (obj.updated && obj.updated !== obj.created) {
|
|
276
277
|
rows.push(h("div", [
|
|
277
|
-
h("span", { class: "text-dimmed" }, "
|
|
278
|
+
h("span", { class: "text-dimmed" }, t("nuxtUiMongocamp.collectionData.updatedByPrefix")),
|
|
278
279
|
h("span", toDateDisplay(obj.updated))
|
|
279
280
|
]));
|
|
280
281
|
}
|
|
281
282
|
if (obj.createdBy) {
|
|
282
283
|
rows.push(h("div", [
|
|
283
|
-
h("span", { class: "text-dimmed" }, "
|
|
284
|
+
h("span", { class: "text-dimmed" }, t("nuxtUiMongocamp.collectionData.byPrefix")),
|
|
284
285
|
h("span", String(obj.createdBy))
|
|
285
286
|
]));
|
|
286
287
|
}
|
|
287
288
|
return h("div", { class: "flex flex-col gap-0.5 text-xs py-1" }, rows);
|
|
288
289
|
}
|
|
289
290
|
}
|
|
290
|
-
const viewLabel = Array.isArray(raw) ? "
|
|
291
|
+
const viewLabel = Array.isArray(raw) ? t("nuxtUiMongocamp.collectionData.viewArray") : t("nuxtUiMongocamp.collectionData.viewObject");
|
|
291
292
|
return withTooltip(viewLabel, h(UButton, {
|
|
292
293
|
"icon": Array.isArray(raw) ? "i-lucide-list" : "i-lucide-braces",
|
|
293
294
|
"color": "neutral",
|
|
@@ -355,7 +356,7 @@ watch(() => props.collectionName, init, { immediate: true });
|
|
|
355
356
|
<UInput
|
|
356
357
|
v-model="filterText"
|
|
357
358
|
icon="i-lucide-search"
|
|
358
|
-
placeholder="
|
|
359
|
+
:placeholder="t('nuxtUiMongocamp.collectionData.filterPlaceholder')"
|
|
359
360
|
size="sm"
|
|
360
361
|
class="flex-1 max-w-xs"
|
|
361
362
|
:disabled="filterableColumns.length === 0"
|
|
@@ -363,11 +364,11 @@ watch(() => props.collectionName, init, { immediate: true });
|
|
|
363
364
|
/>
|
|
364
365
|
<div class="flex items-center gap-2">
|
|
365
366
|
<span class="text-sm text-gray-500 dark:text-gray-400 shrink-0">
|
|
366
|
-
{{ total }}
|
|
367
|
+
{{ t("nuxtUiMongocamp.collectionData.documentsCount", { count: total }) }}
|
|
367
368
|
</span>
|
|
368
369
|
<UTooltip
|
|
369
370
|
v-if="isBucketCollection(collectionName)"
|
|
370
|
-
text="
|
|
371
|
+
:text="t('nuxtUiMongocamp.collectionData.uploadFileTooltip')"
|
|
371
372
|
>
|
|
372
373
|
<UButton
|
|
373
374
|
icon="i-lucide-upload"
|
|
@@ -375,20 +376,20 @@ watch(() => props.collectionName, init, { immediate: true });
|
|
|
375
376
|
variant="ghost"
|
|
376
377
|
size="sm"
|
|
377
378
|
:loading="uploading"
|
|
378
|
-
aria-label="
|
|
379
|
+
:aria-label="t('nuxtUiMongocamp.collectionData.uploadFileTooltip')"
|
|
379
380
|
@click="openFilePicker"
|
|
380
381
|
/>
|
|
381
382
|
</UTooltip>
|
|
382
383
|
<UTooltip
|
|
383
384
|
v-else
|
|
384
|
-
text="
|
|
385
|
+
:text="t('nuxtUiMongocamp.collectionData.insertDocumentTooltip')"
|
|
385
386
|
>
|
|
386
387
|
<UButton
|
|
387
388
|
icon="i-lucide-plus"
|
|
388
389
|
color="primary"
|
|
389
390
|
variant="ghost"
|
|
390
391
|
size="sm"
|
|
391
|
-
aria-label="
|
|
392
|
+
:aria-label="t('nuxtUiMongocamp.collectionData.insertDocumentTooltip')"
|
|
392
393
|
@click="openInsert"
|
|
393
394
|
/>
|
|
394
395
|
</UTooltip>
|
|
@@ -398,13 +399,13 @@ watch(() => props.collectionName, init, { immediate: true });
|
|
|
398
399
|
class="hidden"
|
|
399
400
|
@change="handleFileSelected"
|
|
400
401
|
>
|
|
401
|
-
<UTooltip text="
|
|
402
|
+
<UTooltip :text="t('nuxtUiMongocamp.collectionData.reloadTooltip')">
|
|
402
403
|
<UButton
|
|
403
404
|
icon="i-lucide-refresh-cw"
|
|
404
405
|
color="neutral"
|
|
405
406
|
variant="ghost"
|
|
406
407
|
:loading="loading"
|
|
407
|
-
aria-label="
|
|
408
|
+
:aria-label="t('nuxtUiMongocamp.collectionData.reloadTooltip')"
|
|
408
409
|
@click="init"
|
|
409
410
|
/>
|
|
410
411
|
</UTooltip>
|
|
@@ -426,7 +427,7 @@ watch(() => props.collectionName, init, { immediate: true });
|
|
|
426
427
|
|
|
427
428
|
<UModal
|
|
428
429
|
v-model:open="detailOpen"
|
|
429
|
-
title="
|
|
430
|
+
:title="t('nuxtUiMongocamp.collectionData.detailsTitle')"
|
|
430
431
|
>
|
|
431
432
|
<template #body>
|
|
432
433
|
<pre class="text-xs overflow-auto max-h-[60vh] whitespace-pre-wrap break-all">{{ detailContent }}</pre>
|
|
@@ -435,7 +436,7 @@ watch(() => props.collectionName, init, { immediate: true });
|
|
|
435
436
|
|
|
436
437
|
<UModal
|
|
437
438
|
v-model:open="isEditModalOpen"
|
|
438
|
-
:title="editMode === 'insert' ? '
|
|
439
|
+
:title="editMode === 'insert' ? t('nuxtUiMongocamp.collectionData.insertDocumentTitle') : t('nuxtUiMongocamp.collectionData.editDocumentTitle')"
|
|
439
440
|
:ui="{ footer: 'justify-end' }"
|
|
440
441
|
>
|
|
441
442
|
<template #body>
|
|
@@ -443,7 +444,7 @@ watch(() => props.collectionName, init, { immediate: true });
|
|
|
443
444
|
v-if="editSamples.length > 0"
|
|
444
445
|
v-model="editFormData"
|
|
445
446
|
:data="editSamples"
|
|
446
|
-
:submit-label="editMode === 'insert' ? '
|
|
447
|
+
:submit-label="editMode === 'insert' ? t('nuxtUiMongocamp.collectionData.insert') : t('nuxtUiMongocamp.common.save')"
|
|
447
448
|
:submit-icon="editMode === 'insert' ? 'i-lucide-plus' : 'i-lucide-save'"
|
|
448
449
|
@data-saved="handleSave"
|
|
449
450
|
/>
|
|
@@ -465,13 +466,13 @@ watch(() => props.collectionName, init, { immediate: true });
|
|
|
465
466
|
#footer
|
|
466
467
|
>
|
|
467
468
|
<UButton
|
|
468
|
-
label="
|
|
469
|
+
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
469
470
|
color="neutral"
|
|
470
471
|
variant="ghost"
|
|
471
472
|
@click="isEditModalOpen = false"
|
|
472
473
|
/>
|
|
473
474
|
<UButton
|
|
474
|
-
:label="editMode === 'insert' ? '
|
|
475
|
+
:label="editMode === 'insert' ? t('nuxtUiMongocamp.collectionData.insert') : t('nuxtUiMongocamp.common.save')"
|
|
475
476
|
:icon="editMode === 'insert' ? 'i-lucide-plus' : 'i-lucide-save'"
|
|
476
477
|
@click="handleSave"
|
|
477
478
|
/>
|
|
@@ -480,11 +481,11 @@ watch(() => props.collectionName, init, { immediate: true });
|
|
|
480
481
|
|
|
481
482
|
<UModal
|
|
482
483
|
v-model:open="isDeleteModalOpen"
|
|
483
|
-
title="
|
|
484
|
+
:title="t('nuxtUiMongocamp.collectionData.deleteDocumentTitle')"
|
|
484
485
|
:ui="{ footer: 'justify-end' }"
|
|
485
486
|
>
|
|
486
487
|
<template #body>
|
|
487
|
-
<p>
|
|
488
|
+
<p>{{ t("nuxtUiMongocamp.collectionData.confirmDeleteDocument") }}</p>
|
|
488
489
|
<p
|
|
489
490
|
v-if="deleteError"
|
|
490
491
|
class="mt-2 text-sm text-error-500"
|
|
@@ -494,13 +495,13 @@ watch(() => props.collectionName, init, { immediate: true });
|
|
|
494
495
|
</template>
|
|
495
496
|
<template #footer>
|
|
496
497
|
<UButton
|
|
497
|
-
label="
|
|
498
|
+
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
498
499
|
color="neutral"
|
|
499
500
|
variant="ghost"
|
|
500
501
|
@click="isDeleteModalOpen = false"
|
|
501
502
|
/>
|
|
502
503
|
<UButton
|
|
503
|
-
label="
|
|
504
|
+
:label="t('nuxtUiMongocamp.common.delete')"
|
|
504
505
|
color="error"
|
|
505
506
|
icon="i-lucide-trash-2"
|
|
506
507
|
@click="handleDelete"
|
|
@@ -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"
|