@sfxcode/nuxt-ui-mongocamp 1.5.1 → 1.5.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/dist/module.d.mts +15 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +25 -4
- package/dist/runtime/assets/formkit.css +1 -0
- package/dist/runtime/components/MongocampAccount.vue +4 -4
- package/dist/runtime/components/MongocampBucketFiles.d.vue.ts +21 -1
- package/dist/runtime/components/MongocampBucketFiles.vue +17 -5
- package/dist/runtime/components/MongocampBucketFiles.vue.d.ts +21 -1
- package/dist/runtime/components/MongocampCollectionData.d.vue.ts +22 -2
- package/dist/runtime/components/MongocampCollectionData.vue +31 -9
- package/dist/runtime/components/MongocampCollectionData.vue.d.ts +22 -2
- package/dist/runtime/components/MongocampCollectionInfos.vue +12 -12
- package/dist/runtime/components/MongocampCollections.d.vue.ts +19 -1
- package/dist/runtime/components/MongocampCollections.vue +20 -7
- package/dist/runtime/components/MongocampCollections.vue.d.ts +19 -1
- package/dist/runtime/components/MongocampCommandPalette.d.vue.ts +0 -7
- package/dist/runtime/components/MongocampCommandPalette.vue +16 -15
- package/dist/runtime/components/MongocampCommandPalette.vue.d.ts +0 -7
- package/dist/runtime/components/MongocampDashboard.d.vue.ts +3 -3
- package/dist/runtime/components/MongocampDashboard.vue +19 -12
- package/dist/runtime/components/MongocampDashboard.vue.d.ts +3 -3
- package/dist/runtime/components/MongocampDatabases.d.vue.ts +20 -1
- package/dist/runtime/components/MongocampDatabases.vue +15 -2
- package/dist/runtime/components/MongocampDatabases.vue.d.ts +20 -1
- package/dist/runtime/components/MongocampIndexes.vue +1 -1
- package/dist/runtime/components/MongocampJobs.d.vue.ts +23 -1
- package/dist/runtime/components/MongocampJobs.vue +18 -4
- package/dist/runtime/components/MongocampJobs.vue.d.ts +23 -1
- package/dist/runtime/components/MongocampLogin.d.vue.ts +16 -1
- package/dist/runtime/components/MongocampLogin.vue +13 -5
- package/dist/runtime/components/MongocampLogin.vue.d.ts +16 -1
- package/dist/runtime/components/MongocampPermissionMatrix.d.vue.ts +19 -2
- package/dist/runtime/components/MongocampPermissionMatrix.vue +15 -6
- package/dist/runtime/components/MongocampPermissionMatrix.vue.d.ts +19 -2
- package/dist/runtime/components/MongocampRoleGrants.d.vue.ts +22 -1
- package/dist/runtime/components/MongocampRoleGrants.vue +16 -4
- package/dist/runtime/components/MongocampRoleGrants.vue.d.ts +22 -1
- package/dist/runtime/components/MongocampRoles.d.vue.ts +22 -1
- package/dist/runtime/components/MongocampRoles.vue +22 -5
- package/dist/runtime/components/MongocampRoles.vue.d.ts +22 -1
- package/dist/runtime/components/MongocampServerInfo.d.vue.ts +2 -2
- package/dist/runtime/components/MongocampServerInfo.vue +14 -4
- package/dist/runtime/components/MongocampServerInfo.vue.d.ts +2 -2
- package/dist/runtime/components/MongocampServerOverview.d.vue.ts +18 -4
- package/dist/runtime/components/MongocampServerOverview.vue +33 -22
- package/dist/runtime/components/MongocampServerOverview.vue.d.ts +18 -4
- package/dist/runtime/components/MongocampServerStatus.d.vue.ts +13 -0
- package/dist/runtime/components/MongocampServerStatus.vue +147 -0
- package/dist/runtime/components/MongocampServerStatus.vue.d.ts +13 -0
- package/dist/runtime/components/MongocampSettings.d.vue.ts +1 -1
- package/dist/runtime/components/MongocampSettings.vue.d.ts +1 -1
- package/dist/runtime/components/MongocampUserAccess.d.vue.ts +27 -0
- package/dist/runtime/components/MongocampUserAccess.vue +168 -0
- package/dist/runtime/components/MongocampUserAccess.vue.d.ts +27 -0
- package/dist/runtime/components/MongocampUsers.d.vue.ts +24 -1
- package/dist/runtime/components/MongocampUsers.vue +22 -4
- package/dist/runtime/components/MongocampUsers.vue.d.ts +24 -1
- package/dist/runtime/components/MongocampVersion.vue +3 -3
- package/dist/runtime/composables/useMongocampAdminGate.js +2 -3
- package/dist/runtime/composables/useMongocampBreadcrumbs.d.ts +12 -0
- package/dist/runtime/composables/useMongocampBreadcrumbs.js +13 -0
- package/dist/runtime/composables/useMongocampCollectionNames.d.ts +21 -0
- package/dist/runtime/composables/useMongocampCollectionNames.js +46 -0
- package/dist/runtime/composables/useMongocampNavigation.d.ts +32 -0
- package/dist/runtime/composables/useMongocampNavigation.js +15 -0
- package/dist/runtime/composables/useMongocampPaths.d.ts +6 -0
- package/dist/runtime/composables/useMongocampPaths.js +6 -0
- package/dist/runtime/composables/useMongocampPermissions.js +2 -3
- package/dist/runtime/composables/useMongocampProxyMode.d.ts +5 -0
- package/dist/runtime/composables/useMongocampProxyMode.js +4 -0
- package/dist/runtime/composables/useMongocampRoles.d.ts +3 -0
- package/dist/runtime/composables/useMongocampRoles.js +5 -1
- package/dist/runtime/composables/useMongocampSession.js +2 -3
- package/dist/runtime/formkit.config.d.ts +3 -0
- package/dist/runtime/formkit.config.js +9 -0
- package/dist/runtime/locales/de.json +42 -0
- package/dist/runtime/locales/en.json +42 -0
- package/dist/runtime/publicUtils.d.ts +4 -0
- package/dist/runtime/publicUtils.js +4 -0
- package/dist/runtime/utils/collectionNames.d.ts +13 -0
- package/dist/runtime/utils/collectionNames.js +14 -0
- package/dist/runtime/utils/collectionProtection.d.ts +2 -0
- package/dist/runtime/utils/collectionProtection.js +3 -0
- package/dist/runtime/utils/navigation.d.ts +39 -0
- package/dist/runtime/utils/navigation.js +65 -0
- package/dist/runtime/utils/paths.d.ts +32 -0
- package/dist/runtime/utils/paths.js +24 -0
- package/dist/runtime/utils/serverStatus.d.ts +20 -0
- package/dist/runtime/utils/serverStatus.js +11 -0
- package/package.json +8 -1
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
redirectPath?: string;
|
|
3
|
+
hideHeading?: boolean;
|
|
3
4
|
};
|
|
4
|
-
declare const
|
|
5
|
+
declare const __VLS_template: () => {
|
|
6
|
+
__VLS_Slots: {
|
|
7
|
+
header?: (props: {}) => any;
|
|
8
|
+
} & {
|
|
9
|
+
footer?: (props: {}) => any;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
13
|
+
declare const __VLS_base: 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>;
|
|
14
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
5
15
|
declare const _default: typeof __VLS_export;
|
|
6
16
|
export default _default;
|
|
17
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
18
|
+
new (): {
|
|
19
|
+
$slots: S;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -2,11 +2,28 @@ type __VLS_Props = {
|
|
|
2
2
|
grantsPath?: string;
|
|
3
3
|
maxCollections?: number;
|
|
4
4
|
maxUsers?: number;
|
|
5
|
+
hideHeading?: boolean;
|
|
6
|
+
hideRefresh?: boolean;
|
|
5
7
|
};
|
|
6
|
-
declare
|
|
7
|
-
|
|
8
|
+
declare function load(): Promise<void>;
|
|
9
|
+
declare const __VLS_template: () => {
|
|
10
|
+
__VLS_Slots: {
|
|
11
|
+
toolbar?: (props: {}) => any;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
15
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
16
|
+
refresh: typeof load;
|
|
17
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
18
|
+
hideHeading: boolean;
|
|
8
19
|
maxCollections: number;
|
|
9
20
|
maxUsers: number;
|
|
10
21
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
23
|
declare const _default: typeof __VLS_export;
|
|
12
24
|
export default _default;
|
|
25
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
26
|
+
new (): {
|
|
27
|
+
$slots: S;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, ref } from "vue";
|
|
3
|
-
import { useI18n } from "#imports";
|
|
3
|
+
import { useI18n, useMongocampPaths } from "#imports";
|
|
4
4
|
import useMongocampAdmin from "../composables/useMongocampAdmin";
|
|
5
5
|
import {
|
|
6
6
|
buildPermissionMatrix,
|
|
@@ -14,11 +14,14 @@ import {
|
|
|
14
14
|
import { downloadTextFile, rowsToCsv } from "../utils/exportRows";
|
|
15
15
|
import { isBucketMemberCollection } from "../utils/collectionProtection";
|
|
16
16
|
const props = defineProps({
|
|
17
|
-
grantsPath: { type: String, required: false
|
|
17
|
+
grantsPath: { type: String, required: false },
|
|
18
18
|
maxCollections: { type: Number, required: false, default: 60 },
|
|
19
|
-
maxUsers: { type: Number, required: false, default: 200 }
|
|
19
|
+
maxUsers: { type: Number, required: false, default: 200 },
|
|
20
|
+
hideHeading: { type: Boolean, required: false, default: false },
|
|
21
|
+
hideRefresh: { type: Boolean, required: false }
|
|
20
22
|
});
|
|
21
23
|
const { t } = useI18n();
|
|
24
|
+
const paths = useMongocampPaths();
|
|
22
25
|
const { listUsers, listRoles, listCollections } = useMongocampAdmin();
|
|
23
26
|
const matrix = ref(null);
|
|
24
27
|
const roleNames = ref([]);
|
|
@@ -89,6 +92,7 @@ function exportCsv() {
|
|
|
89
92
|
const { keys, rows } = matrixToCsvRows({ ...shown.value, users: users.value, collections: collections.value });
|
|
90
93
|
downloadTextFile(`permissions-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.csv`, rowsToCsv(rows, keys), "text/csv");
|
|
91
94
|
}
|
|
95
|
+
defineExpose({ refresh: load });
|
|
92
96
|
</script>
|
|
93
97
|
|
|
94
98
|
<template>
|
|
@@ -97,7 +101,10 @@ function exportCsv() {
|
|
|
97
101
|
data-test="permission-matrix"
|
|
98
102
|
>
|
|
99
103
|
<div class="flex flex-wrap items-start justify-between gap-2">
|
|
100
|
-
<div
|
|
104
|
+
<div
|
|
105
|
+
v-if="!hideHeading"
|
|
106
|
+
class="flex flex-col gap-1"
|
|
107
|
+
>
|
|
101
108
|
<h2 class="text-xl font-semibold">
|
|
102
109
|
{{ t("nuxtUiMongocamp.permissionMatrix.heading") }}
|
|
103
110
|
</h2>
|
|
@@ -105,7 +112,7 @@ function exportCsv() {
|
|
|
105
112
|
{{ t("nuxtUiMongocamp.permissionMatrix.subtitle") }}
|
|
106
113
|
</p>
|
|
107
114
|
</div>
|
|
108
|
-
<div class="flex items-center gap-1">
|
|
115
|
+
<div class="ml-auto flex items-center gap-1">
|
|
109
116
|
<UButton
|
|
110
117
|
icon="i-lucide-arrow-left-right"
|
|
111
118
|
color="neutral"
|
|
@@ -124,6 +131,7 @@ function exportCsv() {
|
|
|
124
131
|
@click="exportCsv"
|
|
125
132
|
/>
|
|
126
133
|
<UButton
|
|
134
|
+
v-if="!hideRefresh"
|
|
127
135
|
icon="i-lucide-refresh-cw"
|
|
128
136
|
color="neutral"
|
|
129
137
|
variant="ghost"
|
|
@@ -131,6 +139,7 @@ function exportCsv() {
|
|
|
131
139
|
:aria-label="t('nuxtUiMongocamp.permissionMatrix.refresh')"
|
|
132
140
|
@click="load"
|
|
133
141
|
/>
|
|
142
|
+
<slot name="toolbar" />
|
|
134
143
|
</div>
|
|
135
144
|
</div>
|
|
136
145
|
|
|
@@ -261,7 +270,7 @@ function exportCsv() {
|
|
|
261
270
|
<NuxtLink
|
|
262
271
|
v-for="roleName in userByName.get(row).roles"
|
|
263
272
|
:key="roleName"
|
|
264
|
-
:to="`${grantsPath}/${roleName}`"
|
|
273
|
+
:to="`${grantsPath ?? paths.roles}/${roleName}`"
|
|
265
274
|
class="rounded bg-elevated px-1.5 py-0.5 text-xs hover:underline"
|
|
266
275
|
:class="userByName.get(row).unknownRoles.includes(roleName) ? 'text-warning' : 'text-dimmed'"
|
|
267
276
|
:title="userByName.get(row).unknownRoles.includes(roleName) ? t('nuxtUiMongocamp.permissionMatrix.unknownRoleNote') : t('nuxtUiMongocamp.permissionMatrix.openRole', { role: roleName })"
|
|
@@ -2,11 +2,28 @@ type __VLS_Props = {
|
|
|
2
2
|
grantsPath?: string;
|
|
3
3
|
maxCollections?: number;
|
|
4
4
|
maxUsers?: number;
|
|
5
|
+
hideHeading?: boolean;
|
|
6
|
+
hideRefresh?: boolean;
|
|
5
7
|
};
|
|
6
|
-
declare
|
|
7
|
-
|
|
8
|
+
declare function load(): Promise<void>;
|
|
9
|
+
declare const __VLS_template: () => {
|
|
10
|
+
__VLS_Slots: {
|
|
11
|
+
toolbar?: (props: {}) => any;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
15
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
16
|
+
refresh: typeof load;
|
|
17
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
18
|
+
hideHeading: boolean;
|
|
8
19
|
maxCollections: number;
|
|
9
20
|
maxUsers: number;
|
|
10
21
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
23
|
declare const _default: typeof __VLS_export;
|
|
12
24
|
export default _default;
|
|
25
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
26
|
+
new (): {
|
|
27
|
+
$slots: S;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
roleName: string;
|
|
3
|
+
hideHeading?: boolean;
|
|
4
|
+
hideRefresh?: boolean;
|
|
3
5
|
};
|
|
4
|
-
declare
|
|
6
|
+
declare function fetchRole(): Promise<void>;
|
|
7
|
+
declare const __VLS_template: () => {
|
|
8
|
+
__VLS_Slots: {
|
|
9
|
+
toolbar?: (props: {}) => any;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
13
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
14
|
+
refresh: typeof fetchRole;
|
|
15
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
|
+
changed: () => any;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
18
|
+
onChanged?: (() => any) | undefined;
|
|
19
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
5
21
|
declare const _default: typeof __VLS_export;
|
|
6
22
|
export default _default;
|
|
23
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
24
|
+
new (): {
|
|
25
|
+
$slots: S;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -4,8 +4,11 @@ import { useI18n, useMongocampError } from "#imports";
|
|
|
4
4
|
import useMongocampAdmin from "../composables/useMongocampAdmin";
|
|
5
5
|
import { useMongocampAdminGate } from "../composables/useMongocampAdminGate";
|
|
6
6
|
const props = defineProps({
|
|
7
|
-
roleName: { type: String, required: true }
|
|
7
|
+
roleName: { type: String, required: true },
|
|
8
|
+
hideHeading: { type: Boolean, required: false },
|
|
9
|
+
hideRefresh: { type: Boolean, required: false }
|
|
8
10
|
});
|
|
11
|
+
const emit = defineEmits(["changed"]);
|
|
9
12
|
const { t } = useI18n();
|
|
10
13
|
const { describeServerError } = useMongocampError();
|
|
11
14
|
const { listRoles, updateRole, listCollections } = useMongocampAdmin();
|
|
@@ -99,6 +102,7 @@ async function saveGrants(next) {
|
|
|
99
102
|
saving.value = false;
|
|
100
103
|
}
|
|
101
104
|
await fetchRole();
|
|
105
|
+
emit("changed");
|
|
102
106
|
return true;
|
|
103
107
|
}
|
|
104
108
|
async function handleAddGrant() {
|
|
@@ -226,6 +230,7 @@ if (!blocked.value) {
|
|
|
226
230
|
fetchRole();
|
|
227
231
|
fetchCollections();
|
|
228
232
|
}
|
|
233
|
+
defineExpose({ refresh: fetchRole });
|
|
229
234
|
</script>
|
|
230
235
|
|
|
231
236
|
<template>
|
|
@@ -240,11 +245,17 @@ if (!blocked.value) {
|
|
|
240
245
|
class="flex flex-col gap-4"
|
|
241
246
|
>
|
|
242
247
|
<div class="flex items-center justify-between">
|
|
243
|
-
<h2
|
|
248
|
+
<h2
|
|
249
|
+
v-if="!hideHeading"
|
|
250
|
+
class="text-xl font-semibold"
|
|
251
|
+
>
|
|
244
252
|
{{ t("nuxtUiMongocamp.roleGrants.heading", { roleName }) }}
|
|
245
253
|
</h2>
|
|
246
|
-
<div class="flex gap-2">
|
|
247
|
-
<UTooltip
|
|
254
|
+
<div class="ml-auto flex gap-2">
|
|
255
|
+
<UTooltip
|
|
256
|
+
v-if="!hideRefresh"
|
|
257
|
+
:text="t('nuxtUiMongocamp.common.refresh')"
|
|
258
|
+
>
|
|
248
259
|
<UButton
|
|
249
260
|
icon="i-lucide-refresh-cw"
|
|
250
261
|
color="neutral"
|
|
@@ -254,6 +265,7 @@ if (!blocked.value) {
|
|
|
254
265
|
@click="fetchRole"
|
|
255
266
|
/>
|
|
256
267
|
</UTooltip>
|
|
268
|
+
<slot name="toolbar" />
|
|
257
269
|
<UTooltip :text="t('nuxtUiMongocamp.roleGrants.addAllReadTooltip')">
|
|
258
270
|
<UButton
|
|
259
271
|
icon="i-lucide-eye"
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
roleName: string;
|
|
3
|
+
hideHeading?: boolean;
|
|
4
|
+
hideRefresh?: boolean;
|
|
3
5
|
};
|
|
4
|
-
declare
|
|
6
|
+
declare function fetchRole(): Promise<void>;
|
|
7
|
+
declare const __VLS_template: () => {
|
|
8
|
+
__VLS_Slots: {
|
|
9
|
+
toolbar?: (props: {}) => any;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
13
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
14
|
+
refresh: typeof fetchRole;
|
|
15
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
|
+
changed: () => any;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
18
|
+
onChanged?: (() => any) | undefined;
|
|
19
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
5
21
|
declare const _default: typeof __VLS_export;
|
|
6
22
|
export default _default;
|
|
23
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
24
|
+
new (): {
|
|
25
|
+
$slots: S;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
grantsPath?: string;
|
|
3
|
+
hideHeading?: boolean;
|
|
4
|
+
hideRefresh?: boolean;
|
|
3
5
|
};
|
|
4
|
-
declare
|
|
6
|
+
declare function fetchRoles(): Promise<void>;
|
|
7
|
+
declare const __VLS_template: () => {
|
|
8
|
+
__VLS_Slots: {
|
|
9
|
+
toolbar?: (props: {}) => any;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
13
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
14
|
+
refresh: typeof fetchRoles;
|
|
15
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
|
+
changed: () => any;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
18
|
+
onChanged?: (() => any) | undefined;
|
|
19
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
5
21
|
declare const _default: typeof __VLS_export;
|
|
6
22
|
export default _default;
|
|
23
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
24
|
+
new (): {
|
|
25
|
+
$slots: S;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, h, reactive, ref, resolveComponent } from "vue";
|
|
3
|
-
import { useI18n, useMongocampError } from "#imports";
|
|
3
|
+
import { useI18n, useMongocampError, useMongocampPaths } from "#imports";
|
|
4
4
|
import useMongocampAdmin from "../composables/useMongocampAdmin";
|
|
5
5
|
import { runBulkDelete } from "../utils/bulkDelete";
|
|
6
6
|
import { createSelectColumn } from "../utils/createSelectColumn";
|
|
7
7
|
import { useMongocampAdminGate } from "../composables/useMongocampAdminGate";
|
|
8
8
|
const props = defineProps({
|
|
9
|
-
grantsPath: { type: String, required: false }
|
|
9
|
+
grantsPath: { type: String, required: false },
|
|
10
|
+
hideHeading: { type: Boolean, required: false },
|
|
11
|
+
hideRefresh: { type: Boolean, required: false }
|
|
10
12
|
});
|
|
13
|
+
const emit = defineEmits(["changed"]);
|
|
11
14
|
const { t } = useI18n();
|
|
15
|
+
const paths = useMongocampPaths();
|
|
12
16
|
const { listRoles, addRole, updateRole, deleteRole } = useMongocampAdmin();
|
|
13
17
|
const roles = ref([]);
|
|
14
18
|
const loading = ref(false);
|
|
@@ -75,6 +79,7 @@ async function handleBulkDelete() {
|
|
|
75
79
|
try {
|
|
76
80
|
const { failed } = await runBulkDelete(names, (name) => deleteRole(name));
|
|
77
81
|
await fetchRoles();
|
|
82
|
+
emit("changed");
|
|
78
83
|
if (failed.length > 0) {
|
|
79
84
|
rowSelection.value = Object.fromEntries(failed.map((f) => [f.item, true]));
|
|
80
85
|
bulkError.value = t("nuxtUiMongocamp.bulk.partialFailure", { failed: failed.length, total: names.length, reason: describeError(failed[0].error).message });
|
|
@@ -108,6 +113,7 @@ async function handleAddRole() {
|
|
|
108
113
|
isAddModalOpen.value = false;
|
|
109
114
|
newRole.value = { name: "", isAdmin: false };
|
|
110
115
|
await fetchRoles();
|
|
116
|
+
emit("changed");
|
|
111
117
|
} catch (e) {
|
|
112
118
|
errorMessage.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.roles.errorAddRole");
|
|
113
119
|
}
|
|
@@ -123,6 +129,7 @@ async function handleEditRole() {
|
|
|
123
129
|
await updateRole(editRole.value.roleName, editRole.value.isAdmin, editGrants.value);
|
|
124
130
|
isEditModalOpen.value = false;
|
|
125
131
|
await fetchRoles();
|
|
132
|
+
emit("changed");
|
|
126
133
|
} catch (e) {
|
|
127
134
|
errorMessage.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.roles.errorEditRole");
|
|
128
135
|
}
|
|
@@ -141,6 +148,7 @@ async function handleCloneRole() {
|
|
|
141
148
|
await addRole(cloneRole.value.name, cloneRole.value.isAdmin, cloneGrants.value);
|
|
142
149
|
isCloneModalOpen.value = false;
|
|
143
150
|
await fetchRoles();
|
|
151
|
+
emit("changed");
|
|
144
152
|
} catch (e) {
|
|
145
153
|
cloneError.value = (await describeServerError(e, "nuxtUiMongocamp.roles.errorClone")).message;
|
|
146
154
|
} finally {
|
|
@@ -161,6 +169,7 @@ async function handleDeleteRole() {
|
|
|
161
169
|
await deleteRole(roleToDelete.value);
|
|
162
170
|
isDeleteModalOpen.value = false;
|
|
163
171
|
await fetchRoles();
|
|
172
|
+
emit("changed");
|
|
164
173
|
} catch (e) {
|
|
165
174
|
deleteError.value = (await describeServerError(e, "nuxtUiMongocamp.roles.errorDelete")).message;
|
|
166
175
|
} finally {
|
|
@@ -236,7 +245,7 @@ const columns = computed(() => [
|
|
|
236
245
|
"variant": "ghost",
|
|
237
246
|
"size": "sm",
|
|
238
247
|
"aria-label": t("nuxtUiMongocamp.roles.manageGrantsTooltip"),
|
|
239
|
-
"to":
|
|
248
|
+
"to": `${props.grantsPath || paths.roles}/${row.original.name}`
|
|
240
249
|
})),
|
|
241
250
|
withTooltip(t("nuxtUiMongocamp.roles.editRoleTooltip"), h(UButton, {
|
|
242
251
|
"icon": "i-lucide-pencil",
|
|
@@ -266,6 +275,7 @@ const columns = computed(() => [
|
|
|
266
275
|
}
|
|
267
276
|
]);
|
|
268
277
|
if (!blocked.value) fetchRoles();
|
|
278
|
+
defineExpose({ refresh: fetchRoles });
|
|
269
279
|
</script>
|
|
270
280
|
|
|
271
281
|
<template>
|
|
@@ -280,7 +290,10 @@ if (!blocked.value) fetchRoles();
|
|
|
280
290
|
class="flex flex-col gap-4"
|
|
281
291
|
>
|
|
282
292
|
<div class="flex items-center justify-between gap-4">
|
|
283
|
-
<h2
|
|
293
|
+
<h2
|
|
294
|
+
v-if="!hideHeading"
|
|
295
|
+
class="text-xl font-semibold"
|
|
296
|
+
>
|
|
284
297
|
{{ t("nuxtUiMongocamp.roles.heading") }}
|
|
285
298
|
</h2>
|
|
286
299
|
<div class="flex flex-1 items-center gap-2">
|
|
@@ -292,7 +305,10 @@ if (!blocked.value) fetchRoles();
|
|
|
292
305
|
class="flex-1 max-w-xs"
|
|
293
306
|
@input="onFilterInput"
|
|
294
307
|
/>
|
|
295
|
-
<UTooltip
|
|
308
|
+
<UTooltip
|
|
309
|
+
v-if="!hideRefresh"
|
|
310
|
+
:text="t('nuxtUiMongocamp.common.refresh')"
|
|
311
|
+
>
|
|
296
312
|
<UButton
|
|
297
313
|
icon="i-lucide-refresh-cw"
|
|
298
314
|
color="neutral"
|
|
@@ -302,6 +318,7 @@ if (!blocked.value) fetchRoles();
|
|
|
302
318
|
@click="fetchRoles"
|
|
303
319
|
/>
|
|
304
320
|
</UTooltip>
|
|
321
|
+
<slot name="toolbar" />
|
|
305
322
|
<UButton
|
|
306
323
|
icon="i-lucide-plus"
|
|
307
324
|
:label="t('nuxtUiMongocamp.roles.addRole')"
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
grantsPath?: string;
|
|
3
|
+
hideHeading?: boolean;
|
|
4
|
+
hideRefresh?: boolean;
|
|
3
5
|
};
|
|
4
|
-
declare
|
|
6
|
+
declare function fetchRoles(): Promise<void>;
|
|
7
|
+
declare const __VLS_template: () => {
|
|
8
|
+
__VLS_Slots: {
|
|
9
|
+
toolbar?: (props: {}) => any;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
13
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
14
|
+
refresh: typeof fetchRoles;
|
|
15
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
|
+
changed: () => any;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
18
|
+
onChanged?: (() => any) | undefined;
|
|
19
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
5
21
|
declare const _default: typeof __VLS_export;
|
|
6
22
|
export default _default;
|
|
23
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
24
|
+
new (): {
|
|
25
|
+
$slots: S;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -14,9 +14,9 @@ declare function refresh(): Promise<void>;
|
|
|
14
14
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
15
15
|
refresh: typeof refresh;
|
|
16
16
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
17
|
-
autoRefresh: number;
|
|
18
|
-
hideHeading: boolean;
|
|
19
17
|
hideRefresh: boolean;
|
|
18
|
+
hideHeading: boolean;
|
|
19
|
+
autoRefresh: number;
|
|
20
20
|
hideStats: boolean;
|
|
21
21
|
hideCapabilities: boolean;
|
|
22
22
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -215,7 +215,10 @@ defineExpose({ refresh });
|
|
|
215
215
|
<dt class="text-dimmed">
|
|
216
216
|
{{ t("nuxtUiMongocamp.serverInfo.connectionsCurrent") }}
|
|
217
217
|
</dt>
|
|
218
|
-
<dd
|
|
218
|
+
<dd
|
|
219
|
+
class="tabular-nums"
|
|
220
|
+
data-testid="connections-current"
|
|
221
|
+
>
|
|
219
222
|
{{ formatCount(stats.connections.current) }}
|
|
220
223
|
</dd>
|
|
221
224
|
</div>
|
|
@@ -223,13 +226,17 @@ defineExpose({ refresh });
|
|
|
223
226
|
<dt class="text-dimmed">
|
|
224
227
|
{{ t("nuxtUiMongocamp.serverInfo.connectionsAvailable") }}
|
|
225
228
|
</dt>
|
|
226
|
-
<dd
|
|
229
|
+
<dd class="tabular-nums">
|
|
230
|
+
{{ formatCount(stats.connections.available) }}
|
|
231
|
+
</dd>
|
|
227
232
|
</div>
|
|
228
233
|
<div class="flex justify-between gap-4">
|
|
229
234
|
<dt class="text-dimmed">
|
|
230
235
|
{{ t("nuxtUiMongocamp.serverInfo.connectionsTotal") }}
|
|
231
236
|
</dt>
|
|
232
|
-
<dd
|
|
237
|
+
<dd class="tabular-nums">
|
|
238
|
+
{{ formatCount(stats.connections.totalCreated) }}
|
|
239
|
+
</dd>
|
|
233
240
|
</div>
|
|
234
241
|
</dl>
|
|
235
242
|
</div>
|
|
@@ -246,7 +253,10 @@ defineExpose({ refresh });
|
|
|
246
253
|
<dt class="text-dimmed">
|
|
247
254
|
{{ counter.label }}
|
|
248
255
|
</dt>
|
|
249
|
-
<dd
|
|
256
|
+
<dd
|
|
257
|
+
class="tabular-nums"
|
|
258
|
+
:data-testid="`op-${counter.key}`"
|
|
259
|
+
>
|
|
250
260
|
{{ counter.value }}
|
|
251
261
|
</dd>
|
|
252
262
|
</div>
|
|
@@ -14,9 +14,9 @@ declare function refresh(): Promise<void>;
|
|
|
14
14
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
15
15
|
refresh: typeof refresh;
|
|
16
16
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
17
|
-
autoRefresh: number;
|
|
18
|
-
hideHeading: boolean;
|
|
19
17
|
hideRefresh: boolean;
|
|
18
|
+
hideHeading: boolean;
|
|
19
|
+
autoRefresh: number;
|
|
20
20
|
hideStats: boolean;
|
|
21
21
|
hideCapabilities: boolean;
|
|
22
22
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -6,15 +6,29 @@ type __VLS_Props = {
|
|
|
6
6
|
maxCollections?: number;
|
|
7
7
|
autoRefresh?: number;
|
|
8
8
|
hideCharts?: boolean;
|
|
9
|
+
hideHeading?: boolean;
|
|
10
|
+
hideRefresh?: boolean;
|
|
9
11
|
};
|
|
10
|
-
declare const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
declare const __VLS_template: () => {
|
|
13
|
+
__VLS_Slots: {
|
|
14
|
+
toolbar?: (props: {}) => any;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
18
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
19
|
+
refresh: () => Promise<void>;
|
|
20
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
21
|
+
hideHeading: boolean;
|
|
14
22
|
autoRefresh: number;
|
|
15
23
|
maxCollections: number;
|
|
16
24
|
topN: number;
|
|
17
25
|
hideCharts: boolean;
|
|
18
26
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
19
28
|
declare const _default: typeof __VLS_export;
|
|
20
29
|
export default _default;
|
|
30
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
31
|
+
new (): {
|
|
32
|
+
$slots: S;
|
|
33
|
+
};
|
|
34
|
+
};
|