@sfxcode/nuxt-ui-mongocamp 1.3.1 → 1.3.3

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.
Files changed (94) hide show
  1. package/README.md +1 -1
  2. package/dist/module.d.mts +12 -0
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +18 -5
  5. package/dist/runtime/components/MongocampAggregationBuilder.d.vue.ts +6 -0
  6. package/dist/runtime/components/MongocampAggregationBuilder.vue +390 -0
  7. package/dist/runtime/components/MongocampAggregationBuilder.vue.d.ts +6 -0
  8. package/dist/runtime/components/MongocampBulkDelete.d.vue.ts +11 -1
  9. package/dist/runtime/components/MongocampBulkDelete.vue +1 -0
  10. package/dist/runtime/components/MongocampBulkDelete.vue.d.ts +11 -1
  11. package/dist/runtime/components/MongocampBulkEdit.d.vue.ts +29 -0
  12. package/dist/runtime/components/MongocampBulkEdit.vue +138 -0
  13. package/dist/runtime/components/MongocampBulkEdit.vue.d.ts +29 -0
  14. package/dist/runtime/components/MongocampCollectionData.d.vue.ts +4 -1
  15. package/dist/runtime/components/MongocampCollectionData.vue +167 -4
  16. package/dist/runtime/components/MongocampCollectionData.vue.d.ts +4 -1
  17. package/dist/runtime/components/MongocampCollectionInfos.vue +266 -8
  18. package/dist/runtime/components/MongocampCollections.d.vue.ts +8 -1
  19. package/dist/runtime/components/MongocampCollections.vue +84 -72
  20. package/dist/runtime/components/MongocampCollections.vue.d.ts +8 -1
  21. package/dist/runtime/components/MongocampConfirmByName.d.vue.ts +23 -0
  22. package/dist/runtime/components/MongocampConfirmByName.vue +92 -0
  23. package/dist/runtime/components/MongocampConfirmByName.vue.d.ts +23 -0
  24. package/dist/runtime/components/MongocampErrorAlert.vue +28 -5
  25. package/dist/runtime/components/MongocampFilterBuilder.d.vue.ts +1 -0
  26. package/dist/runtime/components/MongocampFilterBuilder.vue +33 -2
  27. package/dist/runtime/components/MongocampFilterBuilder.vue.d.ts +1 -0
  28. package/dist/runtime/components/MongocampGrantList.d.vue.ts +7 -0
  29. package/dist/runtime/components/MongocampGrantList.vue +38 -0
  30. package/dist/runtime/components/MongocampGrantList.vue.d.ts +7 -0
  31. package/dist/runtime/components/MongocampImport.d.vue.ts +10 -0
  32. package/dist/runtime/components/MongocampImport.vue +479 -0
  33. package/dist/runtime/components/MongocampImport.vue.d.ts +10 -0
  34. package/dist/runtime/components/MongocampRoles.vue +45 -0
  35. package/dist/runtime/components/MongocampSettings.d.vue.ts +3 -0
  36. package/dist/runtime/components/MongocampSettings.vue +179 -0
  37. package/dist/runtime/components/MongocampSettings.vue.d.ts +3 -0
  38. package/dist/runtime/components/MongocampUsers.vue +183 -3
  39. package/dist/runtime/composables/useMongocampAdmin.d.ts +7 -1
  40. package/dist/runtime/composables/useMongocampAdmin.js +24 -1
  41. package/dist/runtime/composables/useMongocampAggregation.d.ts +28 -0
  42. package/dist/runtime/composables/useMongocampAggregation.js +100 -0
  43. package/dist/runtime/composables/useMongocampBucket.js +1 -1
  44. package/dist/runtime/composables/useMongocampBulkDelete.d.ts +1 -1
  45. package/dist/runtime/composables/useMongocampImport.d.ts +14 -0
  46. package/dist/runtime/composables/useMongocampImport.js +25 -0
  47. package/dist/runtime/composables/useMongocampIndex.d.ts +1 -0
  48. package/dist/runtime/composables/useMongocampIndex.js +8 -1
  49. package/dist/runtime/composables/useMongocampRoles.d.ts +1 -0
  50. package/dist/runtime/composables/useMongocampRoles.js +3 -2
  51. package/dist/runtime/composables/useMongocampSession.d.ts +8 -0
  52. package/dist/runtime/composables/useMongocampSession.js +45 -0
  53. package/dist/runtime/composables/useMongocampSystem.d.ts +15 -3
  54. package/dist/runtime/composables/useMongocampSystem.js +19 -2
  55. package/dist/runtime/locales/de.json +200 -3
  56. package/dist/runtime/locales/en.json +200 -3
  57. package/dist/runtime/plugin.js +19 -0
  58. package/dist/runtime/utils/aggregationErrors.d.ts +10 -0
  59. package/dist/runtime/utils/aggregationErrors.js +17 -0
  60. package/dist/runtime/utils/aggregationPipeline.d.ts +42 -0
  61. package/dist/runtime/utils/aggregationPipeline.js +118 -0
  62. package/dist/runtime/utils/aggregationResult.d.ts +5 -0
  63. package/dist/runtime/utils/aggregationResult.js +17 -0
  64. package/dist/runtime/utils/analyzeSamples.d.ts +27 -0
  65. package/dist/runtime/utils/analyzeSamples.js +92 -0
  66. package/dist/runtime/utils/batchInsert.d.ts +22 -0
  67. package/dist/runtime/utils/batchInsert.js +24 -0
  68. package/dist/runtime/utils/bulkDelete.d.ts +6 -1
  69. package/dist/runtime/utils/bulkDelete.js +28 -4
  70. package/dist/runtime/utils/bulkEdit.d.ts +27 -0
  71. package/dist/runtime/utils/bulkEdit.js +45 -0
  72. package/dist/runtime/utils/collectionProtection.d.ts +3 -0
  73. package/dist/runtime/utils/collectionProtection.js +7 -0
  74. package/dist/runtime/utils/configRows.d.ts +11 -0
  75. package/dist/runtime/utils/configRows.js +53 -0
  76. package/dist/runtime/utils/failureKind.d.ts +3 -0
  77. package/dist/runtime/utils/failureKind.js +11 -0
  78. package/dist/runtime/utils/filterSuggestions.d.ts +8 -0
  79. package/dist/runtime/utils/filterSuggestions.js +15 -0
  80. package/dist/runtime/utils/importPipeline.d.ts +21 -0
  81. package/dist/runtime/utils/importPipeline.js +52 -0
  82. package/dist/runtime/utils/importRows.d.ts +36 -0
  83. package/dist/runtime/utils/importRows.js +228 -0
  84. package/dist/runtime/utils/jwtExpiry.d.ts +3 -0
  85. package/dist/runtime/utils/jwtExpiry.js +31 -0
  86. package/dist/runtime/utils/objectId.d.ts +1 -0
  87. package/dist/runtime/utils/objectId.js +4 -0
  88. package/dist/runtime/utils/serverProbe.d.ts +10 -0
  89. package/dist/runtime/utils/serverProbe.js +25 -0
  90. package/dist/runtime/utils/sessionGuard.d.ts +10 -0
  91. package/dist/runtime/utils/sessionGuard.js +10 -0
  92. package/dist/runtime/utils/throttled.d.ts +6 -0
  93. package/dist/runtime/utils/throttled.js +16 -0
  94. package/package.json +1 -1
