@sfxcode/nuxt-ui-mongocamp 1.5.1 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/module.d.mts +15 -0
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +25 -4
  4. package/dist/runtime/assets/formkit.css +1 -0
  5. package/dist/runtime/components/MongocampAccount.vue +4 -4
  6. package/dist/runtime/components/MongocampBucketFiles.d.vue.ts +21 -1
  7. package/dist/runtime/components/MongocampBucketFiles.vue +17 -5
  8. package/dist/runtime/components/MongocampBucketFiles.vue.d.ts +21 -1
  9. package/dist/runtime/components/MongocampCollectionData.d.vue.ts +22 -2
  10. package/dist/runtime/components/MongocampCollectionData.vue +31 -9
  11. package/dist/runtime/components/MongocampCollectionData.vue.d.ts +22 -2
  12. package/dist/runtime/components/MongocampCollectionInfos.vue +12 -12
  13. package/dist/runtime/components/MongocampCollections.d.vue.ts +19 -1
  14. package/dist/runtime/components/MongocampCollections.vue +20 -7
  15. package/dist/runtime/components/MongocampCollections.vue.d.ts +19 -1
  16. package/dist/runtime/components/MongocampCommandPalette.d.vue.ts +0 -7
  17. package/dist/runtime/components/MongocampCommandPalette.vue +16 -15
  18. package/dist/runtime/components/MongocampCommandPalette.vue.d.ts +0 -7
  19. package/dist/runtime/components/MongocampDashboard.d.vue.ts +3 -3
  20. package/dist/runtime/components/MongocampDashboard.vue +19 -12
  21. package/dist/runtime/components/MongocampDashboard.vue.d.ts +3 -3
  22. package/dist/runtime/components/MongocampDatabases.d.vue.ts +20 -1
  23. package/dist/runtime/components/MongocampDatabases.vue +15 -2
  24. package/dist/runtime/components/MongocampDatabases.vue.d.ts +20 -1
  25. package/dist/runtime/components/MongocampIndexes.vue +1 -1
  26. package/dist/runtime/components/MongocampJobs.d.vue.ts +23 -1
  27. package/dist/runtime/components/MongocampJobs.vue +18 -4
  28. package/dist/runtime/components/MongocampJobs.vue.d.ts +23 -1
  29. package/dist/runtime/components/MongocampLogin.d.vue.ts +16 -1
  30. package/dist/runtime/components/MongocampLogin.vue +13 -5
  31. package/dist/runtime/components/MongocampLogin.vue.d.ts +16 -1
  32. package/dist/runtime/components/MongocampPermissionMatrix.d.vue.ts +19 -2
  33. package/dist/runtime/components/MongocampPermissionMatrix.vue +15 -6
  34. package/dist/runtime/components/MongocampPermissionMatrix.vue.d.ts +19 -2
  35. package/dist/runtime/components/MongocampRoleGrants.d.vue.ts +22 -1
  36. package/dist/runtime/components/MongocampRoleGrants.vue +16 -4
  37. package/dist/runtime/components/MongocampRoleGrants.vue.d.ts +22 -1
  38. package/dist/runtime/components/MongocampRoles.d.vue.ts +22 -1
  39. package/dist/runtime/components/MongocampRoles.vue +22 -5
  40. package/dist/runtime/components/MongocampRoles.vue.d.ts +22 -1
  41. package/dist/runtime/components/MongocampServerInfo.d.vue.ts +2 -2
  42. package/dist/runtime/components/MongocampServerInfo.vue +14 -4
  43. package/dist/runtime/components/MongocampServerInfo.vue.d.ts +2 -2
  44. package/dist/runtime/components/MongocampServerOverview.d.vue.ts +18 -4
  45. package/dist/runtime/components/MongocampServerOverview.vue +33 -22
  46. package/dist/runtime/components/MongocampServerOverview.vue.d.ts +18 -4
  47. package/dist/runtime/components/MongocampServerStatus.d.vue.ts +13 -0
  48. package/dist/runtime/components/MongocampServerStatus.vue +147 -0
  49. package/dist/runtime/components/MongocampServerStatus.vue.d.ts +13 -0
  50. package/dist/runtime/components/MongocampSettings.d.vue.ts +1 -1
  51. package/dist/runtime/components/MongocampSettings.vue.d.ts +1 -1
  52. package/dist/runtime/components/MongocampUserAccess.d.vue.ts +27 -0
  53. package/dist/runtime/components/MongocampUserAccess.vue +168 -0
  54. package/dist/runtime/components/MongocampUserAccess.vue.d.ts +27 -0
  55. package/dist/runtime/components/MongocampUsers.d.vue.ts +24 -1
  56. package/dist/runtime/components/MongocampUsers.vue +22 -4
  57. package/dist/runtime/components/MongocampUsers.vue.d.ts +24 -1
  58. package/dist/runtime/components/MongocampVersion.vue +3 -3
  59. package/dist/runtime/composables/useMongocampAdminGate.js +2 -3
  60. package/dist/runtime/composables/useMongocampBreadcrumbs.d.ts +12 -0
  61. package/dist/runtime/composables/useMongocampBreadcrumbs.js +13 -0
  62. package/dist/runtime/composables/useMongocampCollectionNames.d.ts +21 -0
  63. package/dist/runtime/composables/useMongocampCollectionNames.js +46 -0
  64. package/dist/runtime/composables/useMongocampNavigation.d.ts +32 -0
  65. package/dist/runtime/composables/useMongocampNavigation.js +15 -0
  66. package/dist/runtime/composables/useMongocampPaths.d.ts +6 -0
  67. package/dist/runtime/composables/useMongocampPaths.js +6 -0
  68. package/dist/runtime/composables/useMongocampPermissions.js +2 -3
  69. package/dist/runtime/composables/useMongocampProxyMode.d.ts +5 -0
  70. package/dist/runtime/composables/useMongocampProxyMode.js +4 -0
  71. package/dist/runtime/composables/useMongocampRoles.d.ts +3 -0
  72. package/dist/runtime/composables/useMongocampRoles.js +5 -1
  73. package/dist/runtime/composables/useMongocampSession.js +2 -3
  74. package/dist/runtime/formkit.config.d.ts +3 -0
  75. package/dist/runtime/formkit.config.js +9 -0
  76. package/dist/runtime/locales/de.json +42 -0
  77. package/dist/runtime/locales/en.json +42 -0
  78. package/dist/runtime/publicUtils.d.ts +4 -0
  79. package/dist/runtime/publicUtils.js +4 -0
  80. package/dist/runtime/utils/collectionNames.d.ts +13 -0
  81. package/dist/runtime/utils/collectionNames.js +14 -0
  82. package/dist/runtime/utils/collectionProtection.d.ts +2 -0
  83. package/dist/runtime/utils/collectionProtection.js +3 -0
  84. package/dist/runtime/utils/navigation.d.ts +39 -0
  85. package/dist/runtime/utils/navigation.js +65 -0
  86. package/dist/runtime/utils/paths.d.ts +32 -0
  87. package/dist/runtime/utils/paths.js +24 -0
  88. package/dist/runtime/utils/serverStatus.d.ts +20 -0
  89. package/dist/runtime/utils/serverStatus.js +11 -0
  90. package/package.json +8 -1
