@sfxcode/nuxt-ui-mongocamp 1.5.0 → 1.5.2
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 +6 -0
- package/dist/module.json +2 -2
- package/dist/module.mjs +24 -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/MongocampChart.vue +1 -4
- package/dist/runtime/components/MongocampCollectionData.d.vue.ts +22 -1
- package/dist/runtime/components/MongocampCollectionData.vue +27 -6
- package/dist/runtime/components/MongocampCollectionData.vue.d.ts +22 -1
- package/dist/runtime/components/MongocampCollectionInfos.vue +12 -12
- package/dist/runtime/components/MongocampCollections.d.vue.ts +19 -1
- package/dist/runtime/components/MongocampCollections.vue +13 -3
- package/dist/runtime/components/MongocampCollections.vue.d.ts +19 -1
- package/dist/runtime/components/MongocampDashboard.d.vue.ts +3 -0
- package/dist/runtime/components/MongocampDashboard.vue +11 -5
- package/dist/runtime/components/MongocampDashboard.vue.d.ts +3 -0
- 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 -1
- package/dist/runtime/components/MongocampPermissionMatrix.vue +11 -3
- package/dist/runtime/components/MongocampPermissionMatrix.vue.d.ts +19 -1
- 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 +19 -3
- package/dist/runtime/components/MongocampRoles.vue.d.ts +22 -1
- package/dist/runtime/components/MongocampServerInfo.d.vue.ts +24 -0
- package/dist/runtime/components/MongocampServerInfo.vue +341 -0
- package/dist/runtime/components/MongocampServerInfo.vue.d.ts +24 -0
- package/dist/runtime/components/MongocampServerOverview.d.vue.ts +18 -1
- package/dist/runtime/components/MongocampServerOverview.vue +25 -15
- package/dist/runtime/components/MongocampServerOverview.vue.d.ts +18 -1
- package/dist/runtime/components/MongocampSettings.d.vue.ts +1 -1
- package/dist/runtime/components/MongocampSettings.vue.d.ts +1 -1
- 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.d.vue.ts +7 -1
- package/dist/runtime/components/MongocampVersion.vue +49 -19
- package/dist/runtime/components/MongocampVersion.vue.d.ts +7 -1
- package/dist/runtime/composables/useMongocampSystem.d.ts +10 -1
- package/dist/runtime/composables/useMongocampSystem.js +11 -1
- package/dist/runtime/formkit.config.d.ts +3 -0
- package/dist/runtime/formkit.config.js +9 -0
- package/dist/runtime/locales/de.json +35 -0
- package/dist/runtime/locales/en.json +35 -0
- package/dist/runtime/plugin.d.ts +2 -2
- package/dist/runtime/utils/serverInfo.d.ts +8 -0
- package/dist/runtime/utils/serverInfo.js +21 -0
- package/package.json +7 -7
|
@@ -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
|
+
};
|
|
@@ -6,8 +6,11 @@ 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();
|
|
12
15
|
const { listRoles, addRole, updateRole, deleteRole } = useMongocampAdmin();
|
|
13
16
|
const roles = ref([]);
|
|
@@ -75,6 +78,7 @@ async function handleBulkDelete() {
|
|
|
75
78
|
try {
|
|
76
79
|
const { failed } = await runBulkDelete(names, (name) => deleteRole(name));
|
|
77
80
|
await fetchRoles();
|
|
81
|
+
emit("changed");
|
|
78
82
|
if (failed.length > 0) {
|
|
79
83
|
rowSelection.value = Object.fromEntries(failed.map((f) => [f.item, true]));
|
|
80
84
|
bulkError.value = t("nuxtUiMongocamp.bulk.partialFailure", { failed: failed.length, total: names.length, reason: describeError(failed[0].error).message });
|
|
@@ -108,6 +112,7 @@ async function handleAddRole() {
|
|
|
108
112
|
isAddModalOpen.value = false;
|
|
109
113
|
newRole.value = { name: "", isAdmin: false };
|
|
110
114
|
await fetchRoles();
|
|
115
|
+
emit("changed");
|
|
111
116
|
} catch (e) {
|
|
112
117
|
errorMessage.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.roles.errorAddRole");
|
|
113
118
|
}
|
|
@@ -123,6 +128,7 @@ async function handleEditRole() {
|
|
|
123
128
|
await updateRole(editRole.value.roleName, editRole.value.isAdmin, editGrants.value);
|
|
124
129
|
isEditModalOpen.value = false;
|
|
125
130
|
await fetchRoles();
|
|
131
|
+
emit("changed");
|
|
126
132
|
} catch (e) {
|
|
127
133
|
errorMessage.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.roles.errorEditRole");
|
|
128
134
|
}
|
|
@@ -141,6 +147,7 @@ async function handleCloneRole() {
|
|
|
141
147
|
await addRole(cloneRole.value.name, cloneRole.value.isAdmin, cloneGrants.value);
|
|
142
148
|
isCloneModalOpen.value = false;
|
|
143
149
|
await fetchRoles();
|
|
150
|
+
emit("changed");
|
|
144
151
|
} catch (e) {
|
|
145
152
|
cloneError.value = (await describeServerError(e, "nuxtUiMongocamp.roles.errorClone")).message;
|
|
146
153
|
} finally {
|
|
@@ -161,6 +168,7 @@ async function handleDeleteRole() {
|
|
|
161
168
|
await deleteRole(roleToDelete.value);
|
|
162
169
|
isDeleteModalOpen.value = false;
|
|
163
170
|
await fetchRoles();
|
|
171
|
+
emit("changed");
|
|
164
172
|
} catch (e) {
|
|
165
173
|
deleteError.value = (await describeServerError(e, "nuxtUiMongocamp.roles.errorDelete")).message;
|
|
166
174
|
} finally {
|
|
@@ -266,6 +274,7 @@ const columns = computed(() => [
|
|
|
266
274
|
}
|
|
267
275
|
]);
|
|
268
276
|
if (!blocked.value) fetchRoles();
|
|
277
|
+
defineExpose({ refresh: fetchRoles });
|
|
269
278
|
</script>
|
|
270
279
|
|
|
271
280
|
<template>
|
|
@@ -280,7 +289,10 @@ if (!blocked.value) fetchRoles();
|
|
|
280
289
|
class="flex flex-col gap-4"
|
|
281
290
|
>
|
|
282
291
|
<div class="flex items-center justify-between gap-4">
|
|
283
|
-
<h2
|
|
292
|
+
<h2
|
|
293
|
+
v-if="!hideHeading"
|
|
294
|
+
class="text-xl font-semibold"
|
|
295
|
+
>
|
|
284
296
|
{{ t("nuxtUiMongocamp.roles.heading") }}
|
|
285
297
|
</h2>
|
|
286
298
|
<div class="flex flex-1 items-center gap-2">
|
|
@@ -292,7 +304,10 @@ if (!blocked.value) fetchRoles();
|
|
|
292
304
|
class="flex-1 max-w-xs"
|
|
293
305
|
@input="onFilterInput"
|
|
294
306
|
/>
|
|
295
|
-
<UTooltip
|
|
307
|
+
<UTooltip
|
|
308
|
+
v-if="!hideRefresh"
|
|
309
|
+
:text="t('nuxtUiMongocamp.common.refresh')"
|
|
310
|
+
>
|
|
296
311
|
<UButton
|
|
297
312
|
icon="i-lucide-refresh-cw"
|
|
298
313
|
color="neutral"
|
|
@@ -302,6 +317,7 @@ if (!blocked.value) fetchRoles();
|
|
|
302
317
|
@click="fetchRoles"
|
|
303
318
|
/>
|
|
304
319
|
</UTooltip>
|
|
320
|
+
<slot name="toolbar" />
|
|
305
321
|
<UButton
|
|
306
322
|
icon="i-lucide-plus"
|
|
307
323
|
: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
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** Hide the "Server information" heading. */
|
|
3
|
+
hideHeading?: boolean;
|
|
4
|
+
/** Hide the refresh button. */
|
|
5
|
+
hideRefresh?: boolean;
|
|
6
|
+
/** Hide the database load card (uptime, connections, counters, replica set — the request is skipped too). */
|
|
7
|
+
hideStats?: boolean;
|
|
8
|
+
/** Hide the capabilities card (features, limits, refused operators — the request is skipped too). */
|
|
9
|
+
hideCapabilities?: boolean;
|
|
10
|
+
/** Reload the numbers every N seconds (at least 1; 0 = off). Pauses while the tab is hidden and slows down after failures. */
|
|
11
|
+
autoRefresh?: number;
|
|
12
|
+
};
|
|
13
|
+
declare function refresh(): Promise<void>;
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
15
|
+
refresh: typeof refresh;
|
|
16
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
17
|
+
hideRefresh: boolean;
|
|
18
|
+
hideHeading: boolean;
|
|
19
|
+
autoRefresh: number;
|
|
20
|
+
hideStats: boolean;
|
|
21
|
+
hideCapabilities: boolean;
|
|
22
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const _default: typeof __VLS_export;
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, onMounted, ref, watch } from "vue";
|
|
3
|
+
import { useI18n, useMongocampSystem } from "#imports";
|
|
4
|
+
import { useNuxtApp } from "#app";
|
|
5
|
+
import { useMongocampAutoRefresh } from "../composables/useMongocampAutoRefresh";
|
|
6
|
+
import { formatBytes } from "../utils/formatBytes";
|
|
7
|
+
import { connectionUsage, formatCount, formatUptime, OP_COUNTER_KEYS } from "../utils/serverInfo";
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
hideHeading: { type: Boolean, required: false, default: false },
|
|
10
|
+
hideRefresh: { type: Boolean, required: false, default: false },
|
|
11
|
+
hideStats: { type: Boolean, required: false, default: false },
|
|
12
|
+
hideCapabilities: { type: Boolean, required: false, default: false },
|
|
13
|
+
autoRefresh: { type: Number, required: false, default: 0 }
|
|
14
|
+
});
|
|
15
|
+
const { t } = useI18n();
|
|
16
|
+
const { $mongocampVersion } = useNuxtApp();
|
|
17
|
+
const { getServerInfo, getStats, getCapabilities } = useMongocampSystem();
|
|
18
|
+
const version = computed(() => $mongocampVersion.value);
|
|
19
|
+
const mongoDbVersion = ref(null);
|
|
20
|
+
const stats = ref(null);
|
|
21
|
+
const capabilities = ref(null);
|
|
22
|
+
const loading = ref(false);
|
|
23
|
+
const failed = ref({ info: false, stats: false, capabilities: false });
|
|
24
|
+
const olderServer = ref(false);
|
|
25
|
+
function statusOf(error) {
|
|
26
|
+
return error?.response?.status;
|
|
27
|
+
}
|
|
28
|
+
async function load() {
|
|
29
|
+
const [info, loadedStats, loadedCapabilities] = await Promise.allSettled([
|
|
30
|
+
getServerInfo(),
|
|
31
|
+
props.hideStats ? Promise.resolve(null) : getStats(),
|
|
32
|
+
props.hideCapabilities ? Promise.resolve(null) : getCapabilities()
|
|
33
|
+
]);
|
|
34
|
+
mongoDbVersion.value = info.status === "fulfilled" ? info.value.mongoDbVersion || null : mongoDbVersion.value;
|
|
35
|
+
stats.value = loadedStats.status === "fulfilled" ? loadedStats.value : stats.value;
|
|
36
|
+
capabilities.value = loadedCapabilities.status === "fulfilled" ? loadedCapabilities.value : capabilities.value;
|
|
37
|
+
const missing = loadedCapabilities.status === "rejected" && [404, 405].includes(statusOf(loadedCapabilities.reason) ?? 0);
|
|
38
|
+
olderServer.value = missing;
|
|
39
|
+
failed.value = {
|
|
40
|
+
info: info.status === "rejected",
|
|
41
|
+
stats: loadedStats.status === "rejected",
|
|
42
|
+
capabilities: loadedCapabilities.status === "rejected" && !missing
|
|
43
|
+
};
|
|
44
|
+
if ([info, loadedStats, loadedCapabilities].every((r) => r.status === "rejected")) throw info.reason;
|
|
45
|
+
}
|
|
46
|
+
async function refresh() {
|
|
47
|
+
loading.value = true;
|
|
48
|
+
try {
|
|
49
|
+
await load();
|
|
50
|
+
} catch {
|
|
51
|
+
} finally {
|
|
52
|
+
loading.value = false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const { start, stop } = useMongocampAutoRefresh(load, { intervalMs: () => props.autoRefresh * 1e3 });
|
|
56
|
+
watch(() => props.autoRefresh, (seconds) => {
|
|
57
|
+
stop();
|
|
58
|
+
if (seconds > 0) start();
|
|
59
|
+
});
|
|
60
|
+
onMounted(() => {
|
|
61
|
+
refresh();
|
|
62
|
+
if (props.autoRefresh > 0) start();
|
|
63
|
+
});
|
|
64
|
+
const usage = computed(() => connectionUsage(stats.value?.connections?.current, stats.value?.connections?.available));
|
|
65
|
+
function opCount(counters2, key) {
|
|
66
|
+
return key === "delete" ? counters2._delete : counters2[key];
|
|
67
|
+
}
|
|
68
|
+
const counters = computed(() => OP_COUNTER_KEYS.map((key) => ({
|
|
69
|
+
key,
|
|
70
|
+
label: t(`nuxtUiMongocamp.serverInfo.op_${key}`),
|
|
71
|
+
value: stats.value?.opcounters ? formatCount(opCount(stats.value.opcounters, key)) : "-"
|
|
72
|
+
})));
|
|
73
|
+
const hasLoad = computed(() => !!stats.value && !stats.value.partial);
|
|
74
|
+
defineExpose({ refresh });
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<template>
|
|
78
|
+
<div class="flex flex-col gap-4">
|
|
79
|
+
<div
|
|
80
|
+
v-if="!hideHeading || !hideRefresh"
|
|
81
|
+
class="flex items-center justify-between gap-4"
|
|
82
|
+
>
|
|
83
|
+
<h2 class="text-xl font-semibold">
|
|
84
|
+
<template v-if="!hideHeading">
|
|
85
|
+
{{ t("nuxtUiMongocamp.serverInfo.heading") }}
|
|
86
|
+
</template>
|
|
87
|
+
</h2>
|
|
88
|
+
<UTooltip
|
|
89
|
+
v-if="!hideRefresh"
|
|
90
|
+
:text="t('nuxtUiMongocamp.common.refresh')"
|
|
91
|
+
>
|
|
92
|
+
<UButton
|
|
93
|
+
icon="i-lucide-refresh-cw"
|
|
94
|
+
color="neutral"
|
|
95
|
+
variant="ghost"
|
|
96
|
+
:loading="loading"
|
|
97
|
+
:aria-label="t('nuxtUiMongocamp.common.refresh')"
|
|
98
|
+
@click="refresh"
|
|
99
|
+
/>
|
|
100
|
+
</UTooltip>
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
<UAlert
|
|
104
|
+
v-if="failed.info"
|
|
105
|
+
color="warning"
|
|
106
|
+
variant="subtle"
|
|
107
|
+
data-testid="info-failed"
|
|
108
|
+
:description="t('nuxtUiMongocamp.serverInfo.partFailed', { part: t('nuxtUiMongocamp.serverInfo.partInfo') })"
|
|
109
|
+
/>
|
|
110
|
+
<UAlert
|
|
111
|
+
v-if="failed.stats && !hideStats"
|
|
112
|
+
color="warning"
|
|
113
|
+
variant="subtle"
|
|
114
|
+
data-testid="stats-failed"
|
|
115
|
+
:description="t('nuxtUiMongocamp.serverInfo.partFailed', { part: t('nuxtUiMongocamp.serverInfo.partStats') })"
|
|
116
|
+
/>
|
|
117
|
+
<UAlert
|
|
118
|
+
v-if="failed.capabilities && !hideCapabilities"
|
|
119
|
+
color="warning"
|
|
120
|
+
variant="subtle"
|
|
121
|
+
data-testid="capabilities-failed"
|
|
122
|
+
:description="t('nuxtUiMongocamp.serverInfo.partFailed', { part: t('nuxtUiMongocamp.serverInfo.partCapabilities') })"
|
|
123
|
+
/>
|
|
124
|
+
|
|
125
|
+
<UCard>
|
|
126
|
+
<template #header>
|
|
127
|
+
<span class="font-semibold">{{ t("nuxtUiMongocamp.serverInfo.serverHeading") }}</span>
|
|
128
|
+
</template>
|
|
129
|
+
<dl class="grid grid-cols-1 gap-x-6 gap-y-2 text-sm sm:grid-cols-2">
|
|
130
|
+
<div class="flex justify-between gap-4">
|
|
131
|
+
<dt class="text-dimmed">
|
|
132
|
+
{{ t("nuxtUiMongocamp.serverInfo.mongocampVersion") }}
|
|
133
|
+
</dt>
|
|
134
|
+
<dd data-testid="mongocamp-version">
|
|
135
|
+
{{ version ? `${version.name} v${version.version}` : "-" }}
|
|
136
|
+
</dd>
|
|
137
|
+
</div>
|
|
138
|
+
<div class="flex justify-between gap-4">
|
|
139
|
+
<dt class="text-dimmed">
|
|
140
|
+
{{ t("nuxtUiMongocamp.serverInfo.mongoDbVersion") }}
|
|
141
|
+
</dt>
|
|
142
|
+
<dd data-testid="mongodb-version">
|
|
143
|
+
{{ mongoDbVersion ?? "-" }}
|
|
144
|
+
</dd>
|
|
145
|
+
</div>
|
|
146
|
+
<div
|
|
147
|
+
v-if="capabilities?.mongoDbMajor != null"
|
|
148
|
+
class="flex justify-between gap-4"
|
|
149
|
+
>
|
|
150
|
+
<dt class="text-dimmed">
|
|
151
|
+
{{ t("nuxtUiMongocamp.serverInfo.mongoDbMajor") }}
|
|
152
|
+
</dt>
|
|
153
|
+
<dd>{{ capabilities.mongoDbMajor }}</dd>
|
|
154
|
+
</div>
|
|
155
|
+
<div
|
|
156
|
+
v-if="hasLoad && stats?.uptimeSeconds != null"
|
|
157
|
+
class="flex justify-between gap-4"
|
|
158
|
+
>
|
|
159
|
+
<dt class="text-dimmed">
|
|
160
|
+
{{ t("nuxtUiMongocamp.serverInfo.uptime") }}
|
|
161
|
+
</dt>
|
|
162
|
+
<dd data-testid="uptime">
|
|
163
|
+
{{ formatUptime(stats.uptimeSeconds) }}
|
|
164
|
+
</dd>
|
|
165
|
+
</div>
|
|
166
|
+
<div
|
|
167
|
+
v-if="stats?.replicaSet"
|
|
168
|
+
class="flex justify-between gap-4"
|
|
169
|
+
>
|
|
170
|
+
<dt class="text-dimmed">
|
|
171
|
+
{{ t("nuxtUiMongocamp.serverInfo.replicaSet") }}
|
|
172
|
+
</dt>
|
|
173
|
+
<dd class="flex flex-wrap items-center justify-end gap-2">
|
|
174
|
+
<span>{{ stats.replicaSet.name }}</span>
|
|
175
|
+
<UBadge
|
|
176
|
+
:label="stats.replicaSet.state"
|
|
177
|
+
color="neutral"
|
|
178
|
+
variant="subtle"
|
|
179
|
+
/>
|
|
180
|
+
<span class="text-dimmed">{{ t("nuxtUiMongocamp.serverInfo.replicaMembers", { healthy: stats.replicaSet.healthyMembers, count: stats.replicaSet.memberCount }) }}</span>
|
|
181
|
+
</dd>
|
|
182
|
+
</div>
|
|
183
|
+
</dl>
|
|
184
|
+
</UCard>
|
|
185
|
+
|
|
186
|
+
<UCard v-if="!hideStats && stats">
|
|
187
|
+
<template #header>
|
|
188
|
+
<span class="font-semibold">{{ t("nuxtUiMongocamp.serverInfo.statsHeading") }}</span>
|
|
189
|
+
</template>
|
|
190
|
+
<UAlert
|
|
191
|
+
v-if="stats.partial"
|
|
192
|
+
color="info"
|
|
193
|
+
variant="subtle"
|
|
194
|
+
data-testid="stats-partial"
|
|
195
|
+
:description="t('nuxtUiMongocamp.serverInfo.partialNote')"
|
|
196
|
+
/>
|
|
197
|
+
<div
|
|
198
|
+
v-else
|
|
199
|
+
class="flex flex-col gap-4"
|
|
200
|
+
>
|
|
201
|
+
<div
|
|
202
|
+
v-if="stats.connections"
|
|
203
|
+
class="flex flex-col gap-2"
|
|
204
|
+
>
|
|
205
|
+
<div class="text-sm font-medium">
|
|
206
|
+
{{ t("nuxtUiMongocamp.serverInfo.connections") }}
|
|
207
|
+
</div>
|
|
208
|
+
<UProgress
|
|
209
|
+
v-if="usage != null"
|
|
210
|
+
:model-value="usage"
|
|
211
|
+
:aria-label="t('nuxtUiMongocamp.serverInfo.connections')"
|
|
212
|
+
/>
|
|
213
|
+
<dl class="grid grid-cols-1 gap-2 text-sm sm:grid-cols-3">
|
|
214
|
+
<div class="flex justify-between gap-4">
|
|
215
|
+
<dt class="text-dimmed">
|
|
216
|
+
{{ t("nuxtUiMongocamp.serverInfo.connectionsCurrent") }}
|
|
217
|
+
</dt>
|
|
218
|
+
<dd
|
|
219
|
+
class="tabular-nums"
|
|
220
|
+
data-testid="connections-current"
|
|
221
|
+
>
|
|
222
|
+
{{ formatCount(stats.connections.current) }}
|
|
223
|
+
</dd>
|
|
224
|
+
</div>
|
|
225
|
+
<div class="flex justify-between gap-4">
|
|
226
|
+
<dt class="text-dimmed">
|
|
227
|
+
{{ t("nuxtUiMongocamp.serverInfo.connectionsAvailable") }}
|
|
228
|
+
</dt>
|
|
229
|
+
<dd class="tabular-nums">
|
|
230
|
+
{{ formatCount(stats.connections.available) }}
|
|
231
|
+
</dd>
|
|
232
|
+
</div>
|
|
233
|
+
<div class="flex justify-between gap-4">
|
|
234
|
+
<dt class="text-dimmed">
|
|
235
|
+
{{ t("nuxtUiMongocamp.serverInfo.connectionsTotal") }}
|
|
236
|
+
</dt>
|
|
237
|
+
<dd class="tabular-nums">
|
|
238
|
+
{{ formatCount(stats.connections.totalCreated) }}
|
|
239
|
+
</dd>
|
|
240
|
+
</div>
|
|
241
|
+
</dl>
|
|
242
|
+
</div>
|
|
243
|
+
<div v-if="stats.opcounters">
|
|
244
|
+
<div class="mb-2 text-sm font-medium">
|
|
245
|
+
{{ t("nuxtUiMongocamp.serverInfo.opCounters") }}
|
|
246
|
+
</div>
|
|
247
|
+
<dl class="grid grid-cols-2 gap-2 text-sm sm:grid-cols-3">
|
|
248
|
+
<div
|
|
249
|
+
v-for="counter in counters"
|
|
250
|
+
:key="counter.key"
|
|
251
|
+
class="flex justify-between gap-4"
|
|
252
|
+
>
|
|
253
|
+
<dt class="text-dimmed">
|
|
254
|
+
{{ counter.label }}
|
|
255
|
+
</dt>
|
|
256
|
+
<dd
|
|
257
|
+
class="tabular-nums"
|
|
258
|
+
:data-testid="`op-${counter.key}`"
|
|
259
|
+
>
|
|
260
|
+
{{ counter.value }}
|
|
261
|
+
</dd>
|
|
262
|
+
</div>
|
|
263
|
+
</dl>
|
|
264
|
+
</div>
|
|
265
|
+
</div>
|
|
266
|
+
</UCard>
|
|
267
|
+
|
|
268
|
+
<UAlert
|
|
269
|
+
v-if="olderServer && !hideCapabilities"
|
|
270
|
+
color="neutral"
|
|
271
|
+
variant="subtle"
|
|
272
|
+
data-testid="older-server"
|
|
273
|
+
:description="t('nuxtUiMongocamp.serverInfo.olderServer')"
|
|
274
|
+
/>
|
|
275
|
+
<UCard v-if="!hideCapabilities && capabilities">
|
|
276
|
+
<template #header>
|
|
277
|
+
<span class="font-semibold">{{ t("nuxtUiMongocamp.serverInfo.capabilitiesHeading") }}</span>
|
|
278
|
+
</template>
|
|
279
|
+
<div class="flex flex-col gap-4">
|
|
280
|
+
<div v-if="capabilities.features?.length">
|
|
281
|
+
<div class="mb-2 text-sm font-medium">
|
|
282
|
+
{{ t("nuxtUiMongocamp.serverInfo.features") }}
|
|
283
|
+
</div>
|
|
284
|
+
<div
|
|
285
|
+
class="flex flex-wrap gap-1.5"
|
|
286
|
+
data-testid="features"
|
|
287
|
+
>
|
|
288
|
+
<UBadge
|
|
289
|
+
v-for="feature in capabilities.features"
|
|
290
|
+
:key="feature"
|
|
291
|
+
:label="feature"
|
|
292
|
+
color="primary"
|
|
293
|
+
variant="subtle"
|
|
294
|
+
/>
|
|
295
|
+
</div>
|
|
296
|
+
</div>
|
|
297
|
+
<div>
|
|
298
|
+
<div class="mb-2 text-sm font-medium">
|
|
299
|
+
{{ t("nuxtUiMongocamp.serverInfo.limits") }}
|
|
300
|
+
</div>
|
|
301
|
+
<dl class="grid grid-cols-1 gap-2 text-sm sm:grid-cols-2">
|
|
302
|
+
<div class="flex justify-between gap-4">
|
|
303
|
+
<dt class="text-dimmed">
|
|
304
|
+
{{ t("nuxtUiMongocamp.serverInfo.importMaxBytes") }}
|
|
305
|
+
</dt>
|
|
306
|
+
<dd data-testid="import-max">
|
|
307
|
+
{{ formatBytes(capabilities.limits.importMaxBytes) }}
|
|
308
|
+
</dd>
|
|
309
|
+
</div>
|
|
310
|
+
<div class="flex justify-between gap-4">
|
|
311
|
+
<dt class="text-dimmed">
|
|
312
|
+
{{ t("nuxtUiMongocamp.serverInfo.grantDeniedStatus") }}
|
|
313
|
+
</dt>
|
|
314
|
+
<dd data-testid="grant-denied">
|
|
315
|
+
{{ capabilities.limits.grantDeniedStatus }}
|
|
316
|
+
</dd>
|
|
317
|
+
</div>
|
|
318
|
+
</dl>
|
|
319
|
+
</div>
|
|
320
|
+
<div v-if="capabilities.aggregationStagesDenied?.length">
|
|
321
|
+
<div class="mb-2 text-sm font-medium">
|
|
322
|
+
{{ t("nuxtUiMongocamp.serverInfo.deniedStages") }}
|
|
323
|
+
</div>
|
|
324
|
+
<div
|
|
325
|
+
class="flex flex-wrap gap-1.5"
|
|
326
|
+
data-testid="denied-stages"
|
|
327
|
+
>
|
|
328
|
+
<UBadge
|
|
329
|
+
v-for="stage in capabilities.aggregationStagesDenied"
|
|
330
|
+
:key="stage"
|
|
331
|
+
:label="stage"
|
|
332
|
+
color="error"
|
|
333
|
+
variant="subtle"
|
|
334
|
+
class="font-mono"
|
|
335
|
+
/>
|
|
336
|
+
</div>
|
|
337
|
+
</div>
|
|
338
|
+
</div>
|
|
339
|
+
</UCard>
|
|
340
|
+
</div>
|
|
341
|
+
</template>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** Hide the "Server information" heading. */
|
|
3
|
+
hideHeading?: boolean;
|
|
4
|
+
/** Hide the refresh button. */
|
|
5
|
+
hideRefresh?: boolean;
|
|
6
|
+
/** Hide the database load card (uptime, connections, counters, replica set — the request is skipped too). */
|
|
7
|
+
hideStats?: boolean;
|
|
8
|
+
/** Hide the capabilities card (features, limits, refused operators — the request is skipped too). */
|
|
9
|
+
hideCapabilities?: boolean;
|
|
10
|
+
/** Reload the numbers every N seconds (at least 1; 0 = off). Pauses while the tab is hidden and slows down after failures. */
|
|
11
|
+
autoRefresh?: number;
|
|
12
|
+
};
|
|
13
|
+
declare function refresh(): Promise<void>;
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
15
|
+
refresh: typeof refresh;
|
|
16
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
17
|
+
hideRefresh: boolean;
|
|
18
|
+
hideHeading: boolean;
|
|
19
|
+
autoRefresh: number;
|
|
20
|
+
hideStats: boolean;
|
|
21
|
+
hideCapabilities: boolean;
|
|
22
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const _default: typeof __VLS_export;
|
|
24
|
+
export default _default;
|
|
@@ -6,15 +6,32 @@ 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
|
|
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<{}>, {
|
|
11
21
|
infoPath: string;
|
|
12
22
|
dataPath: string;
|
|
23
|
+
hideHeading: boolean;
|
|
13
24
|
jobsPath: string;
|
|
14
25
|
autoRefresh: number;
|
|
15
26
|
maxCollections: number;
|
|
16
27
|
topN: number;
|
|
17
28
|
hideCharts: boolean;
|
|
18
29
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
19
31
|
declare const _default: typeof __VLS_export;
|
|
20
32
|
export default _default;
|
|
33
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
34
|
+
new (): {
|
|
35
|
+
$slots: S;
|
|
36
|
+
};
|
|
37
|
+
};
|