@sfxcode/nuxt-ui-mongocamp 1.5.7 → 2.0.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.
Files changed (130) hide show
  1. package/README.md +5 -5
  2. package/dist/module.d.mts +17 -0
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +4 -0
  5. package/dist/runtime/components/MongocampAccount.vue +12 -14
  6. package/dist/runtime/components/MongocampAggregationBuilder.d.vue.ts +1 -0
  7. package/dist/runtime/components/MongocampAggregationBuilder.vue +32 -45
  8. package/dist/runtime/components/MongocampAggregationBuilder.vue.d.ts +1 -0
  9. package/dist/runtime/components/MongocampAggregationChart.vue +7 -5
  10. package/dist/runtime/components/MongocampAggregationStagePreview.d.vue.ts +1 -0
  11. package/dist/runtime/components/MongocampAggregationStagePreview.vue +5 -3
  12. package/dist/runtime/components/MongocampAggregationStagePreview.vue.d.ts +1 -0
  13. package/dist/runtime/components/MongocampBucketFiles.vue +29 -40
  14. package/dist/runtime/components/MongocampBulkDelete.vue +8 -9
  15. package/dist/runtime/components/MongocampBulkEdit.vue +5 -4
  16. package/dist/runtime/components/MongocampChart.vue +1 -1
  17. package/dist/runtime/components/MongocampCollectionCharts.d.vue.ts +1 -0
  18. package/dist/runtime/components/MongocampCollectionCharts.vue +10 -7
  19. package/dist/runtime/components/MongocampCollectionCharts.vue.d.ts +1 -0
  20. package/dist/runtime/components/MongocampCollectionCopy.d.vue.ts +1 -0
  21. package/dist/runtime/components/MongocampCollectionCopy.vue +11 -9
  22. package/dist/runtime/components/MongocampCollectionCopy.vue.d.ts +1 -0
  23. package/dist/runtime/components/MongocampCollectionData.vue +97 -87
  24. package/dist/runtime/components/MongocampCollectionInfos.vue +34 -24
  25. package/dist/runtime/components/MongocampCollectionRename.vue +5 -4
  26. package/dist/runtime/components/MongocampCollections.vue +24 -33
  27. package/dist/runtime/components/MongocampCommandPalette.vue +3 -1
  28. package/dist/runtime/components/MongocampConfirmByName.vue +5 -4
  29. package/dist/runtime/components/MongocampDashboard.vue +5 -3
  30. package/dist/runtime/components/MongocampDatabases.vue +14 -8
  31. package/dist/runtime/components/MongocampDocumentCompare.vue +6 -4
  32. package/dist/runtime/components/MongocampDocumentView.vue +12 -9
  33. package/dist/runtime/components/MongocampEmptyState.vue +4 -1
  34. package/dist/runtime/components/MongocampErrorAlert.vue +8 -7
  35. package/dist/runtime/components/MongocampExportAll.d.vue.ts +1 -0
  36. package/dist/runtime/components/MongocampExportAll.vue +19 -7
  37. package/dist/runtime/components/MongocampExportAll.vue.d.ts +1 -0
  38. package/dist/runtime/components/MongocampFilePreview.vue +7 -6
  39. package/dist/runtime/components/MongocampFilterBuilder.vue +12 -16
  40. package/dist/runtime/components/MongocampGrantList.vue +6 -2
  41. package/dist/runtime/components/MongocampImport.vue +32 -28
  42. package/dist/runtime/components/MongocampIndexes.vue +21 -19
  43. package/dist/runtime/components/MongocampJobs.vue +20 -20
  44. package/dist/runtime/components/MongocampLogin.vue +2 -1
  45. package/dist/runtime/components/MongocampPermissionMatrix.vue +14 -11
  46. package/dist/runtime/components/MongocampQueryBar.vue +33 -32
  47. package/dist/runtime/components/MongocampRoleGrants.vue +21 -17
  48. package/dist/runtime/components/MongocampRoles.vue +28 -32
  49. package/dist/runtime/components/MongocampServerInfo.vue +17 -25
  50. package/dist/runtime/components/MongocampServerOverview.vue +16 -12
  51. package/dist/runtime/components/MongocampServerStatus.vue +9 -3
  52. package/dist/runtime/components/MongocampSettings.vue +15 -11
  53. package/dist/runtime/components/MongocampUserAccess.vue +11 -6
  54. package/dist/runtime/components/MongocampUsers.vue +32 -35
  55. package/dist/runtime/components/MongocampVersion.d.vue.ts +1 -1
  56. package/dist/runtime/components/MongocampVersion.vue +20 -11
  57. package/dist/runtime/components/MongocampVersion.vue.d.ts +1 -1
  58. package/dist/runtime/composables/useMongocampAdmin.js +6 -5
  59. package/dist/runtime/composables/useMongocampAggregation.d.ts +10 -1
  60. package/dist/runtime/composables/useMongocampAggregation.js +17 -5
  61. package/dist/runtime/composables/useMongocampBucket.d.ts +4 -0
  62. package/dist/runtime/composables/useMongocampBucket.js +7 -6
  63. package/dist/runtime/composables/useMongocampBulkByFilter.d.ts +6 -4
  64. package/dist/runtime/composables/useMongocampBulkByFilter.js +11 -6
  65. package/dist/runtime/composables/useMongocampCollectionCopy.d.ts +3 -1
  66. package/dist/runtime/composables/useMongocampCollectionCopy.js +4 -2
  67. package/dist/runtime/composables/useMongocampCollectionStats.js +2 -4
  68. package/dist/runtime/composables/useMongocampError.d.ts +1 -1
  69. package/dist/runtime/composables/useMongocampError.js +4 -1
  70. package/dist/runtime/composables/useMongocampExportAll.d.ts +10 -1
  71. package/dist/runtime/composables/useMongocampExportAll.js +4 -1
  72. package/dist/runtime/composables/useMongocampFetchAll.d.ts +11 -5
  73. package/dist/runtime/composables/useMongocampFetchAll.js +8 -8
  74. package/dist/runtime/composables/useMongocampJobs.js +3 -2
  75. package/dist/runtime/composables/useMongocampQuery.d.ts +26 -36
  76. package/dist/runtime/composables/useMongocampQuery.js +45 -48
  77. package/dist/runtime/composables/useMongocampSchema.js +2 -0
  78. package/dist/runtime/composables/useMongocampUi.d.ts +8 -0
  79. package/dist/runtime/composables/useMongocampUi.js +7 -0
  80. package/dist/runtime/locales/de.json +12 -4
  81. package/dist/runtime/locales/en.json +12 -4
  82. package/dist/runtime/plugin.js +8 -0
  83. package/dist/runtime/publicUtils.d.ts +1 -0
  84. package/dist/runtime/publicUtils.js +1 -0
  85. package/dist/runtime/server/handlers/mongocampProxy.d.ts +1 -1
  86. package/dist/runtime/server/handlers/mongocampProxy.js +12 -12
  87. package/dist/runtime/utils/aggregationPipeline.d.ts +2 -1
  88. package/dist/runtime/utils/aggregationPipeline.js +2 -3
  89. package/dist/runtime/utils/caseInsensitive.d.ts +10 -0
  90. package/dist/runtime/utils/caseInsensitive.js +8 -0
  91. package/dist/runtime/utils/collectionStats.d.ts +4 -1
  92. package/dist/runtime/utils/collectionStats.js +2 -2
  93. package/dist/runtime/utils/compactSession.d.ts +13 -0
  94. package/dist/runtime/utils/compactSession.js +12 -0
  95. package/dist/runtime/utils/configRows.d.ts +3 -3
  96. package/dist/runtime/utils/cursorPaging.d.ts +16 -0
  97. package/dist/runtime/utils/cursorPaging.js +17 -0
  98. package/dist/runtime/utils/documentCompare.js +2 -3
  99. package/dist/runtime/utils/documentPaths.d.ts +5 -5
  100. package/dist/runtime/utils/documentPaths.js +9 -2
  101. package/dist/runtime/utils/documentTree.js +3 -0
  102. package/dist/runtime/utils/fileFilter.d.ts +7 -0
  103. package/dist/runtime/utils/fileFilter.js +11 -0
  104. package/dist/runtime/utils/filterBuilder.d.ts +1 -1
  105. package/dist/runtime/utils/filterBuilder.js +5 -11
  106. package/dist/runtime/utils/filterSuggestions.js +1 -1
  107. package/dist/runtime/utils/indexForm.d.ts +7 -0
  108. package/dist/runtime/utils/indexForm.js +9 -0
  109. package/dist/runtime/utils/pagedFetch.d.ts +13 -0
  110. package/dist/runtime/utils/pagedFetch.js +44 -0
  111. package/dist/runtime/utils/queryState.d.ts +5 -0
  112. package/dist/runtime/utils/queryState.js +3 -2
  113. package/dist/runtime/utils/relaxedValues.d.ts +17 -0
  114. package/dist/runtime/utils/relaxedValues.js +51 -0
  115. package/dist/runtime/utils/requestLimits.d.ts +1 -1
  116. package/dist/runtime/utils/requestLimits.js +1 -1
  117. package/dist/runtime/utils/savedQueries.d.ts +2 -0
  118. package/dist/runtime/utils/savedQueries.js +1 -0
  119. package/dist/runtime/utils/schemaAnalysis.d.ts +4 -4
  120. package/dist/runtime/utils/schemaAnalysis.js +2 -2
  121. package/dist/runtime/utils/sensitiveFields.d.ts +20 -0
  122. package/dist/runtime/utils/sensitiveFields.js +63 -0
  123. package/dist/runtime/utils/serverError.d.ts +7 -0
  124. package/dist/runtime/utils/serverError.js +11 -0
  125. package/dist/runtime/utils/serverStatus.d.ts +2 -2
  126. package/dist/runtime/utils/uiTheme.d.ts +65 -0
  127. package/dist/runtime/utils/uiTheme.js +47 -0
  128. package/package.json +22 -16
  129. package/dist/runtime/utils/luceneExpression.d.ts +0 -15
  130. package/dist/runtime/utils/luceneExpression.js +0 -74
