@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.
Files changed (63) hide show
  1. package/README.md +1 -1
  2. package/dist/module.d.mts +6 -0
  3. package/dist/module.json +2 -2
  4. package/dist/module.mjs +24 -4
  5. package/dist/runtime/assets/formkit.css +1 -0
  6. package/dist/runtime/components/MongocampAccount.vue +4 -4
  7. package/dist/runtime/components/MongocampBucketFiles.d.vue.ts +21 -1
  8. package/dist/runtime/components/MongocampBucketFiles.vue +17 -5
  9. package/dist/runtime/components/MongocampBucketFiles.vue.d.ts +21 -1
  10. package/dist/runtime/components/MongocampChart.vue +1 -4
  11. package/dist/runtime/components/MongocampCollectionData.d.vue.ts +22 -1
  12. package/dist/runtime/components/MongocampCollectionData.vue +27 -6
  13. package/dist/runtime/components/MongocampCollectionData.vue.d.ts +22 -1
  14. package/dist/runtime/components/MongocampCollectionInfos.vue +12 -12
  15. package/dist/runtime/components/MongocampCollections.d.vue.ts +19 -1
  16. package/dist/runtime/components/MongocampCollections.vue +13 -3
  17. package/dist/runtime/components/MongocampCollections.vue.d.ts +19 -1
  18. package/dist/runtime/components/MongocampDashboard.d.vue.ts +3 -0
  19. package/dist/runtime/components/MongocampDashboard.vue +11 -5
  20. package/dist/runtime/components/MongocampDashboard.vue.d.ts +3 -0
  21. package/dist/runtime/components/MongocampDatabases.d.vue.ts +20 -1
  22. package/dist/runtime/components/MongocampDatabases.vue +15 -2
  23. package/dist/runtime/components/MongocampDatabases.vue.d.ts +20 -1
  24. package/dist/runtime/components/MongocampIndexes.vue +1 -1
  25. package/dist/runtime/components/MongocampJobs.d.vue.ts +23 -1
  26. package/dist/runtime/components/MongocampJobs.vue +18 -4
  27. package/dist/runtime/components/MongocampJobs.vue.d.ts +23 -1
  28. package/dist/runtime/components/MongocampLogin.d.vue.ts +16 -1
  29. package/dist/runtime/components/MongocampLogin.vue +13 -5
  30. package/dist/runtime/components/MongocampLogin.vue.d.ts +16 -1
  31. package/dist/runtime/components/MongocampPermissionMatrix.d.vue.ts +19 -1
  32. package/dist/runtime/components/MongocampPermissionMatrix.vue +11 -3
  33. package/dist/runtime/components/MongocampPermissionMatrix.vue.d.ts +19 -1
  34. package/dist/runtime/components/MongocampRoleGrants.d.vue.ts +22 -1
  35. package/dist/runtime/components/MongocampRoleGrants.vue +16 -4
  36. package/dist/runtime/components/MongocampRoleGrants.vue.d.ts +22 -1
  37. package/dist/runtime/components/MongocampRoles.d.vue.ts +22 -1
  38. package/dist/runtime/components/MongocampRoles.vue +19 -3
  39. package/dist/runtime/components/MongocampRoles.vue.d.ts +22 -1
  40. package/dist/runtime/components/MongocampServerInfo.d.vue.ts +24 -0
  41. package/dist/runtime/components/MongocampServerInfo.vue +341 -0
  42. package/dist/runtime/components/MongocampServerInfo.vue.d.ts +24 -0
  43. package/dist/runtime/components/MongocampServerOverview.d.vue.ts +18 -1
  44. package/dist/runtime/components/MongocampServerOverview.vue +25 -15
  45. package/dist/runtime/components/MongocampServerOverview.vue.d.ts +18 -1
  46. package/dist/runtime/components/MongocampSettings.d.vue.ts +1 -1
  47. package/dist/runtime/components/MongocampSettings.vue.d.ts +1 -1
  48. package/dist/runtime/components/MongocampUsers.d.vue.ts +24 -1
  49. package/dist/runtime/components/MongocampUsers.vue +22 -4
  50. package/dist/runtime/components/MongocampUsers.vue.d.ts +24 -1
  51. package/dist/runtime/components/MongocampVersion.d.vue.ts +7 -1
  52. package/dist/runtime/components/MongocampVersion.vue +49 -19
  53. package/dist/runtime/components/MongocampVersion.vue.d.ts +7 -1
  54. package/dist/runtime/composables/useMongocampSystem.d.ts +10 -1
  55. package/dist/runtime/composables/useMongocampSystem.js +11 -1
  56. package/dist/runtime/formkit.config.d.ts +3 -0
  57. package/dist/runtime/formkit.config.js +9 -0
  58. package/dist/runtime/locales/de.json +35 -0
  59. package/dist/runtime/locales/en.json +35 -0
  60. package/dist/runtime/plugin.d.ts +2 -2
  61. package/dist/runtime/utils/serverInfo.d.ts +8 -0
  62. package/dist/runtime/utils/serverInfo.js +21 -0
  63. package/package.json +7 -7
