@sfxcode/nuxt-ui-mongocamp 1.5.2 → 1.5.4

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 (57) hide show
  1. package/dist/module.d.mts +9 -0
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +1 -0
  4. package/dist/runtime/components/MongocampCollectionData.d.vue.ts +4 -1
  5. package/dist/runtime/components/MongocampCollectionData.vue +21 -9
  6. package/dist/runtime/components/MongocampCollectionData.vue.d.ts +4 -1
  7. package/dist/runtime/components/MongocampCollections.vue +7 -4
  8. package/dist/runtime/components/MongocampCommandPalette.d.vue.ts +0 -7
  9. package/dist/runtime/components/MongocampCommandPalette.vue +16 -15
  10. package/dist/runtime/components/MongocampCommandPalette.vue.d.ts +0 -7
  11. package/dist/runtime/components/MongocampDashboard.d.vue.ts +0 -3
  12. package/dist/runtime/components/MongocampDashboard.vue +8 -7
  13. package/dist/runtime/components/MongocampDashboard.vue.d.ts +0 -3
  14. package/dist/runtime/components/MongocampPermissionMatrix.d.vue.ts +0 -1
  15. package/dist/runtime/components/MongocampPermissionMatrix.vue +4 -3
  16. package/dist/runtime/components/MongocampPermissionMatrix.vue.d.ts +0 -1
  17. package/dist/runtime/components/MongocampRoles.vue +3 -2
  18. package/dist/runtime/components/MongocampServerOverview.d.vue.ts +0 -3
  19. package/dist/runtime/components/MongocampServerOverview.vue +8 -7
  20. package/dist/runtime/components/MongocampServerOverview.vue.d.ts +0 -3
  21. package/dist/runtime/components/MongocampServerStatus.d.vue.ts +13 -0
  22. package/dist/runtime/components/MongocampServerStatus.vue +147 -0
  23. package/dist/runtime/components/MongocampServerStatus.vue.d.ts +13 -0
  24. package/dist/runtime/components/MongocampUserAccess.d.vue.ts +27 -0
  25. package/dist/runtime/components/MongocampUserAccess.vue +168 -0
  26. package/dist/runtime/components/MongocampUserAccess.vue.d.ts +27 -0
  27. package/dist/runtime/components/MongocampVersion.vue +3 -3
  28. package/dist/runtime/composables/useMongocampAdminGate.js +2 -3
  29. package/dist/runtime/composables/useMongocampBreadcrumbs.d.ts +12 -0
  30. package/dist/runtime/composables/useMongocampBreadcrumbs.js +13 -0
  31. package/dist/runtime/composables/useMongocampCollectionNames.d.ts +21 -0
  32. package/dist/runtime/composables/useMongocampCollectionNames.js +46 -0
  33. package/dist/runtime/composables/useMongocampNavigation.d.ts +32 -0
  34. package/dist/runtime/composables/useMongocampNavigation.js +15 -0
  35. package/dist/runtime/composables/useMongocampPaths.d.ts +6 -0
  36. package/dist/runtime/composables/useMongocampPaths.js +6 -0
  37. package/dist/runtime/composables/useMongocampPermissions.js +2 -3
  38. package/dist/runtime/composables/useMongocampProxyMode.d.ts +5 -0
  39. package/dist/runtime/composables/useMongocampProxyMode.js +4 -0
  40. package/dist/runtime/composables/useMongocampRoles.d.ts +3 -0
  41. package/dist/runtime/composables/useMongocampRoles.js +5 -1
  42. package/dist/runtime/composables/useMongocampSession.js +2 -3
  43. package/dist/runtime/locales/de.json +42 -0
  44. package/dist/runtime/locales/en.json +42 -0
  45. package/dist/runtime/publicUtils.d.ts +4 -0
  46. package/dist/runtime/publicUtils.js +4 -0
  47. package/dist/runtime/utils/collectionNames.d.ts +13 -0
  48. package/dist/runtime/utils/collectionNames.js +14 -0
  49. package/dist/runtime/utils/collectionProtection.d.ts +2 -0
  50. package/dist/runtime/utils/collectionProtection.js +3 -0
  51. package/dist/runtime/utils/navigation.d.ts +39 -0
  52. package/dist/runtime/utils/navigation.js +65 -0
  53. package/dist/runtime/utils/paths.d.ts +32 -0
  54. package/dist/runtime/utils/paths.js +24 -0
  55. package/dist/runtime/utils/serverStatus.d.ts +20 -0
  56. package/dist/runtime/utils/serverStatus.js +11 -0
  57. package/package.json +10 -3