@@ -0,0 +1,479 @@
1
+ <script setup>
2
+ import { computed, ref, watch } from "vue";
3
+ import { useI18n, useMongocampError } from "#imports";
4
+ import { useMongocampImport } from "../composables/useMongocampImport";
5
+ import { DEFAULT_IMPORT_LIMITS } from "../utils/importRows";
6
+ import { detectImportFormat, prepareImport } from "../utils/importPipeline";
7
+ const props = defineProps({
8
+ collectionName: { type: String, required: true }
9
+ });
10
+ const emit = defineEmits(["imported"]);
11
+ const PREVIEW_ROWS = 5;
12
+ const ERROR_LIMIT = 10;
13
+ const { t } = useI18n();
14
+ const { describeError } = useMongocampError();
15
+ const { importRows } = useMongocampImport();
16
+ const isOpen = ref(false);
17
+ const step = ref("select");
18
+ const fileInputRef = ref(null);
19
+ const readError = ref("");
20
+ const fileName = ref("");
21
+ const fileText = ref("");
22
+ const format = ref("json");
23
+ const delimiter = ref(",");
24
+ const userColumnTypes = ref(null);
25
+ const emptyAsText = ref(false);
26
+ const stampMetadata = ref(true);
27
+ const progress = ref({ done: 0, total: 0 });
28
+ const attemptRows = ref([]);
29
+ const attemptSources = ref([]);
30
+ const failures = ref([]);
31
+ const totalInserted = ref(0);
32
+ const skipped = ref(0);
33
+ let controller = null;
34
+ const prepared = computed(() => {
35
+ if (!fileText.value) return null;
36
+ return prepareImport({
37
+ format: format.value,
38
+ text: fileText.value,
39
+ delimiter: delimiter.value,
40
+ columnTypes: format.value === "csv" ? userColumnTypes.value ?? void 0 : void 0,
41
+ emptyCells: emptyAsText.value ? "empty-string" : "omit"
42
+ });
43
+ });
44
+ const columnTypes = computed(() => userColumnTypes.value ?? prepared.value?.columnTypes ?? {});
45
+ const formatItems = computed(() => [
46
+ { label: t("nuxtUiMongocamp.import.formatJson"), value: "json" },
47
+ { label: t("nuxtUiMongocamp.import.formatCsv"), value: "csv" }
48
+ ]);
49
+ const delimiterItems = computed(() => [
50
+ { label: t("nuxtUiMongocamp.import.delimiterComma"), value: "," },
51
+ { label: t("nuxtUiMongocamp.import.delimiterSemicolon"), value: ";" },
52
+ { label: t("nuxtUiMongocamp.import.delimiterTab"), value: " " }
53
+ ]);
54
+ const typeItems = computed(() => [
55
+ { label: t("nuxtUiMongocamp.import.typeString"), value: "string" },
56
+ { label: t("nuxtUiMongocamp.import.typeNumber"), value: "number" },
57
+ { label: t("nuxtUiMongocamp.import.typeBoolean"), value: "boolean" },
58
+ { label: t("nuxtUiMongocamp.import.typeDate"), value: "date-time" },
59
+ { label: t("nuxtUiMongocamp.import.typeJson"), value: "json" }
60
+ ]);
61
+ const readyCount = computed(() => prepared.value?.rows.length ?? 0);
62
+ const rowErrors = computed(() => (prepared.value?.errors ?? []).filter((e) => e.rowIndex >= 0 && e.code !== "too-many-rows"));
63
+ const fileErrors = computed(() => (prepared.value?.errors ?? []).filter((e) => e.rowIndex < 0 && e.code !== "too-many-rows"));
64
+ const visibleErrors = computed(() => [...rowErrors.value].sort((a, b) => a.rowIndex - b.rowIndex).slice(0, ERROR_LIMIT));
65
+ const hiddenErrorCount = computed(() => Math.max(0, rowErrors.value.length - ERROR_LIMIT));
66
+ const previewColumns = computed(() => (prepared.value?.columns ?? []).map((column) => ({
67
+ id: column,
68
+ header: column,
69
+ accessorFn: (row) => row[column]
70
+ })));
71
+ const previewRows = computed(() => (prepared.value?.rows ?? []).slice(0, PREVIEW_ROWS).map((row) => {
72
+ const shown = {};
73
+ for (const [key, value] of Object.entries(row)) shown[key] = typeof value === "object" && value !== null ? JSON.stringify(value) : String(value);
74
+ return shown;
75
+ }));
76
+ function errorText(error) {
77
+ const message = t(`nuxtUiMongocamp.import.error.${error.code}`);
78
+ if (error.rowIndex < 0) return message;
79
+ const where = error.column ? t("nuxtUiMongocamp.import.errorRowColumn", { row: error.rowIndex + 1, column: error.column }) : t("nuxtUiMongocamp.import.errorRow", { row: error.rowIndex + 1 });
80
+ return `${where}: ${message}`;
81
+ }
82
+ function resetState() {
83
+ controller?.abort();
84
+ controller = null;
85
+ step.value = "select";
86
+ readError.value = "";
87
+ fileName.value = "";
88
+ fileText.value = "";
89
+ format.value = "json";
90
+ delimiter.value = ",";
91
+ userColumnTypes.value = null;
92
+ emptyAsText.value = false;
93
+ stampMetadata.value = true;
94
+ progress.value = { done: 0, total: 0 };
95
+ attemptRows.value = [];
96
+ attemptSources.value = [];
97
+ failures.value = [];
98
+ totalInserted.value = 0;
99
+ skipped.value = 0;
100
+ }
101
+ function openModal() {
102
+ isOpen.value = true;
103
+ }
104
+ watch(isOpen, (open) => {
105
+ if (!open) resetState();
106
+ });
107
+ function openFilePicker() {
108
+ fileInputRef.value?.click();
109
+ }
110
+ async function handleFileSelected(event) {
111
+ const input = event.target;
112
+ const file = input.files?.[0];
113
+ input.value = "";
114
+ if (!file) return;
115
+ readError.value = "";
116
+ try {
117
+ const text = await file.text();
118
+ fileName.value = file.name;
119
+ fileText.value = text;
120
+ format.value = detectImportFormat(file.name, text);
121
+ delimiter.value = file.name.toLowerCase().endsWith(".tsv") ? " " : ",";
122
+ userColumnTypes.value = null;
123
+ step.value = "preview";
124
+ } catch {
125
+ readError.value = t("nuxtUiMongocamp.import.readError");
126
+ }
127
+ }
128
+ function backToSelect() {
129
+ fileName.value = "";
130
+ fileText.value = "";
131
+ userColumnTypes.value = null;
132
+ step.value = "select";
133
+ }
134
+ function onFormatChange(value) {
135
+ format.value = value;
136
+ userColumnTypes.value = null;
137
+ }
138
+ function onDelimiterChange(value) {
139
+ delimiter.value = value;
140
+ userColumnTypes.value = null;
141
+ }
142
+ function setColumnType(column, type) {
143
+ userColumnTypes.value = { ...columnTypes.value, [column]: type };
144
+ }
145
+ async function failureReason(error) {
146
+ const response = error?.response;
147
+ if (response) {
148
+ try {
149
+ const body = await response.clone().json();
150
+ if (typeof body?.msg === "string" && body.msg) return body.msg;
151
+ } catch {
152
+ }
153
+ }
154
+ return describeError(error).message;
155
+ }
156
+ async function runImport(rows, sources) {
157
+ attemptRows.value = rows;
158
+ attemptSources.value = sources;
159
+ progress.value = { done: 0, total: rows.length };
160
+ failures.value = [];
161
+ skipped.value = 0;
162
+ step.value = "importing";
163
+ const run = new AbortController();
164
+ controller = run;
165
+ const result = await importRows(props.collectionName, rows, {
166
+ signal: run.signal,
167
+ stampMetadata: stampMetadata.value,
168
+ onProgress: (p) => {
169
+ progress.value = p;
170
+ }
171
+ });
172
+ if (controller === run) controller = null;
173
+ if (!isOpen.value) return;
174
+ totalInserted.value += result.inserted;
175
+ skipped.value = result.skipped;
176
+ failures.value = await Promise.all(result.failedBatches.map(async (batch) => ({
177
+ start: batch.start,
178
+ count: batch.count,
179
+ from: sources[batch.start] + 1,
180
+ to: sources[batch.start + batch.count - 1] + 1,
181
+ reason: await failureReason(batch.error),
182
+ mayBePartial: batch.mayBePartial
183
+ })));
184
+ step.value = "done";
185
+ if (result.inserted > 0) emit("imported", result.inserted);
186
+ }
187
+ async function startImport() {
188
+ if (!prepared.value || prepared.value.rows.length === 0) return;
189
+ await runImport(prepared.value.rows, prepared.value.sourceIndexes);
190
+ }
191
+ async function retryFailed() {
192
+ const rows = [];
193
+ const sources = [];
194
+ for (const range of failures.value) {
195
+ rows.push(...attemptRows.value.slice(range.start, range.start + range.count));
196
+ sources.push(...attemptSources.value.slice(range.start, range.start + range.count));
197
+ }
198
+ if (rows.length > 0) await runImport(rows, sources);
199
+ }
200
+ function stopImport() {
201
+ controller?.abort();
202
+ }
203
+ const anyMayBePartial = computed(() => failures.value.some((f) => f.mayBePartial));
204
+ const progressPercent = computed(() => progress.value.total === 0 ? 0 : Math.round(progress.value.done / progress.value.total * 100));
205
+ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, maxMb: DEFAULT_IMPORT_LIMITS.maxBytes / (1024 * 1024) }));
206
+ </script>
207
+
208
+ <template>
209
+ <UTooltip :text="t('nuxtUiMongocamp.import.trigger')">
210
+ <UButton
211
+ icon="i-lucide-file-up"
212
+ color="neutral"
213
+ variant="ghost"
214
+ size="sm"
215
+ :aria-label="t('nuxtUiMongocamp.import.trigger')"
216
+ @click="openModal"
217
+ />
218
+ </UTooltip>
219
+
220
+ <UModal
221
+ v-model:open="isOpen"
222
+ :title="t('nuxtUiMongocamp.import.title')"
223
+ :dismissible="step !== 'importing'"
224
+ :ui="{ footer: 'justify-end', content: 'sm:max-w-3xl' }"
225
+ >
226
+ <template #body>
227
+ <div
228
+ v-if="step === 'select'"
229
+ class="flex flex-col items-start gap-3"
230
+ >
231
+ <p class="font-medium">
232
+ {{ t("nuxtUiMongocamp.import.chooseFile") }}
233
+ </p>
234
+ <p class="text-sm text-dimmed">
235
+ {{ t("nuxtUiMongocamp.import.hint", limitsText) }}
236
+ </p>
237
+ <input
238
+ ref="fileInputRef"
239
+ type="file"
240
+ class="hidden"
241
+ accept=".json,.csv,.tsv,.txt,application/json,text/csv"
242
+ data-testid="import-file-input"
243
+ @change="handleFileSelected"
244
+ >
245
+ <UButton
246
+ icon="i-lucide-folder-open"
247
+ :label="t('nuxtUiMongocamp.import.chooseButton')"
248
+ @click="openFilePicker"
249
+ />
250
+ <UAlert
251
+ v-if="readError"
252
+ color="error"
253
+ variant="subtle"
254
+ icon="i-lucide-circle-alert"
255
+ :description="readError"
256
+ />
257
+ </div>
258
+
259
+ <div
260
+ v-else-if="step === 'preview' && prepared"
261
+ class="flex flex-col gap-4"
262
+ >
263
+ <div class="flex flex-wrap items-end gap-3">
264
+ <span class="text-sm font-medium break-all">{{ fileName }}</span>
265
+ <USelect
266
+ :model-value="format"
267
+ :items="formatItems"
268
+ size="sm"
269
+ class="w-28"
270
+ :aria-label="t('nuxtUiMongocamp.import.format')"
271
+ @update:model-value="onFormatChange"
272
+ />
273
+ <USelect
274
+ v-if="format === 'csv'"
275
+ :model-value="delimiter"
276
+ :items="delimiterItems"
277
+ size="sm"
278
+ class="w-40"
279
+ :aria-label="t('nuxtUiMongocamp.import.delimiter')"
280
+ @update:model-value="onDelimiterChange"
281
+ />
282
+ </div>
283
+
284
+ <UAlert
285
+ v-for="error in fileErrors"
286
+ :key="error.code"
287
+ color="error"
288
+ variant="subtle"
289
+ icon="i-lucide-circle-alert"
290
+ :description="errorText(error)"
291
+ />
292
+
293
+ <template v-if="fileErrors.length === 0">
294
+ <p class="text-sm font-medium">
295
+ {{ t("nuxtUiMongocamp.import.summary", { ready: readyCount, total: prepared.sourceRowCount }) }}
296
+ </p>
297
+ <UAlert
298
+ v-if="prepared.truncated"
299
+ color="warning"
300
+ variant="subtle"
301
+ icon="i-lucide-triangle-alert"
302
+ :description="t('nuxtUiMongocamp.import.truncated', { maxRows: limitsText.maxRows })"
303
+ />
304
+
305
+ <div
306
+ v-if="format === 'csv' && prepared.columns.length > 0"
307
+ class="flex flex-col gap-2"
308
+ >
309
+ <p class="text-sm font-medium">
310
+ {{ t("nuxtUiMongocamp.import.columnTypes") }}
311
+ </p>
312
+ <div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
313
+ <div
314
+ v-for="column in prepared.columns"
315
+ :key="column"
316
+ class="flex items-center gap-2"
317
+ >
318
+ <span class="w-32 truncate text-sm">{{ column }}</span>
319
+ <USelect
320
+ :model-value="columnTypes[column]"
321
+ :items="typeItems"
322
+ size="sm"
323
+ class="w-32"
324
+ :aria-label="column"
325
+ @update:model-value="setColumnType(column, $event)"
326
+ />
327
+ </div>
328
+ </div>
329
+ <USwitch
330
+ v-model="emptyAsText"
331
+ :label="t('nuxtUiMongocamp.import.emptyAsText')"
332
+ />
333
+ </div>
334
+
335
+ <UAlert
336
+ v-if="rowErrors.length > 0"
337
+ color="warning"
338
+ variant="subtle"
339
+ icon="i-lucide-triangle-alert"
340
+ :title="t('nuxtUiMongocamp.import.problems', { count: rowErrors.length }, rowErrors.length)"
341
+ >
342
+ <template #description>
343
+ <ul class="list-disc pl-5 text-sm">
344
+ <li
345
+ v-for="error in visibleErrors"
346
+ :key="`${error.rowIndex}-${error.column ?? ''}-${error.code}`"
347
+ >
348
+ {{ errorText(error) }}
349
+ </li>
350
+ </ul>
351
+ <p
352
+ v-if="hiddenErrorCount > 0"
353
+ class="mt-1 text-sm"
354
+ >
355
+ {{ t("nuxtUiMongocamp.import.moreErrors", { count: hiddenErrorCount }) }}
356
+ </p>
357
+ </template>
358
+ </UAlert>
359
+
360
+ <div v-if="previewRows.length > 0">
361
+ <p class="mb-1 text-sm font-medium">
362
+ {{ t("nuxtUiMongocamp.import.previewTitle", { count: previewRows.length }) }}
363
+ </p>
364
+ <UTable
365
+ :data="previewRows"
366
+ :columns="previewColumns"
367
+ class="max-h-64"
368
+ />
369
+ </div>
370
+
371
+ <USwitch
372
+ v-model="stampMetadata"
373
+ :label="t('nuxtUiMongocamp.import.stampMetadata')"
374
+ />
375
+ </template>
376
+ </div>
377
+
378
+ <div
379
+ v-else-if="step === 'importing'"
380
+ class="flex flex-col gap-3"
381
+ >
382
+ <p class="text-sm">
383
+ {{ t("nuxtUiMongocamp.import.importing", progress) }}
384
+ </p>
385
+ <UProgress
386
+ :model-value="progressPercent"
387
+ :aria-label="t('nuxtUiMongocamp.import.importing', progress)"
388
+ />
389
+ </div>
390
+
391
+ <div
392
+ v-else-if="step === 'done'"
393
+ class="flex flex-col gap-3"
394
+ >
395
+ <UAlert
396
+ :color="totalInserted > 0 ? 'success' : 'neutral'"
397
+ variant="subtle"
398
+ :icon="totalInserted > 0 ? 'i-lucide-circle-check' : 'i-lucide-info'"
399
+ :title="t('nuxtUiMongocamp.import.result', { count: totalInserted }, totalInserted)"
400
+ />
401
+ <UAlert
402
+ v-if="skipped > 0"
403
+ color="warning"
404
+ variant="subtle"
405
+ icon="i-lucide-triangle-alert"
406
+ :description="t('nuxtUiMongocamp.import.aborted', { count: skipped })"
407
+ />
408
+ <UAlert
409
+ v-if="failures.length > 0"
410
+ color="error"
411
+ variant="subtle"
412
+ icon="i-lucide-circle-alert"
413
+ >
414
+ <template #description>
415
+ <ul class="list-disc pl-5 text-sm">
416
+ <li
417
+ v-for="failure in failures"
418
+ :key="failure.start"
419
+ >
420
+ {{ t("nuxtUiMongocamp.import.failedBatch", { from: failure.from, to: failure.to, reason: failure.reason }) }}
421
+ </li>
422
+ </ul>
423
+ <p
424
+ v-if="anyMayBePartial"
425
+ class="mt-2 text-sm"
426
+ >
427
+ {{ t("nuxtUiMongocamp.import.maybePartial") }}
428
+ </p>
429
+ </template>
430
+ </UAlert>
431
+ </div>
432
+ </template>
433
+
434
+ <template #footer>
435
+ <template v-if="step === 'preview'">
436
+ <UButton
437
+ :label="t('nuxtUiMongocamp.import.back')"
438
+ color="neutral"
439
+ variant="ghost"
440
+ @click="backToSelect"
441
+ />
442
+ <UButton
443
+ :label="t('nuxtUiMongocamp.import.importButton', { count: readyCount }, readyCount)"
444
+ :disabled="readyCount === 0"
445
+ @click="startImport"
446
+ />
447
+ </template>
448
+ <template v-else-if="step === 'importing'">
449
+ <UButton
450
+ :label="t('nuxtUiMongocamp.import.stop')"
451
+ color="neutral"
452
+ variant="subtle"
453
+ @click="stopImport"
454
+ />
455
+ </template>
456
+ <template v-else-if="step === 'done'">
457
+ <UButton
458
+ v-if="failures.length > 0"
459
+ :label="t('nuxtUiMongocamp.import.retryFailed')"
460
+ color="neutral"
461
+ variant="subtle"
462
+ @click="retryFailed"
463
+ />
464
+ <UButton
465
+ :label="t('nuxtUiMongocamp.import.close')"
466
+ @click="isOpen = false"
467
+ />
468
+ </template>
469
+ <template v-else>
470
+ <UButton
471
+ :label="t('nuxtUiMongocamp.common.cancel')"
472
+ color="neutral"
473
+ variant="ghost"
474
+ @click="isOpen = false"
475
+ />
476
+ </template>
477
+ </template>
478
+ </UModal>
479
+ </template>
@@ -0,0 +1,10 @@
1
+ type __VLS_Props = {
2
+ collectionName: string;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
+ imported: (count: number) => any;
6
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
7
+ onImported?: ((count: number) => any) | undefined;
8
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -165,6 +165,16 @@ async function handleDeleteRole() {
165
165
  deleting.value = false;
166
166
  }
167
167
  }
