@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.
- package/dist/module.d.mts +17 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +4 -0
- package/dist/runtime/components/MongocampAccount.vue +12 -14
- package/dist/runtime/components/MongocampAggregationBuilder.vue +27 -43
- package/dist/runtime/components/MongocampAggregationChart.vue +7 -5
- package/dist/runtime/components/MongocampAggregationStagePreview.vue +1 -1
- package/dist/runtime/components/MongocampBucketFiles.vue +25 -34
- package/dist/runtime/components/MongocampBulkDelete.vue +8 -9
- package/dist/runtime/components/MongocampBulkEdit.vue +5 -4
- package/dist/runtime/components/MongocampChart.vue +1 -1
- package/dist/runtime/components/MongocampCollectionCharts.vue +6 -5
- package/dist/runtime/components/MongocampCollectionCopy.vue +6 -6
- package/dist/runtime/components/MongocampCollectionData.vue +37 -62
- package/dist/runtime/components/MongocampCollectionInfos.vue +18 -23
- package/dist/runtime/components/MongocampCollectionRename.vue +5 -4
- package/dist/runtime/components/MongocampCollections.vue +24 -33
- package/dist/runtime/components/MongocampCommandPalette.vue +3 -1
- package/dist/runtime/components/MongocampConfirmByName.vue +5 -4
- package/dist/runtime/components/MongocampDashboard.vue +5 -3
- package/dist/runtime/components/MongocampDatabases.vue +14 -8
- package/dist/runtime/components/MongocampDocumentCompare.vue +6 -4
- package/dist/runtime/components/MongocampDocumentView.vue +6 -8
- package/dist/runtime/components/MongocampEmptyState.vue +4 -1
- package/dist/runtime/components/MongocampErrorAlert.vue +8 -7
- package/dist/runtime/components/MongocampExportAll.vue +7 -7
- package/dist/runtime/components/MongocampFilePreview.vue +7 -6
- package/dist/runtime/components/MongocampFilterBuilder.vue +12 -16
- package/dist/runtime/components/MongocampGrantList.vue +6 -2
- package/dist/runtime/components/MongocampImport.vue +29 -28
- package/dist/runtime/components/MongocampIndexes.vue +15 -17
- package/dist/runtime/components/MongocampJobs.vue +20 -20
- package/dist/runtime/components/MongocampLogin.vue +2 -1
- package/dist/runtime/components/MongocampPermissionMatrix.vue +14 -11
- package/dist/runtime/components/MongocampQueryBar.vue +18 -32
- package/dist/runtime/components/MongocampRoleGrants.vue +21 -17
- package/dist/runtime/components/MongocampRoles.vue +28 -32
- package/dist/runtime/components/MongocampServerInfo.vue +17 -12
- package/dist/runtime/components/MongocampServerOverview.vue +16 -12
- package/dist/runtime/components/MongocampServerStatus.vue +2 -1
- package/dist/runtime/components/MongocampSettings.vue +15 -11
- package/dist/runtime/components/MongocampUserAccess.vue +11 -6
- package/dist/runtime/components/MongocampUsers.vue +32 -35
- package/dist/runtime/components/MongocampVersion.vue +6 -4
- package/dist/runtime/composables/useMongocampUi.d.ts +8 -0
- package/dist/runtime/composables/useMongocampUi.js +7 -0
- package/dist/runtime/plugin.js +8 -0
- package/dist/runtime/utils/compactSession.d.ts +13 -0
- package/dist/runtime/utils/compactSession.js +12 -0
- package/dist/runtime/utils/uiTheme.d.ts +65 -0
- package/dist/runtime/utils/uiTheme.js +47 -0
- package/package.json +13 -13
|
@@ -3,6 +3,7 @@ import { computed, h, reactive, ref, resolveComponent } from "vue";
|
|
|
3
3
|
import { useI18n, useMongocampError, useToast } from "#imports";
|
|
4
4
|
import useMongocampAdmin from "../composables/useMongocampAdmin";
|
|
5
5
|
import { useMongocampAdminGate } from "../composables/useMongocampAdminGate";
|
|
6
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
6
7
|
const props = defineProps({
|
|
7
8
|
roleName: { type: String, required: true },
|
|
8
9
|
hideHeading: { type: Boolean, required: false },
|
|
@@ -10,6 +11,7 @@ const props = defineProps({
|
|
|
10
11
|
});
|
|
11
12
|
const emit = defineEmits(["changed"]);
|
|
12
13
|
const { t } = useI18n();
|
|
14
|
+
const ui = useMongocampUi();
|
|
13
15
|
const { describeServerError } = useMongocampError();
|
|
14
16
|
const { listRoles, updateRole, listCollections } = useMongocampAdmin();
|
|
15
17
|
const grants = ref([]);
|
|
@@ -181,7 +183,7 @@ const columns = computed(() => [
|
|
|
181
183
|
cell: ({ row }) => h(UBadge, {
|
|
182
184
|
label: row.original.grantType,
|
|
183
185
|
color: "neutral",
|
|
184
|
-
variant:
|
|
186
|
+
variant: ui.value.badge.variant
|
|
185
187
|
})
|
|
186
188
|
},
|
|
187
189
|
{
|
|
@@ -190,7 +192,7 @@ const columns = computed(() => [
|
|
|
190
192
|
cell: ({ row }) => h(UBadge, {
|
|
191
193
|
label: row.original.read ? t("nuxtUiMongocamp.common.yes") : t("nuxtUiMongocamp.common.no"),
|
|
192
194
|
color: row.original.read ? "success" : "neutral",
|
|
193
|
-
variant:
|
|
195
|
+
variant: ui.value.badge.variant
|
|
194
196
|
})
|
|
195
197
|
},
|
|
196
198
|
{
|
|
@@ -199,7 +201,7 @@ const columns = computed(() => [
|
|
|
199
201
|
cell: ({ row }) => h(UBadge, {
|
|
200
202
|
label: row.original.write ? t("nuxtUiMongocamp.common.yes") : t("nuxtUiMongocamp.common.no"),
|
|
201
203
|
color: row.original.write ? "success" : "neutral",
|
|
202
|
-
variant:
|
|
204
|
+
variant: ui.value.badge.variant
|
|
203
205
|
})
|
|
204
206
|
},
|
|
205
207
|
{
|
|
@@ -208,27 +210,24 @@ const columns = computed(() => [
|
|
|
208
210
|
cell: ({ row }) => h(UBadge, {
|
|
209
211
|
label: row.original.administrate ? t("nuxtUiMongocamp.common.yes") : t("nuxtUiMongocamp.common.no"),
|
|
210
212
|
color: row.original.administrate ? "primary" : "neutral",
|
|
211
|
-
variant:
|
|
213
|
+
variant: ui.value.badge.variant
|
|
212
214
|
})
|
|
213
215
|
},
|
|
214
216
|
{
|
|
215
217
|
id: "actions",
|
|
216
218
|
header: "",
|
|
217
|
-
cell: ({ row }) => h("div", { class: "flex gap-1 justify-end" }, [
|
|
219
|
+
cell: ({ row }) => h("div", { "class": "flex gap-1 justify-end", "data-mongocamp-part": "row-actions" }, [
|
|
218
220
|
withTooltip(t("nuxtUiMongocamp.roleGrants.editGrantTooltip"), h(UButton, {
|
|
219
221
|
"icon": "i-lucide-pencil",
|
|
220
|
-
|
|
221
|
-
"variant": "ghost",
|
|
222
|
-
"size": "sm",
|
|
222
|
+
...ui.value.iconButton,
|
|
223
223
|
"aria-label": t("nuxtUiMongocamp.roleGrants.editGrantTooltip"),
|
|
224
224
|
"disabled": saving.value,
|
|
225
225
|
"onClick": () => openEdit(row.index)
|
|
226
226
|
})),
|
|
227
227
|
withTooltip(t("nuxtUiMongocamp.roleGrants.removeGrantTooltip"), h(UButton, {
|
|
228
228
|
"icon": "i-lucide-trash-2",
|
|
229
|
+
...ui.value.iconButton,
|
|
229
230
|
"color": "error",
|
|
230
|
-
"variant": "ghost",
|
|
231
|
-
"size": "sm",
|
|
232
231
|
"aria-label": t("nuxtUiMongocamp.roleGrants.removeGrantTooltip"),
|
|
233
232
|
"disabled": saving.value,
|
|
234
233
|
"onClick": () => removeGrant(row.index)
|
|
@@ -246,30 +245,34 @@ defineExpose({ refresh: fetchRole });
|
|
|
246
245
|
<template>
|
|
247
246
|
<MongocampEmptyState
|
|
248
247
|
v-if="blocked"
|
|
248
|
+
class="mongocamp-role-grants"
|
|
249
249
|
icon="i-lucide-shield-alert"
|
|
250
250
|
:title="message"
|
|
251
251
|
data-test="admin-only"
|
|
252
252
|
/>
|
|
253
253
|
<div
|
|
254
254
|
v-else
|
|
255
|
-
class="flex flex-col gap-4"
|
|
255
|
+
class="mongocamp-role-grants flex flex-col gap-4"
|
|
256
256
|
>
|
|
257
257
|
<div class="flex items-center justify-between">
|
|
258
258
|
<h2
|
|
259
259
|
v-if="!hideHeading"
|
|
260
|
+
data-mongocamp-part="heading"
|
|
260
261
|
class="text-xl font-semibold"
|
|
261
262
|
>
|
|
262
263
|
{{ t("nuxtUiMongocamp.roleGrants.heading", { roleName }) }}
|
|
263
264
|
</h2>
|
|
264
|
-
<div
|
|
265
|
+
<div
|
|
266
|
+
data-mongocamp-part="toolbar"
|
|
267
|
+
class="ml-auto flex gap-2"
|
|
268
|
+
>
|
|
265
269
|
<UTooltip
|
|
266
270
|
v-if="!hideRefresh"
|
|
267
271
|
:text="t('nuxtUiMongocamp.common.refresh')"
|
|
268
272
|
>
|
|
269
273
|
<UButton
|
|
270
274
|
icon="i-lucide-refresh-cw"
|
|
271
|
-
|
|
272
|
-
variant="ghost"
|
|
275
|
+
v-bind="ui.toolbarButton"
|
|
273
276
|
:loading="loading"
|
|
274
277
|
:aria-label="t('nuxtUiMongocamp.common.refresh')"
|
|
275
278
|
@click="fetchRole"
|
|
@@ -307,7 +310,7 @@ defineExpose({ refresh: fetchRole });
|
|
|
307
310
|
<UAlert
|
|
308
311
|
v-if="saveError && !isAddModalOpen && !isEditModalOpen"
|
|
309
312
|
color="error"
|
|
310
|
-
variant="
|
|
313
|
+
:variant="ui.alert.variant"
|
|
311
314
|
icon="i-lucide-circle-alert"
|
|
312
315
|
:title="t('nuxtUiMongocamp.roleGrants.errorSave')"
|
|
313
316
|
:description="saveError"
|
|
@@ -323,6 +326,7 @@ defineExpose({ refresh: fetchRole });
|
|
|
323
326
|
|
|
324
327
|
<UTable
|
|
325
328
|
v-else
|
|
329
|
+
data-mongocamp-part="table"
|
|
326
330
|
:data="grants"
|
|
327
331
|
:columns="columns"
|
|
328
332
|
:loading="loading"
|
|
@@ -349,7 +353,7 @@ defineExpose({ refresh: fetchRole });
|
|
|
349
353
|
v-if="saveError"
|
|
350
354
|
class="mt-3"
|
|
351
355
|
color="error"
|
|
352
|
-
variant="
|
|
356
|
+
:variant="ui.alert.variant"
|
|
353
357
|
icon="i-lucide-circle-alert"
|
|
354
358
|
:description="saveError"
|
|
355
359
|
/>
|
|
@@ -373,7 +377,7 @@ defineExpose({ refresh: fetchRole });
|
|
|
373
377
|
v-if="saveError"
|
|
374
378
|
class="mt-3"
|
|
375
379
|
color="error"
|
|
376
|
-
variant="
|
|
380
|
+
:variant="ui.alert.variant"
|
|
377
381
|
icon="i-lucide-circle-alert"
|
|
378
382
|
:description="saveError"
|
|
379
383
|
/>
|
|
@@ -6,6 +6,7 @@ import { runBulkDelete } from "../utils/bulkDelete";
|
|
|
6
6
|
import { createSelectColumn } from "../utils/createSelectColumn";
|
|
7
7
|
import { createListPagination } from "../utils/listPagination";
|
|
8
8
|
import { useMongocampAdminGate } from "../composables/useMongocampAdminGate";
|
|
9
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
9
10
|
const props = defineProps({
|
|
10
11
|
grantsPath: { type: String, required: false },
|
|
11
12
|
hideHeading: { type: Boolean, required: false },
|
|
@@ -13,6 +14,7 @@ const props = defineProps({
|
|
|
13
14
|
});
|
|
14
15
|
const emit = defineEmits(["changed"]);
|
|
15
16
|
const { t } = useI18n();
|
|
17
|
+
const ui = useMongocampUi();
|
|
16
18
|
const paths = useMongocampPaths();
|
|
17
19
|
const { listRoles, addRole, updateRole, deleteRole } = useMongocampAdmin();
|
|
18
20
|
const roles = ref([]);
|
|
@@ -201,8 +203,7 @@ function withTooltip(text, node) {
|
|
|
201
203
|
function sortHeader(column, label) {
|
|
202
204
|
const isSorted = column.getIsSorted();
|
|
203
205
|
return h(UButton, {
|
|
204
|
-
|
|
205
|
-
variant: "ghost",
|
|
206
|
+
...ui.value.sortHeader,
|
|
206
207
|
label,
|
|
207
208
|
icon: isSorted === "asc" ? "i-lucide-arrow-up-narrow-wide" : isSorted === "desc" ? "i-lucide-arrow-down-wide-narrow" : "i-lucide-arrow-up-down",
|
|
208
209
|
class: "-mx-2.5",
|
|
@@ -221,7 +222,7 @@ const columns = computed(() => [
|
|
|
221
222
|
cell: ({ row }) => h(UBadge, {
|
|
222
223
|
label: row.original.isAdmin ? t("nuxtUiMongocamp.common.admin") : t("nuxtUiMongocamp.common.standard"),
|
|
223
224
|
color: row.original.isAdmin ? "primary" : "neutral",
|
|
224
|
-
variant:
|
|
225
|
+
variant: ui.value.badge.variant
|
|
225
226
|
})
|
|
226
227
|
},
|
|
227
228
|
{
|
|
@@ -229,50 +230,41 @@ const columns = computed(() => [
|
|
|
229
230
|
header: t("nuxtUiMongocamp.roles.columnGrants"),
|
|
230
231
|
cell: ({ row }) => {
|
|
231
232
|
const count = row.original.collectionGrants?.length ?? 0;
|
|
232
|
-
return count ? h(UBadge, { label: String(count), color: "primary", variant:
|
|
233
|
+
return count ? h(UBadge, { label: String(count), color: "primary", variant: ui.value.badge.variant }) : h("span", { class: "text-dimmed" }, "\u2014");
|
|
233
234
|
}
|
|
234
235
|
},
|
|
235
236
|
{
|
|
236
237
|
id: "actions",
|
|
237
238
|
header: "",
|
|
238
|
-
cell: ({ row }) => h("div", { class: "flex gap-1 justify-end" }, [
|
|
239
|
+
cell: ({ row }) => h("div", { "class": "flex gap-1 justify-end", "data-mongocamp-part": "row-actions" }, [
|
|
239
240
|
withTooltip(t("nuxtUiMongocamp.roles.detailsTooltip"), h(UButton, {
|
|
240
241
|
"icon": "i-lucide-info",
|
|
241
|
-
|
|
242
|
-
"variant": "ghost",
|
|
243
|
-
"size": "sm",
|
|
242
|
+
...ui.value.iconButton,
|
|
244
243
|
"aria-label": t("nuxtUiMongocamp.roles.detailsTooltip"),
|
|
245
244
|
"onClick": () => openDetail(row.original)
|
|
246
245
|
})),
|
|
247
246
|
withTooltip(t("nuxtUiMongocamp.roles.manageGrantsTooltip"), h(UButton, {
|
|
248
247
|
"icon": "i-lucide-key",
|
|
249
|
-
|
|
250
|
-
"variant": "ghost",
|
|
251
|
-
"size": "sm",
|
|
248
|
+
...ui.value.iconButton,
|
|
252
249
|
"aria-label": t("nuxtUiMongocamp.roles.manageGrantsTooltip"),
|
|
253
250
|
"to": `${props.grantsPath || paths.roles}/${row.original.name}`
|
|
254
251
|
})),
|
|
255
252
|
withTooltip(t("nuxtUiMongocamp.roles.editRoleTooltip"), h(UButton, {
|
|
256
253
|
"icon": "i-lucide-pencil",
|
|
257
|
-
|
|
258
|
-
"variant": "ghost",
|
|
259
|
-
"size": "sm",
|
|
254
|
+
...ui.value.iconButton,
|
|
260
255
|
"aria-label": t("nuxtUiMongocamp.roles.editRoleTooltip"),
|
|
261
256
|
"onClick": () => openEdit(row.original)
|
|
262
257
|
})),
|
|
263
258
|
withTooltip(t("nuxtUiMongocamp.roles.cloneRoleTooltip"), h(UButton, {
|
|
264
259
|
"icon": "i-lucide-copy",
|
|
265
|
-
|
|
266
|
-
"variant": "ghost",
|
|
267
|
-
"size": "sm",
|
|
260
|
+
...ui.value.iconButton,
|
|
268
261
|
"aria-label": t("nuxtUiMongocamp.roles.cloneRoleTooltip"),
|
|
269
262
|
"onClick": () => openClone(row.original)
|
|
270
263
|
})),
|
|
271
264
|
withTooltip(t("nuxtUiMongocamp.roles.deleteRoleTooltip"), h(UButton, {
|
|
272
265
|
"icon": "i-lucide-trash-2",
|
|
266
|
+
...ui.value.iconButton,
|
|
273
267
|
"color": "error",
|
|
274
|
-
"variant": "ghost",
|
|
275
|
-
"size": "sm",
|
|
276
268
|
"aria-label": t("nuxtUiMongocamp.roles.deleteRoleTooltip"),
|
|
277
269
|
"onClick": () => confirmDelete(row.original.name)
|
|
278
270
|
}))
|
|
@@ -286,27 +278,32 @@ defineExpose({ refresh: fetchRoles });
|
|
|
286
278
|
<template>
|
|
287
279
|
<MongocampEmptyState
|
|
288
280
|
v-if="blocked"
|
|
281
|
+
class="mongocamp-roles"
|
|
289
282
|
icon="i-lucide-shield-alert"
|
|
290
283
|
:title="message"
|
|
291
284
|
data-test="admin-only"
|
|
292
285
|
/>
|
|
293
286
|
<div
|
|
294
287
|
v-else
|
|
295
|
-
class="flex flex-col gap-4"
|
|
288
|
+
class="mongocamp-roles flex flex-col gap-4"
|
|
296
289
|
>
|
|
297
290
|
<div class="flex items-center justify-between gap-4">
|
|
298
291
|
<h2
|
|
299
292
|
v-if="!hideHeading"
|
|
293
|
+
data-mongocamp-part="heading"
|
|
300
294
|
class="text-xl font-semibold"
|
|
301
295
|
>
|
|
302
296
|
{{ t("nuxtUiMongocamp.roles.heading") }}
|
|
303
297
|
</h2>
|
|
304
|
-
<div
|
|
298
|
+
<div
|
|
299
|
+
data-mongocamp-part="toolbar"
|
|
300
|
+
class="flex flex-1 items-center gap-2"
|
|
301
|
+
>
|
|
305
302
|
<UInput
|
|
306
303
|
v-model="filterText"
|
|
307
304
|
icon="i-lucide-search"
|
|
308
305
|
:placeholder="t('nuxtUiMongocamp.roles.searchPlaceholder')"
|
|
309
|
-
size="
|
|
306
|
+
:size="ui.controlSize"
|
|
310
307
|
class="flex-1 max-w-xs"
|
|
311
308
|
@input="onFilterInput"
|
|
312
309
|
/>
|
|
@@ -316,8 +313,7 @@ defineExpose({ refresh: fetchRoles });
|
|
|
316
313
|
>
|
|
317
314
|
<UButton
|
|
318
315
|
icon="i-lucide-refresh-cw"
|
|
319
|
-
|
|
320
|
-
variant="ghost"
|
|
316
|
+
v-bind="ui.toolbarButton"
|
|
321
317
|
:loading="loading"
|
|
322
318
|
:aria-label="t('nuxtUiMongocamp.common.refresh')"
|
|
323
319
|
@click="fetchRoles"
|
|
@@ -350,6 +346,7 @@ defineExpose({ refresh: fetchRoles });
|
|
|
350
346
|
v-model:sorting="sorting"
|
|
351
347
|
v-model:row-selection="rowSelection"
|
|
352
348
|
v-model:pagination="pagination"
|
|
349
|
+
data-mongocamp-part="table"
|
|
353
350
|
:pagination-options="paginationOptions"
|
|
354
351
|
:get-row-id="(row) => row.name"
|
|
355
352
|
:data="roles"
|
|
@@ -435,7 +432,7 @@ defineExpose({ refresh: fetchRoles });
|
|
|
435
432
|
v-if="cloneError"
|
|
436
433
|
class="mt-3"
|
|
437
434
|
color="error"
|
|
438
|
-
variant="
|
|
435
|
+
:variant="ui.alert.variant"
|
|
439
436
|
icon="i-lucide-circle-alert"
|
|
440
437
|
:description="cloneError"
|
|
441
438
|
/>
|
|
@@ -446,7 +443,7 @@ defineExpose({ refresh: fetchRoles });
|
|
|
446
443
|
<UModal
|
|
447
444
|
v-model:open="isDeleteModalOpen"
|
|
448
445
|
:title="t('nuxtUiMongocamp.roles.deleteRoleTitle')"
|
|
449
|
-
:ui="{ footer:
|
|
446
|
+
:ui="{ footer: ui.modal.footer }"
|
|
450
447
|
>
|
|
451
448
|
<template #body>
|
|
452
449
|
<p>{{ t("nuxtUiMongocamp.roles.confirmDelete", { roleName: roleToDelete }) }}</p>
|
|
@@ -454,7 +451,7 @@ defineExpose({ refresh: fetchRoles });
|
|
|
454
451
|
v-if="deleteError"
|
|
455
452
|
class="mt-3"
|
|
456
453
|
color="error"
|
|
457
|
-
variant="
|
|
454
|
+
:variant="ui.alert.variant"
|
|
458
455
|
icon="i-lucide-circle-alert"
|
|
459
456
|
:description="deleteError"
|
|
460
457
|
/>
|
|
@@ -462,14 +459,13 @@ defineExpose({ refresh: fetchRoles });
|
|
|
462
459
|
<template #footer>
|
|
463
460
|
<UButton
|
|
464
461
|
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
465
|
-
|
|
466
|
-
variant="ghost"
|
|
462
|
+
v-bind="ui.dialogCancel"
|
|
467
463
|
:disabled="deleting"
|
|
468
464
|
@click="isDeleteModalOpen = false"
|
|
469
465
|
/>
|
|
470
466
|
<UButton
|
|
471
467
|
:label="t('nuxtUiMongocamp.common.delete')"
|
|
472
|
-
|
|
468
|
+
v-bind="ui.dangerAction"
|
|
473
469
|
:loading="deleting"
|
|
474
470
|
@click="handleDeleteRole"
|
|
475
471
|
/>
|
|
@@ -479,7 +475,7 @@ defineExpose({ refresh: fetchRoles });
|
|
|
479
475
|
<USlideover
|
|
480
476
|
v-model:open="isDetailOpen"
|
|
481
477
|
:title="t('nuxtUiMongocamp.roles.detailsTitle', { roleName: detail?.name ?? '' })"
|
|
482
|
-
:ui="{ content:
|
|
478
|
+
:ui="{ content: ui.modal.md }"
|
|
483
479
|
>
|
|
484
480
|
<template #body>
|
|
485
481
|
<div
|
|
@@ -490,7 +486,7 @@ defineExpose({ refresh: fetchRoles });
|
|
|
490
486
|
<UBadge
|
|
491
487
|
:label="detail.isAdmin ? t('nuxtUiMongocamp.common.admin') : t('nuxtUiMongocamp.common.standard')"
|
|
492
488
|
:color="detail.isAdmin ? 'primary' : 'neutral'"
|
|
493
|
-
variant="
|
|
489
|
+
:variant="ui.badge.variant"
|
|
494
490
|
/>
|
|
495
491
|
</div>
|
|
496
492
|
<section class="flex flex-col gap-2">
|
|
@@ -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);
|
|
@@ -75,12 +77,16 @@ defineExpose({ refresh });
|
|
|
75
77
|
</script>
|
|
76
78
|
|
|
77
79
|
<template>
|
|
78
|
-
<div class="flex flex-col gap-4">
|
|
80
|
+
<div class="mongocamp-server-info flex flex-col gap-4">
|
|
79
81
|
<div
|
|
80
82
|
v-if="!hideHeading || !hideRefresh"
|
|
83
|
+
data-mongocamp-part="toolbar"
|
|
81
84
|
class="flex items-center justify-between gap-4"
|
|
82
85
|
>
|
|
83
|
-
<h2
|
|
86
|
+
<h2
|
|
87
|
+
data-mongocamp-part="heading"
|
|
88
|
+
class="text-xl font-semibold"
|
|
89
|
+
>
|
|
84
90
|
<template v-if="!hideHeading">
|
|
85
91
|
{{ t("nuxtUiMongocamp.serverInfo.heading") }}
|
|
86
92
|
</template>
|
|
@@ -91,8 +97,7 @@ defineExpose({ refresh });
|
|
|
91
97
|
>
|
|
92
98
|
<UButton
|
|
93
99
|
icon="i-lucide-refresh-cw"
|
|
94
|
-
|
|
95
|
-
variant="ghost"
|
|
100
|
+
v-bind="ui.toolbarButton"
|
|
96
101
|
:loading="loading"
|
|
97
102
|
:aria-label="t('nuxtUiMongocamp.common.refresh')"
|
|
98
103
|
@click="refresh"
|
|
@@ -103,21 +108,21 @@ defineExpose({ refresh });
|
|
|
103
108
|
<UAlert
|
|
104
109
|
v-if="failed.info"
|
|
105
110
|
color="warning"
|
|
106
|
-
variant="
|
|
111
|
+
:variant="ui.alert.variant"
|
|
107
112
|
data-testid="info-failed"
|
|
108
113
|
:description="t('nuxtUiMongocamp.serverInfo.partFailed', { part: t('nuxtUiMongocamp.serverInfo.partInfo') })"
|
|
109
114
|
/>
|
|
110
115
|
<UAlert
|
|
111
116
|
v-if="failed.stats && !hideStats"
|
|
112
117
|
color="warning"
|
|
113
|
-
variant="
|
|
118
|
+
:variant="ui.alert.variant"
|
|
114
119
|
data-testid="stats-failed"
|
|
115
120
|
:description="t('nuxtUiMongocamp.serverInfo.partFailed', { part: t('nuxtUiMongocamp.serverInfo.partStats') })"
|
|
116
121
|
/>
|
|
117
122
|
<UAlert
|
|
118
123
|
v-if="failed.capabilities && !hideCapabilities"
|
|
119
124
|
color="warning"
|
|
120
|
-
variant="
|
|
125
|
+
:variant="ui.alert.variant"
|
|
121
126
|
data-testid="capabilities-failed"
|
|
122
127
|
:description="t('nuxtUiMongocamp.serverInfo.partFailed', { part: t('nuxtUiMongocamp.serverInfo.partCapabilities') })"
|
|
123
128
|
/>
|
|
@@ -175,7 +180,7 @@ defineExpose({ refresh });
|
|
|
175
180
|
<UBadge
|
|
176
181
|
:label="stats.replicaSet.state"
|
|
177
182
|
color="neutral"
|
|
178
|
-
variant="
|
|
183
|
+
:variant="ui.badge.variant"
|
|
179
184
|
/>
|
|
180
185
|
<span class="text-dimmed">{{ t("nuxtUiMongocamp.serverInfo.replicaMembers", { healthy: stats.replicaSet.healthyMembers, count: stats.replicaSet.memberCount }) }}</span>
|
|
181
186
|
</dd>
|
|
@@ -190,7 +195,7 @@ defineExpose({ refresh });
|
|
|
190
195
|
<UAlert
|
|
191
196
|
v-if="stats.partial"
|
|
192
197
|
color="info"
|
|
193
|
-
variant="
|
|
198
|
+
:variant="ui.alert.variant"
|
|
194
199
|
data-testid="stats-partial"
|
|
195
200
|
:description="t('nuxtUiMongocamp.serverInfo.partialNote')"
|
|
196
201
|
/>
|
|
@@ -268,7 +273,7 @@ defineExpose({ refresh });
|
|
|
268
273
|
<UAlert
|
|
269
274
|
v-if="olderServer && !hideCapabilities"
|
|
270
275
|
color="neutral"
|
|
271
|
-
variant="
|
|
276
|
+
:variant="ui.alert.variant"
|
|
272
277
|
data-testid="older-server"
|
|
273
278
|
:description="t('nuxtUiMongocamp.serverInfo.olderServer')"
|
|
274
279
|
/>
|
|
@@ -290,7 +295,7 @@ defineExpose({ refresh });
|
|
|
290
295
|
:key="feature"
|
|
291
296
|
:label="feature"
|
|
292
297
|
color="primary"
|
|
293
|
-
variant="
|
|
298
|
+
:variant="ui.badge.variant"
|
|
294
299
|
/>
|
|
295
300
|
</div>
|
|
296
301
|
</div>
|
|
@@ -330,7 +335,7 @@ defineExpose({ refresh });
|
|
|
330
335
|
:key="stage"
|
|
331
336
|
:label="stage"
|
|
332
337
|
color="error"
|
|
333
|
-
variant="
|
|
338
|
+
:variant="ui.badge.variant"
|
|
334
339
|
class="font-mono"
|
|
335
340
|
/>
|
|
336
341
|
</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
|
|
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
|
-
|
|
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="
|
|
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="
|
|
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
|
-
|
|
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="
|
|
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="
|
|
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="
|
|
387
|
+
:variant="ui.badge.variant"
|
|
384
388
|
size="sm"
|
|
385
389
|
/>
|
|
386
390
|
</li>
|
|
@@ -70,6 +70,7 @@ defineExpose({ refresh: quietRefresh });
|
|
|
70
70
|
<template>
|
|
71
71
|
<UTooltip
|
|
72
72
|
v-if="collapsed"
|
|
73
|
+
class="mongocamp-server-status"
|
|
73
74
|
:text="healthLabel"
|
|
74
75
|
>
|
|
75
76
|
<div
|
|
@@ -90,7 +91,7 @@ defineExpose({ refresh: quietRefresh });
|
|
|
90
91
|
:is="linkTarget ? NuxtLink : 'div'"
|
|
91
92
|
v-else
|
|
92
93
|
:to="linkTarget || void 0"
|
|
93
|
-
class="flex flex-col gap-1.5 rounded-md text-xs"
|
|
94
|
+
class="mongocamp-server-status flex flex-col gap-1.5 rounded-md text-xs"
|
|
94
95
|
:class="linkTarget ? 'hover:bg-elevated' : ''"
|
|
95
96
|
data-test="server-status"
|
|
96
97
|
:data-health="health"
|