package/dist/module.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
+ import { MongocampPaths } from '../dist/runtime/utils/paths.js';
2
3
 
3
4
  interface ModuleOptions {
4
5
  useGlobalAuthMiddleware?: boolean;
@@ -66,6 +67,14 @@ interface ModuleOptions {
66
67
  * Local route prefix the proxy listens on when `useServerProxy` is enabled.
67
68
  */
68
69
  serverProxyPath?: string;
70
+ /**
71
+ * Base routes of the app's MongoCamp pages. Every `*Path` prop of the components falls back to
72
+ * these (and `useMongocampPaths()` returns them), so an app with other routes sets them once
73
+ * instead of a prop per component. Keys: `home`, `account`, `collections`, `buckets`, `users`,
74
+ * `roles`, `permissions`, `jobs`, `databases`, `overview`, `server`, `settings`; a key left out
75
+ * keeps its default (`/secured`, `/secured/account`, `/secured/admin/<key>`).
76
+ */
77
+ paths?: Partial<MongocampPaths>;
69
78
  /**
70
79
  * Load the module's default styles for FormKit's label, help text, validation message and form
71
80
  * spacing (`runtime/assets/formkit.css`, built on Nuxt UI's `--ui-*` tokens). It is loaded before
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.16.0"
6
6
  },
7
- "version": "1.5.2",
7
+ "version": "1.5.4",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.4",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -61,6 +61,7 @@ const module$1 = defineNuxtModule({
61
61
  useServerProxy: false,
62
62
  serverProxyPath: "/api/_mongocamp",
63
63
  formkitStyles: true
64
+ // `paths` has no entry here: `useMongocampPaths()` fills in the defaults at runtime (`utils/paths.ts`).
64
65
  },
65
66
  // A function, not an object: the FormKit entry depends on the app (does it bring its own config?).
66
67
  // It has to be decided here — `@formkit/nuxt` is set up before this module's `setup()` runs, the
@@ -5,6 +5,8 @@ type __VLS_Props = {
5
5
  persistState?: boolean;
6
6
  stateKey?: string;
7
7
  hideRefresh?: boolean;
8
+ stickyActions?: boolean;
9
+ stickyId?: boolean;
8
10
  };
9
11
  declare function init(): Promise<void>;
10
12
  declare const __VLS_template: () => {
@@ -21,10 +23,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
21
23
  onChanged?: (() => any) | undefined;
22
24
  }>, {
23
25
  hideRefresh: boolean;
24
- infoPath: string;
25
26
  aggregatePath: string;
26
27
  persistState: boolean;
27
28
  stateKey: string;
29
+ stickyActions: boolean;
30
+ stickyId: boolean;
28
31
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
29
32
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
30
33
  declare const _default: typeof __VLS_export;
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { computed, h, ref, resolveComponent, watch } from "vue";
3
- import { useI18n, useMongocampClientApi, useMongocampError, useMongocampPermissions, useMongocampRoles, useMongocampSchema, useToast } from "#imports";
3
+ import { useI18n, useMongocampClientApi, useMongocampError, useMongocampPermissions, useMongocampRoles, useMongocampSchema, useToast, useMongocampPaths } from "#imports";
4
4
  import useMongocampCollection from "../composables/useMongocampCollection";
5
5
  import { useMongocampBucket } from "../composables/useMongocampBucket";
6
6
  import { useMongocampIndex } from "../composables/useMongocampIndex";
@@ -30,14 +30,17 @@ import MongocampCollectionCharts from "./MongocampCollectionCharts.vue";
30
30
  import { isFilterTooLong } from "../utils/requestLimits";
31
31
  const props = defineProps({
32
32
  collectionName: { type: String, required: true },
33
- infoPath: { type: String, required: false, default: "/secured/admin/collections" },
33
+ infoPath: { type: String, required: false },
34
34
  aggregatePath: { type: String, required: false, default: "" },
35
35
  persistState: { type: Boolean, required: false, default: true },
36
36
  stateKey: { type: String, required: false, default: "" },
37
- hideRefresh: { type: Boolean, required: false, default: false }
37
+ hideRefresh: { type: Boolean, required: false, default: false },
38
+ stickyActions: { type: Boolean, required: false, default: true },
39
+ stickyId: { type: Boolean, required: false, default: false }
38
40
  });
39
41
  const emit = defineEmits(["changed"]);
40
42
  const { t } = useI18n();
43
+ const paths = useMongocampPaths();
41
44
  const { documentApi } = useMongocampClientApi();
42
45
  const { pagination, total } = useMongocampCollection();
43
46
  const { state: persisted } = useMongocampPersistedState(
@@ -291,7 +294,7 @@ async function indexField(key, ascending) {
291
294
  title: t("nuxtUiMongocamp.collectionData.indexCreatedTitle"),
292
295
  description: t("nuxtUiMongocamp.collectionData.indexCreatedDescription", { name: created.name, collection: props.collectionName }),
293
296
  color: "success",
294
- actions: [{ label: t("nuxtUiMongocamp.collectionData.viewIndexes"), to: `${props.infoPath}/${props.collectionName}` }]
297
+ actions: [{ label: t("nuxtUiMongocamp.collectionData.viewIndexes"), to: `${props.infoPath ?? paths.collections}/${props.collectionName}` }]
295
298
  });
296
299
  } catch (e) {
297
300
  toast.add({ title: t("nuxtUiMongocamp.collectionData.indexFailedTitle", { field: key }), description: await indexFailureMessage(e), color: "error" });
@@ -325,6 +328,17 @@ function columnHeader(column, key) {
325
328
  ]);
326
329
  }
327
330
  const columns = ref([]);
331
+ const STICKY_ACTIONS = "sticky right-0 z-10 bg-default";
332
+ const STICKY_ID = "sticky left-0 z-10 bg-default";
333
+ const tableColumns = computed(() => {
334
+ if (!props.stickyActions && !props.stickyId) return columns.value;
335
+ const firstData = columns.value.find((column) => "accessorKey" in column);
336
+ return columns.value.map((column) => {
337
+ if (props.stickyActions && column.id === "actions") return { ...column, meta: { class: { th: STICKY_ACTIONS, td: STICKY_ACTIONS } } };
338
+ if (props.stickyId && column === firstData) return { ...column, meta: { class: { th: STICKY_ID, td: STICKY_ID } } };
339
+ return column;
340
+ });
341
+ });
328
342
  const documents = ref([]);
329
343
  const loading = ref(false);
330
344
  const filterText = ref("");
@@ -672,12 +686,10 @@ async function fetchDocuments() {
672
686
  ...keys.filter((k) => k !== "_id" && k !== "metaData").sort(),
673
687
  ...keys.filter((k) => k === "metaData")
674
688
  ];
675
- columns.value = orderedKeys.map((key, index) => ({
689
+ columns.value = orderedKeys.map((key) => ({
676
690
  accessorKey: key,
677
691
  header: ({ column }) => columnHeader(column, key),
678
- cell: makeCell(key, "string"),
679
- // keep the first column (usually _id) pinned so rows stay identifiable when the table scrolls sideways
680
- ...index === 0 ? { meta: { class: { th: "sticky left-0 z-10 bg-default", td: "sticky left-0 z-10 bg-default" } } } : {}
692
+ cell: makeCell(key, "string")
681
693
  }));
682
694
  filterableColumns.value = orderedKeys.filter((k) => k !== "_id" && k !== "metaData" && typeof firstRow[k] === "string");
683
695
  pageFilterFields.value = schemaFromSamples(rows.map((row) => unwrapExtendedJson(row, { exactLongs: false }))).map((c) => ({ key: c.columnKey, type: c.columnKey === "_id" ? "objectId" : toFilterFieldType(c.columnType) })).filter((f) => operatorsFor(f.type).length > 0);
@@ -1035,7 +1047,7 @@ defineExpose({ refresh: init });
1035
1047
  :get-row-id="rowId"
1036
1048
  :sorting-options="{ manualSorting: true }"
1037
1049
  :data="documents"
1038
- :columns="columns"
1050
+ :columns="tableColumns"
1039
1051
  :loading="loading"
1040
1052
  >
1041
1053
  <template #empty>
@@ -5,6 +5,8 @@ type __VLS_Props = {
5
5
  persistState?: boolean;
6
6
  stateKey?: string;
7
7
  hideRefresh?: boolean;
8
+ stickyActions?: boolean;
9
+ stickyId?: boolean;
8
10
  };
9
11
  declare function init(): Promise<void>;
10
12
  declare const __VLS_template: () => {
@@ -21,10 +23,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
21
23
  onChanged?: (() => any) | undefined;
22
24
  }>, {
23
25
  hideRefresh: boolean;
24
- infoPath: string;
25
26
  aggregatePath: string;
26
27
  persistState: boolean;
27
28
  stateKey: string;
29
+ stickyActions: boolean;
30
+ stickyId: boolean;
28
31
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
29
32
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
30
33
  declare const _default: typeof __VLS_export;
@@ -2,7 +2,7 @@
2
2
  import { formatBytes } from "../utils/formatBytes";
3
3
  import { shortenLabel, topNWithOther } from "../utils/chartData";
4
4
  import { computed, h, ref, resolveComponent } from "vue";
5
- import { useI18n, useMongocampClientApi, useMongocampBucket, useMongocampRoles, useToast } from "#imports";
5
+ import { useI18n, useMongocampClientApi, useMongocampBucket, useMongocampCollectionNames, useMongocampRoles, useToast, useMongocampPaths } from "#imports";
6
6
  import useMongocampAdmin from "../composables/useMongocampAdmin";
7
7
  import { isProtectedCollection } from "../utils/collectionProtection";
8
8
  const props = defineProps({
@@ -15,6 +15,8 @@ const props = defineProps({
15
15
  });
16
16
  const emit = defineEmits(["changed"]);
17
17
  const { t } = useI18n();
18
+ const paths = useMongocampPaths();
19
+ const sharedNames = useMongocampCollectionNames();
18
20
  const { collectionApi } = useMongocampClientApi();
19
21
  const { isBucketCollection, bucketNameFor, bucketActionInFlight, clearBucket, deleteBucket } = useMongocampBucket();
20
22
  const { clearCollection, deleteCollection } = useMongocampAdmin();
@@ -40,6 +42,7 @@ async function fetchCollections() {
40
42
  loadError.value = null;
41
43
  try {
42
44
  const [names, infos] = await Promise.all([collectionApi.listCollections(), collectionApi.listCollectionInformation({})]);
45
+ sharedNames.set(names);
43
46
  const byName = new Map(infos.map((info) => [info.name, info]));
44
47
  const rows = names.filter((name) => !name.startsWith("mc")).flatMap((name) => {
45
48
  const info = byName.get(name);
@@ -148,7 +151,7 @@ const columns = computed(() => [
148
151
  "variant": "ghost",
149
152
  "size": "sm",
150
153
  "aria-label": t("nuxtUiMongocamp.collections.infoTooltip"),
151
- "to": `${props.infoPath ?? "/secured/admin/collections"}/${row.original.name}`
154
+ "to": `${props.infoPath ?? paths.collections}/${row.original.name}`
152
155
  })),
153
156
  withTooltip(t("nuxtUiMongocamp.collections.dataTooltip"), h(UButton, {
154
157
  "icon": "i-lucide-table",
@@ -156,7 +159,7 @@ const columns = computed(() => [
156
159
  "variant": "ghost",
157
160
  "size": "sm",
158
161
  "aria-label": t("nuxtUiMongocamp.collections.dataTooltip"),
159
- "to": `${props.dataPath ?? "/secured/admin/collections"}/${row.original.name}/data`
162
+ "to": `${props.dataPath ?? paths.collections}/${row.original.name}/data`
160
163
  }))
161
164
  ];
162
165
  if (isBucketCollection(row.original.name)) {
@@ -168,7 +171,7 @@ const columns = computed(() => [
168
171
  "variant": "ghost",
169
172
  "size": "sm",
170
173
  "aria-label": t("nuxtUiMongocamp.collections.browseFilesTooltip"),
171
- "to": `${props.bucketFilesPath ?? "/secured/admin/buckets"}/${bucketName}`
174
+ "to": `${props.bucketFilesPath ?? paths.buckets}/${bucketName}`
172
175
  })),
173
176
  withTooltip(t("nuxtUiMongocamp.collections.clearBucketTooltip"), h(UButton, {
174
177
  "icon": "i-lucide-eraser",
@@ -28,13 +28,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
28
28
  shortcut: string;
29
29
  cacheMs: number;
30
30
  navigate: boolean;
31
- collectionPath: string;
32
- bucketPath: string;
33
- usersPath: string;
34
- rolePath: string;
35
- jobsPath: string;
36
- settingsPath: string;
37
- accountPath: string;
38
31
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
39
32
  declare const _default: typeof __VLS_export;
40
33
  export default _default;
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { computed, ref, watch } from "vue";
3
- import { defineShortcuts, navigateTo, useI18n } from "#imports";
3
+ import { defineShortcuts, navigateTo, useI18n, useMongocampPaths } from "#imports";
4
4
  import useMongocampAdmin from "../composables/useMongocampAdmin";
5
5
  import { useMongocampJobs } from "../composables/useMongocampJobs";
6
6
  import { useMongocampPermissions } from "../composables/useMongocampPermissions";
@@ -10,17 +10,18 @@ const props = defineProps({
10
10
  shortcut: { type: String, required: false, default: "meta_k" },
11
11
  cacheMs: { type: Number, required: false, default: 6e4 },
12
12
  navigate: { type: Boolean, required: false, default: true },
13
- collectionPath: { type: String, required: false, default: "/secured/admin/collections" },
14
- bucketPath: { type: String, required: false, default: "/secured/admin/buckets" },
15
- usersPath: { type: String, required: false, default: "/secured/admin/users" },
16
- rolePath: { type: String, required: false, default: "/secured/admin/roles" },
17
- jobsPath: { type: String, required: false, default: "/secured/admin/jobs" },
18
- settingsPath: { type: String, required: false, default: "/secured/admin/settings" },
19
- accountPath: { type: String, required: false, default: "/secured/account" }
13
+ collectionPath: { type: String, required: false },
14
+ bucketPath: { type: String, required: false },
15
+ usersPath: { type: String, required: false },
16
+ rolePath: { type: String, required: false },
17
+ jobsPath: { type: String, required: false },
18
+ settingsPath: { type: String, required: false },
19
+ accountPath: { type: String, required: false }
20
20
  });
21
21
  const emit = defineEmits(["select"]);
22
22
  const open = defineModel("open", { type: Boolean, ...{ default: false } });
23
23
  const { t } = useI18n();
24
+ const basePaths = useMongocampPaths();
24
25
  const { listUsers, listRoles, listCollections } = useMongocampAdmin();
25
26
  const { listJobs } = useMongocampJobs();
26
27
  const { canRead, load: loadPermissions } = useMongocampPermissions();
@@ -31,13 +32,13 @@ const loading = ref(false);
31
32
  const failed = ref([]);
32
33
  let generation = 0;
33
34
  const paths = computed(() => ({
34
- collectionPath: props.collectionPath,
35
- bucketPath: props.bucketPath,
36
- usersPath: props.usersPath,
37
- rolePath: props.rolePath,
38
- jobsPath: props.jobsPath,
39
- settingsPath: props.settingsPath,
40
- accountPath: props.accountPath
35
+ collectionPath: props.collectionPath ?? basePaths.collections,
36
+ bucketPath: props.bucketPath ?? basePaths.buckets,
37
+ usersPath: props.usersPath ?? basePaths.users,
38
+ rolePath: props.rolePath ?? basePaths.roles,
39
+ jobsPath: props.jobsPath ?? basePaths.jobs,
40
+ settingsPath: props.settingsPath ?? basePaths.settings,
41
+ accountPath: props.accountPath ?? basePaths.account
41
42
  }));
42
43
  async function load() {
43
44
  const current = ++generation;
@@ -28,13 +28,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
28
28
  shortcut: string;
29
29
  cacheMs: number;
30
30
  navigate: boolean;
31
- collectionPath: string;
32
- bucketPath: string;
33
- usersPath: string;
34
- rolePath: string;
35
- jobsPath: string;
36
- settingsPath: string;
37
- accountPath: string;
38
31
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
39
32
  declare const _default: typeof __VLS_export;
40
33
  export default _default;
@@ -17,9 +17,6 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
17
17
  refresh: typeof refresh;
18
18
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
19
19
  hideHeading: boolean;
20
- usersPath: string;
21
- collectionsPath: string;
22
- rolesPath: string;
23
20
  autoRefresh: number;
24
21
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
25
22
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -1,19 +1,20 @@
1
1
  <script setup>
2
2
  import { computed, onMounted, ref, watch } from "vue";
3
- import { useI18n } from "#imports";
3
+ import { useI18n, useMongocampPaths } from "#imports";
4
4
  import { useNuxtApp } from "#app";
5
5
  import useMongocampAdmin from "../composables/useMongocampAdmin";
6
6
  import { useMongocampAutoRefresh } from "../composables/useMongocampAutoRefresh";
7
7
  import { useMongocampAdminGate } from "../composables/useMongocampAdminGate";
8
8
  const props = defineProps({
9
- collectionsPath: { type: String, required: false, default: "/secured/admin/collections" },
10
- usersPath: { type: String, required: false, default: "/secured/admin/users" },
11
- rolesPath: { type: String, required: false, default: "/secured/admin/roles" },
9
+ collectionsPath: { type: String, required: false },
10
+ usersPath: { type: String, required: false },
11
+ rolesPath: { type: String, required: false },
12
12
  autoRefresh: { type: Number, required: false, default: 0 },
13
13
  hideHeading: { type: Boolean, required: false, default: false },
14
14
  hideRefresh: { type: Boolean, required: false }
15
15
  });
16
16
  const { t } = useI18n();
17
+ const paths = useMongocampPaths();
17
18
  const { $mongocampVersion } = useNuxtApp();
18
19
  const { listUsers, listRoles, listCollections } = useMongocampAdmin();
19
20
  const version = computed(() => $mongocampVersion.value);
@@ -52,9 +53,9 @@ function syncAutoRefresh() {
52
53
  onMounted(syncAutoRefresh);
53
54
  watch(() => props.autoRefresh, syncAutoRefresh);
54
55
  const boxes = computed(() => [
55
- { key: "collections", label: t("nuxtUiMongocamp.dashboard.collections"), icon: "i-lucide-database", to: props.collectionsPath },
56
- { key: "users", label: t("nuxtUiMongocamp.dashboard.users"), icon: "i-lucide-users", to: props.usersPath },
57
- { key: "roles", label: t("nuxtUiMongocamp.dashboard.roles"), icon: "i-lucide-shield", to: props.rolesPath }
56
+ { key: "collections", label: t("nuxtUiMongocamp.dashboard.collections"), icon: "i-lucide-database", to: props.collectionsPath ?? paths.collections },
57
+ { key: "users", label: t("nuxtUiMongocamp.dashboard.users"), icon: "i-lucide-users", to: props.usersPath ?? paths.users },
58
+ { key: "roles", label: t("nuxtUiMongocamp.dashboard.roles"), icon: "i-lucide-shield", to: props.rolesPath ?? paths.roles }
58
59
  ]);
59
60
  defineExpose({ refresh });
60
61
  if (!blocked.value) refresh();
@@ -17,9 +17,6 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
17
17
  refresh: typeof refresh;
18
18
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
19
19
  hideHeading: boolean;
20
- usersPath: string;
21
- collectionsPath: string;
22
- rolesPath: string;
23
20
  autoRefresh: number;
24
21
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
25
22
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -16,7 +16,6 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
16
16
  refresh: typeof load;
17
17
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
18
18
  hideHeading: boolean;
19
- grantsPath: string;
20
19
  maxCollections: number;
21
20
  maxUsers: number;
22
21
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -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,13 +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, default: "/secured/admin/roles" },
17
+ grantsPath: { type: String, required: false },
18
18
  maxCollections: { type: Number, required: false, default: 60 },
19
19
  maxUsers: { type: Number, required: false, default: 200 },
20
20
  hideHeading: { type: Boolean, required: false, default: false },
21
21
  hideRefresh: { type: Boolean, required: false }
22
22
  });
23
23
  const { t } = useI18n();
24
+ const paths = useMongocampPaths();
24
25
  const { listUsers, listRoles, listCollections } = useMongocampAdmin();
25
26
  const matrix = ref(null);
26
27
  const roleNames = ref([]);
@@ -269,7 +270,7 @@ defineExpose({ refresh: load });
269
270
  <NuxtLink
270
271
  v-for="roleName in userByName.get(row).roles"
271
272
  :key="roleName"
272
- :to="`${grantsPath}/${roleName}`"
273
+ :to="`${grantsPath ?? paths.roles}/${roleName}`"
273
274
  class="rounded bg-elevated px-1.5 py-0.5 text-xs hover:underline"
274
275
  :class="userByName.get(row).unknownRoles.includes(roleName) ? 'text-warning' : 'text-dimmed'"
275
276
  :title="userByName.get(row).unknownRoles.includes(roleName) ? t('nuxtUiMongocamp.permissionMatrix.unknownRoleNote') : t('nuxtUiMongocamp.permissionMatrix.openRole', { role: roleName })"
@@ -16,7 +16,6 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
16
16
  refresh: typeof load;
17
17
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
18
18
  hideHeading: boolean;
19
- grantsPath: string;
20
19
  maxCollections: number;
21
20
  maxUsers: number;
22
21
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1,6 +1,6 @@
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";
@@ -12,6 +12,7 @@ const props = defineProps({
12
12
  });
13
13
  const emit = defineEmits(["changed"]);
14
14
  const { t } = useI18n();
15
+ const paths = useMongocampPaths();
15
16
  const { listRoles, addRole, updateRole, deleteRole } = useMongocampAdmin();
16
17
  const roles = ref([]);
17
18
  const loading = ref(false);
@@ -244,7 +245,7 @@ const columns = computed(() => [
244
245
  "variant": "ghost",
245
246
  "size": "sm",
246
247
  "aria-label": t("nuxtUiMongocamp.roles.manageGrantsTooltip"),
247
- "to": props.grantsPath ? `${props.grantsPath}/${row.original.name}` : `/secured/admin/roles/${row.original.name}`
248
+ "to": `${props.grantsPath || paths.roles}/${row.original.name}`
248
249
  })),
249
250
  withTooltip(t("nuxtUiMongocamp.roles.editRoleTooltip"), h(UButton, {
250
251
  "icon": "i-lucide-pencil",
@@ -18,10 +18,7 @@ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
18
18
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
19
19
  refresh: () => Promise<void>;
20
20
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
21
- infoPath: string;
22
- dataPath: string;
23
21
  hideHeading: boolean;
24
- jobsPath: string;
25
22
  autoRefresh: number;
26
23
  maxCollections: number;
27
24
  topN: number;
@@ -1,15 +1,15 @@
1
1
  <script setup>
2
2
  import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
3
- import { useI18n } from "#imports";
3
+ import { useI18n, useMongocampPaths } from "#imports";
4
4
  import { useMongocampAutoRefresh } from "../composables/useMongocampAutoRefresh";
5
5
  import { useMongocampAdminGate } from "../composables/useMongocampAdminGate";
6
6
  import { useMongocampServerOverview } from "../composables/useMongocampServerOverview";
7
7
  import { formatBytes } from "../utils/formatBytes";
8
8
  import { BYTE_METRICS, nextJobs, overviewTotals, rankCollections, RANK_METRICS, shareSlices } from "../utils/serverOverview";
9
9
  const props = defineProps({
10
- infoPath: { type: String, required: false, default: "/secured/admin/collections" },
11
- dataPath: { type: String, required: false, default: "/secured/admin/collections" },
12
- jobsPath: { type: String, required: false, default: "/secured/admin/jobs" },
10
+ infoPath: { type: String, required: false },
11
+ dataPath: { type: String, required: false },
12
+ jobsPath: { type: String, required: false },
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 },
@@ -18,6 +18,7 @@ const props = defineProps({
18
18
  hideRefresh: { type: Boolean, required: false }
19
19
  });
20
20
  const { t, locale } = useI18n();
21
+ const paths = useMongocampPaths();
21
22
  const { loadOverview } = useMongocampServerOverview();
22
23
  const overview = ref(null);
23
24
  const loading = ref(false);
@@ -274,7 +275,7 @@ defineExpose({ refresh: () => load() });
274
275
  >
275
276
  <span class="w-6 text-right text-dimmed">{{ index + 1 }}</span>
276
277
  <NuxtLink
277
- :to="`${infoPath}/${collection.name}`"
278
+ :to="`${infoPath ?? paths.collections}/${collection.name}`"
278
279
  class="min-w-0 flex-1 truncate font-medium hover:underline"
279
280
  :aria-label="t('nuxtUiMongocamp.serverOverview.openInfo', { name: collection.name })"
280
281
  >
@@ -286,7 +287,7 @@ defineExpose({ refresh: () => load() });
286
287
  color="neutral"
287
288
  variant="ghost"
288
289
  size="xs"
289
- :to="`${dataPath}/${collection.name}/data`"
290
+ :to="`${dataPath ?? paths.collections}/${collection.name}/data`"
290
291
  :aria-label="t('nuxtUiMongocamp.serverOverview.openData', { name: collection.name })"
291
292
  />
292
293
  </li>
@@ -392,7 +393,7 @@ defineExpose({ refresh: () => load() });
392
393
  <span class="font-semibold">{{ t("nuxtUiMongocamp.serverOverview.jobsTitle") }}</span>
393
394
  <UButton
394
395
  :label="t('nuxtUiMongocamp.serverOverview.allJobs')"
395
- :to="jobsPath"
396
+ :to="jobsPath ?? paths.jobs"
396
397
  color="neutral"
397
398
  variant="link"
398
399
  size="xs"
@@ -18,10 +18,7 @@ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
18
18
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
19
19
  refresh: () => Promise<void>;
20
20
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
21
- infoPath: string;
22
- dataPath: string;
23
21
  hideHeading: boolean;
24
- jobsPath: string;
25
22
  autoRefresh: number;
26
23
  maxCollections: number;
27
24
  topN: number;
@@ -0,0 +1,13 @@
1
+ type __VLS_Props = {
2
+ collapsed?: boolean;
3
+ autoRefresh?: number;
4
+ detailsPath?: string;
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
7
+ refresh: () => Promise<void>;
8
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
9
+ collapsed: boolean;
10
+ autoRefresh: number;
11
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;