168
+ const isDetailOpen = ref(false);
169
+ const detail = ref(null);
170
+ function openDetail(role) {
171
+ detail.value = {
172
+ name: role.name,
173
+ isAdmin: role.isAdmin,
174
+ grants: (role.collectionGrants ?? []).map((g) => ({ ...g }))
175
+ };
176
+ isDetailOpen.value = true;
177
+ }
168
178
  const UBadge = resolveComponent("UBadge");
169
179
  const UButton = resolveComponent("UButton");
170
180
  const UTooltip = resolveComponent("UTooltip");
@@ -210,6 +220,14 @@ const columns = computed(() => [
210
220
  id: "actions",
211
221
  header: "",
212
222
  cell: ({ row }) => h("div", { class: "flex gap-1 justify-end" }, [
223
+ withTooltip(t("nuxtUiMongocamp.roles.detailsTooltip"), h(UButton, {
224
+ "icon": "i-lucide-info",
225
+ "color": "neutral",
226
+ "variant": "ghost",
227
+ "size": "sm",
228
+ "aria-label": t("nuxtUiMongocamp.roles.detailsTooltip"),
229
+ "onClick": () => openDetail(row.original)
230
+ })),
213
231
  withTooltip(t("nuxtUiMongocamp.roles.manageGrantsTooltip"), h(UButton, {
214
232
  "icon": "i-lucide-key",
215
233
  "color": "neutral",
@@ -412,5 +430,32 @@ fetchRoles();
412
430
  />
413
431
  </template>
414
432
  </UModal>
433
+
434
+ <USlideover
435
+ v-model:open="isDetailOpen"
436
+ :title="t('nuxtUiMongocamp.roles.detailsTitle', { roleName: detail?.name ?? '' })"
437
+ :ui="{ content: 'sm:max-w-xl' }"
438
+ >
439
+ <template #body>
440
+ <div
441
+ v-if="detail"
442
+ class="flex flex-col gap-4"
443
+ >
444
+ <div class="flex items-center gap-2">
445
+ <UBadge
446
+ :label="detail.isAdmin ? t('nuxtUiMongocamp.common.admin') : t('nuxtUiMongocamp.common.standard')"
447
+ :color="detail.isAdmin ? 'error' : 'neutral'"
448
+ variant="subtle"
449
+ />
450
+ </div>
451
+ <section class="flex flex-col gap-2">
452
+ <h3 class="text-sm font-semibold">
453
+ {{ t("nuxtUiMongocamp.roles.detailsGrants") }}
454
+ </h3>
455
+ <MongocampGrantList :grants="detail.grants" />
456
+ </section>
457
+ </div>
458
+ </template>
459
+ </USlideover>
415
460
  </div>
416
461
  </template>
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;