@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
@@ -5,6 +5,7 @@ import { useNuxtApp } from "#app";
5
5
  import { useMongocampAutoRefresh } from "../composables/useMongocampAutoRefresh";
6
6
  import { formatBytes } from "../utils/formatBytes";
7
7
  import { connectionUsage, formatCount, formatUptime, OP_COUNTER_KEYS } from "../utils/serverInfo";
8
+ import { useMongocampUi } from "../composables/useMongocampUi";
8
9
  const props = defineProps({
9
10
  hideHeading: { type: Boolean, required: false, default: false },
10
11
  hideRefresh: { type: Boolean, required: false, default: false },
@@ -13,6 +14,7 @@ const props = defineProps({
13
14
  autoRefresh: { type: Number, required: false, default: 0 }
14
15
  });
15
16
  const { t } = useI18n();
17
+ const ui = useMongocampUi();
16
18
  const { $mongocampVersion } = useNuxtApp();
17
19
  const { getServerInfo, getStats, getCapabilities } = useMongocampSystem();
18
20
  const version = computed(() => $mongocampVersion.value);
@@ -21,10 +23,6 @@ const stats = ref(null);
21
23
  const capabilities = ref(null);
22
24
  const loading = ref(false);
23
25
  const failed = ref({ info: false, stats: false, capabilities: false });
24
- const olderServer = ref(false);
25
- function statusOf(error) {
26
- return error?.response?.status;
27
- }
28
26
  async function load() {
29
27
  const [info, loadedStats, loadedCapabilities] = await Promise.allSettled([
30
28
  getServerInfo(),
@@ -34,12 +32,10 @@ async function load() {
34
32
  mongoDbVersion.value = info.status === "fulfilled" ? info.value.mongoDbVersion || null : mongoDbVersion.value;
35
33
  stats.value = loadedStats.status === "fulfilled" ? loadedStats.value : stats.value;
36
34
  capabilities.value = loadedCapabilities.status === "fulfilled" ? loadedCapabilities.value : capabilities.value;
37
- const missing = loadedCapabilities.status === "rejected" && [404, 405].includes(statusOf(loadedCapabilities.reason) ?? 0);
38
- olderServer.value = missing;
39
35
  failed.value = {
40
36
  info: info.status === "rejected",
41
37
  stats: loadedStats.status === "rejected",
42
- capabilities: loadedCapabilities.status === "rejected" && !missing
38
+ capabilities: loadedCapabilities.status === "rejected"
43
39
  };
44
40
  if ([info, loadedStats, loadedCapabilities].every((r) => r.status === "rejected")) throw info.reason;
45
41
  }
@@ -75,12 +71,16 @@ defineExpose({ refresh });
75
71
  </script>
76
72
 
77
73
  <template>
78
- <div class="flex flex-col gap-4">
74
+ <div class="mongocamp-server-info flex flex-col gap-4">
79
75
  <div
80
76
  v-if="!hideHeading || !hideRefresh"
77
+ data-mongocamp-part="toolbar"
81
78
  class="flex items-center justify-between gap-4"
82
79
  >
83
- <h2 class="text-xl font-semibold">
80
+ <h2
81
+ data-mongocamp-part="heading"
82
+ class="text-xl font-semibold"
83
+ >
84
84
  <template v-if="!hideHeading">
85
85
  {{ t("nuxtUiMongocamp.serverInfo.heading") }}
86
86
  </template>
@@ -91,8 +91,7 @@ defineExpose({ refresh });
91
91
  >
92
92
  <UButton
93
93
  icon="i-lucide-refresh-cw"
94
- color="neutral"
95
- variant="ghost"
94
+ v-bind="ui.toolbarButton"
96
95
  :loading="loading"
97
96
  :aria-label="t('nuxtUiMongocamp.common.refresh')"
98
97
  @click="refresh"
@@ -103,21 +102,21 @@ defineExpose({ refresh });
103
102
  <UAlert
104
103
  v-if="failed.info"
105
104
  color="warning"
106
- variant="subtle"
105
+ :variant="ui.alert.variant"
107
106
  data-testid="info-failed"
108
107
  :description="t('nuxtUiMongocamp.serverInfo.partFailed', { part: t('nuxtUiMongocamp.serverInfo.partInfo') })"
109
108
  />
110
109
  <UAlert
111
110
  v-if="failed.stats && !hideStats"
112
111
  color="warning"
113
- variant="subtle"
112
+ :variant="ui.alert.variant"
114
113
  data-testid="stats-failed"
115
114
  :description="t('nuxtUiMongocamp.serverInfo.partFailed', { part: t('nuxtUiMongocamp.serverInfo.partStats') })"
116
115
  />
117
116
  <UAlert
118
117
  v-if="failed.capabilities && !hideCapabilities"
119
118
  color="warning"
120
- variant="subtle"
119
+ :variant="ui.alert.variant"
121
120
  data-testid="capabilities-failed"
122
121
  :description="t('nuxtUiMongocamp.serverInfo.partFailed', { part: t('nuxtUiMongocamp.serverInfo.partCapabilities') })"
123
122
  />
@@ -175,7 +174,7 @@ defineExpose({ refresh });
175
174
  <UBadge
176
175
  :label="stats.replicaSet.state"
177
176
  color="neutral"
178
- variant="subtle"
177
+ :variant="ui.badge.variant"
179
178
  />
180
179
  <span class="text-dimmed">{{ t("nuxtUiMongocamp.serverInfo.replicaMembers", { healthy: stats.replicaSet.healthyMembers, count: stats.replicaSet.memberCount }) }}</span>
181
180
  </dd>
@@ -190,7 +189,7 @@ defineExpose({ refresh });
190
189
  <UAlert
191
190
  v-if="stats.partial"
192
191
  color="info"
193
- variant="subtle"
192
+ :variant="ui.alert.variant"
194
193
  data-testid="stats-partial"
195
194
  :description="t('nuxtUiMongocamp.serverInfo.partialNote')"
196
195
  />
@@ -265,13 +264,6 @@ defineExpose({ refresh });
265
264
  </div>
266
265
  </UCard>
267
266
 
268
- <UAlert
269
- v-if="olderServer && !hideCapabilities"
270
- color="neutral"
271
- variant="subtle"
272
- data-testid="older-server"
273
- :description="t('nuxtUiMongocamp.serverInfo.olderServer')"
274
- />
275
267
  <UCard v-if="!hideCapabilities && capabilities">
276
268
  <template #header>
277
269
  <span class="font-semibold">{{ t("nuxtUiMongocamp.serverInfo.capabilitiesHeading") }}</span>
@@ -290,7 +282,7 @@ defineExpose({ refresh });
290
282
  :key="feature"
291
283
  :label="feature"
292
284
  color="primary"
293
- variant="subtle"
285
+ :variant="ui.badge.variant"
294
286
  />
295
287
  </div>
296
288
  </div>
@@ -330,7 +322,7 @@ defineExpose({ refresh });
330
322
  :key="stage"
331
323
  :label="stage"
332
324
  color="error"
333
- variant="subtle"
325
+ :variant="ui.badge.variant"
334
326
  class="font-mono"
335
327
  />
336
328
  </div>
@@ -6,6 +6,7 @@ import { useMongocampAdminGate } from "../composables/useMongocampAdminGate";
6
6
  import { useMongocampServerOverview } from "../composables/useMongocampServerOverview";
7
7
  import { formatBytes } from "../utils/formatBytes";
8
8
  import { BYTE_METRICS, nextJobs, overviewTotals, rankCollections, RANK_METRICS, shareSlices } from "../utils/serverOverview";
9
+ import { useMongocampUi } from "../composables/useMongocampUi";
9
10
  const props = defineProps({
10
11
  infoPath: { type: String, required: false },
11
12
  dataPath: { type: String, required: false },
@@ -18,6 +19,7 @@ const props = defineProps({
18
19
  hideRefresh: { type: Boolean, required: false }
19
20
  });
20
21
  const { t, locale } = useI18n();
22
+ const ui = useMongocampUi();
21
23
  const paths = useMongocampPaths();
22
24
  const { loadOverview } = useMongocampServerOverview();
23
25
  const overview = ref(null);
@@ -86,18 +88,20 @@ defineExpose({ refresh: () => load() });
86
88
  <template>
87
89
  <MongocampEmptyState
88
90
  v-if="blocked"
91
+ class="mongocamp-server-overview"
89
92
  icon="i-lucide-shield-alert"
90
93
  :title="message"
91
94
  data-test="admin-only"
92
95
  />
93
96
  <div
94
97
  v-else
95
- class="flex flex-col gap-6"
98
+ class="mongocamp-server-overview flex flex-col gap-6"
96
99
  data-test="server-overview"
97
100
  >
98
101
  <div class="flex flex-wrap items-start justify-between gap-2">
99
102
  <div
100
103
  v-if="!hideHeading"
104
+ data-mongocamp-part="heading"
101
105
  class="flex flex-col gap-1"
102
106
  >
103
107
  <h2 class="text-xl font-semibold">
@@ -107,12 +111,14 @@ defineExpose({ refresh: () => load() });
107
111
  {{ t("nuxtUiMongocamp.serverOverview.subtitle") }}
108
112
  </p>
109
113
  </div>
110
- <div class="ml-auto flex items-center gap-1">
114
+ <div
115
+ data-mongocamp-part="toolbar"
116
+ class="ml-auto flex items-center gap-1"
117
+ >
111
118
  <UButton
112
119
  v-if="!hideRefresh"
113
120
  icon="i-lucide-refresh-cw"
114
- color="neutral"
115
- variant="ghost"
121
+ v-bind="ui.toolbarButton"
116
122
  :loading="loading"
117
123
  :aria-label="t('nuxtUiMongocamp.common.refresh')"
118
124
  @click="load()"
@@ -125,7 +131,7 @@ defineExpose({ refresh: () => load() });
125
131
  v-for="part in failedParts"
126
132
  :key="part"
127
133
  color="warning"
128
- variant="subtle"
134
+ :variant="ui.alert.variant"
129
135
  icon="i-lucide-triangle-alert"
130
136
  :description="t(`nuxtUiMongocamp.serverOverview.error${part.charAt(0).toUpperCase()}${part.slice(1)}`)"
131
137
  data-test="overview-error"
@@ -233,7 +239,7 @@ defineExpose({ refresh: () => load() });
233
239
  <USelect
234
240
  v-model="rankBy"
235
241
  :items="metricItems"
236
- size="sm"
242
+ :size="ui.controlSize"
237
243
  class="w-60"
238
244
  :aria-label="t('nuxtUiMongocamp.serverOverview.rankBy')"
239
245
  />
@@ -284,9 +290,7 @@ defineExpose({ refresh: () => load() });
284
290
  <span class="tabular-nums text-dimmed">{{ formatMetric(collection[rankBy]) }}</span>
285
291
  <UButton
286
292
  icon="i-lucide-table"
287
- color="neutral"
288
- variant="ghost"
289
- size="xs"
293
+ v-bind="ui.compactButton"
290
294
  :to="`${dataPath ?? paths.collections}/${collection.name}/data`"
291
295
  :aria-label="t('nuxtUiMongocamp.serverOverview.openData', { name: collection.name })"
292
296
  />
@@ -346,7 +350,7 @@ defineExpose({ refresh: () => load() });
346
350
  v-if="database.empty"
347
351
  :label="t('nuxtUiMongocamp.serverOverview.databaseEmpty')"
348
352
  color="neutral"
349
- variant="subtle"
353
+ :variant="ui.badge.variant"
350
354
  size="sm"
351
355
  />
352
356
  <span class="tabular-nums text-dimmed">{{ formatBytes(database.sizeOnDisk) }}</span>
@@ -373,14 +377,14 @@ defineExpose({ refresh: () => load() });
373
377
  v-if="member.coordinator"
374
378
  :label="t('nuxtUiMongocamp.serverOverview.coordinator')"
375
379
  color="primary"
376
- variant="subtle"
380
+ :variant="ui.badge.variant"
377
381
  size="sm"
378
382
  />
379
383
  <UBadge
380
384
  v-if="member.siteMaster"
381
385
  :label="t('nuxtUiMongocamp.serverOverview.siteMaster')"
382
386
  color="info"
383
- variant="subtle"
387
+ :variant="ui.badge.variant"
384
388
  size="sm"
385
389
  />
386
390
  </li>
@@ -12,7 +12,7 @@ const props = defineProps({
12
12
  const { t } = useI18n();
13
13
  const paths = useMongocampPaths();
14
14
  const { $mongocampVersion } = useNuxtApp();
15
- const { getStats, getServerInfo } = useMongocampSystem();
15
+ const { getStats, getServerInfo, getCapabilities } = useMongocampSystem();
16
16
  const { canSeeAdmin } = useMongocampRoles();
17
17
  const { blocked } = useMongocampAdminGate();
18
18
  const state = useMongocampStorage();
@@ -24,9 +24,14 @@ const uptimeSeconds = ref();
24
24
  const outcome = ref({ info: "skipped", stats: "skipped" });
25
25
  const canAskInfo = computed(() => isProxyMode || !!state.value?.profile);
26
26
  const canAskStats = computed(() => canAskInfo.value && !blocked.value);
27
+ async function databaseInfo() {
28
+ if (!blocked.value) return getServerInfo();
29
+ const major = (await getCapabilities()).mongoDbMajor;
30
+ return { mongoDbVersion: major ? String(major) : void 0 };
31
+ }
27
32
  async function refresh() {
28
33
  const [info, stats] = await Promise.allSettled([
29
- canAskInfo.value ? getServerInfo() : Promise.reject(new Error("skipped")),
34
+ canAskInfo.value ? databaseInfo() : Promise.reject(new Error("skipped")),
30
35
  canAskStats.value ? getStats() : Promise.reject(new Error("skipped"))
31
36
  ]);
32
37
  mongoDbVersion.value = info.status === "fulfilled" ? info.value.mongoDbVersion || void 0 : void 0;
@@ -70,6 +75,7 @@ defineExpose({ refresh: quietRefresh });
70
75
  <template>
71
76
  <UTooltip
72
77
  v-if="collapsed"
78
+ class="mongocamp-server-status"
73
79
  :text="healthLabel"
74
80
  >
75
81
  <div
@@ -90,7 +96,7 @@ defineExpose({ refresh: quietRefresh });
90
96
  :is="linkTarget ? NuxtLink : 'div'"
91
97
  v-else
92
98
  :to="linkTarget || void 0"
93
- class="flex flex-col gap-1.5 rounded-md text-xs"
99
+ class="mongocamp-server-status flex flex-col gap-1.5 rounded-md text-xs"
94
100
  :class="linkTarget ? 'hover:bg-elevated' : ''"
95
101
  data-test="server-status"
96
102
  :data-health="health"
@@ -2,6 +2,7 @@
2
2
  import { computed, h, ref, resolveComponent, watch } from "vue";
3
3
  import { useI18n, useMongocampRoles, useMongocampSystem } from "#imports";
4
4
  import { grantStatusHint, MASKED_VALUE } from "../utils/configRows";
5
+ import { useMongocampUi } from "../composables/useMongocampUi";
5
6
  const PAGE_SIZE = 10;
6
7
  const props = defineProps({
7
8
  hideHeading: { type: Boolean, required: false, default: false },
@@ -14,6 +15,7 @@ const props = defineProps({
14
15
  hideGrantHint: { type: Boolean, required: false, default: false }
15
16
  });
16
17
  const { t } = useI18n();
18
+ const ui = useMongocampUi();
17
19
  const { getSettings, listConfigurations, getCluster } = useMongocampSystem();
18
20
  const { isAdmin } = useMongocampRoles();
19
21
  const configurations = ref([]);
@@ -71,13 +73,13 @@ const columns = computed(() => [
71
73
  {
72
74
  accessorKey: "value",
73
75
  header: t("nuxtUiMongocamp.settings.columnValue"),
74
- cell: ({ row }) => row.original.masked ? h(UBadge, { label: MASKED_VALUE, color: "neutral", variant: "subtle", title: t("nuxtUiMongocamp.settings.maskedHint") }) : h("span", { class: "font-mono text-xs break-all" }, row.original.value)
76
+ cell: ({ row }) => row.original.masked ? h(UBadge, { label: MASKED_VALUE, color: "neutral", variant: ui.value.badge.variant, title: t("nuxtUiMongocamp.settings.maskedHint") }) : h("span", { class: "font-mono text-xs break-all" }, row.original.value)
75
77
  },
76
78
  { accessorKey: "configType", header: t("nuxtUiMongocamp.settings.columnType") },
77
79
  {
78
80
  accessorKey: "needsRestart",
79
81
  header: t("nuxtUiMongocamp.settings.columnRestart"),
80
- cell: ({ row }) => row.original.needsRestart ? h(UBadge, { label: t("nuxtUiMongocamp.settings.restartNeeded"), color: "warning", variant: "subtle" }) : h("span", { class: "text-dimmed" }, "\u2014")
82
+ cell: ({ row }) => row.original.needsRestart ? h(UBadge, { label: t("nuxtUiMongocamp.settings.restartNeeded"), color: "warning", variant: ui.value.badge.variant }) : h("span", { class: "text-dimmed" }, "\u2014")
81
83
  }
82
84
  ]);
83
85
  const pluginGroups = computed(() => [
@@ -90,13 +92,15 @@ defineExpose({ refresh: fetchSettings });
90
92
  </script>
91
93
 
92
94
  <template>
93
- <div class="flex flex-col gap-4">
95
+ <div class="mongocamp-settings flex flex-col gap-4">
94
96
  <div
95
97
  v-if="!hideHeading || isAdmin && !hideRefresh || $slots.toolbar"
98
+ data-mongocamp-part="toolbar"
96
99
  class="flex items-center justify-between gap-4"
97
100
  >
98
101
  <h2
99
102
  v-if="!hideHeading"
103
+ data-mongocamp-part="heading"
100
104
  class="text-xl font-semibold"
101
105
  >
102
106
  {{ t("nuxtUiMongocamp.settings.heading") }}
@@ -108,8 +112,7 @@ defineExpose({ refresh: fetchSettings });
108
112
  >
109
113
  <UButton
110
114
  icon="i-lucide-refresh-cw"
111
- color="neutral"
112
- variant="ghost"
115
+ v-bind="ui.toolbarButton"
113
116
  :loading="loading"
114
117
  :aria-label="t('nuxtUiMongocamp.common.refresh')"
115
118
  @click="fetchSettings"
@@ -121,7 +124,7 @@ defineExpose({ refresh: fetchSettings });
121
124
  <UAlert
122
125
  v-if="!isAdmin"
123
126
  color="neutral"
124
- variant="subtle"
127
+ :variant="ui.alert.variant"
125
128
  icon="i-lucide-lock"
126
129
  :description="t('nuxtUiMongocamp.settings.adminOnly')"
127
130
  />
@@ -155,7 +158,7 @@ defineExpose({ refresh: fetchSettings });
155
158
  :key="item"
156
159
  :label="item"
157
160
  color="neutral"
158
- variant="subtle"
161
+ :variant="ui.badge.variant"
159
162
  size="sm"
160
163
  />
161
164
  </div>
@@ -184,14 +187,14 @@ defineExpose({ refresh: fetchSettings });
184
187
  v-if="member.coordinator"
185
188
  :label="t('nuxtUiMongocamp.settings.clusterCoordinator')"
186
189
  color="primary"
187
- variant="subtle"
190
+ :variant="ui.badge.variant"
188
191
  size="sm"
189
192
  />
190
193
  <UBadge
191
194
  v-if="member.siteMaster"
192
195
  :label="t('nuxtUiMongocamp.settings.clusterSiteMaster')"
193
196
  color="neutral"
194
- variant="subtle"
197
+ :variant="ui.badge.variant"
195
198
  size="sm"
196
199
  />
197
200
  </li>
@@ -207,7 +210,7 @@ defineExpose({ refresh: fetchSettings });
207
210
  v-model="search"
208
211
  icon="i-lucide-search"
209
212
  :placeholder="t('nuxtUiMongocamp.settings.searchPlaceholder')"
210
- size="sm"
213
+ :size="ui.controlSize"
211
214
  class="w-full max-w-xs"
212
215
  />
213
216
  <p
@@ -221,7 +224,7 @@ defineExpose({ refresh: fetchSettings });
221
224
  <UAlert
222
225
  v-if="!hideConfigurations && !hideGrantHint && showGrantHint"
223
226
  color="info"
224
- variant="subtle"
227
+ :variant="ui.alert.variant"
225
228
  icon="i-lucide-info"
226
229
  :title="t('nuxtUiMongocamp.settings.grantHintTitle')"
227
230
  :description="t('nuxtUiMongocamp.settings.grantHint')"
@@ -231,6 +234,7 @@ defineExpose({ refresh: fetchSettings });
231
234
  <!-- Long values make it scroll sideways: focusable and named so a keyboard can scroll it too -->
232
235
  <UTable
233
236
  v-if="!hideConfigurations"
237
+ data-mongocamp-part="table"
234
238
  :data="pageRows"
235
239
  :columns="columns"
236
240
  :loading="loading"
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  import { computed, ref } from "vue";
3
3
  import { useI18n, useMongocampClientApi, useMongocampStorage } from "#imports";
4
+ import { useMongocampUi } from "../composables/useMongocampUi";
4
5
  defineProps({
5
6
  hideHeading: { type: Boolean, required: false, default: false },
6
7
  hideRefresh: { type: Boolean, required: false, default: false },
@@ -8,6 +9,7 @@ defineProps({
8
9
  });
9
10
  const FLAGS = ["read", "write", "administrate"];
10
11
  const { t } = useI18n();
12
+ const ui = useMongocampUi();
11
13
  const { authApi } = useMongocampClientApi();
12
14
  const state = useMongocampStorage();
13
15
  const isAdmin = computed(() => state.value?.profile?.isAdmin === true);
@@ -39,26 +41,29 @@ refresh();
39
41
  </script>
40
42
 
41
43
  <template>
42
- <div class="flex flex-col gap-6">
44
+ <div class="mongocamp-user-access flex flex-col gap-6">
43
45
  <div
44
46
  v-if="!hideHeading || !hideRefresh || $slots.toolbar"
45
47
  class="flex items-center justify-between gap-2"
46
48
  >
47
49
  <h2
48
50
  v-if="!hideHeading"
51
+ data-mongocamp-part="heading"
49
52
  class="text-lg font-semibold"
50
53
  >
51
54
  {{ t("nuxtUiMongocamp.userAccess.heading") }}
52
55
  </h2>
53
- <div class="ml-auto flex items-center gap-2">
56
+ <div
57
+ data-mongocamp-part="toolbar"
58
+ class="ml-auto flex items-center gap-2"
59
+ >
54
60
  <UTooltip
55
61
  v-if="!isAdmin && !hideRefresh"
56
62
  :text="t('nuxtUiMongocamp.common.refresh')"
57
63
  >
58
64
  <UButton
59
65
  icon="i-lucide-refresh-cw"
60
- color="neutral"
61
- variant="ghost"
66
+ v-bind="ui.toolbarButton"
62
67
  :loading="loading"
63
68
  :aria-label="t('nuxtUiMongocamp.common.refresh')"
64
69
  @click="refresh"
@@ -71,7 +76,7 @@ refresh();
71
76
  <UAlert
72
77
  v-if="isAdmin"
73
78
  color="info"
74
- variant="subtle"
79
+ :variant="ui.alert.variant"
75
80
  icon="i-lucide-shield-check"
76
81
  :title="t('nuxtUiMongocamp.userAccess.adminTitle')"
77
82
  :description="t('nuxtUiMongocamp.userAccess.adminDescription')"
@@ -157,7 +162,7 @@ refresh();
157
162
  <UBadge
158
163
  :label="row[flag] ? t('nuxtUiMongocamp.common.yes') : t('nuxtUiMongocamp.common.no')"
159
164
  :color="row[flag] ? 'success' : 'neutral'"
160
- variant="subtle"
165
+ :variant="ui.badge.variant"
161
166
  />
162
167
  </td>
163
168
  </tr>