@@ -8,11 +8,13 @@ import { analyzeSamples } from "../utils/analyzeSamples";
8
8
  import { shortenLabel } from "../utils/chartData";
9
9
  import { downloadTextFile } from "../utils/exportRows";
10
10
  import { FULL_ANALYSIS_MAX_DOCUMENTS, statisticsFromSchemaAnalysis } from "../utils/schemaAnalysis";
11
+ import { useMongocampUi } from "../composables/useMongocampUi";
11
12
  const props = defineProps({
12
13
  collectionName: { type: String, required: true },
13
14
  sampleSize: { type: Number, required: false, default: 500 }
14
15
  });
15
16
  const { t } = useI18n();
17
+ const ui = useMongocampUi();
16
18
  const { collectionApi, documentApi } = useMongocampClientApi();
17
19
  const { schemaFromSamples, schemaToTsInterface } = useMongocampSchema();
18
20
  const { sampleDocuments, describeAggregationError } = useMongocampAggregation();
@@ -23,17 +25,26 @@ const info = ref(null);
23
25
  const chartField = ref("");
24
26
  const columnDefinitions = ref([]);
25
27
  const loading = ref(false);
28
+ const loadError = ref(null);
26
29
  async function fetchInfo() {
27
30
  if (!props.collectionName) return;
28
31
  loading.value = true;
32
+ loadError.value = null;
29
33
  try {
30
34
  info.value = await collectionApi.getCollectionInformation({ collectionName: props.collectionName });
31
35
  const samples = await documentApi.listDocuments({
32
36
  collectionName: props.collectionName,
33
37
  rowsPerPage: props.sampleSize,
34
- page: 1
38
+ page: 1,
39
+ // the server's default, asked for by name: ids, dates and date-looking text keep their types for the inference
40
+ extendedJson: "relaxed",
41
+ // only the rows are used; the count is on the cards already
42
+ count: "none"
35
43
  });
36
44
  columnDefinitions.value = schemaFromSamples(samples);
45
+ } catch (e) {
46
+ info.value = null;
47
+ loadError.value = e;
37
48
  } finally {
38
49
  loading.value = false;
39
50
  }
@@ -112,7 +123,7 @@ const schemaTableColumns = computed(() => [
112
123
  cell: ({ row }) => h(UBadge, {
113
124
  label: row.original.type,
114
125
  color: TYPE_COLORS[row.original.type] ?? "neutral",
115
- variant: "subtle"
126
+ variant: ui.value.badge.variant
116
127
  })
117
128
  },
118
129
  {
@@ -203,7 +214,7 @@ const statsColumns = computed(() => [
203
214
  ({ type, count }) => h(UBadge, {
204
215
  label: row.original.types.length > 1 ? `${type} ${percent(count / row.original.present)}` : type,
205
216
  color: KIND_COLORS[type] ?? "neutral",
206
- variant: "subtle",
217
+ variant: ui.value.badge.variant,
207
218
  size: "sm"
208
219
  })
209
220
  ))
@@ -227,7 +238,13 @@ defineExpose({ refresh: fetchInfo });
227
238
  </script>
228
239
 
229
240
  <template>
230
- <div class="flex flex-col gap-4">
241
+ <div class="mongocamp-collection-infos flex flex-col gap-4">
242
+ <MongocampErrorAlert
243
+ v-if="!loading"
244
+ :error="loadError"
245
+ :title="t('nuxtUiMongocamp.collectionInfos.loadFailedTitle', { name: collectionName })"
246
+ @retry="fetchInfo"
247
+ />
231
248
  <USkeleton
232
249
  v-if="loading"
233
250
  class="h-32 w-full"
@@ -303,7 +320,7 @@ defineExpose({ refresh: fetchInfo });
303
320
  <span class="font-semibold">{{ schemaTitle }}</span>
304
321
  <UBadge
305
322
  :label="t('nuxtUiMongocamp.collectionInfos.fieldsCount', { count: schemaRows.length })"
306
- variant="subtle"
323
+ :variant="ui.badge.variant"
307
324
  color="neutral"
308
325
  size="sm"
309
326
  />
@@ -312,23 +329,20 @@ defineExpose({ refresh: fetchInfo });
312
329
  <UButton
313
330
  icon="i-lucide-file-json"
314
331
  :label="t('nuxtUiMongocamp.collectionInfos.jsonSchema')"
315
- color="neutral"
316
- variant="ghost"
317
- size="sm"
332
+ v-bind="ui.iconButton"
318
333
  @click="openJsonSchema"
319
334
  />
320
335
  <UButton
321
336
  icon="i-lucide-copy"
322
337
  :label="t('nuxtUiMongocamp.collectionInfos.copyAsTs')"
323
- color="neutral"
324
- variant="ghost"
325
- size="sm"
338
+ v-bind="ui.iconButton"
326
339
  @click="copySchemaAsTs"
327
340
  />
328
341
  </div>
329
342
  </div>
330
343
  </template>
331
344
  <UTable
345
+ data-mongocamp-part="table"
332
346
  :data="schemaRows"
333
347
  :columns="schemaTableColumns"
334
348
  />
@@ -372,7 +386,7 @@ defineExpose({ refresh: fetchInfo });
372
386
  <UBadge
373
387
  v-if="statsAnalysis"
374
388
  :label="statsMode === 'server' ? t('nuxtUiMongocamp.collectionInfos.statsAnalysed', { count: statsAnalysis.sampled }) : t('nuxtUiMongocamp.collectionInfos.statsSampled', { sampled: statsAnalysis.sampled, total: info.count })"
375
- variant="subtle"
389
+ :variant="ui.badge.variant"
376
390
  color="neutral"
377
391
  size="sm"
378
392
  />
@@ -381,16 +395,14 @@ defineExpose({ refresh: fetchInfo });
381
395
  <USelect
382
396
  v-model="statsSampleSize"
383
397
  :items="STATS_SAMPLE_SIZES"
384
- size="sm"
398
+ :size="ui.controlSize"
385
399
  class="w-24"
386
400
  :aria-label="t('nuxtUiMongocamp.collectionInfos.statsSampleSize')"
387
401
  />
388
402
  <UButton
389
403
  icon="i-lucide-activity"
390
404
  :label="t('nuxtUiMongocamp.collectionInfos.statsAnalyze')"
391
- color="neutral"
392
- variant="subtle"
393
- size="sm"
405
+ v-bind="{ ...ui.secondaryAction, size: ui.controlSize }"
394
406
  :loading="statsLoading && statsMode === 'sample'"
395
407
  :disabled="statsLoading"
396
408
  @click="analyzeFields"
@@ -419,7 +431,7 @@ defineExpose({ refresh: fetchInfo });
419
431
  <UAlert
420
432
  v-if="statsError"
421
433
  color="error"
422
- variant="subtle"
434
+ :variant="ui.alert.variant"
423
435
  icon="i-lucide-circle-alert"
424
436
  :title="t('nuxtUiMongocamp.collectionInfos.statsFailed')"
425
437
  :description="statsError.message"
@@ -429,15 +441,13 @@ defineExpose({ refresh: fetchInfo });
429
441
  v-if="statsError.kind === 'unauthorized'"
430
442
  :label="t('nuxtUiMongocamp.errors.loginAgain')"
431
443
  to="/"
432
- color="error"
433
- variant="subtle"
444
+ v-bind="{ ...ui.alertAction, color: 'error' }"
434
445
  icon="i-lucide-log-in"
435
446
  />
436
447
  <UButton
437
448
  v-else
438
449
  :label="t('nuxtUiMongocamp.common.retry')"
439
- color="error"
440
- variant="subtle"
450
+ v-bind="{ ...ui.alertAction, color: 'error' }"
441
451
  icon="i-lucide-refresh-cw"
442
452
  @click="retryStats"
443
453
  />
@@ -451,6 +461,7 @@ defineExpose({ refresh: fetchInfo });
451
461
  </template>
452
462
  </p>
453
463
  <UTable
464
+ data-mongocamp-part="table"
454
465
  :data="statsAnalysis.fields"
455
466
  :columns="statsColumns"
456
467
  >
@@ -482,7 +493,7 @@ defineExpose({ refresh: fetchInfo });
482
493
  <UModal
483
494
  v-model:open="isSchemaOpen"
484
495
  :title="t('nuxtUiMongocamp.collectionInfos.jsonSchemaTitle', { name: collectionName })"
485
- :ui="{ content: 'sm:max-w-3xl', footer: 'justify-end' }"
496
+ :ui="{ content: ui.modal.lg, footer: ui.modal.footer }"
486
497
  >
487
498
  <template #body>
488
499
  <MongocampErrorAlert
@@ -510,8 +521,7 @@ defineExpose({ refresh: fetchInfo });
510
521
  <UButton
511
522
  icon="i-lucide-copy"
512
523
  :label="t('nuxtUiMongocamp.common.copy')"
513
- color="neutral"
514
- variant="ghost"
524
+ v-bind="ui.toolbarButton"
515
525
  :disabled="!schemaJson"
516
526
  @click="copyJsonSchema"
517
527
  />
@@ -3,12 +3,14 @@ import { computed, ref, watch } from "vue";
3
3
  import { useI18n, useMongocampError } from "#imports";
4
4
  import { useMongocampCollectionCopy } from "../composables/useMongocampCollectionCopy";
5
5
  import { MAX_COLLECTION_NAME_LENGTH, validateTargetName } from "../utils/collectionCopy";
6
+ import { useMongocampUi } from "../composables/useMongocampUi";
6
7
  const props = defineProps({
7
8
  source: { type: String, required: true }
8
9
  });
9
10
  const emit = defineEmits(["done"]);
10
11
  const isOpen = defineModel("open", { type: Boolean, ...{ default: false } });
11
12
  const { t } = useI18n();
13
+ const ui = useMongocampUi();
12
14
  const { describeServerError } = useMongocampError();
13
15
  const { renameCollection, listCollectionNames } = useMongocampCollectionCopy();
14
16
  const target = ref("");
@@ -62,13 +64,13 @@ async function rename() {
62
64
  v-model:open="isOpen"
63
65
  :title="t('nuxtUiMongocamp.collectionRename.title', { source })"
64
66
  :dismissible="!renaming"
65
- :ui="{ footer: 'justify-end' }"
67
+ :ui="{ content: 'mongocamp-collection-rename', footer: ui.modal.footer }"
66
68
  >
67
69
  <template #body>
68
70
  <div class="flex flex-col gap-4">
69
71
  <UAlert
70
72
  color="warning"
71
- variant="subtle"
73
+ :variant="ui.alert.variant"
72
74
  icon="i-lucide-triangle-alert"
73
75
  :description="t('nuxtUiMongocamp.collectionRename.grantsWarning')"
74
76
  data-test="rename-grants-warning"
@@ -99,8 +101,7 @@ async function rename() {
99
101
  <template #footer>
100
102
  <UButton
101
103
  :label="t('nuxtUiMongocamp.common.cancel')"
102
- color="neutral"
103
- variant="ghost"
104
+ v-bind="ui.dialogCancel"
104
105
  :disabled="renaming"
105
106
  @click="isOpen = false"
106
107
  />
@@ -5,6 +5,7 @@ import { computed, h, ref, resolveComponent } from "vue";
5
5
  import { useI18n, useMongocampClientApi, useMongocampBucket, useMongocampCollectionNames, useMongocampRoles, useToast, useMongocampPaths } from "#imports";
6
6
  import useMongocampAdmin from "../composables/useMongocampAdmin";
7
7
  import { isProtectedCollection } from "../utils/collectionProtection";
8
+ import { useMongocampUi } from "../composables/useMongocampUi";
8
9
  const props = defineProps({
9
10
  infoPath: { type: String, required: false },
10
11
  dataPath: { type: String, required: false },
@@ -15,6 +16,7 @@ const props = defineProps({
15
16
  });
16
17
  const emit = defineEmits(["changed"]);
17
18
  const { t } = useI18n();
19
+ const ui = useMongocampUi();
18
20
  const paths = useMongocampPaths();
19
21
  const sharedNames = useMongocampCollectionNames();
20
22
  const { collectionApi } = useMongocampClientApi();
@@ -111,8 +113,7 @@ async function runPending() {
111
113
  function sortHeader(column, label) {
112
114
  const isSorted = column.getIsSorted();
113
115
  return h(UButton, {
114
- color: "neutral",
115
- variant: "ghost",
116
+ ...ui.value.sortHeader,
116
117
  label,
117
118
  icon: isSorted === "asc" ? "i-lucide-arrow-up-narrow-wide" : isSorted === "desc" ? "i-lucide-arrow-down-wide-narrow" : "i-lucide-arrow-up-down",
118
119
  class: "-mx-2.5",
@@ -125,7 +126,7 @@ const columns = computed(() => [
125
126
  header: ({ column }) => sortHeader(column, t("nuxtUiMongocamp.collections.columnCollection")),
126
127
  cell: ({ row }) => h("div", { class: "flex items-center gap-2" }, [
127
128
  h("span", row.original.name),
128
- isBucketCollection(row.original.name) ? h(UBadge, { label: t("nuxtUiMongocamp.collections.bucketBadge"), color: "neutral", variant: "subtle", size: "sm" }) : null
129
+ isBucketCollection(row.original.name) ? h(UBadge, { label: t("nuxtUiMongocamp.collections.bucketBadge"), color: "neutral", variant: ui.value.badge.variant, size: "sm" }) : null
129
130
  ])
130
131
  },
131
132
  {
@@ -147,17 +148,13 @@ const columns = computed(() => [
147
148
  const buttons = [
148
149
  withTooltip(t("nuxtUiMongocamp.collections.infoTooltip"), h(UButton, {
149
150
  "icon": "i-lucide-info",
150
- "color": "neutral",
151
- "variant": "ghost",
152
- "size": "sm",
151
+ ...ui.value.iconButton,
153
152
  "aria-label": t("nuxtUiMongocamp.collections.infoTooltip"),
154
153
  "to": `${props.infoPath ?? paths.collections}/${row.original.name}`
155
154
  })),
156
155
  withTooltip(t("nuxtUiMongocamp.collections.dataTooltip"), h(UButton, {
157
156
  "icon": "i-lucide-table",
158
- "color": "neutral",
159
- "variant": "ghost",
160
- "size": "sm",
157
+ ...ui.value.iconButton,
161
158
  "aria-label": t("nuxtUiMongocamp.collections.dataTooltip"),
162
159
  "to": `${props.dataPath ?? paths.collections}/${row.original.name}/data`
163
160
  }))
@@ -167,26 +164,22 @@ const columns = computed(() => [
167
164
  buttons.push(
168
165
  withTooltip(t("nuxtUiMongocamp.collections.browseFilesTooltip"), h(UButton, {
169
166
  "icon": "i-lucide-folder-open",
170
- "color": "neutral",
171
- "variant": "ghost",
172
- "size": "sm",
167
+ ...ui.value.iconButton,
173
168
  "aria-label": t("nuxtUiMongocamp.collections.browseFilesTooltip"),
174
169
  "to": `${props.bucketFilesPath ?? paths.buckets}/${bucketName}`
175
170
  })),
176
171
  withTooltip(t("nuxtUiMongocamp.collections.clearBucketTooltip"), h(UButton, {
177
172
  "icon": "i-lucide-eraser",
173
+ ...ui.value.iconButton,
178
174
  "color": "warning",
179
- "variant": "ghost",
180
- "size": "sm",
181
175
  "aria-label": t("nuxtUiMongocamp.collections.clearBucketTooltip"),
182
176
  "loading": bucketActionInFlight.value.has(bucketName),
183
177
  "onClick": () => askToConfirm("clearBucket", bucketName)
184
178
  })),
185
179
  withTooltip(t("nuxtUiMongocamp.collections.deleteBucketTooltip"), h(UButton, {
186
180
  "icon": "i-lucide-trash-2",
181
+ ...ui.value.iconButton,
187
182
  "color": "error",
188
- "variant": "ghost",
189
- "size": "sm",
190
183
  "aria-label": t("nuxtUiMongocamp.collections.deleteBucketTooltip"),
191
184
  "loading": bucketActionInFlight.value.has(bucketName),
192
185
  "onClick": () => askToConfirm("deleteBucket", bucketName)
@@ -197,39 +190,33 @@ const columns = computed(() => [
197
190
  buttons.push(
198
191
  withTooltip(t("nuxtUiMongocamp.collections.copyTooltip"), h(UButton, {
199
192
  "icon": "i-lucide-copy",
200
- "color": "neutral",
201
- "variant": "ghost",
202
- "size": "sm",
193
+ ...ui.value.iconButton,
203
194
  "aria-label": t("nuxtUiMongocamp.collections.copyTooltip"),
204
195
  "onClick": () => openCopy(name)
205
196
  })),
206
197
  withTooltip(t("nuxtUiMongocamp.collections.renameTooltip"), h(UButton, {
207
198
  "icon": "i-lucide-pencil",
208
- "color": "neutral",
209
- "variant": "ghost",
210
- "size": "sm",
199
+ ...ui.value.iconButton,
211
200
  "aria-label": t("nuxtUiMongocamp.collections.renameTooltip"),
212
201
  "onClick": () => openRename(name)
213
202
  })),
214
203
  withTooltip(t("nuxtUiMongocamp.collections.clearTooltip"), h(UButton, {
215
204
  "icon": "i-lucide-eraser",
205
+ ...ui.value.iconButton,
216
206
  "color": "warning",
217
- "variant": "ghost",
218
- "size": "sm",
219
207
  "aria-label": t("nuxtUiMongocamp.collections.clearTooltip"),
220
208
  "onClick": () => askToConfirm("clear", name)
221
209
  })),
222
210
  withTooltip(t("nuxtUiMongocamp.collections.dropTooltip"), h(UButton, {
223
211
  "icon": "i-lucide-trash-2",
212
+ ...ui.value.iconButton,
224
213
  "color": "error",
225
- "variant": "ghost",
226
- "size": "sm",
227
214
  "aria-label": t("nuxtUiMongocamp.collections.dropTooltip"),
228
215
  "onClick": () => askToConfirm("drop", name)
229
216
  }))
230
217
  );
231
218
  }
232
- return h("div", { class: "flex gap-1 justify-end" }, buttons);
219
+ return h("div", { "class": "flex gap-1 justify-end", "data-mongocamp-part": "row-actions" }, buttons);
233
220
  }
234
221
  }
235
222
  ]);
@@ -254,20 +241,24 @@ defineExpose({ refresh: fetchCollections });
254
241
  </script>
255
242
 
256
243
  <template>
257
- <div class="flex flex-col gap-4">
244
+ <div class="mongocamp-collections flex flex-col gap-4">
258
245
  <div class="flex items-center justify-between gap-4">
259
246
  <h2
260
247
  v-if="!hideHeading"
248
+ data-mongocamp-part="heading"
261
249
  class="text-xl font-semibold"
262
250
  >
263
251
  {{ t("nuxtUiMongocamp.collections.heading") }}
264
252
  </h2>
265
- <div class="flex flex-1 items-center gap-2">
253
+ <div
254
+ data-mongocamp-part="toolbar"
255
+ class="flex flex-1 items-center gap-2"
256
+ >
266
257
  <UInput
267
258
  v-model="globalFilter"
268
259
  icon="i-lucide-search"
269
260
  :placeholder="t('nuxtUiMongocamp.collections.filterPlaceholder')"
270
- size="sm"
261
+ :size="ui.controlSize"
271
262
  class="flex-1 max-w-xs"
272
263
  />
273
264
  <UTooltip
@@ -276,8 +267,7 @@ defineExpose({ refresh: fetchCollections });
276
267
  >
277
268
  <UButton
278
269
  icon="i-lucide-refresh-cw"
279
- color="neutral"
280
- variant="ghost"
270
+ v-bind="ui.toolbarButton"
281
271
  :loading="loading"
282
272
  :aria-label="t('nuxtUiMongocamp.common.refresh')"
283
273
  @click="fetchCollections"
@@ -305,7 +295,7 @@ defineExpose({ refresh: fetchCollections });
305
295
  <USelect
306
296
  v-model="chartMetric"
307
297
  :items="chartMetrics"
308
- size="sm"
298
+ :size="ui.controlSize"
309
299
  class="w-44"
310
300
  :aria-label="t('nuxtUiMongocamp.collections.chartMetric')"
311
301
  />
@@ -323,6 +313,7 @@ defineExpose({ refresh: fetchCollections });
323
313
  <UTable
324
314
  v-model:global-filter="globalFilter"
325
315
  v-model:sorting="sorting"
316
+ data-mongocamp-part="table"
326
317
  :data="collections"
327
318
  :columns="columns"
328
319
  :loading="loading"
@@ -6,6 +6,7 @@ import { useMongocampJobs } from "../composables/useMongocampJobs";
6
6
  import { useMongocampPermissions } from "../composables/useMongocampPermissions";
7
7
  import { useMongocampRoles } from "../composables/useMongocampRoles";
8
8
  import { buildActions, buildEntries, isFresh } from "../utils/commandPalette";
9
+ import { useMongocampUi } from "../composables/useMongocampUi";
9
10
  const props = defineProps({
10
11
  shortcut: { type: String, required: false, default: "meta_k" },
11
12
  cacheMs: { type: Number, required: false, default: 6e4 },
@@ -21,6 +22,7 @@ const props = defineProps({
21
22
  const emit = defineEmits(["select"]);
22
23
  const open = defineModel("open", { type: Boolean, ...{ default: false } });
23
24
  const { t } = useI18n();
25
+ const ui = useMongocampUi();
24
26
  const basePaths = useMongocampPaths();
25
27
  const { listUsers, listRoles, listCollections } = useMongocampAdmin();
26
28
  const { listJobs } = useMongocampJobs();
@@ -105,7 +107,7 @@ defineShortcuts(computed(() => props.shortcut ? { [props.shortcut]: { usingInput
105
107
  v-model:open="open"
106
108
  :title="t('nuxtUiMongocamp.commandPalette.title')"
107
109
  :description="t('nuxtUiMongocamp.commandPalette.description')"
108
- :ui="{ content: 'sm:max-w-xl' }"
110
+ :ui="{ content: ui.modal.md + ' mongocamp-command-palette' }"
109
111
  >
110
112
  <template #content>
111
113
  <UCommandPalette
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  import { computed, ref, watch } from "vue";
3
3
  import { useI18n, useMongocampError } from "#imports";
4
+ import { useMongocampUi } from "../composables/useMongocampUi";
4
5
  const props = defineProps({
5
6
  name: { type: String, required: true },
6
7
  title: { type: String, required: true },
@@ -12,6 +13,7 @@ const props = defineProps({
12
13
  });
13
14
  const open = defineModel("open", { type: Boolean, ...{ default: false } });
14
15
  const { t } = useI18n();
16
+ const ui = useMongocampUi();
15
17
  const { describeServerError } = useMongocampError();
16
18
  const typed = ref("");
17
19
  const busy = ref(false);
@@ -45,7 +47,7 @@ async function handleConfirm() {
45
47
  v-model:open="open"
46
48
  :title="title"
47
49
  :dismissible="!busy"
48
- :ui="{ footer: 'justify-end' }"
50
+ :ui="{ content: 'mongocamp-confirm-by-name', footer: ui.modal.footer }"
49
51
  >
50
52
  <template #body>
51
53
  <p>{{ description }}</p>
@@ -66,7 +68,7 @@ async function handleConfirm() {
66
68
  v-if="error"
67
69
  class="mt-3"
68
70
  color="error"
69
- variant="subtle"
71
+ :variant="ui.alert.variant"
70
72
  icon="i-lucide-circle-alert"
71
73
  :description="error"
72
74
  />
@@ -74,8 +76,7 @@ async function handleConfirm() {
74
76
  <template #footer>
75
77
  <UButton
76
78
  :label="t('nuxtUiMongocamp.common.cancel')"
77
- color="neutral"
78
- variant="ghost"
79
+ v-bind="ui.dialogCancel"
79
80
  :disabled="busy"
80
81
  @click="close"
81
82
  />
@@ -5,6 +5,7 @@ import { useNuxtApp } from "#app";
5
5
  import useMongocampAdmin from "../composables/useMongocampAdmin";
6
6
  import { useMongocampAutoRefresh } from "../composables/useMongocampAutoRefresh";
7
7
  import { useMongocampAdminGate } from "../composables/useMongocampAdminGate";
8
+ import { useMongocampUi } from "../composables/useMongocampUi";
8
9
  const props = defineProps({
9
10
  collectionsPath: { type: String, required: false },
10
11
  usersPath: { type: String, required: false },
@@ -14,6 +15,7 @@ const props = defineProps({
14
15
  hideRefresh: { type: Boolean, required: false }
15
16
  });
16
17
  const { t } = useI18n();
18
+ const ui = useMongocampUi();
17
19
  const paths = useMongocampPaths();
18
20
  const { $mongocampVersion } = useNuxtApp();
19
21
  const { listUsers, listRoles, listCollections } = useMongocampAdmin();
@@ -62,10 +64,11 @@ if (!blocked.value) refresh();
62
64
  </script>
63
65
 
64
66
  <template>
65
- <div class="flex flex-col gap-8">
67
+ <div class="mongocamp-dashboard flex flex-col gap-8">
66
68
  <div class="flex items-start justify-between">
67
69
  <div
68
70
  v-if="!hideHeading"
71
+ data-mongocamp-part="heading"
69
72
  class="flex flex-col gap-1"
70
73
  >
71
74
  <h1 class="text-3xl font-bold">
@@ -88,8 +91,7 @@ if (!blocked.value) refresh();
88
91
  >
89
92
  <UButton
90
93
  icon="i-lucide-refresh-cw"
91
- color="neutral"
92
- variant="ghost"
94
+ v-bind="ui.toolbarButton"
93
95
  :loading="loading"
94
96
  :aria-label="t('nuxtUiMongocamp.common.refresh')"
95
97
  @click="refresh"
@@ -4,11 +4,13 @@ import { useI18n, useMongocampSystem } from "#imports";
4
4
  import { formatBytes } from "../utils/formatBytes";
5
5
  import { shortenLabel } from "../utils/chartData";
6
6
  import { useMongocampAdminGate } from "../composables/useMongocampAdminGate";
7
+ import { useMongocampUi } from "../composables/useMongocampUi";
7
8
  defineProps({
8
9
  hideHeading: { type: Boolean, required: false },
9
10
  hideRefresh: { type: Boolean, required: false }
10
11
  });
11
12
  const { t } = useI18n();
13
+ const ui = useMongocampUi();
12
14
  const { getDatabaseInfos, listCollectionsByDatabase } = useMongocampSystem();
13
15
  const databases = ref([]);
14
16
  const chartRows = computed(() => [...databases.value].sort((a, b) => b.sizeKb - a.sizeKb).map((d) => ({ name: shortenLabel(d.name), size: d.sizeKb * 1024 })));
@@ -45,8 +47,7 @@ const UButton = resolveComponent("UButton");
45
47
  function sortHeader(column, label) {
46
48
  const isSorted = column.getIsSorted();
47
49
  return h(UButton, {
48
- color: "neutral",
49
- variant: "ghost",
50
+ ...ui.value.sortHeader,
50
51
  label,
51
52
  icon: isSorted === "asc" ? "i-lucide-arrow-up-narrow-wide" : isSorted === "desc" ? "i-lucide-arrow-down-wide-narrow" : "i-lucide-arrow-up-down",
52
53
  class: "-mx-2.5",
@@ -65,12 +66,12 @@ const columns = computed(() => [
65
66
  {
66
67
  accessorKey: "collectionCount",
67
68
  header: t("nuxtUiMongocamp.databases.columnCollections"),
68
- cell: ({ row }) => h(UBadge, { label: String(row.original.collectionCount), color: "primary", variant: "subtle" })
69
+ cell: ({ row }) => h(UBadge, { label: String(row.original.collectionCount), color: "primary", variant: ui.value.badge.variant })
69
70
  },
70
71
  {
71
72
  accessorKey: "empty",
72
73
  header: t("nuxtUiMongocamp.databases.columnEmpty"),
73
- cell: ({ row }) => row.original.empty ? h(UBadge, { label: t("nuxtUiMongocamp.databases.emptyBadge"), color: "neutral", variant: "subtle" }) : h("span", { class: "text-dimmed" }, "\u2014")
74
+ cell: ({ row }) => row.original.empty ? h(UBadge, { label: t("nuxtUiMongocamp.databases.emptyBadge"), color: "neutral", variant: ui.value.badge.variant }) : h("span", { class: "text-dimmed" }, "\u2014")
74
75
  }
75
76
  ]);
76
77
  if (!blocked.value) fetchDatabases();
@@ -80,17 +81,22 @@ defineExpose({ refresh: fetchDatabases });
80
81
  <template>
81
82
  <MongocampEmptyState
82
83
  v-if="blocked"
84
+ class="mongocamp-databases"
83
85
  icon="i-lucide-shield-alert"
84
86
  :title="message"
85
87
  data-test="admin-only"
86
88
  />
87
89
  <div
88
90
  v-else
89
- class="flex flex-col gap-4"
91
+ class="mongocamp-databases flex flex-col gap-4"
90
92
  >
91
- <div class="flex items-center justify-between gap-4">
93
+ <div
94
+ data-mongocamp-part="toolbar"
95
+ class="flex items-center justify-between gap-4"
96
+ >
92
97
  <h2
93
98
  v-if="!hideHeading"
99
+ data-mongocamp-part="heading"
94
100
  class="text-xl font-semibold"
95
101
  >
96
102
  {{ t("nuxtUiMongocamp.databases.heading") }}
@@ -102,8 +108,7 @@ defineExpose({ refresh: fetchDatabases });
102
108
  >
103
109
  <UButton
104
110
  icon="i-lucide-refresh-cw"
105
- color="neutral"
106
- variant="ghost"
111
+ v-bind="ui.toolbarButton"
107
112
  :loading="loading"
108
113
  :aria-label="t('nuxtUiMongocamp.common.refresh')"
109
114
  @click="fetchDatabases"
@@ -139,6 +144,7 @@ defineExpose({ refresh: fetchDatabases });
139
144
 
140
145
  <UTable
141
146
  v-model:sorting="sorting"
147
+ data-mongocamp-part="table"
142
148
  :data="databases"
143
149
  :columns="columns"
144
150
  :loading="loading"
@@ -2,6 +2,7 @@
2
2
  import { computed } from "vue";
3
3
  import { useI18n } from "#imports";
4
4
  import { compareDocuments, compareText } from "../utils/documentCompare";
5
+ import { useMongocampUi } from "../composables/useMongocampUi";
5
6
  const props = defineProps({
6
7
  left: { type: null, required: true },
7
8
  right: { type: null, required: true },
@@ -10,6 +11,7 @@ const props = defineProps({
10
11
  });
11
12
  const onlyDifferences = defineModel("onlyDifferences", { type: Boolean, ...{ default: false } });
12
13
  const { t } = useI18n();
14
+ const ui = useMongocampUi();
13
15
  const result = computed(() => compareDocuments(props.left, props.right));
14
16
  const visibleRows = computed(() => onlyDifferences.value ? result.value.rows.filter((r) => r.status !== "same") : result.value.rows);
15
17
  const identical = computed(() => result.value.rows.every((r) => r.status === "same"));
@@ -24,7 +26,7 @@ const statusLabel = (status) => t(`nuxtUiMongocamp.documentCompare.status.${stat
24
26
 
25
27
  <template>
26
28
  <div
27
- class="flex flex-col gap-3"
29
+ class="mongocamp-document-compare flex flex-col gap-3"
28
30
  data-testid="document-compare"
29
31
  >
30
32
  <div class="flex flex-wrap items-center justify-between gap-3">
@@ -36,7 +38,7 @@ const statusLabel = (status) => t(`nuxtUiMongocamp.documentCompare.status.${stat
36
38
  v-for="status in ['changed', 'added', 'removed', 'same']"
37
39
  :key="status"
38
40
  :color="STATUS[status].color"
39
- variant="subtle"
41
+ :variant="ui.badge.variant"
40
42
  :icon="STATUS[status].icon"
41
43
  :label="`${result.counts[status]} ${statusLabel(status)}`"
42
44
  />
@@ -51,7 +53,7 @@ const statusLabel = (status) => t(`nuxtUiMongocamp.documentCompare.status.${stat
51
53
  <UAlert
52
54
  v-if="result.truncated"
53
55
  color="warning"
54
- variant="subtle"
56
+ :variant="ui.alert.variant"
55
57
  icon="i-lucide-triangle-alert"
56
58
  :title="t('nuxtUiMongocamp.documentCompare.truncated')"
57
59
  />
@@ -126,7 +128,7 @@ const statusLabel = (status) => t(`nuxtUiMongocamp.documentCompare.status.${stat
126
128
  <td class="p-2 align-top">
127
129
  <UBadge
128
130
  :color="STATUS[row.status].color"
129
- variant="subtle"
131
+ :variant="ui.badge.variant"
130
132
  :label="statusLabel(row.status)"
131
133
  />
132
134
  </td>