@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
|
@@ -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
|
-
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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="
|
|
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
|
-
|
|
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="
|
|
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"
|
|
@@ -19,11 +19,11 @@ type __VLS_ModelProps = {
|
|
|
19
19
|
};
|
|
20
20
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
21
21
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
22
|
-
select: (entry: PaletteEntry) => any;
|
|
23
22
|
"update:open": (value: boolean) => any;
|
|
23
|
+
select: (entry: PaletteEntry) => any;
|
|
24
24
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
25
|
-
onSelect?: ((entry: PaletteEntry) => any) | undefined;
|
|
26
25
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
26
|
+
onSelect?: ((entry: PaletteEntry) => any) | undefined;
|
|
27
27
|
}>, {
|
|
28
28
|
shortcut: string;
|
|
29
29
|
cacheMs: number;
|
|
@@ -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: '
|
|
110
|
+
:ui="{ content: ui.modal.md + ' mongocamp-command-palette' }"
|
|
109
111
|
>
|
|
110
112
|
<template #content>
|
|
111
113
|
<UCommandPalette
|
|
@@ -19,11 +19,11 @@ type __VLS_ModelProps = {
|
|
|
19
19
|
};
|
|
20
20
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
21
21
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
22
|
-
select: (entry: PaletteEntry) => any;
|
|
23
22
|
"update:open": (value: boolean) => any;
|
|
23
|
+
select: (entry: PaletteEntry) => any;
|
|
24
24
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
25
|
-
onSelect?: ((entry: PaletteEntry) => any) | undefined;
|
|
26
25
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
26
|
+
onSelect?: ((entry: PaletteEntry) => any) | undefined;
|
|
27
27
|
}>, {
|
|
28
28
|
shortcut: string;
|
|
29
29
|
cacheMs: number;
|
|
@@ -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="{
|
|
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="
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
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:
|
|
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
|
|
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
|
-
|
|
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="
|
|
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="
|
|
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="
|
|
131
|
+
:variant="ui.badge.variant"
|
|
130
132
|
:label="statusLabel(row.status)"
|
|
131
133
|
/>
|
|
132
134
|
</td>
|
|
@@ -3,12 +3,14 @@ import { computed, ref, watch } from "vue";
|
|
|
3
3
|
import { useI18n, useToast } from "#imports";
|
|
4
4
|
import { allContainerPaths, buildDocumentTree, defaultExpanded, nodeDisplay, visibleNodes } from "../utils/documentTree";
|
|
5
5
|
import { valueToJson } from "../utils/exportDocuments";
|
|
6
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
6
7
|
const props = defineProps({
|
|
7
8
|
document: { type: null, required: true }
|
|
8
9
|
});
|
|
9
10
|
const emit = defineEmits(["copy"]);
|
|
10
11
|
const mode = defineModel("mode", { type: String, ...{ default: "tree" } });
|
|
11
12
|
const { t } = useI18n();
|
|
13
|
+
const ui = useMongocampUi();
|
|
12
14
|
const toast = useToast();
|
|
13
15
|
const tree = computed(() => buildDocumentTree(props.document ?? {}));
|
|
14
16
|
const expanded = ref(/* @__PURE__ */ new Set());
|
|
@@ -59,7 +61,7 @@ const modeItems = computed(() => [
|
|
|
59
61
|
</script>
|
|
60
62
|
|
|
61
63
|
<template>
|
|
62
|
-
<div class="flex flex-col gap-3">
|
|
64
|
+
<div class="mongocamp-document-view flex flex-col gap-3">
|
|
63
65
|
<div class="flex flex-wrap items-center justify-between gap-2">
|
|
64
66
|
<div
|
|
65
67
|
class="inline-flex rounded-md border border-default p-0.5"
|
|
@@ -83,17 +85,13 @@ const modeItems = computed(() => [
|
|
|
83
85
|
v-if="mode === 'tree' && hasContainers"
|
|
84
86
|
:label="allOpen ? t('nuxtUiMongocamp.documentView.collapseAll') : t('nuxtUiMongocamp.documentView.expandAll')"
|
|
85
87
|
:icon="allOpen ? 'i-lucide-chevrons-down-up' : 'i-lucide-chevrons-up-down'"
|
|
86
|
-
|
|
87
|
-
color="neutral"
|
|
88
|
-
variant="ghost"
|
|
88
|
+
v-bind="ui.compactButton"
|
|
89
89
|
@click="toggleAll"
|
|
90
90
|
/>
|
|
91
91
|
<UButton
|
|
92
92
|
:label="t('nuxtUiMongocamp.documentView.copyDocument')"
|
|
93
93
|
icon="i-lucide-copy"
|
|
94
|
-
|
|
95
|
-
color="neutral"
|
|
96
|
-
variant="ghost"
|
|
94
|
+
v-bind="ui.compactButton"
|
|
97
95
|
:disabled="!document"
|
|
98
96
|
@click="copy('document', jsonText)"
|
|
99
97
|
/>
|
|
@@ -154,7 +152,7 @@ const modeItems = computed(() => [
|
|
|
154
152
|
<UBadge
|
|
155
153
|
:label="node.type"
|
|
156
154
|
:color="BADGE_COLORS[node.type]"
|
|
157
|
-
variant="
|
|
155
|
+
:variant="ui.badge.variant"
|
|
158
156
|
size="sm"
|
|
159
157
|
class="shrink-0"
|
|
160
158
|
:title="t('nuxtUiMongocamp.documentView.typeLabel', { type: node.type })"
|
|
@@ -9,7 +9,10 @@ const { t } = useI18n();
|
|
|
9
9
|
</script>
|
|
10
10
|
|
|
11
11
|
<template>
|
|
12
|
-
<div
|
|
12
|
+
<div
|
|
13
|
+
data-mongocamp-part="empty"
|
|
14
|
+
class="mongocamp-empty-state flex flex-col items-center gap-2 py-8 text-center"
|
|
15
|
+
>
|
|
13
16
|
<UIcon
|
|
14
17
|
:name="icon ?? 'i-lucide-inbox'"
|
|
15
18
|
class="size-8 text-dimmed"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, ref, watch } from "vue";
|
|
3
3
|
import { navigateTo, useI18n, useMongocampError, useMongocampRoles, useMongocampSession } from "#imports";
|
|
4
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
4
5
|
const props = defineProps({
|
|
5
6
|
error: { type: null, required: true },
|
|
6
7
|
title: { type: String, required: false },
|
|
@@ -9,6 +10,7 @@ const props = defineProps({
|
|
|
9
10
|
});
|
|
10
11
|
const emit = defineEmits(["retry", "clearFilters"]);
|
|
11
12
|
const { t } = useI18n();
|
|
13
|
+
const ui = useMongocampUi();
|
|
12
14
|
const { describeError, describeServerError } = useMongocampError();
|
|
13
15
|
const { invalidateSession } = useMongocampSession();
|
|
14
16
|
const { loginPath: configuredLoginPath } = useMongocampRoles();
|
|
@@ -36,8 +38,10 @@ async function loginAgain() {
|
|
|
36
38
|
<template>
|
|
37
39
|
<UAlert
|
|
38
40
|
v-if="error"
|
|
41
|
+
class="mongocamp-error-alert"
|
|
42
|
+
data-mongocamp-part="error"
|
|
39
43
|
color="error"
|
|
40
|
-
variant="
|
|
44
|
+
:variant="ui.alert.variant"
|
|
41
45
|
icon="i-lucide-circle-alert"
|
|
42
46
|
:title="filterRejected ? t('nuxtUiMongocamp.errors.filterRejectedTitle') : title ?? t('nuxtUiMongocamp.errors.loadFailedTitle')"
|
|
43
47
|
:description="description"
|
|
@@ -46,24 +50,21 @@ async function loginAgain() {
|
|
|
46
50
|
<UButton
|
|
47
51
|
v-if="filterRejected"
|
|
48
52
|
:label="t('nuxtUiMongocamp.errors.clearFilters')"
|
|
49
|
-
|
|
50
|
-
variant="subtle"
|
|
53
|
+
v-bind="{ ...ui.alertAction, color: 'error' }"
|
|
51
54
|
icon="i-lucide-filter-x"
|
|
52
55
|
@click="emit('clearFilters')"
|
|
53
56
|
/>
|
|
54
57
|
<UButton
|
|
55
58
|
v-else-if="sessionGone"
|
|
56
59
|
:label="t('nuxtUiMongocamp.errors.loginAgain')"
|
|
57
|
-
|
|
58
|
-
variant="subtle"
|
|
60
|
+
v-bind="{ ...ui.alertAction, color: 'error' }"
|
|
59
61
|
icon="i-lucide-log-in"
|
|
60
62
|
@click="loginAgain"
|
|
61
63
|
/>
|
|
62
64
|
<UButton
|
|
63
65
|
v-else
|
|
64
66
|
:label="t('nuxtUiMongocamp.common.retry')"
|
|
65
|
-
|
|
66
|
-
variant="subtle"
|
|
67
|
+
v-bind="{ ...ui.alertAction, color: 'error' }"
|
|
67
68
|
icon="i-lucide-refresh-cw"
|
|
68
69
|
@click="emit('retry')"
|
|
69
70
|
/>
|
|
@@ -3,6 +3,7 @@ import { computed, ref, watch } from "vue";
|
|
|
3
3
|
import { useI18n, useMongocampError } from "#imports";
|
|
4
4
|
import { useMongocampExportAll } from "../composables/useMongocampExportAll";
|
|
5
5
|
import { formatBytes } from "../utils/formatBytes";
|
|
6
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
6
7
|
const props = defineProps({
|
|
7
8
|
collection: { type: String, required: true },
|
|
8
9
|
filter: { type: String, required: false },
|
|
@@ -12,6 +13,7 @@ const props = defineProps({
|
|
|
12
13
|
});
|
|
13
14
|
const isOpen = defineModel("open", { type: Boolean, ...{ default: false } });
|
|
14
15
|
const { t } = useI18n();
|
|
16
|
+
const ui = useMongocampUi();
|
|
15
17
|
const { describeServerError } = useMongocampError();
|
|
16
18
|
const { exportCollection } = useMongocampExportAll();
|
|
17
19
|
const step = ref("form");
|
|
@@ -77,7 +79,7 @@ function cancel() {
|
|
|
77
79
|
<UModal
|
|
78
80
|
v-model:open="isOpen"
|
|
79
81
|
:title="t('nuxtUiMongocamp.exportAll.title')"
|
|
80
|
-
:ui="{
|
|
82
|
+
:ui="{ content: 'mongocamp-export-all', footer: ui.modal.footer }"
|
|
81
83
|
>
|
|
82
84
|
<template #body>
|
|
83
85
|
<div
|
|
@@ -141,7 +143,7 @@ function cancel() {
|
|
|
141
143
|
<UAlert
|
|
142
144
|
v-if="result.incomplete"
|
|
143
145
|
color="warning"
|
|
144
|
-
variant="
|
|
146
|
+
:variant="ui.alert.variant"
|
|
145
147
|
icon="i-lucide-circle-alert"
|
|
146
148
|
:title="t('nuxtUiMongocamp.exportAll.incomplete', { file: result.filename })"
|
|
147
149
|
data-test="export-incomplete"
|
|
@@ -149,7 +151,7 @@ function cancel() {
|
|
|
149
151
|
<UAlert
|
|
150
152
|
v-else
|
|
151
153
|
color="success"
|
|
152
|
-
variant="
|
|
154
|
+
:variant="ui.alert.variant"
|
|
153
155
|
icon="i-lucide-circle-check"
|
|
154
156
|
:title="result.documents === void 0 ? t('nuxtUiMongocamp.exportAll.doneSize', { size: formatBytes(result.bytes), file: result.filename }) : t('nuxtUiMongocamp.exportAll.done', { count: result.documents, file: result.filename }, result.documents)"
|
|
155
157
|
/>
|
|
@@ -168,16 +170,14 @@ function cancel() {
|
|
|
168
170
|
<template v-else-if="step === 'done'">
|
|
169
171
|
<UButton
|
|
170
172
|
:label="t('nuxtUiMongocamp.exportAll.close')"
|
|
171
|
-
|
|
172
|
-
variant="ghost"
|
|
173
|
+
v-bind="ui.dialogCancel"
|
|
173
174
|
@click="isOpen = false"
|
|
174
175
|
/>
|
|
175
176
|
</template>
|
|
176
177
|
<template v-else>
|
|
177
178
|
<UButton
|
|
178
179
|
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
179
|
-
|
|
180
|
-
variant="ghost"
|
|
180
|
+
v-bind="ui.dialogCancel"
|
|
181
181
|
@click="isOpen = false"
|
|
182
182
|
/>
|
|
183
183
|
<UButton
|