@sfxcode/nuxt-ui-mongocamp 1.5.6 → 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 +26 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +5 -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.d.vue.ts +2 -2
- package/dist/runtime/components/MongocampBulkDelete.vue +8 -9
- package/dist/runtime/components/MongocampBulkDelete.vue.d.ts +2 -2
- 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.d.vue.ts +2 -2
- package/dist/runtime/components/MongocampCollectionCopy.vue +6 -6
- package/dist/runtime/components/MongocampCollectionCopy.vue.d.ts +2 -2
- package/dist/runtime/components/MongocampCollectionData.vue +37 -62
- package/dist/runtime/components/MongocampCollectionInfos.vue +18 -23
- package/dist/runtime/components/MongocampCollectionRename.d.vue.ts +2 -2
- package/dist/runtime/components/MongocampCollectionRename.vue +5 -4
- package/dist/runtime/components/MongocampCollectionRename.vue.d.ts +2 -2
- package/dist/runtime/components/MongocampCollections.vue +24 -33
- package/dist/runtime/components/MongocampCommandPalette.d.vue.ts +2 -2
- package/dist/runtime/components/MongocampCommandPalette.vue +3 -1
- package/dist/runtime/components/MongocampCommandPalette.vue.d.ts +2 -2
- 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/useMongocampAdmin.d.ts +4 -4
- package/dist/runtime/composables/useMongocampClientApi.d.ts +13 -1
- package/dist/runtime/composables/useMongocampConnection.d.ts +25 -0
- package/dist/runtime/composables/useMongocampConnection.js +33 -0
- package/dist/runtime/composables/useMongocampRoles.d.ts +5 -5
- package/dist/runtime/composables/useMongocampUi.d.ts +8 -0
- package/dist/runtime/composables/useMongocampUi.js +7 -0
- package/dist/runtime/plugin.d.ts +5 -1
- package/dist/runtime/plugin.js +62 -2
- package/dist/runtime/publicUtils.d.ts +1 -0
- package/dist/runtime/publicUtils.js +1 -0
- package/dist/runtime/utils/compactSession.d.ts +13 -0
- package/dist/runtime/utils/compactSession.js +12 -0
- package/dist/runtime/utils/connection.d.ts +23 -0
- package/dist/runtime/utils/connection.js +31 -0
- package/dist/runtime/utils/sessionGuard.d.ts +1 -0
- package/dist/runtime/utils/sessionGuard.js +8 -0
- package/dist/runtime/utils/uiTheme.d.ts +65 -0
- package/dist/runtime/utils/uiTheme.js +47 -0
- package/package.json +13 -13
|
@@ -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"
|
|
@@ -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:
|
|
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:
|
|
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
|
-
|
|
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="
|
|
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="
|
|
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="
|
|
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="
|
|
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="
|
|
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="
|
|
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
|
|
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
|
-
|
|
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="
|
|
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="
|
|
165
|
+
:variant="ui.badge.variant"
|
|
161
166
|
/>
|
|
162
167
|
</td>
|
|
163
168
|
</tr>
|