@sfxcode/nuxt-ui-mongocamp 1.3.2 → 1.3.3
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/README.md +1 -1
- package/dist/module.d.mts +12 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +18 -5
- package/dist/runtime/components/MongocampAggregationBuilder.vue +2 -2
- package/dist/runtime/components/MongocampCollectionData.d.vue.ts +4 -1
- package/dist/runtime/components/MongocampCollectionData.vue +67 -3
- package/dist/runtime/components/MongocampCollectionData.vue.d.ts +4 -1
- package/dist/runtime/components/MongocampCollectionInfos.vue +104 -8
- package/dist/runtime/components/MongocampCollections.d.vue.ts +8 -1
- package/dist/runtime/components/MongocampCollections.vue +84 -72
- package/dist/runtime/components/MongocampCollections.vue.d.ts +8 -1
- package/dist/runtime/components/MongocampConfirmByName.d.vue.ts +23 -0
- package/dist/runtime/components/MongocampConfirmByName.vue +92 -0
- package/dist/runtime/components/MongocampConfirmByName.vue.d.ts +23 -0
- package/dist/runtime/components/MongocampErrorAlert.vue +28 -5
- package/dist/runtime/components/MongocampGrantList.d.vue.ts +7 -0
- package/dist/runtime/components/MongocampGrantList.vue +38 -0
- package/dist/runtime/components/MongocampGrantList.vue.d.ts +7 -0
- package/dist/runtime/components/MongocampRoles.vue +45 -0
- package/dist/runtime/components/MongocampSettings.d.vue.ts +3 -0
- package/dist/runtime/components/MongocampSettings.vue +179 -0
- package/dist/runtime/components/MongocampSettings.vue.d.ts +3 -0
- package/dist/runtime/components/MongocampUsers.vue +183 -3
- package/dist/runtime/composables/useMongocampAdmin.d.ts +7 -1
- package/dist/runtime/composables/useMongocampAdmin.js +24 -1
- package/dist/runtime/composables/useMongocampAggregation.js +1 -0
- package/dist/runtime/composables/useMongocampBucket.js +1 -1
- package/dist/runtime/composables/useMongocampIndex.d.ts +1 -0
- package/dist/runtime/composables/useMongocampIndex.js +8 -1
- package/dist/runtime/composables/useMongocampRoles.d.ts +1 -0
- package/dist/runtime/composables/useMongocampRoles.js +3 -2
- package/dist/runtime/composables/useMongocampSession.d.ts +8 -0
- package/dist/runtime/composables/useMongocampSession.js +45 -0
- package/dist/runtime/composables/useMongocampSystem.d.ts +15 -3
- package/dist/runtime/composables/useMongocampSystem.js +19 -2
- package/dist/runtime/locales/de.json +61 -2
- package/dist/runtime/locales/en.json +61 -2
- package/dist/runtime/plugin.js +19 -0
- package/dist/runtime/utils/collectionProtection.d.ts +3 -0
- package/dist/runtime/utils/collectionProtection.js +7 -0
- package/dist/runtime/utils/configRows.d.ts +11 -0
- package/dist/runtime/utils/configRows.js +53 -0
- package/dist/runtime/utils/failureKind.d.ts +3 -0
- package/dist/runtime/utils/failureKind.js +11 -0
- package/dist/runtime/utils/jwtExpiry.d.ts +3 -0
- package/dist/runtime/utils/jwtExpiry.js +31 -0
- package/dist/runtime/utils/serverProbe.d.ts +10 -0
- package/dist/runtime/utils/serverProbe.js +25 -0
- package/dist/runtime/utils/sessionGuard.d.ts +10 -0
- package/dist/runtime/utils/sessionGuard.js +10 -0
- package/dist/runtime/utils/throttled.d.ts +6 -0
- package/dist/runtime/utils/throttled.js +16 -0
- package/package.json +1 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref, watch } from "vue";
|
|
3
|
+
import { useI18n, useMongocampError } from "#imports";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
name: { type: String, required: true },
|
|
6
|
+
title: { type: String, required: true },
|
|
7
|
+
description: { type: String, required: true },
|
|
8
|
+
confirmLabel: { type: String, required: true },
|
|
9
|
+
confirmColor: { type: String, required: false, default: "error" },
|
|
10
|
+
confirmIcon: { type: String, required: false, default: "i-lucide-trash-2" },
|
|
11
|
+
onConfirm: { type: Function, required: true }
|
|
12
|
+
});
|
|
13
|
+
const open = defineModel("open", { type: Boolean, ...{ default: false } });
|
|
14
|
+
const { t } = useI18n();
|
|
15
|
+
const { describeError } = useMongocampError();
|
|
16
|
+
const typed = ref("");
|
|
17
|
+
const busy = ref(false);
|
|
18
|
+
const error = ref("");
|
|
19
|
+
const matches = computed(() => props.name !== "" && typed.value.trim() === props.name);
|
|
20
|
+
watch(open, (isOpen) => {
|
|
21
|
+
if (!isOpen) return;
|
|
22
|
+
typed.value = "";
|
|
23
|
+
error.value = "";
|
|
24
|
+
});
|
|
25
|
+
function close() {
|
|
26
|
+
open.value = false;
|
|
27
|
+
}
|
|
28
|
+
async function handleConfirm() {
|
|
29
|
+
if (!matches.value || busy.value) return;
|
|
30
|
+
busy.value = true;
|
|
31
|
+
error.value = "";
|
|
32
|
+
try {
|
|
33
|
+
await props.onConfirm();
|
|
34
|
+
close();
|
|
35
|
+
} catch (e) {
|
|
36
|
+
error.value = describeError(e).message;
|
|
37
|
+
} finally {
|
|
38
|
+
busy.value = false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<template>
|
|
44
|
+
<UModal
|
|
45
|
+
v-model:open="open"
|
|
46
|
+
:title="title"
|
|
47
|
+
:dismissible="!busy"
|
|
48
|
+
:ui="{ footer: 'justify-end' }"
|
|
49
|
+
>
|
|
50
|
+
<template #body>
|
|
51
|
+
<p>{{ description }}</p>
|
|
52
|
+
<UFormField
|
|
53
|
+
class="mt-4"
|
|
54
|
+
:label="t('nuxtUiMongocamp.confirmByName.prompt', { name })"
|
|
55
|
+
>
|
|
56
|
+
<UInput
|
|
57
|
+
v-model="typed"
|
|
58
|
+
class="w-full"
|
|
59
|
+
autocomplete="off"
|
|
60
|
+
:disabled="busy"
|
|
61
|
+
:aria-label="t('nuxtUiMongocamp.confirmByName.prompt', { name })"
|
|
62
|
+
@keydown.enter.prevent="handleConfirm"
|
|
63
|
+
/>
|
|
64
|
+
</UFormField>
|
|
65
|
+
<UAlert
|
|
66
|
+
v-if="error"
|
|
67
|
+
class="mt-3"
|
|
68
|
+
color="error"
|
|
69
|
+
variant="subtle"
|
|
70
|
+
icon="i-lucide-circle-alert"
|
|
71
|
+
:description="error"
|
|
72
|
+
/>
|
|
73
|
+
</template>
|
|
74
|
+
<template #footer>
|
|
75
|
+
<UButton
|
|
76
|
+
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
77
|
+
color="neutral"
|
|
78
|
+
variant="ghost"
|
|
79
|
+
:disabled="busy"
|
|
80
|
+
@click="close"
|
|
81
|
+
/>
|
|
82
|
+
<UButton
|
|
83
|
+
:label="confirmLabel"
|
|
84
|
+
:color="confirmColor"
|
|
85
|
+
:icon="confirmIcon"
|
|
86
|
+
:disabled="!matches"
|
|
87
|
+
:loading="busy"
|
|
88
|
+
@click="handleConfirm"
|
|
89
|
+
/>
|
|
90
|
+
</template>
|
|
91
|
+
</UModal>
|
|
92
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
name: string;
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
confirmLabel: string;
|
|
6
|
+
confirmColor?: 'error' | 'warning';
|
|
7
|
+
confirmIcon?: string;
|
|
8
|
+
onConfirm: () => Promise<void>;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_ModelProps = {
|
|
11
|
+
'open'?: boolean;
|
|
12
|
+
};
|
|
13
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
|
+
"update:open": (value: boolean) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
17
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
18
|
+
}>, {
|
|
19
|
+
confirmColor: "error" | "warning";
|
|
20
|
+
confirmIcon: string;
|
|
21
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
3
|
-
import { useI18n, useMongocampError } from "#imports";
|
|
2
|
+
import { computed, ref, watch } from "vue";
|
|
3
|
+
import { navigateTo, useI18n, useMongocampError, useMongocampRoles, useMongocampSession } from "#imports";
|
|
4
|
+
import { classifyFailure } from "../utils/failureKind";
|
|
4
5
|
const props = defineProps({
|
|
5
6
|
error: { type: null, required: true },
|
|
6
7
|
title: { type: String, required: false },
|
|
@@ -10,8 +11,30 @@ const props = defineProps({
|
|
|
10
11
|
const emit = defineEmits(["retry", "clearFilters"]);
|
|
11
12
|
const { t } = useI18n();
|
|
12
13
|
const { describeError } = useMongocampError();
|
|
14
|
+
const { diagnoseFailure, invalidateSession } = useMongocampSession();
|
|
15
|
+
const { loginPath: configuredLoginPath } = useMongocampRoles();
|
|
13
16
|
const described = computed(() => describeError(props.error));
|
|
14
|
-
const
|
|
17
|
+
const failure = ref(null);
|
|
18
|
+
let diagnosisRun = 0;
|
|
19
|
+
watch(() => [props.error, props.filterRejected], async ([error, filterRejected]) => {
|
|
20
|
+
const run = ++diagnosisRun;
|
|
21
|
+
failure.value = null;
|
|
22
|
+
if (!error || filterRejected) return;
|
|
23
|
+
const kind = await classifyFailure(describeError(error).kind, diagnoseFailure);
|
|
24
|
+
if (run === diagnosisRun) failure.value = kind;
|
|
25
|
+
}, { immediate: true });
|
|
26
|
+
const sessionGone = computed(() => described.value.kind === "unauthorized" || failure.value === "session-ended");
|
|
27
|
+
const requestRefused = computed(() => failure.value === "rejected-request");
|
|
28
|
+
const description = computed(() => {
|
|
29
|
+
if (props.filterRejected) return t("nuxtUiMongocamp.errors.filterRejected");
|
|
30
|
+
if (sessionGone.value) return t("nuxtUiMongocamp.errors.unauthorized");
|
|
31
|
+
if (requestRefused.value) return t("nuxtUiMongocamp.errors.requestRefused");
|
|
32
|
+
return described.value.message;
|
|
33
|
+
});
|
|
34
|
+
async function loginAgain() {
|
|
35
|
+
await invalidateSession();
|
|
36
|
+
await navigateTo(props.loginPath ?? configuredLoginPath);
|
|
37
|
+
}
|
|
15
38
|
</script>
|
|
16
39
|
|
|
17
40
|
<template>
|
|
@@ -21,7 +44,7 @@ const sessionGone = computed(() => described.value.kind === "unauthorized");
|
|
|
21
44
|
variant="subtle"
|
|
22
45
|
icon="i-lucide-circle-alert"
|
|
23
46
|
:title="filterRejected ? t('nuxtUiMongocamp.errors.filterRejectedTitle') : title ?? t('nuxtUiMongocamp.errors.loadFailedTitle')"
|
|
24
|
-
:description="
|
|
47
|
+
:description="description"
|
|
25
48
|
>
|
|
26
49
|
<template #actions>
|
|
27
50
|
<UButton
|
|
@@ -35,10 +58,10 @@ const sessionGone = computed(() => described.value.kind === "unauthorized");
|
|
|
35
58
|
<UButton
|
|
36
59
|
v-else-if="sessionGone"
|
|
37
60
|
:label="t('nuxtUiMongocamp.errors.loginAgain')"
|
|
38
|
-
:to="loginPath ?? '/'"
|
|
39
61
|
color="error"
|
|
40
62
|
variant="subtle"
|
|
41
63
|
icon="i-lucide-log-in"
|
|
64
|
+
@click="loginAgain"
|
|
42
65
|
/>
|
|
43
66
|
<UButton
|
|
44
67
|
v-else
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Grant } from '@sfxcode/nuxt-mongocamp-server';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
grants: Grant[];
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, h, resolveComponent } from "vue";
|
|
3
|
+
import { useI18n } from "#imports";
|
|
4
|
+
defineProps({
|
|
5
|
+
grants: { type: Array, required: true }
|
|
6
|
+
});
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
const UBadge = resolveComponent("UBadge");
|
|
9
|
+
function flag(value) {
|
|
10
|
+
return h(UBadge, {
|
|
11
|
+
label: value ? t("nuxtUiMongocamp.common.yes") : t("nuxtUiMongocamp.common.no"),
|
|
12
|
+
color: value ? "success" : "neutral",
|
|
13
|
+
variant: "subtle"
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
const columns = computed(() => [
|
|
17
|
+
{ accessorKey: "name", header: t("nuxtUiMongocamp.roleGrants.columnCollection") },
|
|
18
|
+
{
|
|
19
|
+
accessorKey: "grantType",
|
|
20
|
+
header: t("nuxtUiMongocamp.roleGrants.columnType"),
|
|
21
|
+
cell: ({ row }) => h(UBadge, { label: row.original.grantType, color: "neutral", variant: "subtle" })
|
|
22
|
+
},
|
|
23
|
+
{ accessorKey: "read", header: t("nuxtUiMongocamp.roleGrants.columnRead"), cell: ({ row }) => flag(row.original.read) },
|
|
24
|
+
{ accessorKey: "write", header: t("nuxtUiMongocamp.roleGrants.columnWrite"), cell: ({ row }) => flag(row.original.write) },
|
|
25
|
+
{ accessorKey: "administrate", header: t("nuxtUiMongocamp.roleGrants.columnAdmin"), cell: ({ row }) => flag(row.original.administrate) }
|
|
26
|
+
]);
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<UTable
|
|
31
|
+
:data="grants"
|
|
32
|
+
:columns="columns"
|
|
33
|
+
>
|
|
34
|
+
<template #empty>
|
|
35
|
+
<MongocampEmptyState :title="t('nuxtUiMongocamp.empty.grants')" />
|
|
36
|
+
</template>
|
|
37
|
+
</UTable>
|
|
38
|
+
</template>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Grant } from '@sfxcode/nuxt-mongocamp-server';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
grants: Grant[];
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -165,6 +165,16 @@ async function handleDeleteRole() {
|
|
|
165
165
|
deleting.value = false;
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
|
+
const isDetailOpen = ref(false);
|
|
169
|
+
const detail = ref(null);
|
|
170
|
+
function openDetail(role) {
|
|
171
|
+
detail.value = {
|
|
172
|
+
name: role.name,
|
|
173
|
+
isAdmin: role.isAdmin,
|
|
174
|
+
grants: (role.collectionGrants ?? []).map((g) => ({ ...g }))
|
|
175
|
+
};
|
|
176
|
+
isDetailOpen.value = true;
|
|
177
|
+
}
|
|
168
178
|
const UBadge = resolveComponent("UBadge");
|
|
169
179
|
const UButton = resolveComponent("UButton");
|
|
170
180
|
const UTooltip = resolveComponent("UTooltip");
|
|
@@ -210,6 +220,14 @@ const columns = computed(() => [
|
|
|
210
220
|
id: "actions",
|
|
211
221
|
header: "",
|
|
212
222
|
cell: ({ row }) => h("div", { class: "flex gap-1 justify-end" }, [
|
|
223
|
+
withTooltip(t("nuxtUiMongocamp.roles.detailsTooltip"), h(UButton, {
|
|
224
|
+
"icon": "i-lucide-info",
|
|
225
|
+
"color": "neutral",
|
|
226
|
+
"variant": "ghost",
|
|
227
|
+
"size": "sm",
|
|
228
|
+
"aria-label": t("nuxtUiMongocamp.roles.detailsTooltip"),
|
|
229
|
+
"onClick": () => openDetail(row.original)
|
|
230
|
+
})),
|
|
213
231
|
withTooltip(t("nuxtUiMongocamp.roles.manageGrantsTooltip"), h(UButton, {
|
|
214
232
|
"icon": "i-lucide-key",
|
|
215
233
|
"color": "neutral",
|
|
@@ -412,5 +430,32 @@ fetchRoles();
|
|
|
412
430
|
/>
|
|
413
431
|
</template>
|
|
414
432
|
</UModal>
|
|
433
|
+
|
|
434
|
+
<USlideover
|
|
435
|
+
v-model:open="isDetailOpen"
|
|
436
|
+
:title="t('nuxtUiMongocamp.roles.detailsTitle', { roleName: detail?.name ?? '' })"
|
|
437
|
+
:ui="{ content: 'sm:max-w-xl' }"
|
|
438
|
+
>
|
|
439
|
+
<template #body>
|
|
440
|
+
<div
|
|
441
|
+
v-if="detail"
|
|
442
|
+
class="flex flex-col gap-4"
|
|
443
|
+
>
|
|
444
|
+
<div class="flex items-center gap-2">
|
|
445
|
+
<UBadge
|
|
446
|
+
:label="detail.isAdmin ? t('nuxtUiMongocamp.common.admin') : t('nuxtUiMongocamp.common.standard')"
|
|
447
|
+
:color="detail.isAdmin ? 'error' : 'neutral'"
|
|
448
|
+
variant="subtle"
|
|
449
|
+
/>
|
|
450
|
+
</div>
|
|
451
|
+
<section class="flex flex-col gap-2">
|
|
452
|
+
<h3 class="text-sm font-semibold">
|
|
453
|
+
{{ t("nuxtUiMongocamp.roles.detailsGrants") }}
|
|
454
|
+
</h3>
|
|
455
|
+
<MongocampGrantList :grants="detail.grants" />
|
|
456
|
+
</section>
|
|
457
|
+
</div>
|
|
458
|
+
</template>
|
|
459
|
+
</USlideover>
|
|
415
460
|
</div>
|
|
416
461
|
</template>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, h, ref, resolveComponent, watch } from "vue";
|
|
3
|
+
import { useI18n, useMongocampRoles, useMongocampSystem } from "#imports";
|
|
4
|
+
import { MASKED_VALUE } from "../utils/configRows";
|
|
5
|
+
const PAGE_SIZE = 10;
|
|
6
|
+
const { t } = useI18n();
|
|
7
|
+
const { getSettings, listConfigurations } = useMongocampSystem();
|
|
8
|
+
const { isAdmin } = useMongocampRoles();
|
|
9
|
+
const configurations = ref([]);
|
|
10
|
+
const plugins = ref(null);
|
|
11
|
+
const loading = ref(false);
|
|
12
|
+
const loadError = ref(null);
|
|
13
|
+
const search = ref("");
|
|
14
|
+
const page = ref(1);
|
|
15
|
+
async function fetchSettings() {
|
|
16
|
+
if (!isAdmin.value) return;
|
|
17
|
+
loading.value = true;
|
|
18
|
+
loadError.value = null;
|
|
19
|
+
try {
|
|
20
|
+
const [loadedPlugins, rows] = await Promise.all([getSettings(), listConfigurations()]);
|
|
21
|
+
plugins.value = loadedPlugins;
|
|
22
|
+
configurations.value = rows;
|
|
23
|
+
} catch (e) {
|
|
24
|
+
loadError.value = e;
|
|
25
|
+
plugins.value = null;
|
|
26
|
+
configurations.value = [];
|
|
27
|
+
} finally {
|
|
28
|
+
loading.value = false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const filteredRows = computed(() => {
|
|
32
|
+
const needle = search.value.trim().toLowerCase();
|
|
33
|
+
if (!needle) return configurations.value;
|
|
34
|
+
return configurations.value.filter(
|
|
35
|
+
(row) => [row.key, row.value, row.comment, row.configType].some((text) => text.toLowerCase().includes(needle))
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
const pageRows = computed(() => filteredRows.value.slice((page.value - 1) * PAGE_SIZE, page.value * PAGE_SIZE));
|
|
39
|
+
watch(() => filteredRows.value.length, () => {
|
|
40
|
+
page.value = 1;
|
|
41
|
+
});
|
|
42
|
+
const UBadge = resolveComponent("UBadge");
|
|
43
|
+
const columns = computed(() => [
|
|
44
|
+
{
|
|
45
|
+
accessorKey: "key",
|
|
46
|
+
header: t("nuxtUiMongocamp.settings.columnKey"),
|
|
47
|
+
cell: ({ row }) => h("div", { class: "flex flex-col" }, [
|
|
48
|
+
h("span", { class: "font-mono text-xs" }, row.original.key),
|
|
49
|
+
row.original.comment ? h("span", { class: "text-xs text-dimmed" }, row.original.comment) : null
|
|
50
|
+
])
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
accessorKey: "value",
|
|
54
|
+
header: t("nuxtUiMongocamp.settings.columnValue"),
|
|
55
|
+
cell: ({ row }) => row.original.masked ? h(UBadge, { label: MASKED_VALUE, color: "neutral", variant: "subtle", title: t("nuxtUiMongocamp.settings.maskedHint") }) : h("span", { class: "font-mono text-xs break-all" }, row.original.value)
|
|
56
|
+
},
|
|
57
|
+
{ accessorKey: "configType", header: t("nuxtUiMongocamp.settings.columnType") },
|
|
58
|
+
{
|
|
59
|
+
accessorKey: "needsRestart",
|
|
60
|
+
header: t("nuxtUiMongocamp.settings.columnRestart"),
|
|
61
|
+
cell: ({ row }) => row.original.needsRestart ? h(UBadge, { label: t("nuxtUiMongocamp.settings.restartNeeded"), color: "warning", variant: "subtle" }) : h("span", { class: "text-dimmed" }, "\u2014")
|
|
62
|
+
}
|
|
63
|
+
]);
|
|
64
|
+
const pluginGroups = computed(() => [
|
|
65
|
+
{ key: "routes", label: t("nuxtUiMongocamp.settings.routesPlugins"), items: plugins.value?.routesPlugins ?? [] },
|
|
66
|
+
{ key: "file", label: t("nuxtUiMongocamp.settings.filePlugins"), items: plugins.value?.filePlugins ?? [] },
|
|
67
|
+
{ key: "ignored", label: t("nuxtUiMongocamp.settings.ignoredPlugins"), items: plugins.value?.ignoredPlugins ?? [] }
|
|
68
|
+
]);
|
|
69
|
+
fetchSettings();
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<template>
|
|
73
|
+
<div class="flex flex-col gap-4">
|
|
74
|
+
<div class="flex items-center justify-between gap-4">
|
|
75
|
+
<h2 class="text-xl font-semibold">
|
|
76
|
+
{{ t("nuxtUiMongocamp.settings.heading") }}
|
|
77
|
+
</h2>
|
|
78
|
+
<UTooltip
|
|
79
|
+
v-if="isAdmin"
|
|
80
|
+
:text="t('nuxtUiMongocamp.common.refresh')"
|
|
81
|
+
>
|
|
82
|
+
<UButton
|
|
83
|
+
icon="i-lucide-refresh-cw"
|
|
84
|
+
color="neutral"
|
|
85
|
+
variant="ghost"
|
|
86
|
+
:loading="loading"
|
|
87
|
+
:aria-label="t('nuxtUiMongocamp.common.refresh')"
|
|
88
|
+
@click="fetchSettings"
|
|
89
|
+
/>
|
|
90
|
+
</UTooltip>
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
<UAlert
|
|
94
|
+
v-if="!isAdmin"
|
|
95
|
+
color="neutral"
|
|
96
|
+
variant="subtle"
|
|
97
|
+
icon="i-lucide-lock"
|
|
98
|
+
:description="t('nuxtUiMongocamp.settings.adminOnly')"
|
|
99
|
+
/>
|
|
100
|
+
|
|
101
|
+
<template v-else>
|
|
102
|
+
<MongocampErrorAlert
|
|
103
|
+
:error="loadError"
|
|
104
|
+
:title="t('nuxtUiMongocamp.settings.loadFailedTitle')"
|
|
105
|
+
@retry="fetchSettings"
|
|
106
|
+
/>
|
|
107
|
+
|
|
108
|
+
<UCard v-if="plugins">
|
|
109
|
+
<template #header>
|
|
110
|
+
<span class="font-semibold">{{ t("nuxtUiMongocamp.settings.pluginsHeading") }}</span>
|
|
111
|
+
</template>
|
|
112
|
+
<div class="grid gap-4 sm:grid-cols-3">
|
|
113
|
+
<section
|
|
114
|
+
v-for="group in pluginGroups"
|
|
115
|
+
:key="group.key"
|
|
116
|
+
class="flex flex-col gap-1"
|
|
117
|
+
>
|
|
118
|
+
<h3 class="text-sm font-semibold">
|
|
119
|
+
{{ group.label }}
|
|
120
|
+
</h3>
|
|
121
|
+
<div
|
|
122
|
+
v-if="group.items.length"
|
|
123
|
+
class="flex flex-wrap gap-1"
|
|
124
|
+
>
|
|
125
|
+
<UBadge
|
|
126
|
+
v-for="item in group.items"
|
|
127
|
+
:key="item"
|
|
128
|
+
:label="item"
|
|
129
|
+
color="neutral"
|
|
130
|
+
variant="subtle"
|
|
131
|
+
size="sm"
|
|
132
|
+
/>
|
|
133
|
+
</div>
|
|
134
|
+
<p
|
|
135
|
+
v-else
|
|
136
|
+
class="text-sm text-dimmed"
|
|
137
|
+
>
|
|
138
|
+
{{ t("nuxtUiMongocamp.settings.noPlugins") }}
|
|
139
|
+
</p>
|
|
140
|
+
</section>
|
|
141
|
+
</div>
|
|
142
|
+
</UCard>
|
|
143
|
+
|
|
144
|
+
<div class="flex flex-wrap items-center justify-between gap-2">
|
|
145
|
+
<UInput
|
|
146
|
+
v-model="search"
|
|
147
|
+
icon="i-lucide-search"
|
|
148
|
+
:placeholder="t('nuxtUiMongocamp.settings.searchPlaceholder')"
|
|
149
|
+
size="sm"
|
|
150
|
+
class="w-full max-w-xs"
|
|
151
|
+
/>
|
|
152
|
+
<p class="text-xs text-dimmed">
|
|
153
|
+
{{ t("nuxtUiMongocamp.settings.maskedNote") }}
|
|
154
|
+
</p>
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
<UTable
|
|
158
|
+
:data="pageRows"
|
|
159
|
+
:columns="columns"
|
|
160
|
+
:loading="loading"
|
|
161
|
+
>
|
|
162
|
+
<template #empty>
|
|
163
|
+
<MongocampEmptyState :title="t('nuxtUiMongocamp.settings.empty')" />
|
|
164
|
+
</template>
|
|
165
|
+
</UTable>
|
|
166
|
+
|
|
167
|
+
<div
|
|
168
|
+
v-if="filteredRows.length > PAGE_SIZE"
|
|
169
|
+
class="flex justify-end"
|
|
170
|
+
>
|
|
171
|
+
<UPagination
|
|
172
|
+
v-model:page="page"
|
|
173
|
+
:total="filteredRows.length"
|
|
174
|
+
:items-per-page="PAGE_SIZE"
|
|
175
|
+
/>
|
|
176
|
+
</div>
|
|
177
|
+
</template>
|
|
178
|
+
</div>
|
|
179
|
+
</template>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|