@@ -2,17 +2,21 @@
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({
9
9
  infoPath: { type: String, required: false },
10
10
  dataPath: { type: String, required: false },
11
11
  bucketFilesPath: { type: String, required: false },
12
- canManage: { type: Boolean, required: false, default: true }
12
+ canManage: { type: Boolean, required: false, default: true },
13
+ hideHeading: { type: Boolean, required: false, default: false },
14
+ hideRefresh: { type: Boolean, required: false }
13
15
  });
14
16
  const emit = defineEmits(["changed"]);
15
17
  const { t } = useI18n();
18
+ const paths = useMongocampPaths();
19
+ const sharedNames = useMongocampCollectionNames();
16
20
  const { collectionApi } = useMongocampClientApi();
17
21
  const { isBucketCollection, bucketNameFor, bucketActionInFlight, clearBucket, deleteBucket } = useMongocampBucket();
18
22
  const { clearCollection, deleteCollection } = useMongocampAdmin();
@@ -38,6 +42,7 @@ async function fetchCollections() {
38
42
  loadError.value = null;
39
43
  try {
40
44
  const [names, infos] = await Promise.all([collectionApi.listCollections(), collectionApi.listCollectionInformation({})]);
45
+ sharedNames.set(names);
41
46
  const byName = new Map(infos.map((info) => [info.name, info]));
42
47
  const rows = names.filter((name) => !name.startsWith("mc")).flatMap((name) => {
43
48
  const info = byName.get(name);
@@ -146,7 +151,7 @@ const columns = computed(() => [
146
151
  "variant": "ghost",
147
152
  "size": "sm",
148
153
  "aria-label": t("nuxtUiMongocamp.collections.infoTooltip"),
149
- "to": `${props.infoPath ?? "/secured/admin/collections"}/${row.original.name}`
154
+ "to": `${props.infoPath ?? paths.collections}/${row.original.name}`
150
155
  })),
151
156
  withTooltip(t("nuxtUiMongocamp.collections.dataTooltip"), h(UButton, {
152
157
  "icon": "i-lucide-table",
@@ -154,7 +159,7 @@ const columns = computed(() => [
154
159
  "variant": "ghost",
155
160
  "size": "sm",
156
161
  "aria-label": t("nuxtUiMongocamp.collections.dataTooltip"),
157
- "to": `${props.dataPath ?? "/secured/admin/collections"}/${row.original.name}/data`
162
+ "to": `${props.dataPath ?? paths.collections}/${row.original.name}/data`
158
163
  }))
159
164
  ];
160
165
  if (isBucketCollection(row.original.name)) {
@@ -166,7 +171,7 @@ const columns = computed(() => [
166
171
  "variant": "ghost",
167
172
  "size": "sm",
168
173
  "aria-label": t("nuxtUiMongocamp.collections.browseFilesTooltip"),
169
- "to": `${props.bucketFilesPath ?? "/secured/admin/buckets"}/${bucketName}`
174
+ "to": `${props.bucketFilesPath ?? paths.buckets}/${bucketName}`
170
175
  })),
171
176
  withTooltip(t("nuxtUiMongocamp.collections.clearBucketTooltip"), h(UButton, {
172
177
  "icon": "i-lucide-eraser",
@@ -245,12 +250,16 @@ function openRename(name) {
245
250
  isRenameOpen.value = true;
246
251
  }
247
252
  fetchCollections();
253
+ defineExpose({ refresh: fetchCollections });
248
254
  </script>
249
255
 
250
256
  <template>
251
257
  <div class="flex flex-col gap-4">
252
258
  <div class="flex items-center justify-between gap-4">
253
- <h2 class="text-xl font-semibold">
259
+ <h2
260
+ v-if="!hideHeading"
261
+ class="text-xl font-semibold"
262
+ >
254
263
  {{ t("nuxtUiMongocamp.collections.heading") }}
255
264
  </h2>
256
265
  <div class="flex flex-1 items-center gap-2">
@@ -261,7 +270,10 @@ fetchCollections();
261
270
  size="sm"
262
271
  class="flex-1 max-w-xs"
263
272
  />
264
- <UTooltip :text="t('nuxtUiMongocamp.common.refresh')">
273
+ <UTooltip
274
+ v-if="!hideRefresh"
275
+ :text="t('nuxtUiMongocamp.common.refresh')"
276
+ >
265
277
  <UButton
266
278
  icon="i-lucide-refresh-cw"
267
279
  color="neutral"
@@ -271,6 +283,7 @@ fetchCollections();
271
283
  @click="fetchCollections"
272
284
  />
273
285
  </UTooltip>
286
+ <slot name="toolbar" />
274
287
  </div>
275
288
  </div>
276
289
 
@@ -3,13 +3,31 @@ type __VLS_Props = {
3
3
  dataPath?: string;
4
4
  bucketFilesPath?: string;
5
5
  canManage?: boolean;
6
+ hideHeading?: boolean;
7
+ hideRefresh?: boolean;
6
8
  };
7
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ declare function fetchCollections(): Promise<void>;
10
+ declare const __VLS_template: () => {
11
+ __VLS_Slots: {
12
+ toolbar?: (props: {}) => any;
13
+ };
14
+ };
15
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
16
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
17
+ refresh: typeof fetchCollections;
18
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
19
  changed: () => any;
9
20
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
10
21
  onChanged?: (() => any) | undefined;
11
22
  }>, {
12
23
  canManage: boolean;
24
+ hideHeading: boolean;
13
25
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
26
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
14
27
  declare const _default: typeof __VLS_export;
15
28
  export default _default;
29
+ type __VLS_WithSlots<T, S> = T & {
30
+ new (): {
31
+ $slots: S;
32
+ };
33
+ };
@@ -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;
@@ -3,6 +3,8 @@ type __VLS_Props = {
3
3
  usersPath?: string;
4
4
  rolesPath?: string;
5
5
  autoRefresh?: number;
6
+ hideHeading?: boolean;
7
+ hideRefresh?: boolean;
6
8
  };
7
9
  declare function refresh(): Promise<void>;
8
10
  declare const __VLS_template: () => {
@@ -14,9 +16,7 @@ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
14
16
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
15
17
  refresh: typeof refresh;
16
18
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
17
- usersPath: string;
18
- collectionsPath: string;
19
- rolesPath: string;
19
+ hideHeading: boolean;
20
20
  autoRefresh: number;
21
21
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
22
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -1,17 +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" },
12
- autoRefresh: { type: Number, required: false, default: 0 }
9
+ collectionsPath: { type: String, required: false },
10
+ usersPath: { type: String, required: false },
11
+ rolesPath: { type: String, required: false },
12
+ autoRefresh: { type: Number, required: false, default: 0 },
13
+ hideHeading: { type: Boolean, required: false, default: false },
14
+ hideRefresh: { type: Boolean, required: false }
13
15
  });
14
16
  const { t } = useI18n();
17
+ const paths = useMongocampPaths();
15
18
  const { $mongocampVersion } = useNuxtApp();
16
19
  const { listUsers, listRoles, listCollections } = useMongocampAdmin();
17
20
  const version = computed(() => $mongocampVersion.value);
@@ -50,18 +53,21 @@ function syncAutoRefresh() {
50
53
  onMounted(syncAutoRefresh);
51
54
  watch(() => props.autoRefresh, syncAutoRefresh);
52
55
  const boxes = computed(() => [
53
- { key: "collections", label: t("nuxtUiMongocamp.dashboard.collections"), icon: "i-lucide-database", to: props.collectionsPath },
54
- { key: "users", label: t("nuxtUiMongocamp.dashboard.users"), icon: "i-lucide-users", to: props.usersPath },
55
- { 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 }
56
59
  ]);
57
60
  defineExpose({ refresh });
58
61
  if (!blocked.value) refresh();
59
62
  </script>
60
63
 
61
64
  <template>
62
- <div class="flex flex-col gap-8 py-8">
65
+ <div class="flex flex-col gap-8">
63
66
  <div class="flex items-start justify-between">
64
- <div class="flex flex-col gap-1">
67
+ <div
68
+ v-if="!hideHeading"
69
+ class="flex flex-col gap-1"
70
+ >
65
71
  <h1 class="text-3xl font-bold">
66
72
  {{ t("nuxtUiMongocamp.dashboard.heading") }}
67
73
  </h1>
@@ -76,7 +82,8 @@ if (!blocked.value) refresh();
76
82
  </p>
77
83
  </div>
78
84
  <UTooltip
79
- v-if="!blocked"
85
+ v-if="!blocked && !hideRefresh"
86
+ class="ml-auto"
80
87
  :text="t('nuxtUiMongocamp.common.refresh')"
81
88
  >
82
89
  <UButton
@@ -127,7 +134,7 @@ if (!blocked.value) refresh();
127
134
  />
128
135
  <div
129
136
  v-else
130
- class="text-3xl font-bold"
137
+ class="tabular-nums text-3xl font-bold"
131
138
  >
132
139
  {{ stats?.[box.key] ?? "\u2014" }}
133
140
  </div>
@@ -3,6 +3,8 @@ type __VLS_Props = {
3
3
  usersPath?: string;
4
4
  rolesPath?: string;
5
5
  autoRefresh?: number;
6
+ hideHeading?: boolean;
7
+ hideRefresh?: boolean;
6
8
  };
7
9
  declare function refresh(): Promise<void>;
8
10
  declare const __VLS_template: () => {
@@ -14,9 +16,7 @@ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
14
16
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
15
17
  refresh: typeof refresh;
16
18
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
17
- usersPath: string;
18
- collectionsPath: string;
19
- rolesPath: string;
19
+ hideHeading: boolean;
20
20
  autoRefresh: number;
21
21
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
22
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -1,3 +1,22 @@
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 fetchDatabases(): 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 fetchDatabases;
14
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
2
16
  declare const _default: typeof __VLS_export;
3
17
  export default _default;
18
+ type __VLS_WithSlots<T, S> = T & {
19
+ new (): {
20
+ $slots: S;
21
+ };
22
+ };
@@ -4,6 +4,10 @@ import { useI18n, useMongocampSystem } from "#imports";
4
4
  import { formatBytes } from "../utils/formatBytes";
5
5
  import { shortenLabel } from "../utils/chartData";
6
6
  import { useMongocampAdminGate } from "../composables/useMongocampAdminGate";
7
+ defineProps({
8
+ hideHeading: { type: Boolean, required: false },
9
+ hideRefresh: { type: Boolean, required: false }
10
+ });
7
11
  const { t } = useI18n();
8
12
  const { getDatabaseInfos, listCollectionsByDatabase } = useMongocampSystem();
9
13
  const databases = ref([]);
@@ -70,6 +74,7 @@ const columns = computed(() => [
70
74
  }
71
75
  ]);
72
76
  if (!blocked.value) fetchDatabases();
77
+ defineExpose({ refresh: fetchDatabases });
73
78
  </script>
74
79
 
75
80
  <template>
@@ -84,10 +89,17 @@ if (!blocked.value) fetchDatabases();
84
89
  class="flex flex-col gap-4"
85
90
  >
86
91
  <div class="flex items-center justify-between gap-4">
87
- <h2 class="text-xl font-semibold">
92
+ <h2
93
+ v-if="!hideHeading"
94
+ class="text-xl font-semibold"
95
+ >
88
96
  {{ t("nuxtUiMongocamp.databases.heading") }}
89
97
  </h2>
90
- <UTooltip :text="t('nuxtUiMongocamp.common.refresh')">
98
+ <UTooltip
99
+ v-if="!hideRefresh"
100
+ class="ml-auto"
101
+ :text="t('nuxtUiMongocamp.common.refresh')"
102
+ >
91
103
  <UButton
92
104
  icon="i-lucide-refresh-cw"
93
105
  color="neutral"
@@ -97,6 +109,7 @@ if (!blocked.value) fetchDatabases();
97
109
  @click="fetchDatabases"
98
110
  />
99
111
  </UTooltip>
112
+ <slot name="toolbar" />
100
113
  </div>
101
114
 
102
115
  <MongocampErrorAlert
@@ -1,3 +1,22 @@
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 fetchDatabases(): 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 fetchDatabases;
14
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
2
16
  declare const _default: typeof __VLS_export;
3
17
  export default _default;
18
+ type __VLS_WithSlots<T, S> = T & {
19
+ new (): {
20
+ $slots: S;
21
+ };
22
+ };
@@ -117,7 +117,7 @@ const columns = computed(() => [
117
117
  {
118
118
  accessorKey: "size",
119
119
  header: t("nuxtUiMongocamp.indexes.columnSize"),
120
- cell: ({ row }) => h("span", row.original.size === void 0 ? "\u2014" : formatBytes(row.original.size))
120
+ cell: ({ row }) => h("span", { class: "tabular-nums" }, row.original.size === void 0 ? "\u2014" : formatBytes(row.original.size))
121
121
  },
122
122
  {
123
123
  id: "usage",
@@ -1,8 +1,30 @@
1
1
  type __VLS_Props = {
2
2
  autoRefresh?: number;
3
+ hideHeading?: boolean;
4
+ hideRefresh?: boolean;
3
5
  };
4
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
6
+ declare function fetchJobs(): 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 fetchJobs;
15
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
+ changed: () => any;
17
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
18
+ onChanged?: (() => any) | undefined;
19
+ }>, {
20
+ hideHeading: boolean;
5
21
  autoRefresh: number;
6
22
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
23
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
7
24
  declare const _default: typeof __VLS_export;
8
25
  export default _default;
26
+ type __VLS_WithSlots<T, S> = T & {
27
+ new (): {
28
+ $slots: S;
29
+ };
30
+ };
@@ -4,8 +4,11 @@ import { useI18n, useMongocampError, useMongocampJobs, useToast } from "#imports
4
4
  import { useMongocampAutoRefresh } from "../composables/useMongocampAutoRefresh";
5
5
  import { useMongocampAdminGate } from "../composables/useMongocampAdminGate";
6
6
  const props = defineProps({
7
- autoRefresh: { type: Number, required: false, default: 0 }
7
+ autoRefresh: { type: Number, required: false, default: 0 },
8
+ hideHeading: { type: Boolean, required: false, default: 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 { listJobs, listPossibleJobs, registerJob, updateJob, executeJob, deleteJob } = useMongocampJobs();
@@ -145,6 +148,7 @@ async function handleAddJob() {
145
148
  await registerJob({ ...newJob.value, className });
146
149
  isAddModalOpen.value = false;
147
150
  await fetchJobs();
151
+ emit("changed");
148
152
  } catch (e) {
149
153
  errorMessage.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.jobs.errorAdd");
150
154
  }
@@ -169,6 +173,7 @@ async function handleEditJob() {
169
173
  await updateJob(editJobOriginal.value.group, editJobOriginal.value.name, jobConfig);
170
174
  isEditModalOpen.value = false;
171
175
  await fetchJobs();
176
+ emit("changed");
172
177
  } catch (e) {
173
178
  errorMessage.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.jobs.errorEdit");
174
179
  }
@@ -188,6 +193,7 @@ async function handleDeleteJob() {
188
193
  await deleteJob(jobToDelete.value.group, jobToDelete.value.name);
189
194
  isDeleteModalOpen.value = false;
190
195
  await fetchJobs();
196
+ emit("changed");
191
197
  } catch (e) {
192
198
  deleteError.value = (await describeServerError(e, "nuxtUiMongocamp.jobs.errorDelete")).message;
193
199
  } finally {
@@ -285,6 +291,7 @@ const columns = computed(() => [
285
291
  }
286
292
  ]);
287
293
  if (!blocked.value) fetchJobs();
294
+ defineExpose({ refresh: fetchJobs });
288
295
  </script>
289
296
 
290
297
  <template>
@@ -299,11 +306,17 @@ if (!blocked.value) fetchJobs();
299
306
  class="flex flex-col gap-4"
300
307
  >
301
308
  <div class="flex items-center justify-between gap-4">
302
- <h2 class="text-xl font-semibold">
309
+ <h2
310
+ v-if="!hideHeading"
311
+ class="text-xl font-semibold"
312
+ >
303
313
  {{ t("nuxtUiMongocamp.jobs.heading") }}
304
314
  </h2>
305
- <div class="flex items-center gap-2">
306
- <UTooltip :text="t('nuxtUiMongocamp.common.refresh')">
315
+ <div class="ml-auto flex items-center gap-2">
316
+ <UTooltip
317
+ v-if="!hideRefresh"
318
+ :text="t('nuxtUiMongocamp.common.refresh')"
319
+ >
307
320
  <UButton
308
321
  icon="i-lucide-refresh-cw"
309
322
  color="neutral"
@@ -313,6 +326,7 @@ if (!blocked.value) fetchJobs();
313
326
  @click="fetchJobs"
314
327
  />
315
328
  </UTooltip>
329
+ <slot name="toolbar" />
316
330
  <UButton
317
331
  icon="i-lucide-plus"
318
332
  :label="t('nuxtUiMongocamp.jobs.addJob')"
@@ -1,8 +1,30 @@
1
1
  type __VLS_Props = {
2
2
  autoRefresh?: number;
3
+ hideHeading?: boolean;
4
+ hideRefresh?: boolean;
3
5
  };
4
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
6
+ declare function fetchJobs(): 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 fetchJobs;
15
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
+ changed: () => any;
17
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
18
+ onChanged?: (() => any) | undefined;
19
+ }>, {
20
+ hideHeading: boolean;
5
21
  autoRefresh: number;
6
22
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
23
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
7
24
  declare const _default: typeof __VLS_export;
8
25
  export default _default;
26
+ type __VLS_WithSlots<T, S> = T & {
27
+ new (): {
28
+ $slots: S;
29
+ };
30
+ };
@@ -1,6 +1,21 @@
1
1
  type __VLS_Props = {
2
2
  redirectPath?: string;
3
+ hideHeading?: boolean;
3
4
  };
4
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
+ declare const __VLS_template: () => {
6
+ __VLS_Slots: {
7
+ header?: (props: {}) => any;
8
+ } & {
9
+ footer?: (props: {}) => any;
10
+ };
11
+ };
12
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
13
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
5
15
  declare const _default: typeof __VLS_export;
6
16
  export default _default;
17
+ type __VLS_WithSlots<T, S> = T & {
18
+ new (): {
19
+ $slots: S;
20
+ };
21
+ };
@@ -4,7 +4,8 @@ import { ref, reactive } from "vue";
4
4
  import { useI18n, useMongocampAuth } from "#imports";
5
5
  import { navigateTo, useCookie, useNuxtApp } from "#app";
6
6
  const props = defineProps({
7
- redirectPath: { type: String, required: false }
7
+ redirectPath: { type: String, required: false },
8
+ hideHeading: { type: Boolean, required: false }
8
9
  });
9
10
  const { t } = useI18n();
10
11
  const { login } = useMongocampAuth();
@@ -12,24 +13,27 @@ const errorMessage = ref("");
12
13
  const nuxtApp = useNuxtApp();
13
14
  const loginMail = useCookie("mongocamp_login", { maxAge: 30 * 24 * 60 * 60 });
14
15
  const data = ref({ userId: loginMail.value, password: "" });
16
+ const fullWidth = { outerClass: "w-full", innerClass: "w-full", class: "w-full" };
15
17
  const schema = reactive(
16
18
  [
17
- {
19
+ ...props.hideHeading ? [] : [{
18
20
  $el: "h3",
19
21
  children: t("nuxtUiMongocamp.login.heading")
20
- },
22
+ }],
21
23
  {
22
24
  $formkit: "nuxtUIInput",
23
25
  name: "userId",
24
26
  label: t("nuxtUiMongocamp.login.email"),
25
- validation: "required|email"
27
+ validation: "required|email",
28
+ ...fullWidth
26
29
  },
27
30
  {
28
31
  $formkit: "nuxtUIInput",
29
32
  name: "password",
30
33
  label: t("nuxtUiMongocamp.login.password"),
31
34
  inputType: "password",
32
- validation: "required|length:3"
35
+ validation: "required|length:3",
36
+ ...fullWidth
33
37
  }
34
38
  ]
35
39
  );
@@ -50,6 +54,8 @@ async function actionLogin() {
50
54
  <template>
51
55
  <div class="flex flex-col items-center justify-center gap-4 p-4 w-full">
52
56
  <UPageCard class="w-full max-w-md">
57
+ <!-- above the form: a logo, a title, a hint -->
58
+ <slot name="header" />
53
59
  <FUDataEdit
54
60
  :data="data"
55
61
  :schema="schema"
@@ -63,6 +69,8 @@ async function actionLogin() {
63
69
  >
64
70
  {{ errorMessage }}
65
71
  </div>
72
+ <!-- below the form and its error: links, legal text -->
73
+ <slot name="footer" />
66
74
  </UPageCard>
67
75
  </div>
68
76
  </template>