@sfxcode/nuxt-ui-mongocamp 1.5.7 → 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.
Files changed (52) hide show
  1. package/dist/module.d.mts +17 -0
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +4 -0
  4. package/dist/runtime/components/MongocampAccount.vue +12 -14
  5. package/dist/runtime/components/MongocampAggregationBuilder.vue +27 -43
  6. package/dist/runtime/components/MongocampAggregationChart.vue +7 -5
  7. package/dist/runtime/components/MongocampAggregationStagePreview.vue +1 -1
  8. package/dist/runtime/components/MongocampBucketFiles.vue +25 -34
  9. package/dist/runtime/components/MongocampBulkDelete.vue +8 -9
  10. package/dist/runtime/components/MongocampBulkEdit.vue +5 -4
  11. package/dist/runtime/components/MongocampChart.vue +1 -1
  12. package/dist/runtime/components/MongocampCollectionCharts.vue +6 -5
  13. package/dist/runtime/components/MongocampCollectionCopy.vue +6 -6
  14. package/dist/runtime/components/MongocampCollectionData.vue +37 -62
  15. package/dist/runtime/components/MongocampCollectionInfos.vue +18 -23
  16. package/dist/runtime/components/MongocampCollectionRename.vue +5 -4
  17. package/dist/runtime/components/MongocampCollections.vue +24 -33
  18. package/dist/runtime/components/MongocampCommandPalette.vue +3 -1
  19. package/dist/runtime/components/MongocampConfirmByName.vue +5 -4
  20. package/dist/runtime/components/MongocampDashboard.vue +5 -3
  21. package/dist/runtime/components/MongocampDatabases.vue +14 -8
  22. package/dist/runtime/components/MongocampDocumentCompare.vue +6 -4
  23. package/dist/runtime/components/MongocampDocumentView.vue +6 -8
  24. package/dist/runtime/components/MongocampEmptyState.vue +4 -1
  25. package/dist/runtime/components/MongocampErrorAlert.vue +8 -7
  26. package/dist/runtime/components/MongocampExportAll.vue +7 -7
  27. package/dist/runtime/components/MongocampFilePreview.vue +7 -6
  28. package/dist/runtime/components/MongocampFilterBuilder.vue +12 -16
  29. package/dist/runtime/components/MongocampGrantList.vue +6 -2
  30. package/dist/runtime/components/MongocampImport.vue +29 -28
  31. package/dist/runtime/components/MongocampIndexes.vue +15 -17
  32. package/dist/runtime/components/MongocampJobs.vue +20 -20
  33. package/dist/runtime/components/MongocampLogin.vue +2 -1
  34. package/dist/runtime/components/MongocampPermissionMatrix.vue +14 -11
  35. package/dist/runtime/components/MongocampQueryBar.vue +18 -32
  36. package/dist/runtime/components/MongocampRoleGrants.vue +21 -17
  37. package/dist/runtime/components/MongocampRoles.vue +28 -32
  38. package/dist/runtime/components/MongocampServerInfo.vue +17 -12
  39. package/dist/runtime/components/MongocampServerOverview.vue +16 -12
  40. package/dist/runtime/components/MongocampServerStatus.vue +2 -1
  41. package/dist/runtime/components/MongocampSettings.vue +15 -11
  42. package/dist/runtime/components/MongocampUserAccess.vue +11 -6
  43. package/dist/runtime/components/MongocampUsers.vue +32 -35
  44. package/dist/runtime/components/MongocampVersion.vue +6 -4
  45. package/dist/runtime/composables/useMongocampUi.d.ts +8 -0
  46. package/dist/runtime/composables/useMongocampUi.js +7 -0
  47. package/dist/runtime/plugin.js +8 -0
  48. package/dist/runtime/utils/compactSession.d.ts +13 -0
  49. package/dist/runtime/utils/compactSession.js +12 -0
  50. package/dist/runtime/utils/uiTheme.d.ts +65 -0
  51. package/dist/runtime/utils/uiTheme.js +47 -0
  52. package/package.json +13 -13
