@sfxcode/nuxt-ui-mongocamp 1.5.6 → 1.5.8
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/dist/module.d.mts +26 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +5 -0
- package/dist/runtime/components/MongocampAccount.vue +12 -14
- package/dist/runtime/components/MongocampAggregationBuilder.vue +27 -43
- package/dist/runtime/components/MongocampAggregationChart.vue +7 -5
- package/dist/runtime/components/MongocampAggregationStagePreview.vue +1 -1
- package/dist/runtime/components/MongocampBucketFiles.vue +25 -34
- package/dist/runtime/components/MongocampBulkDelete.d.vue.ts +2 -2
- package/dist/runtime/components/MongocampBulkDelete.vue +8 -9
- package/dist/runtime/components/MongocampBulkDelete.vue.d.ts +2 -2
- package/dist/runtime/components/MongocampBulkEdit.vue +5 -4
- package/dist/runtime/components/MongocampChart.vue +1 -1
- package/dist/runtime/components/MongocampCollectionCharts.vue +6 -5
- package/dist/runtime/components/MongocampCollectionCopy.d.vue.ts +2 -2
- package/dist/runtime/components/MongocampCollectionCopy.vue +6 -6
- package/dist/runtime/components/MongocampCollectionCopy.vue.d.ts +2 -2
- package/dist/runtime/components/MongocampCollectionData.vue +37 -62
- package/dist/runtime/components/MongocampCollectionInfos.vue +18 -23
- package/dist/runtime/components/MongocampCollectionRename.d.vue.ts +2 -2
- package/dist/runtime/components/MongocampCollectionRename.vue +5 -4
- package/dist/runtime/components/MongocampCollectionRename.vue.d.ts +2 -2
- package/dist/runtime/components/MongocampCollections.vue +24 -33
- package/dist/runtime/components/MongocampCommandPalette.d.vue.ts +2 -2
- package/dist/runtime/components/MongocampCommandPalette.vue +3 -1
- package/dist/runtime/components/MongocampCommandPalette.vue.d.ts +2 -2
- package/dist/runtime/components/MongocampConfirmByName.vue +5 -4
- package/dist/runtime/components/MongocampDashboard.vue +5 -3
- package/dist/runtime/components/MongocampDatabases.vue +14 -8
- package/dist/runtime/components/MongocampDocumentCompare.vue +6 -4
- package/dist/runtime/components/MongocampDocumentView.vue +6 -8
- package/dist/runtime/components/MongocampEmptyState.vue +4 -1
- package/dist/runtime/components/MongocampErrorAlert.vue +8 -7
- package/dist/runtime/components/MongocampExportAll.vue +7 -7
- package/dist/runtime/components/MongocampFilePreview.vue +7 -6
- package/dist/runtime/components/MongocampFilterBuilder.vue +12 -16
- package/dist/runtime/components/MongocampGrantList.vue +6 -2
- package/dist/runtime/components/MongocampImport.vue +29 -28
- package/dist/runtime/components/MongocampIndexes.vue +15 -17
- package/dist/runtime/components/MongocampJobs.vue +20 -20
- package/dist/runtime/components/MongocampLogin.vue +2 -1
- package/dist/runtime/components/MongocampPermissionMatrix.vue +14 -11
- package/dist/runtime/components/MongocampQueryBar.vue +18 -32
- package/dist/runtime/components/MongocampRoleGrants.vue +21 -17
- package/dist/runtime/components/MongocampRoles.vue +28 -32
- package/dist/runtime/components/MongocampServerInfo.vue +17 -12
- package/dist/runtime/components/MongocampServerOverview.vue +16 -12
- package/dist/runtime/components/MongocampServerStatus.vue +2 -1
- package/dist/runtime/components/MongocampSettings.vue +15 -11
- package/dist/runtime/components/MongocampUserAccess.vue +11 -6
- package/dist/runtime/components/MongocampUsers.vue +32 -35
- package/dist/runtime/components/MongocampVersion.vue +6 -4
- package/dist/runtime/composables/useMongocampAdmin.d.ts +4 -4
- package/dist/runtime/composables/useMongocampClientApi.d.ts +13 -1
- package/dist/runtime/composables/useMongocampConnection.d.ts +25 -0
- package/dist/runtime/composables/useMongocampConnection.js +33 -0
- package/dist/runtime/composables/useMongocampRoles.d.ts +5 -5
- package/dist/runtime/composables/useMongocampUi.d.ts +8 -0
- package/dist/runtime/composables/useMongocampUi.js +7 -0
- package/dist/runtime/plugin.d.ts +5 -1
- package/dist/runtime/plugin.js +62 -2
- package/dist/runtime/publicUtils.d.ts +1 -0
- package/dist/runtime/publicUtils.js +1 -0
- package/dist/runtime/utils/compactSession.d.ts +13 -0
- package/dist/runtime/utils/compactSession.js +12 -0
- package/dist/runtime/utils/connection.d.ts +23 -0
- package/dist/runtime/utils/connection.js +31 -0
- package/dist/runtime/utils/sessionGuard.d.ts +1 -0
- package/dist/runtime/utils/sessionGuard.js +8 -0
- package/dist/runtime/utils/uiTheme.d.ts +65 -0
- package/dist/runtime/utils/uiTheme.js +47 -0
- package/package.json +13 -13
|
@@ -5,12 +5,14 @@ import { useMongocampBucket } from "../composables/useMongocampBucket";
|
|
|
5
5
|
import { useMongocampError } from "../composables/useMongocampError";
|
|
6
6
|
import { canPreview, clipText, PREVIEW_LIMITS, prettyJson, previewKind } from "../utils/filePreview";
|
|
7
7
|
import { formatBytes } from "../utils/formatBytes";
|
|
8
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
8
9
|
const props = defineProps({
|
|
9
10
|
bucketName: { type: String, required: true },
|
|
10
11
|
file: { type: Object, required: false }
|
|
11
12
|
});
|
|
12
13
|
const open = defineModel("open", { type: Boolean, ...{ default: false } });
|
|
13
14
|
const { t } = useI18n();
|
|
15
|
+
const ui = useMongocampUi();
|
|
14
16
|
const { fetchFileBlob, downloadFile, downloadingFileIds } = useMongocampBucket();
|
|
15
17
|
const { describeError } = useMongocampError();
|
|
16
18
|
const loading = ref(false);
|
|
@@ -70,7 +72,7 @@ onBeforeUnmount(() => {
|
|
|
70
72
|
v-model:open="open"
|
|
71
73
|
:title="file?.filename ?? t('nuxtUiMongocamp.filePreview.title')"
|
|
72
74
|
:description="file ? formatBytes(file.length) : void 0"
|
|
73
|
-
:ui="{ content: 'max-w-3xl' }"
|
|
75
|
+
:ui="{ content: 'max-w-3xl mongocamp-file-preview' }"
|
|
74
76
|
>
|
|
75
77
|
<template #body>
|
|
76
78
|
<div
|
|
@@ -92,7 +94,7 @@ onBeforeUnmount(() => {
|
|
|
92
94
|
<UAlert
|
|
93
95
|
v-else-if="error"
|
|
94
96
|
color="error"
|
|
95
|
-
variant="
|
|
97
|
+
:variant="ui.alert.variant"
|
|
96
98
|
icon="i-lucide-circle-alert"
|
|
97
99
|
:title="t('nuxtUiMongocamp.filePreview.failed')"
|
|
98
100
|
:description="error"
|
|
@@ -101,7 +103,7 @@ onBeforeUnmount(() => {
|
|
|
101
103
|
<UAlert
|
|
102
104
|
v-else-if="kind === 'other'"
|
|
103
105
|
color="neutral"
|
|
104
|
-
variant="
|
|
106
|
+
:variant="ui.alert.variant"
|
|
105
107
|
icon="i-lucide-file"
|
|
106
108
|
:title="t('nuxtUiMongocamp.filePreview.noPreview')"
|
|
107
109
|
/>
|
|
@@ -109,7 +111,7 @@ onBeforeUnmount(() => {
|
|
|
109
111
|
<UAlert
|
|
110
112
|
v-else-if="tooLarge"
|
|
111
113
|
color="neutral"
|
|
112
|
-
variant="
|
|
114
|
+
:variant="ui.alert.variant"
|
|
113
115
|
icon="i-lucide-file-warning"
|
|
114
116
|
:title="t('nuxtUiMongocamp.filePreview.tooLarge', { max: limitLabel })"
|
|
115
117
|
/>
|
|
@@ -142,8 +144,7 @@ onBeforeUnmount(() => {
|
|
|
142
144
|
<div class="flex justify-end">
|
|
143
145
|
<UButton
|
|
144
146
|
icon="i-lucide-download"
|
|
145
|
-
|
|
146
|
-
variant="subtle"
|
|
147
|
+
v-bind="ui.secondaryAction"
|
|
147
148
|
:label="t('nuxtUiMongocamp.filePreview.download')"
|
|
148
149
|
:loading="downloadingFileIds.has(file.id)"
|
|
149
150
|
@click="downloadFile(bucketName, file.id)"
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
valueCountFor
|
|
10
10
|
} from "../utils/filterBuilder";
|
|
11
11
|
import { suggestionOptions, wantsSuggestions } from "../utils/filterSuggestions";
|
|
12
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
12
13
|
const props = defineProps({
|
|
13
14
|
fields: { type: Array, required: true },
|
|
14
15
|
loadDistinct: { type: Function, required: false }
|
|
@@ -16,6 +17,7 @@ const props = defineProps({
|
|
|
16
17
|
const model = defineModel({ type: Object, ...{ required: true } });
|
|
17
18
|
const emit = defineEmits(["apply"]);
|
|
18
19
|
const { t } = useI18n();
|
|
20
|
+
const ui = useMongocampUi();
|
|
19
21
|
let idCounter = 0;
|
|
20
22
|
function newId() {
|
|
21
23
|
return `filter-${Date.now()}-${idCounter++}`;
|
|
@@ -92,7 +94,7 @@ function clearAll() {
|
|
|
92
94
|
</script>
|
|
93
95
|
|
|
94
96
|
<template>
|
|
95
|
-
<div class="flex flex-col gap-3 rounded-md border border-default p-3">
|
|
97
|
+
<div class="mongocamp-filter-builder flex flex-col gap-3 rounded-md border border-default p-3">
|
|
96
98
|
<p
|
|
97
99
|
v-if="fields.length === 0"
|
|
98
100
|
class="text-sm text-dimmed"
|
|
@@ -109,7 +111,7 @@ function clearAll() {
|
|
|
109
111
|
<USelect
|
|
110
112
|
:model-value="model.match"
|
|
111
113
|
:items="matchItems"
|
|
112
|
-
size="
|
|
114
|
+
:size="ui.controlSize"
|
|
113
115
|
class="w-44"
|
|
114
116
|
:aria-label="t('nuxtUiMongocamp.filterBuilder.matchLabel')"
|
|
115
117
|
@update:model-value="(value) => setMatch(value)"
|
|
@@ -139,7 +141,7 @@ function clearAll() {
|
|
|
139
141
|
<USelect
|
|
140
142
|
:model-value="condition.field"
|
|
141
143
|
:items="fieldItems"
|
|
142
|
-
size="
|
|
144
|
+
:size="ui.controlSize"
|
|
143
145
|
class="w-44"
|
|
144
146
|
:aria-label="t('nuxtUiMongocamp.filterBuilder.field')"
|
|
145
147
|
@update:model-value="(value) => changeField(index, value)"
|
|
@@ -147,7 +149,7 @@ function clearAll() {
|
|
|
147
149
|
<USelect
|
|
148
150
|
:model-value="condition.operator"
|
|
149
151
|
:items="operatorItems(typeOf(condition.field))"
|
|
150
|
-
size="
|
|
152
|
+
:size="ui.controlSize"
|
|
151
153
|
class="w-44"
|
|
152
154
|
:aria-label="t('nuxtUiMongocamp.filterBuilder.operator')"
|
|
153
155
|
@update:model-value="(value) => updateCondition(index, { operator: value })"
|
|
@@ -159,7 +161,7 @@ function clearAll() {
|
|
|
159
161
|
:inputmode="typeOf(condition.field) === 'number' ? 'decimal' : void 0"
|
|
160
162
|
:placeholder="condition.operator === 'oneOf' ? t('nuxtUiMongocamp.filterBuilder.listPlaceholder') : void 0"
|
|
161
163
|
:list="listId(condition)"
|
|
162
|
-
size="
|
|
164
|
+
:size="ui.controlSize"
|
|
163
165
|
class="w-48"
|
|
164
166
|
:aria-label="t('nuxtUiMongocamp.filterBuilder.value')"
|
|
165
167
|
@focus="ensureSuggestions(condition)"
|
|
@@ -182,7 +184,7 @@ function clearAll() {
|
|
|
182
184
|
:model-value="condition.value2 ?? ''"
|
|
183
185
|
:type="typeOf(condition.field) === 'date-time' ? 'date' : 'text'"
|
|
184
186
|
:inputmode="typeOf(condition.field) === 'number' ? 'decimal' : void 0"
|
|
185
|
-
size="
|
|
187
|
+
:size="ui.controlSize"
|
|
186
188
|
class="w-48"
|
|
187
189
|
:aria-label="t('nuxtUiMongocamp.filterBuilder.valueTo')"
|
|
188
190
|
@update:model-value="(value) => updateCondition(index, { value2: String(value ?? '') })"
|
|
@@ -191,9 +193,7 @@ function clearAll() {
|
|
|
191
193
|
</template>
|
|
192
194
|
<UButton
|
|
193
195
|
icon="i-lucide-x"
|
|
194
|
-
|
|
195
|
-
variant="ghost"
|
|
196
|
-
size="sm"
|
|
196
|
+
v-bind="ui.iconButton"
|
|
197
197
|
:aria-label="t('nuxtUiMongocamp.filterBuilder.remove')"
|
|
198
198
|
@click="removeCondition(index)"
|
|
199
199
|
/>
|
|
@@ -217,22 +217,18 @@ function clearAll() {
|
|
|
217
217
|
<div class="flex flex-wrap items-center justify-between gap-2">
|
|
218
218
|
<UButton
|
|
219
219
|
icon="i-lucide-plus"
|
|
220
|
-
|
|
221
|
-
variant="ghost"
|
|
222
|
-
size="sm"
|
|
220
|
+
v-bind="ui.iconButton"
|
|
223
221
|
:label="t('nuxtUiMongocamp.filterBuilder.addCondition')"
|
|
224
222
|
@click="addCondition"
|
|
225
223
|
/>
|
|
226
224
|
<div class="flex items-center gap-2">
|
|
227
225
|
<UButton
|
|
228
|
-
|
|
229
|
-
variant="ghost"
|
|
230
|
-
size="sm"
|
|
226
|
+
v-bind="ui.iconButton"
|
|
231
227
|
:label="t('nuxtUiMongocamp.filterBuilder.clearAll')"
|
|
232
228
|
@click="clearAll"
|
|
233
229
|
/>
|
|
234
230
|
<UButton
|
|
235
|
-
size="
|
|
231
|
+
:size="ui.controlSize"
|
|
236
232
|
:label="t('nuxtUiMongocamp.filterBuilder.apply')"
|
|
237
233
|
@click="apply"
|
|
238
234
|
/>
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, h, resolveComponent } from "vue";
|
|
3
3
|
import { useI18n } from "#imports";
|
|
4
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
4
5
|
defineProps({
|
|
5
6
|
grants: { type: Array, required: true }
|
|
6
7
|
});
|
|
7
8
|
const { t } = useI18n();
|
|
9
|
+
const ui = useMongocampUi();
|
|
8
10
|
const UBadge = resolveComponent("UBadge");
|
|
9
11
|
function flag(value) {
|
|
10
12
|
return h(UBadge, {
|
|
11
13
|
label: value ? t("nuxtUiMongocamp.common.yes") : t("nuxtUiMongocamp.common.no"),
|
|
12
14
|
color: value ? "success" : "neutral",
|
|
13
|
-
variant:
|
|
15
|
+
variant: ui.value.badge.variant
|
|
14
16
|
});
|
|
15
17
|
}
|
|
16
18
|
const columns = computed(() => [
|
|
@@ -18,7 +20,7 @@ const columns = computed(() => [
|
|
|
18
20
|
{
|
|
19
21
|
accessorKey: "grantType",
|
|
20
22
|
header: t("nuxtUiMongocamp.roleGrants.columnType"),
|
|
21
|
-
cell: ({ row }) => h(UBadge, { label: row.original.grantType, color: "neutral", variant:
|
|
23
|
+
cell: ({ row }) => h(UBadge, { label: row.original.grantType, color: "neutral", variant: ui.value.badge.variant })
|
|
22
24
|
},
|
|
23
25
|
{ accessorKey: "read", header: t("nuxtUiMongocamp.roleGrants.columnRead"), cell: ({ row }) => flag(row.original.read) },
|
|
24
26
|
{ accessorKey: "write", header: t("nuxtUiMongocamp.roleGrants.columnWrite"), cell: ({ row }) => flag(row.original.write) },
|
|
@@ -28,6 +30,8 @@ const columns = computed(() => [
|
|
|
28
30
|
|
|
29
31
|
<template>
|
|
30
32
|
<UTable
|
|
33
|
+
data-mongocamp-part="table"
|
|
34
|
+
class="mongocamp-grant-list"
|
|
31
35
|
:data="grants"
|
|
32
36
|
:columns="columns"
|
|
33
37
|
>
|
|
@@ -5,6 +5,7 @@ import { useMongocampImport } from "../composables/useMongocampImport";
|
|
|
5
5
|
import { DEFAULT_IMPORT_LIMITS } from "../utils/importRows";
|
|
6
6
|
import { detectImportFormat, prepareImport } from "../utils/importPipeline";
|
|
7
7
|
import { formatBytes } from "../utils/formatBytes";
|
|
8
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
8
9
|
const props = defineProps({
|
|
9
10
|
collectionName: { type: String, required: true }
|
|
10
11
|
});
|
|
@@ -12,6 +13,7 @@ const emit = defineEmits(["imported"]);
|
|
|
12
13
|
const PREVIEW_ROWS = 5;
|
|
13
14
|
const ERROR_LIMIT = 10;
|
|
14
15
|
const { t } = useI18n();
|
|
16
|
+
const ui = useMongocampUi();
|
|
15
17
|
const { describeServerError } = useMongocampError();
|
|
16
18
|
const { importRows, importNdjson } = useMongocampImport();
|
|
17
19
|
const isOpen = ref(false);
|
|
@@ -269,12 +271,13 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
269
271
|
</script>
|
|
270
272
|
|
|
271
273
|
<template>
|
|
272
|
-
<UTooltip
|
|
274
|
+
<UTooltip
|
|
275
|
+
class="mongocamp-import"
|
|
276
|
+
:text="t('nuxtUiMongocamp.import.trigger')"
|
|
277
|
+
>
|
|
273
278
|
<UButton
|
|
274
279
|
icon="i-lucide-file-up"
|
|
275
|
-
|
|
276
|
-
variant="ghost"
|
|
277
|
-
size="sm"
|
|
280
|
+
v-bind="ui.iconButton"
|
|
278
281
|
:aria-label="t('nuxtUiMongocamp.import.trigger')"
|
|
279
282
|
@click="openModal"
|
|
280
283
|
/>
|
|
@@ -284,7 +287,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
284
287
|
v-model:open="isOpen"
|
|
285
288
|
:title="t('nuxtUiMongocamp.import.title')"
|
|
286
289
|
:dismissible="step !== 'importing'"
|
|
287
|
-
:ui="{ footer:
|
|
290
|
+
:ui="{ footer: ui.modal.footer, content: ui.modal.lg + ' mongocamp-import' }"
|
|
288
291
|
>
|
|
289
292
|
<template #body>
|
|
290
293
|
<div
|
|
@@ -313,7 +316,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
313
316
|
<UAlert
|
|
314
317
|
v-if="readError"
|
|
315
318
|
color="error"
|
|
316
|
-
variant="
|
|
319
|
+
:variant="ui.alert.variant"
|
|
317
320
|
icon="i-lucide-circle-alert"
|
|
318
321
|
:description="readError"
|
|
319
322
|
/>
|
|
@@ -327,14 +330,14 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
327
330
|
<span class="text-sm font-medium break-all">{{ fileName }} ({{ formatBytes(serverFile.size) }})</span>
|
|
328
331
|
<UAlert
|
|
329
332
|
color="info"
|
|
330
|
-
variant="
|
|
333
|
+
:variant="ui.alert.variant"
|
|
331
334
|
icon="i-lucide-info"
|
|
332
335
|
:description="t('nuxtUiMongocamp.import.ndjsonNote')"
|
|
333
336
|
/>
|
|
334
337
|
<UAlert
|
|
335
338
|
v-if="serverPreview.unreadable > 0"
|
|
336
339
|
color="warning"
|
|
337
|
-
variant="
|
|
340
|
+
:variant="ui.alert.variant"
|
|
338
341
|
icon="i-lucide-triangle-alert"
|
|
339
342
|
:description="t('nuxtUiMongocamp.import.ndjsonUnreadable', { count: serverPreview.unreadable }, serverPreview.unreadable)"
|
|
340
343
|
/>
|
|
@@ -343,6 +346,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
343
346
|
{{ t("nuxtUiMongocamp.import.previewTitle", { count: serverPreview.rows.length }) }}
|
|
344
347
|
</p>
|
|
345
348
|
<UTable
|
|
349
|
+
data-mongocamp-part="table"
|
|
346
350
|
:data="serverPreview.rows"
|
|
347
351
|
:columns="serverPreview.columns.map((column2) => ({ id: column2, header: column2, accessorFn: (row) => row[column2] }))"
|
|
348
352
|
class="max-h-64"
|
|
@@ -359,7 +363,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
359
363
|
<USelect
|
|
360
364
|
:model-value="format"
|
|
361
365
|
:items="formatItems"
|
|
362
|
-
size="
|
|
366
|
+
:size="ui.controlSize"
|
|
363
367
|
class="w-28"
|
|
364
368
|
:aria-label="t('nuxtUiMongocamp.import.format')"
|
|
365
369
|
@update:model-value="onFormatChange"
|
|
@@ -368,7 +372,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
368
372
|
v-if="format === 'csv'"
|
|
369
373
|
:model-value="delimiter"
|
|
370
374
|
:items="delimiterItems"
|
|
371
|
-
size="
|
|
375
|
+
:size="ui.controlSize"
|
|
372
376
|
class="w-40"
|
|
373
377
|
:aria-label="t('nuxtUiMongocamp.import.delimiter')"
|
|
374
378
|
@update:model-value="onDelimiterChange"
|
|
@@ -379,7 +383,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
379
383
|
v-for="error in fileErrors"
|
|
380
384
|
:key="error.code"
|
|
381
385
|
color="error"
|
|
382
|
-
variant="
|
|
386
|
+
:variant="ui.alert.variant"
|
|
383
387
|
icon="i-lucide-circle-alert"
|
|
384
388
|
:description="errorText(error)"
|
|
385
389
|
/>
|
|
@@ -391,7 +395,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
391
395
|
<UAlert
|
|
392
396
|
v-if="prepared.truncated"
|
|
393
397
|
color="warning"
|
|
394
|
-
variant="
|
|
398
|
+
:variant="ui.alert.variant"
|
|
395
399
|
icon="i-lucide-triangle-alert"
|
|
396
400
|
:description="t('nuxtUiMongocamp.import.truncated', { maxRows: limitsText.maxRows })"
|
|
397
401
|
/>
|
|
@@ -413,7 +417,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
413
417
|
<USelect
|
|
414
418
|
:model-value="columnTypes[column]"
|
|
415
419
|
:items="typeItems"
|
|
416
|
-
size="
|
|
420
|
+
:size="ui.controlSize"
|
|
417
421
|
class="w-32"
|
|
418
422
|
:aria-label="column"
|
|
419
423
|
@update:model-value="setColumnType(column, $event)"
|
|
@@ -429,7 +433,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
429
433
|
<UAlert
|
|
430
434
|
v-if="rowErrors.length > 0"
|
|
431
435
|
color="warning"
|
|
432
|
-
variant="
|
|
436
|
+
:variant="ui.alert.variant"
|
|
433
437
|
icon="i-lucide-triangle-alert"
|
|
434
438
|
:title="t('nuxtUiMongocamp.import.problems', { count: rowErrors.length }, rowErrors.length)"
|
|
435
439
|
>
|
|
@@ -456,6 +460,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
456
460
|
{{ t("nuxtUiMongocamp.import.previewTitle", { count: previewRows.length }) }}
|
|
457
461
|
</p>
|
|
458
462
|
<UTable
|
|
463
|
+
data-mongocamp-part="table"
|
|
459
464
|
:data="previewRows"
|
|
460
465
|
:columns="previewColumns"
|
|
461
466
|
class="max-h-64"
|
|
@@ -501,21 +506,21 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
501
506
|
<UAlert
|
|
502
507
|
v-if="serverError"
|
|
503
508
|
color="error"
|
|
504
|
-
variant="
|
|
509
|
+
:variant="ui.alert.variant"
|
|
505
510
|
icon="i-lucide-circle-alert"
|
|
506
511
|
:description="serverError"
|
|
507
512
|
/>
|
|
508
513
|
<template v-else-if="serverResult">
|
|
509
514
|
<UAlert
|
|
510
515
|
:color="serverResult.inserted > 0 ? 'success' : 'neutral'"
|
|
511
|
-
variant="
|
|
516
|
+
:variant="ui.alert.variant"
|
|
512
517
|
:icon="serverResult.inserted > 0 ? 'i-lucide-circle-check' : 'i-lucide-info'"
|
|
513
518
|
:title="t('nuxtUiMongocamp.import.result', { count: serverResult.inserted }, serverResult.inserted)"
|
|
514
519
|
/>
|
|
515
520
|
<UAlert
|
|
516
521
|
v-if="serverResult.failed > 0"
|
|
517
522
|
color="error"
|
|
518
|
-
variant="
|
|
523
|
+
:variant="ui.alert.variant"
|
|
519
524
|
icon="i-lucide-circle-alert"
|
|
520
525
|
:title="t('nuxtUiMongocamp.import.ndjsonFailed', { failed: serverResult.failed, read: serverResult.read })"
|
|
521
526
|
>
|
|
@@ -545,21 +550,21 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
545
550
|
>
|
|
546
551
|
<UAlert
|
|
547
552
|
:color="totalInserted > 0 ? 'success' : 'neutral'"
|
|
548
|
-
variant="
|
|
553
|
+
:variant="ui.alert.variant"
|
|
549
554
|
:icon="totalInserted > 0 ? 'i-lucide-circle-check' : 'i-lucide-info'"
|
|
550
555
|
:title="t('nuxtUiMongocamp.import.result', { count: totalInserted }, totalInserted)"
|
|
551
556
|
/>
|
|
552
557
|
<UAlert
|
|
553
558
|
v-if="skipped > 0"
|
|
554
559
|
color="warning"
|
|
555
|
-
variant="
|
|
560
|
+
:variant="ui.alert.variant"
|
|
556
561
|
icon="i-lucide-triangle-alert"
|
|
557
562
|
:description="t('nuxtUiMongocamp.import.aborted', { count: skipped })"
|
|
558
563
|
/>
|
|
559
564
|
<UAlert
|
|
560
565
|
v-if="failures.length > 0"
|
|
561
566
|
color="error"
|
|
562
|
-
variant="
|
|
567
|
+
:variant="ui.alert.variant"
|
|
563
568
|
icon="i-lucide-circle-alert"
|
|
564
569
|
>
|
|
565
570
|
<template #description>
|
|
@@ -586,8 +591,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
586
591
|
<template v-if="step === 'preview'">
|
|
587
592
|
<UButton
|
|
588
593
|
:label="t('nuxtUiMongocamp.import.back')"
|
|
589
|
-
|
|
590
|
-
variant="ghost"
|
|
594
|
+
v-bind="ui.dialogCancel"
|
|
591
595
|
@click="backToSelect"
|
|
592
596
|
/>
|
|
593
597
|
<UButton
|
|
@@ -606,8 +610,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
606
610
|
<template v-else-if="step === 'importing'">
|
|
607
611
|
<UButton
|
|
608
612
|
:label="t('nuxtUiMongocamp.import.stop')"
|
|
609
|
-
|
|
610
|
-
variant="subtle"
|
|
613
|
+
v-bind="ui.secondaryAction"
|
|
611
614
|
@click="stopImport"
|
|
612
615
|
/>
|
|
613
616
|
</template>
|
|
@@ -615,8 +618,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
615
618
|
<UButton
|
|
616
619
|
v-if="failures.length > 0 && !serverFile"
|
|
617
620
|
:label="t('nuxtUiMongocamp.import.retryFailed')"
|
|
618
|
-
|
|
619
|
-
variant="subtle"
|
|
621
|
+
v-bind="ui.secondaryAction"
|
|
620
622
|
@click="retryFailed"
|
|
621
623
|
/>
|
|
622
624
|
<UButton
|
|
@@ -627,8 +629,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
627
629
|
<template v-else>
|
|
628
630
|
<UButton
|
|
629
631
|
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
630
|
-
|
|
631
|
-
variant="ghost"
|
|
632
|
+
v-bind="ui.dialogCancel"
|
|
632
633
|
@click="isOpen = false"
|
|
633
634
|
/>
|
|
634
635
|
</template>
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
} from "../utils/indexForm";
|
|
20
20
|
import { shortenLabel } from "../utils/chartData";
|
|
21
21
|
import MongocampConfirmByName from "./MongocampConfirmByName.vue";
|
|
22
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
22
23
|
const props = defineProps({
|
|
23
24
|
collectionName: { type: String, required: true },
|
|
24
25
|
canManage: { type: Boolean, required: false, default: true },
|
|
@@ -26,6 +27,7 @@ const props = defineProps({
|
|
|
26
27
|
});
|
|
27
28
|
const emit = defineEmits(["changed"]);
|
|
28
29
|
const { t } = useI18n();
|
|
30
|
+
const ui = useMongocampUi();
|
|
29
31
|
const toast = useToast();
|
|
30
32
|
const { describeServerError } = useMongocampError();
|
|
31
33
|
const { listIndexDetails, createOrderedIndex, createExpiringIndex, deleteIndex } = useMongocampIndex();
|
|
@@ -109,8 +111,8 @@ const columns = computed(() => [
|
|
|
109
111
|
if (row.original.hidden) flags.push({ label: "hidden", color: "warning" });
|
|
110
112
|
if (row.original.collation) flags.push({ label: "collation", color: "secondary" });
|
|
111
113
|
if (row.original.text && row.original.language) flags.push({ label: row.original.language, color: "info" });
|
|
112
|
-
const badges = flags.map((flag) => h(UBadge, { label: flag.label, color: flag.color, variant:
|
|
113
|
-
if (badges.length === 0) badges.push(h(UBadge, { label: t("nuxtUiMongocamp.collectionInfos.typeStandard"), color: "neutral", variant:
|
|
114
|
+
const badges = flags.map((flag) => h(UBadge, { label: flag.label, color: flag.color, variant: ui.value.badge.variant, size: "sm" }));
|
|
115
|
+
if (badges.length === 0) badges.push(h(UBadge, { label: t("nuxtUiMongocamp.collectionInfos.typeStandard"), color: "neutral", variant: ui.value.badge.variant, size: "sm" }));
|
|
114
116
|
return h("div", { class: "flex flex-wrap gap-1" }, badges);
|
|
115
117
|
}
|
|
116
118
|
},
|
|
@@ -129,7 +131,7 @@ const columns = computed(() => [
|
|
|
129
131
|
return withTooltip(t("nuxtUiMongocamp.indexes.neverUsedHint"), h(UBadge, {
|
|
130
132
|
label: t("nuxtUiMongocamp.indexes.neverUsed", { date: dateText(since) }),
|
|
131
133
|
color: "warning",
|
|
132
|
-
variant:
|
|
134
|
+
variant: ui.value.badge.variant,
|
|
133
135
|
size: "sm"
|
|
134
136
|
}));
|
|
135
137
|
}
|
|
@@ -145,13 +147,12 @@ const columns = computed(() => [
|
|
|
145
147
|
cell: ({ row }) => {
|
|
146
148
|
if (!props.canManage) return null;
|
|
147
149
|
if (!canDropIndex(row.original.name)) {
|
|
148
|
-
return h("div", { class: "flex justify-end" }, withTooltip(t("nuxtUiMongocamp.indexes.protectedHint"), h("span", { class: "text-dimmed text-xs" }, "\u2014")));
|
|
150
|
+
return h("div", { "class": "flex justify-end", "data-mongocamp-part": "row-actions" }, withTooltip(t("nuxtUiMongocamp.indexes.protectedHint"), h("span", { class: "text-dimmed text-xs" }, "\u2014")));
|
|
149
151
|
}
|
|
150
|
-
return h("div", { class: "flex justify-end" }, withTooltip(t("nuxtUiMongocamp.collectionInfos.deleteIndexTooltip"), h(UButton, {
|
|
152
|
+
return h("div", { "class": "flex justify-end", "data-mongocamp-part": "row-actions" }, withTooltip(t("nuxtUiMongocamp.collectionInfos.deleteIndexTooltip"), h(UButton, {
|
|
151
153
|
"icon": "i-lucide-trash-2",
|
|
154
|
+
...ui.value.iconButton,
|
|
152
155
|
"color": "error",
|
|
153
|
-
"variant": "ghost",
|
|
154
|
-
"size": "sm",
|
|
155
156
|
"aria-label": t("nuxtUiMongocamp.collectionInfos.deleteIndexTooltip"),
|
|
156
157
|
"onClick": () => askDrop(row.original.name)
|
|
157
158
|
})));
|
|
@@ -236,7 +237,7 @@ async function runDrop() {
|
|
|
236
237
|
</script>
|
|
237
238
|
|
|
238
239
|
<template>
|
|
239
|
-
<UCard>
|
|
240
|
+
<UCard class="mongocamp-indexes">
|
|
240
241
|
<template #header>
|
|
241
242
|
<div class="flex items-center justify-between gap-2">
|
|
242
243
|
<div class="flex items-center gap-2">
|
|
@@ -247,7 +248,7 @@ async function runDrop() {
|
|
|
247
248
|
<span class="font-semibold">{{ t("nuxtUiMongocamp.collectionInfos.indexes") }}</span>
|
|
248
249
|
<UBadge
|
|
249
250
|
:label="t('nuxtUiMongocamp.collectionInfos.indexesCount', { count: rows.length })"
|
|
250
|
-
variant="
|
|
251
|
+
:variant="ui.badge.variant"
|
|
251
252
|
color="neutral"
|
|
252
253
|
size="sm"
|
|
253
254
|
/>
|
|
@@ -256,9 +257,7 @@ async function runDrop() {
|
|
|
256
257
|
v-if="canManage"
|
|
257
258
|
icon="i-lucide-plus"
|
|
258
259
|
:label="t('nuxtUiMongocamp.collectionInfos.createIndex')"
|
|
259
|
-
|
|
260
|
-
variant="ghost"
|
|
261
|
-
size="sm"
|
|
260
|
+
v-bind="ui.iconButton"
|
|
262
261
|
@click="openCreate"
|
|
263
262
|
/>
|
|
264
263
|
</div>
|
|
@@ -275,6 +274,7 @@ async function runDrop() {
|
|
|
275
274
|
{{ t("nuxtUiMongocamp.indexes.usageUnavailable") }}
|
|
276
275
|
</p>
|
|
277
276
|
<UTable
|
|
277
|
+
data-mongocamp-part="table"
|
|
278
278
|
:data="rows"
|
|
279
279
|
:columns="columns"
|
|
280
280
|
:loading="loading"
|
|
@@ -354,8 +354,7 @@ async function runDrop() {
|
|
|
354
354
|
<UButton
|
|
355
355
|
v-if="!singleField && !textKind"
|
|
356
356
|
:icon="row.descending ? 'i-lucide-arrow-down-wide-narrow' : 'i-lucide-arrow-up-narrow-wide'"
|
|
357
|
-
|
|
358
|
-
variant="ghost"
|
|
357
|
+
v-bind="ui.toolbarButton"
|
|
359
358
|
:label="row.descending ? t('nuxtUiMongocamp.indexes.directionDesc') : t('nuxtUiMongocamp.indexes.directionAsc')"
|
|
360
359
|
:aria-label="t('nuxtUiMongocamp.indexes.directionLabel', { position: index + 1 })"
|
|
361
360
|
@click="row.descending = !row.descending"
|
|
@@ -363,8 +362,7 @@ async function runDrop() {
|
|
|
363
362
|
<UButton
|
|
364
363
|
v-if="!singleField && form.fields.length > 1"
|
|
365
364
|
icon="i-lucide-x"
|
|
366
|
-
|
|
367
|
-
variant="ghost"
|
|
365
|
+
v-bind="ui.toolbarButton"
|
|
368
366
|
:aria-label="t('nuxtUiMongocamp.indexes.removeField', { position: index + 1 })"
|
|
369
367
|
@click="removeField(index)"
|
|
370
368
|
/>
|
|
@@ -381,7 +379,7 @@ async function runDrop() {
|
|
|
381
379
|
icon="i-lucide-plus"
|
|
382
380
|
color="neutral"
|
|
383
381
|
variant="soft"
|
|
384
|
-
size="
|
|
382
|
+
:size="ui.controlSize"
|
|
385
383
|
class="self-start"
|
|
386
384
|
:label="t('nuxtUiMongocamp.indexes.addField')"
|
|
387
385
|
:disabled="form.fields.length >= MAX_INDEX_FIELDS"
|