@@ -13,7 +13,9 @@ const props = defineProps({
13
13
  topN: { type: Number, required: false, default: 10 },
14
14
  maxCollections: { type: Number, required: false, default: 200 },
15
15
  autoRefresh: { type: Number, required: false, default: 0 },
16
- hideCharts: { type: Boolean, required: false, default: false }
16
+ hideCharts: { type: Boolean, required: false, default: false },
17
+ hideHeading: { type: Boolean, required: false, default: false },
18
+ hideRefresh: { type: Boolean, required: false }
17
19
  });
18
20
  const { t, locale } = useI18n();
19
21
  const { loadOverview } = useMongocampServerOverview();
@@ -77,6 +79,7 @@ const failedNames = computed(() => {
77
79
  });
78
80
  const seriesSize = computed(() => [{ key: "value", label: t("nuxtUiMongocamp.serverOverview.seriesSize") }]);
79
81
  const seriesMetric = computed(() => [{ key: "value", label: metricLabel.value }]);
82
+ defineExpose({ refresh: () => load() });
80
83
  </script>
81
84
 
82
85
  <template>
@@ -92,7 +95,10 @@ const seriesMetric = computed(() => [{ key: "value", label: metricLabel.value }]
92
95
  data-test="server-overview"
93
96
  >
94
97
  <div class="flex flex-wrap items-start justify-between gap-2">
95
- <div class="flex flex-col gap-1">
98
+ <div
99
+ v-if="!hideHeading"
100
+ class="flex flex-col gap-1"
101
+ >
96
102
  <h2 class="text-xl font-semibold">
97
103
  {{ t("nuxtUiMongocamp.serverOverview.heading") }}
98
104
  </h2>
@@ -100,14 +106,18 @@ const seriesMetric = computed(() => [{ key: "value", label: metricLabel.value }]
100
106
  {{ t("nuxtUiMongocamp.serverOverview.subtitle") }}
101
107
  </p>
102
108
  </div>
103
- <UButton
104
- icon="i-lucide-refresh-cw"
105
- color="neutral"
106
- variant="ghost"
107
- :loading="loading"
108
- :aria-label="t('nuxtUiMongocamp.common.refresh')"
109
- @click="load()"
110
- />
109
+ <div class="ml-auto flex items-center gap-1">
110
+ <UButton
111
+ v-if="!hideRefresh"
112
+ icon="i-lucide-refresh-cw"
113
+ color="neutral"
114
+ variant="ghost"
115
+ :loading="loading"
116
+ :aria-label="t('nuxtUiMongocamp.common.refresh')"
117
+ @click="load()"
118
+ />
119
+ <slot name="toolbar" />
120
+ </div>
111
121
  </div>
112
122
 
113
123
  <UAlert
@@ -137,7 +147,7 @@ const seriesMetric = computed(() => [{ key: "value", label: metricLabel.value }]
137
147
  {{ t("nuxtUiMongocamp.serverOverview.statDatabases") }}
138
148
  </div>
139
149
  <div
140
- class="text-2xl font-semibold"
150
+ class="tabular-nums text-2xl font-semibold"
141
151
  data-test="stat-databases"
142
152
  >
143
153
  {{ overview.databases ? totals.databases : "\u2014" }}
@@ -154,7 +164,7 @@ const seriesMetric = computed(() => [{ key: "value", label: metricLabel.value }]
154
164
  {{ t("nuxtUiMongocamp.serverOverview.statCollections") }}
155
165
  </div>
156
166
  <div
157
- class="text-2xl font-semibold"
167
+ class="tabular-nums text-2xl font-semibold"
158
168
  data-test="stat-collections"
159
169
  >
160
170
  {{ number(overview.collectionCount) }}
@@ -165,7 +175,7 @@ const seriesMetric = computed(() => [{ key: "value", label: metricLabel.value }]
165
175
  {{ t("nuxtUiMongocamp.serverOverview.statDocuments") }}
166
176
  </div>
167
177
  <div
168
- class="text-2xl font-semibold"
178
+ class="tabular-nums text-2xl font-semibold"
169
179
  data-test="stat-documents"
170
180
  >
171
181
  {{ number(totals.documents) }}
@@ -176,7 +186,7 @@ const seriesMetric = computed(() => [{ key: "value", label: metricLabel.value }]
176
186
  {{ t("nuxtUiMongocamp.serverOverview.statStorage") }}
177
187
  </div>
178
188
  <div
179
- class="text-2xl font-semibold"
189
+ class="tabular-nums text-2xl font-semibold"
180
190
  data-test="stat-storage"
181
191
  >
182
192
  {{ formatBytes(totals.storageBytes) }}
@@ -187,7 +197,7 @@ const seriesMetric = computed(() => [{ key: "value", label: metricLabel.value }]
187
197
  {{ t("nuxtUiMongocamp.serverOverview.statIndexes") }}
188
198
  </div>
189
199
  <div
190
- class="text-2xl font-semibold"
200
+ class="tabular-nums text-2xl font-semibold"
191
201
  data-test="stat-indexes"
192
202
  >
193
203
  {{ formatBytes(totals.indexBytes) }}
@@ -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 __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
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
+ };
@@ -17,8 +17,8 @@ type __VLS_Props = {
17
17
  hideGrantHint?: boolean;
18
18
  };
19
19
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
20
- hideHeading: boolean;
21
20
  hideRefresh: boolean;
21
+ hideHeading: boolean;
22
22
  hidePlugins: boolean;
23
23
  hideCluster: boolean;
24
24
  hideConfigurations: boolean;
@@ -17,8 +17,8 @@ type __VLS_Props = {
17
17
  hideGrantHint?: boolean;
18
18
  };
19
19
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
20
- hideHeading: boolean;
21
20
  hideRefresh: boolean;
21
+ hideHeading: boolean;
22
22
  hidePlugins: boolean;
23
23
  hideCluster: boolean;
24
24
  hideConfigurations: boolean;
@@ -1,3 +1,26 @@
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>;
1
+ type __VLS_Props = {
2
+ hideHeading?: boolean;
3
+ hideRefresh?: boolean;
4
+ };
5
+ declare function fetchUsers(): Promise<void>;
6
+ declare const __VLS_template: () => {
7
+ __VLS_Slots: {
8
+ toolbar?: (props: {}) => any;
9
+ };
10
+ };
11
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
12
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
13
+ refresh: typeof fetchUsers;
14
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
+ changed: () => any;
16
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
17
+ onChanged?: (() => any) | undefined;
18
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
2
20
  declare const _default: typeof __VLS_export;
3
21
  export default _default;
22
+ type __VLS_WithSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -5,6 +5,11 @@ 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
+ defineProps({
9
+ hideHeading: { type: Boolean, required: false },
10
+ hideRefresh: { type: Boolean, required: false }
11
+ });
12
+ const emit = defineEmits(["changed"]);
8
13
  const { t } = useI18n();
9
14
  const { listUsers, addUser, deleteUser, updateUserRoles, updateUserPassword, listRoles, regenerateUserApiKey } = useMongocampAdmin();
10
15
  const toast = useToast();
@@ -50,7 +55,7 @@ const addUserSchema = reactive([
50
55
  options: [],
51
56
  filter: true,
52
57
  class: "h-60",
53
- transferHeaderClass: "text-sm text-gray-500 font-medium",
58
+ transferHeaderClass: "text-sm text-muted font-medium",
54
59
  transferAll: true,
55
60
  transferLeftHeaderText: t("nuxtUiMongocamp.users.available"),
56
61
  transferRightHeaderText: t("nuxtUiMongocamp.users.assigned")
@@ -72,7 +77,7 @@ const editUserSchema = reactive([
72
77
  displayMode: "transfer",
73
78
  filter: true,
74
79
  class: "h-60",
75
- transferHeaderClass: "text-sm text-gray-500 font-medium",
80
+ transferHeaderClass: "text-sm text-muted font-medium",
76
81
  options: [],
77
82
  transferAll: true,
78
83
  transferLeftHeaderText: t("nuxtUiMongocamp.users.available"),
@@ -100,6 +105,7 @@ async function handleBulkDelete() {
100
105
  try {
101
106
  const { failed } = await runBulkDelete(ids, (id) => deleteUser(id));
102
107
  await fetchUsers();
108
+ emit("changed");
103
109
  if (failed.length > 0) {
104
110
  rowSelection.value = Object.fromEntries(failed.map((f) => [f.item, true]));
105
111
  bulkError.value = t("nuxtUiMongocamp.bulk.partialFailure", { failed: failed.length, total: ids.length, reason: describeError(failed[0].error).message });
@@ -140,6 +146,7 @@ async function handleAddUser() {
140
146
  isAddModalOpen.value = false;
141
147
  newUser.value = { userId: "", password: "", roles: [] };
142
148
  await fetchUsers();
149
+ emit("changed");
143
150
  } catch (e) {
144
151
  errorMessage.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.users.errorAddUser");
145
152
  }
@@ -162,6 +169,7 @@ async function handleEditUser() {
162
169
  }
163
170
  isEditModalOpen.value = false;
164
171
  await fetchUsers();
172
+ emit("changed");
165
173
  } catch (e) {
166
174
  errorMessage.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.users.errorEditUser");
167
175
  }
@@ -180,6 +188,7 @@ async function handleDeleteUser() {
180
188
  await deleteUser(userToDelete.value);
181
189
  isDeleteModalOpen.value = false;
182
190
  await fetchUsers();
191
+ emit("changed");
183
192
  } catch (e) {
184
193
  deleteError.value = (await describeServerError(e, "nuxtUiMongocamp.users.errorDelete")).message;
185
194
  } finally {
@@ -205,6 +214,7 @@ async function handleRegenerateKey() {
205
214
  try {
206
215
  newApiKey.value = await regenerateUserApiKey(keyUser.value);
207
216
  await fetchUsers();
217
+ emit("changed");
208
218
  } catch (e) {
209
219
  keyError.value = (await describeServerError(e)).message;
210
220
  } finally {
@@ -333,6 +343,7 @@ if (!blocked.value) {
333
343
  fetchUsers();
334
344
  fetchRoles();
335
345
  }
346
+ defineExpose({ refresh: fetchUsers });
336
347
  </script>
337
348
 
338
349
  <template>
@@ -347,7 +358,10 @@ if (!blocked.value) {
347
358
  class="flex flex-col gap-4"
348
359
  >
349
360
  <div class="flex items-center justify-between gap-4">
350
- <h2 class="text-xl font-semibold">
361
+ <h2
362
+ v-if="!hideHeading"
363
+ class="text-xl font-semibold"
364
+ >
351
365
  {{ t("nuxtUiMongocamp.users.heading") }}
352
366
  </h2>
353
367
  <div class="flex flex-1 items-center gap-2">
@@ -359,7 +373,10 @@ if (!blocked.value) {
359
373
  class="flex-1 max-w-xs"
360
374
  @input="onFilterInput"
361
375
  />
362
- <UTooltip :text="t('nuxtUiMongocamp.common.refresh')">
376
+ <UTooltip
377
+ v-if="!hideRefresh"
378
+ :text="t('nuxtUiMongocamp.common.refresh')"
379
+ >
363
380
  <UButton
364
381
  icon="i-lucide-refresh-cw"
365
382
  color="neutral"
@@ -369,6 +386,7 @@ if (!blocked.value) {
369
386
  @click="fetchUsers"
370
387
  />
371
388
  </UTooltip>
389
+ <slot name="toolbar" />
372
390
  <UButton
373
391
  icon="i-lucide-plus"
374
392
  :label="t('nuxtUiMongocamp.users.addUser')"
@@ -1,3 +1,26 @@
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>;
1
+ type __VLS_Props = {
2
+ hideHeading?: boolean;
3
+ hideRefresh?: boolean;
4
+ };
5
+ declare function fetchUsers(): Promise<void>;
6
+ declare const __VLS_template: () => {
7
+ __VLS_Slots: {
8
+ toolbar?: (props: {}) => any;
9
+ };
10
+ };
11
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
12
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
13
+ refresh: typeof fetchUsers;
14
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
+ changed: () => any;
16
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
17
+ onChanged?: (() => any) | undefined;
18
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
2
20
  declare const _default: typeof __VLS_export;
3
21
  export default _default;
22
+ type __VLS_WithSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -1,3 +1,9 @@
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>;
1
+ type __VLS_Props = {
2
+ /** Hide the MongoDB version badge (it is also hidden while the server cannot tell, e.g. before login or below server 1.9.0). */
3
+ hideDatabase?: boolean;
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<{}>, {
6
+ hideDatabase: boolean;
7
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
2
8
  declare const _default: typeof __VLS_export;
3
9
  export default _default;
@@ -1,27 +1,57 @@
1
1
  <script setup>
2
- import { computed } from "vue";
3
- import { useI18n } from "#imports";
4
- import { useNuxtApp } from "#app";
2
+ import { computed, ref, watch } from "vue";
3
+ import { useI18n, useMongocampStorage, useMongocampSystem } from "#imports";
4
+ import { useNuxtApp, useRuntimeConfig } from "#app";
5
+ const props = defineProps({
6
+ hideDatabase: { type: Boolean, required: false, default: false }
7
+ });
5
8
  const { t } = useI18n();
6
9
  const { $mongocampVersion } = useNuxtApp();
10
+ const { getServerInfo } = useMongocampSystem();
11
+ const state = useMongocampStorage();
12
+ const isProxyMode = useRuntimeConfig().public.nuxtUiMongocampOptions?.useServerProxy ?? false;
7
13
  const version = computed(() => $mongocampVersion.value);
14
+ const mongoDbVersion = ref(null);
15
+ const canAsk = computed(() => !props.hideDatabase && (isProxyMode || !!state.value?.profile));
16
+ watch(canAsk, async (ask) => {
17
+ if (!ask) {
18
+ mongoDbVersion.value = null;
19
+ return;
20
+ }
21
+ try {
22
+ mongoDbVersion.value = (await getServerInfo()).mongoDbVersion || null;
23
+ } catch {
24
+ mongoDbVersion.value = null;
25
+ }
26
+ }, { immediate: true });
8
27
  </script>
9
28
 
10
29
  <template>
11
- <UBadge
12
- v-if="version"
13
- color="primary"
14
- variant="subtle"
15
- icon="i-lucide-database"
16
- >
17
- {{ version.name }} v{{ version.version }}
18
- </UBadge>
19
- <UBadge
20
- v-else
21
- color="neutral"
22
- variant="subtle"
23
- icon="i-lucide-database-zap"
24
- >
25
- {{ t("nuxtUiMongocamp.version.unavailable") }}
26
- </UBadge>
30
+ <span class="inline-flex items-center gap-1.5">
31
+ <UBadge
32
+ v-if="version"
33
+ color="primary"
34
+ variant="subtle"
35
+ icon="i-lucide-database"
36
+ >
37
+ {{ version.name }} v{{ version.version }}
38
+ </UBadge>
39
+ <UBadge
40
+ v-else
41
+ color="neutral"
42
+ variant="subtle"
43
+ icon="i-lucide-database-zap"
44
+ >
45
+ {{ t("nuxtUiMongocamp.version.unavailable") }}
46
+ </UBadge>
47
+ <UBadge
48
+ v-if="mongoDbVersion"
49
+ color="neutral"
50
+ variant="subtle"
51
+ icon="i-simple-icons-mongodb"
52
+ data-testid="mongodb-version"
53
+ >
54
+ MongoDB {{ mongoDbVersion }}
55
+ </UBadge>
56
+ </span>
27
57
  </template>
@@ -1,3 +1,9 @@
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>;
1
+ type __VLS_Props = {
2
+ /** Hide the MongoDB version badge (it is also hidden while the server cannot tell, e.g. before login or below server 1.9.0). */
3
+ hideDatabase?: boolean;
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<{}>, {
6
+ hideDatabase: boolean;
7
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
2
8
  declare const _default: typeof __VLS_export;
3
9
  export default _default;
@@ -1,9 +1,15 @@
1
- import type { ClusterMemberInformation, DatabaseInfo } from '@sfxcode/nuxt-mongocamp-server';
1
+ import type { Capabilities, ClusterMemberInformation, DatabaseInfo, SystemStats } from '@sfxcode/nuxt-mongocamp-server';
2
2
  import type { ConfigRow } from '../utils/configRows.js';
3
3
  export interface ServerCluster {
4
4
  coordinator: ClusterMemberInformation;
5
5
  members: ClusterMemberInformation[];
6
6
  }
7
+ export interface ServerInfo {
8
+ /** Version of the MongoDB server the MongoCamp server is connected to, e.g. `9.0.4`. */
9
+ mongoDbVersion: string;
10
+ /** The same version as numbers (`[9, 0, 4, 0]`), empty if the server sent none. */
11
+ mongoDbVersionArray: number[];
12
+ }
7
13
  export interface ServerPlugins {
8
14
  routesPlugins: string[];
9
15
  filePlugins: string[];
@@ -19,6 +25,9 @@ export interface ServerPlugins {
19
25
  */
20
26
  export declare function useMongocampSystem(): {
21
27
  getCluster: () => Promise<ServerCluster>;
28
+ getServerInfo: () => Promise<ServerInfo>;
29
+ getStats: () => Promise<SystemStats>;
30
+ getCapabilities: () => Promise<Capabilities>;
22
31
  listDatabases: () => Promise<string[]>;
23
32
  getDatabaseInfos: () => Promise<DatabaseInfo[]>;
24
33
  getDatabaseInfo: (databaseName: string) => Promise<DatabaseInfo>;
@@ -38,5 +38,15 @@ export function useMongocampSystem() {
38
38
  const cluster = await systemApi.viewCluster(withTimeout());
39
39
  return { coordinator: cluster.coordinator, members: cluster.members?.length ? cluster.members : [cluster.coordinator] };
40
40
  }
41
- return { getCluster, listDatabases, getDatabaseInfos, getDatabaseInfo, listCollectionsByDatabase, getSettings, listConfigurations, getConfig };
41
+ async function getServerInfo() {
42
+ const info = await systemApi.systemInfo(withTimeout());
43
+ return { mongoDbVersion: info.mongoDbVersion, mongoDbVersionArray: info.mongoDbVersionArray ?? [] };
44
+ }
45
+ async function getStats() {
46
+ return systemApi.systemStats(withTimeout());
47
+ }
48
+ async function getCapabilities() {
49
+ return systemApi.systemCapabilities(withTimeout());
50
+ }
51
+ return { getCluster, getServerInfo, getStats, getCapabilities, listDatabases, getDatabaseInfos, getDatabaseInfo, listCollectionsByDatabase, getSettings, listConfigurations, getConfig };
42
52
  }
@@ -0,0 +1,3 @@
1
+ import type { DefaultConfigOptions } from '@formkit/vue';
2
+ declare const config: DefaultConfigOptions;
3
+ export default config;
@@ -0,0 +1,9 @@
1
+ import { nuxtUIInputs, nuxtUIOutputs } from "@sfxcode/nuxt-ui-formkit/definitions";
2
+ import { addNuxtAsteriskPlugin } from "@sfxcode/nuxt-ui-formkit/plugins";
3
+ const config = {
4
+ inputs: { ...nuxtUIInputs, ...nuxtUIOutputs },
5
+ // The module's forms use Nuxt UI icons, not FormKit's own icon set
6
+ iconLoader: () => void 0,
7
+ plugins: [addNuxtAsteriskPlugin]
8
+ };
9
+ export default config;
@@ -369,6 +369,41 @@
369
369
  "chartSize": "Größe auf der Platte",
370
370
  "chartDescription": "Größe von {count} Datenbanken, größte zuerst"
371
371
  },
372
+ "serverInfo": {
373
+ "heading": "Serverinformationen",
374
+ "serverHeading": "Server",
375
+ "mongocampVersion": "MongoCamp",
376
+ "mongoDbVersion": "MongoDB",
377
+ "mongoDbMajor": "MongoDB-Hauptversion",
378
+ "uptime": "Laufzeit (Datenbank)",
379
+ "replicaSet": "Replica Set",
380
+ "replicaState": "Zustand",
381
+ "replicaMembers": "{healthy} von {count} Mitgliedern gesund",
382
+ "statsHeading": "Datenbanklast",
383
+ "connections": "Verbindungen",
384
+ "connectionsCurrent": "In Benutzung",
385
+ "connectionsAvailable": "Verfügbar",
386
+ "connectionsTotal": "Seit dem Start geöffnet",
387
+ "opCounters": "Operationen seit dem Start des Datenbankservers",
388
+ "partialNote": "Dem Datenbankbenutzer fehlt die Rolle clusterMonitor, daher fehlen Laufzeit, Verbindungen und Zähler.",
389
+ "capabilitiesHeading": "Fähigkeiten",
390
+ "features": "Funktionen",
391
+ "limits": "Grenzen",
392
+ "importMaxBytes": "Größter Import",
393
+ "grantDeniedStatus": "Status bei fehlender Berechtigung",
394
+ "deniedStages": "Abgelehnte Aggregations-Operatoren",
395
+ "olderServer": "Dieser Server hat keine Capabilities-Route (älter als 1.9.0).",
396
+ "partFailed": "{part} konnte nicht geladen werden.",
397
+ "partStats": "Die Datenbanklast",
398
+ "partCapabilities": "Die Fähigkeiten",
399
+ "partInfo": "Die MongoDB-Version",
400
+ "op_insert": "insert",
401
+ "op_query": "query",
402
+ "op_update": "update",
403
+ "op_delete": "delete",
404
+ "op_getmore": "getmore",
405
+ "op_command": "command"
406
+ },
372
407
  "version": {
373
408
  "unavailable": "MongoCamp nicht verfügbar"
374
409
  },
@@ -369,6 +369,41 @@
369
369
  "chartSize": "Size on disk",
370
370
  "chartDescription": "Size of {count} databases, biggest first"
371
371
  },
372
+ "serverInfo": {
373
+ "heading": "Server information",
374
+ "serverHeading": "Server",
375
+ "mongocampVersion": "MongoCamp",
376
+ "mongoDbVersion": "MongoDB",
377
+ "mongoDbMajor": "MongoDB major version",
378
+ "uptime": "Uptime (database)",
379
+ "replicaSet": "Replica set",
380
+ "replicaState": "State",
381
+ "replicaMembers": "{healthy} of {count} members healthy",
382
+ "statsHeading": "Database load",
383
+ "connections": "Connections",
384
+ "connectionsCurrent": "In use",
385
+ "connectionsAvailable": "Available",
386
+ "connectionsTotal": "Opened since start",
387
+ "opCounters": "Operations since the database server started",
388
+ "partialNote": "The database user lacks the clusterMonitor role, so uptime, connections and counters are not available.",
389
+ "capabilitiesHeading": "Capabilities",
390
+ "features": "Features",
391
+ "limits": "Limits",
392
+ "importMaxBytes": "Largest import",
393
+ "grantDeniedStatus": "Status for a missing grant",
394
+ "deniedStages": "Refused aggregation operators",
395
+ "olderServer": "This server has no capabilities route (older than 1.9.0).",
396
+ "partFailed": "{part} could not be loaded.",
397
+ "partStats": "The database load",
398
+ "partCapabilities": "The capabilities",
399
+ "partInfo": "The MongoDB version",
400
+ "op_insert": "insert",
401
+ "op_query": "query",
402
+ "op_update": "update",
403
+ "op_delete": "delete",
404
+ "op_getmore": "getmore",
405
+ "op_command": "command"
406
+ },
372
407
  "version": {
373
408
  "unavailable": "MongoCamp unavailable"
374
409
  },
@@ -1,6 +1,6 @@
1
- declare const _default: import("#app").Plugin<{
1
+ declare const _default: import("nuxt/app").Plugin<{
2
2
  mongocampVersion: import("vue").Ref<import("@sfxcode/nuxt-mongocamp-server").Version | undefined, import("@sfxcode/nuxt-mongocamp-server").Version | undefined>;
3
- }> & import("#app").ObjectPlugin<{
3
+ }> & import("nuxt/app").ObjectPlugin<{
4
4
  mongocampVersion: import("vue").Ref<import("@sfxcode/nuxt-mongocamp-server").Version | undefined, import("@sfxcode/nuxt-mongocamp-server").Version | undefined>;
5
5
  }>;
6
6
  export default _default;
@@ -0,0 +1,8 @@
1
+ /** `3d 4h`, `5h 12m`, `7m 3s`, `42s` — the two biggest non-zero units; `-` for nothing/unknown. */
2
+ export declare function formatUptime(seconds: number | null | undefined): string;
3
+ /** Thousands separators without a locale dependency (the counters run into the millions). */
4
+ export declare function formatCount(value: number | null | undefined): string;
5
+ /** Share of connections in use, 0–100 (`current` against `current + available`); `null` if nothing is known. */
6
+ export declare function connectionUsage(current: number | null | undefined, available: number | null | undefined): number | null;
7
+ export declare const OP_COUNTER_KEYS: readonly ["insert", "query", "update", "delete", "getmore", "command"];
8
+ export type OpCounterKey = typeof OP_COUNTER_KEYS[number];
@@ -0,0 +1,21 @@
1
+ export function formatUptime(seconds) {
2
+ if (seconds == null || !Number.isFinite(seconds) || seconds < 0) return "-";
3
+ const total = Math.floor(seconds);
4
+ const days = Math.floor(total / 86400);
5
+ const hours = Math.floor(total % 86400 / 3600);
6
+ const minutes = Math.floor(total % 3600 / 60);
7
+ const secs = total % 60;
8
+ const parts = [[days, "d"], [hours, "h"], [minutes, "m"], [secs, "s"]];
9
+ const shown = parts.filter(([value]) => value > 0).slice(0, 2).map(([value, unit]) => `${value}${unit}`);
10
+ return shown.length ? shown.join(" ") : "0s";
11
+ }
12
+ export function formatCount(value) {
13
+ if (value == null || !Number.isFinite(value)) return "-";
14
+ return Math.trunc(value).toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
15
+ }
16
+ export function connectionUsage(current, available) {
17
+ if (current == null || available == null) return null;
18
+ const total = current + available;
19
+ return total > 0 ? Math.round(current / total * 100) : null;
20
+ }
21
+ export const OP_COUNTER_KEYS = ["insert", "query", "update", "delete", "getmore", "command"];