@@ -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();
@@ -112,7 +114,7 @@ const schemaTableColumns = computed(() => [
112
114
  cell: ({ row }) => h(UBadge, {
113
115
  label: row.original.type,
114
116
  color: TYPE_COLORS[row.original.type] ?? "neutral",
115
- variant: "subtle"
117
+ variant: ui.value.badge.variant
116
118
  })
117
119
  },
118
120
  {
@@ -203,7 +205,7 @@ const statsColumns = computed(() => [
203
205
  ({ type, count }) => h(UBadge, {
204
206
  label: row.original.types.length > 1 ? `${type} ${percent(count / row.original.present)}` : type,
205
207
  color: KIND_COLORS[type] ?? "neutral",
206
- variant: "subtle",
208
+ variant: ui.value.badge.variant,
207
209
  size: "sm"
208
210
  })
209
211
  ))
@@ -227,7 +229,7 @@ defineExpose({ refresh: fetchInfo });
227
229
  </script>
228
230
 
229
231
  <template>
230
- <div class="flex flex-col gap-4">
232
+ <div class="mongocamp-collection-infos flex flex-col gap-4">
231
233
  <USkeleton
232
234
  v-if="loading"
233
235
  class="h-32 w-full"
@@ -303,7 +305,7 @@ defineExpose({ refresh: fetchInfo });
303
305
  <span class="font-semibold">{{ schemaTitle }}</span>
304
306
  <UBadge
305
307
  :label="t('nuxtUiMongocamp.collectionInfos.fieldsCount', { count: schemaRows.length })"
306
- variant="subtle"
308
+ :variant="ui.badge.variant"
307
309
  color="neutral"
308
310
  size="sm"
309
311
  />
@@ -312,23 +314,20 @@ defineExpose({ refresh: fetchInfo });
312
314
  <UButton
313
315
  icon="i-lucide-file-json"
314
316
  :label="t('nuxtUiMongocamp.collectionInfos.jsonSchema')"
315
- color="neutral"
316
- variant="ghost"
317
- size="sm"
317
+ v-bind="ui.iconButton"
318
318
  @click="openJsonSchema"
319
319
  />
320
320
  <UButton
321
321
  icon="i-lucide-copy"
322
322
  :label="t('nuxtUiMongocamp.collectionInfos.copyAsTs')"
323
- color="neutral"
324
- variant="ghost"
325
- size="sm"
323
+ v-bind="ui.iconButton"
326
324
  @click="copySchemaAsTs"
327
325
  />
328
326
  </div>
329
327
  </div>
330
328
  </template>
331
329
  <UTable
330
+ data-mongocamp-part="table"
332
331
  :data="schemaRows"
333
332
  :columns="schemaTableColumns"
334
333
  />
@@ -372,7 +371,7 @@ defineExpose({ refresh: fetchInfo });
372
371
  <UBadge
373
372
  v-if="statsAnalysis"
374
373
  :label="statsMode === 'server' ? t('nuxtUiMongocamp.collectionInfos.statsAnalysed', { count: statsAnalysis.sampled }) : t('nuxtUiMongocamp.collectionInfos.statsSampled', { sampled: statsAnalysis.sampled, total: info.count })"
375
- variant="subtle"
374
+ :variant="ui.badge.variant"
376
375
  color="neutral"
377
376
  size="sm"
378
377
  />
@@ -381,16 +380,14 @@ defineExpose({ refresh: fetchInfo });
381
380
  <USelect
382
381
  v-model="statsSampleSize"
383
382
  :items="STATS_SAMPLE_SIZES"
384
- size="sm"
383
+ :size="ui.controlSize"
385
384
  class="w-24"
386
385
  :aria-label="t('nuxtUiMongocamp.collectionInfos.statsSampleSize')"
387
386
  />
388
387
  <UButton
389
388
  icon="i-lucide-activity"
390
389
  :label="t('nuxtUiMongocamp.collectionInfos.statsAnalyze')"
391
- color="neutral"
392
- variant="subtle"
393
- size="sm"
390
+ v-bind="{ ...ui.secondaryAction, size: ui.controlSize }"
394
391
  :loading="statsLoading && statsMode === 'sample'"
395
392
  :disabled="statsLoading"
396
393
  @click="analyzeFields"
@@ -419,7 +416,7 @@ defineExpose({ refresh: fetchInfo });
419
416
  <UAlert
420
417
  v-if="statsError"
421
418
  color="error"
422
- variant="subtle"
419
+ :variant="ui.alert.variant"
423
420
  icon="i-lucide-circle-alert"
424
421
  :title="t('nuxtUiMongocamp.collectionInfos.statsFailed')"
425
422
  :description="statsError.message"
@@ -429,15 +426,13 @@ defineExpose({ refresh: fetchInfo });
429
426
  v-if="statsError.kind === 'unauthorized'"
430
427
  :label="t('nuxtUiMongocamp.errors.loginAgain')"
431
428
  to="/"
432
- color="error"
433
- variant="subtle"
429
+ v-bind="{ ...ui.alertAction, color: 'error' }"
434
430
  icon="i-lucide-log-in"
435
431
  />
436
432
  <UButton
437
433
  v-else
438
434
  :label="t('nuxtUiMongocamp.common.retry')"
439
- color="error"
440
- variant="subtle"
435
+ v-bind="{ ...ui.alertAction, color: 'error' }"
441
436
  icon="i-lucide-refresh-cw"
442
437
  @click="retryStats"
443
438
  />
@@ -451,6 +446,7 @@ defineExpose({ refresh: fetchInfo });
451
446
  </template>
452
447
  </p>
453
448
  <UTable
449
+ data-mongocamp-part="table"
454
450
  :data="statsAnalysis.fields"
455
451
  :columns="statsColumns"
456
452
  >
@@ -482,7 +478,7 @@ defineExpose({ refresh: fetchInfo });
482
478
  <UModal
483
479
  v-model:open="isSchemaOpen"
484
480
  :title="t('nuxtUiMongocamp.collectionInfos.jsonSchemaTitle', { name: collectionName })"
485
- :ui="{ content: 'sm:max-w-3xl', footer: 'justify-end' }"
481
+ :ui="{ content: ui.modal.lg, footer: ui.modal.footer }"
486
482
  >
487
483
  <template #body>
488
484
  <MongocampErrorAlert
@@ -510,8 +506,7 @@ defineExpose({ refresh: fetchInfo });
510
506
  <UButton
511
507
  icon="i-lucide-copy"
512
508
  :label="t('nuxtUiMongocamp.common.copy')"
513
- color="neutral"
514
- variant="ghost"
509
+ v-bind="ui.toolbarButton"
515
510
  :disabled="!schemaJson"
516
511
  @click="copyJsonSchema"
517
512
  />
@@ -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>