@sfxcode/nuxt-ui-mongocamp 1.5.1 → 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 (51) hide show
  1. package/dist/module.d.mts +6 -0
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +24 -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 -1
  10. package/dist/runtime/components/MongocampCollectionData.vue +27 -6
  11. package/dist/runtime/components/MongocampCollectionData.vue.d.ts +22 -1
  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 +13 -3
  15. package/dist/runtime/components/MongocampCollections.vue.d.ts +19 -1
  16. package/dist/runtime/components/MongocampDashboard.d.vue.ts +3 -0
  17. package/dist/runtime/components/MongocampDashboard.vue +11 -5
  18. package/dist/runtime/components/MongocampDashboard.vue.d.ts +3 -0
  19. package/dist/runtime/components/MongocampDatabases.d.vue.ts +20 -1
  20. package/dist/runtime/components/MongocampDatabases.vue +15 -2
  21. package/dist/runtime/components/MongocampDatabases.vue.d.ts +20 -1
  22. package/dist/runtime/components/MongocampIndexes.vue +1 -1
  23. package/dist/runtime/components/MongocampJobs.d.vue.ts +23 -1
  24. package/dist/runtime/components/MongocampJobs.vue +18 -4
  25. package/dist/runtime/components/MongocampJobs.vue.d.ts +23 -1
  26. package/dist/runtime/components/MongocampLogin.d.vue.ts +16 -1
  27. package/dist/runtime/components/MongocampLogin.vue +13 -5
  28. package/dist/runtime/components/MongocampLogin.vue.d.ts +16 -1
  29. package/dist/runtime/components/MongocampPermissionMatrix.d.vue.ts +19 -1
  30. package/dist/runtime/components/MongocampPermissionMatrix.vue +11 -3
  31. package/dist/runtime/components/MongocampPermissionMatrix.vue.d.ts +19 -1
  32. package/dist/runtime/components/MongocampRoleGrants.d.vue.ts +22 -1
  33. package/dist/runtime/components/MongocampRoleGrants.vue +16 -4
  34. package/dist/runtime/components/MongocampRoleGrants.vue.d.ts +22 -1
  35. package/dist/runtime/components/MongocampRoles.d.vue.ts +22 -1
  36. package/dist/runtime/components/MongocampRoles.vue +19 -3
  37. package/dist/runtime/components/MongocampRoles.vue.d.ts +22 -1
  38. package/dist/runtime/components/MongocampServerInfo.d.vue.ts +2 -2
  39. package/dist/runtime/components/MongocampServerInfo.vue +14 -4
  40. package/dist/runtime/components/MongocampServerInfo.vue.d.ts +2 -2
  41. package/dist/runtime/components/MongocampServerOverview.d.vue.ts +18 -1
  42. package/dist/runtime/components/MongocampServerOverview.vue +25 -15
  43. package/dist/runtime/components/MongocampServerOverview.vue.d.ts +18 -1
  44. package/dist/runtime/components/MongocampSettings.d.vue.ts +1 -1
  45. package/dist/runtime/components/MongocampSettings.vue.d.ts +1 -1
  46. package/dist/runtime/components/MongocampUsers.d.vue.ts +24 -1
  47. package/dist/runtime/components/MongocampUsers.vue +22 -4
  48. package/dist/runtime/components/MongocampUsers.vue.d.ts +24 -1
  49. package/dist/runtime/formkit.config.d.ts +3 -0
  50. package/dist/runtime/formkit.config.js +9 -0
  51. package/package.json +1 -1
@@ -1,6 +1,27 @@
1
1
  type __VLS_Props = {
2
2
  roleName: string;
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<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare function fetchRole(): Promise<void>;
7
+ declare const __VLS_template: () => {
8
+ __VLS_Slots: {
9
+ toolbar?: (props: {}) => any;
10
+ };
11
+ };
12
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
13
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
14
+ refresh: typeof fetchRole;
15
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
+ changed: () => any;
17
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
18
+ onChanged?: (() => any) | undefined;
19
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
5
21
  declare const _default: typeof __VLS_export;
6
22
  export default _default;
23
+ type __VLS_WithSlots<T, S> = T & {
24
+ new (): {
25
+ $slots: S;
26
+ };
27
+ };
@@ -1,6 +1,27 @@
1
1
  type __VLS_Props = {
2
2
  grantsPath?: string;
3
+ hideHeading?: boolean;
4
+ hideRefresh?: boolean;
3
5
  };
4
- declare 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>;
6
+ declare function fetchRoles(): Promise<void>;
7
+ declare const __VLS_template: () => {
8
+ __VLS_Slots: {
9
+ toolbar?: (props: {}) => any;
10
+ };
11
+ };
12
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
13
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
14
+ refresh: typeof fetchRoles;
15
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
+ changed: () => any;
17
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
18
+ onChanged?: (() => any) | undefined;
19
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
5
21
  declare const _default: typeof __VLS_export;
6
22
  export default _default;
23
+ type __VLS_WithSlots<T, S> = T & {
24
+ new (): {
25
+ $slots: S;
26
+ };
27
+ };
@@ -6,8 +6,11 @@ import { runBulkDelete } from "../utils/bulkDelete";
6
6
  import { createSelectColumn } from "../utils/createSelectColumn";
7
7
  import { useMongocampAdminGate } from "../composables/useMongocampAdminGate";
8
8
  const props = defineProps({
9
- grantsPath: { type: String, required: false }
9
+ grantsPath: { type: String, required: false },
10
+ hideHeading: { type: Boolean, required: false },
11
+ hideRefresh: { type: Boolean, required: false }
10
12
  });
13
+ const emit = defineEmits(["changed"]);
11
14
  const { t } = useI18n();
12
15
  const { listRoles, addRole, updateRole, deleteRole } = useMongocampAdmin();
13
16
  const roles = ref([]);
@@ -75,6 +78,7 @@ async function handleBulkDelete() {
75
78
  try {
76
79
  const { failed } = await runBulkDelete(names, (name) => deleteRole(name));
77
80
  await fetchRoles();
81
+ emit("changed");
78
82
  if (failed.length > 0) {
79
83
  rowSelection.value = Object.fromEntries(failed.map((f) => [f.item, true]));
80
84
  bulkError.value = t("nuxtUiMongocamp.bulk.partialFailure", { failed: failed.length, total: names.length, reason: describeError(failed[0].error).message });
@@ -108,6 +112,7 @@ async function handleAddRole() {
108
112
  isAddModalOpen.value = false;
109
113
  newRole.value = { name: "", isAdmin: false };
110
114
  await fetchRoles();
115
+ emit("changed");
111
116
  } catch (e) {
112
117
  errorMessage.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.roles.errorAddRole");
113
118
  }
@@ -123,6 +128,7 @@ async function handleEditRole() {
123
128
  await updateRole(editRole.value.roleName, editRole.value.isAdmin, editGrants.value);
124
129
  isEditModalOpen.value = false;
125
130
  await fetchRoles();
131
+ emit("changed");
126
132
  } catch (e) {
127
133
  errorMessage.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.roles.errorEditRole");
128
134
  }
@@ -141,6 +147,7 @@ async function handleCloneRole() {
141
147
  await addRole(cloneRole.value.name, cloneRole.value.isAdmin, cloneGrants.value);
142
148
  isCloneModalOpen.value = false;
143
149
  await fetchRoles();
150
+ emit("changed");
144
151
  } catch (e) {
145
152
  cloneError.value = (await describeServerError(e, "nuxtUiMongocamp.roles.errorClone")).message;
146
153
  } finally {
@@ -161,6 +168,7 @@ async function handleDeleteRole() {
161
168
  await deleteRole(roleToDelete.value);
162
169
  isDeleteModalOpen.value = false;
163
170
  await fetchRoles();
171
+ emit("changed");
164
172
  } catch (e) {
165
173
  deleteError.value = (await describeServerError(e, "nuxtUiMongocamp.roles.errorDelete")).message;
166
174
  } finally {
@@ -266,6 +274,7 @@ const columns = computed(() => [
266
274
  }
267
275
  ]);
268
276
  if (!blocked.value) fetchRoles();
277
+ defineExpose({ refresh: fetchRoles });
269
278
  </script>
270
279
 
271
280
  <template>
@@ -280,7 +289,10 @@ if (!blocked.value) fetchRoles();
280
289
  class="flex flex-col gap-4"
281
290
  >
282
291
  <div class="flex items-center justify-between gap-4">
283
- <h2 class="text-xl font-semibold">
292
+ <h2
293
+ v-if="!hideHeading"
294
+ class="text-xl font-semibold"
295
+ >
284
296
  {{ t("nuxtUiMongocamp.roles.heading") }}
285
297
  </h2>
286
298
  <div class="flex flex-1 items-center gap-2">
@@ -292,7 +304,10 @@ if (!blocked.value) fetchRoles();
292
304
  class="flex-1 max-w-xs"
293
305
  @input="onFilterInput"
294
306
  />
295
- <UTooltip :text="t('nuxtUiMongocamp.common.refresh')">
307
+ <UTooltip
308
+ v-if="!hideRefresh"
309
+ :text="t('nuxtUiMongocamp.common.refresh')"
310
+ >
296
311
  <UButton
297
312
  icon="i-lucide-refresh-cw"
298
313
  color="neutral"
@@ -302,6 +317,7 @@ if (!blocked.value) fetchRoles();
302
317
  @click="fetchRoles"
303
318
  />
304
319
  </UTooltip>
320
+ <slot name="toolbar" />
305
321
  <UButton
306
322
  icon="i-lucide-plus"
307
323
  :label="t('nuxtUiMongocamp.roles.addRole')"
@@ -1,6 +1,27 @@
1
1
  type __VLS_Props = {
2
2
  grantsPath?: string;
3
+ hideHeading?: boolean;
4
+ hideRefresh?: boolean;
3
5
  };
4
- declare 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>;
6
+ declare function fetchRoles(): Promise<void>;
7
+ declare const __VLS_template: () => {
8
+ __VLS_Slots: {
9
+ toolbar?: (props: {}) => any;
10
+ };
11
+ };
12
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
13
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
14
+ refresh: typeof fetchRoles;
15
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
+ changed: () => any;
17
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
18
+ onChanged?: (() => any) | undefined;
19
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
5
21
  declare const _default: typeof __VLS_export;
6
22
  export default _default;
23
+ type __VLS_WithSlots<T, S> = T & {
24
+ new (): {
25
+ $slots: S;
26
+ };
27
+ };
@@ -14,9 +14,9 @@ declare function refresh(): Promise<void>;
14
14
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
15
15
  refresh: typeof refresh;
16
16
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
17
- autoRefresh: number;
18
- hideHeading: boolean;
19
17
  hideRefresh: boolean;
18
+ hideHeading: boolean;
19
+ autoRefresh: number;
20
20
  hideStats: boolean;
21
21
  hideCapabilities: boolean;
22
22
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -215,7 +215,10 @@ defineExpose({ refresh });
215
215
  <dt class="text-dimmed">
216
216
  {{ t("nuxtUiMongocamp.serverInfo.connectionsCurrent") }}
217
217
  </dt>
218
- <dd data-testid="connections-current">
218
+ <dd
219
+ class="tabular-nums"
220
+ data-testid="connections-current"
221
+ >
219
222
  {{ formatCount(stats.connections.current) }}
220
223
  </dd>
221
224
  </div>
@@ -223,13 +226,17 @@ defineExpose({ refresh });
223
226
  <dt class="text-dimmed">
224
227
  {{ t("nuxtUiMongocamp.serverInfo.connectionsAvailable") }}
225
228
  </dt>
226
- <dd>{{ formatCount(stats.connections.available) }}</dd>
229
+ <dd class="tabular-nums">
230
+ {{ formatCount(stats.connections.available) }}
231
+ </dd>
227
232
  </div>
228
233
  <div class="flex justify-between gap-4">
229
234
  <dt class="text-dimmed">
230
235
  {{ t("nuxtUiMongocamp.serverInfo.connectionsTotal") }}
231
236
  </dt>
232
- <dd>{{ formatCount(stats.connections.totalCreated) }}</dd>
237
+ <dd class="tabular-nums">
238
+ {{ formatCount(stats.connections.totalCreated) }}
239
+ </dd>
233
240
  </div>
234
241
  </dl>
235
242
  </div>
@@ -246,7 +253,10 @@ defineExpose({ refresh });
246
253
  <dt class="text-dimmed">
247
254
  {{ counter.label }}
248
255
  </dt>
249
- <dd :data-testid="`op-${counter.key}`">
256
+ <dd
257
+ class="tabular-nums"
258
+ :data-testid="`op-${counter.key}`"
259
+ >
250
260
  {{ counter.value }}
251
261
  </dd>
252
262
  </div>
@@ -14,9 +14,9 @@ declare function refresh(): Promise<void>;
14
14
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
15
15
  refresh: typeof refresh;
16
16
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
17
- autoRefresh: number;
18
- hideHeading: boolean;
19
17
  hideRefresh: boolean;
18
+ hideHeading: boolean;
19
+ autoRefresh: number;
20
20
  hideStats: boolean;
21
21
  hideCapabilities: boolean;
22
22
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -6,15 +6,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
+ };
@@ -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
+ };
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sfxcode/nuxt-ui-mongocamp",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "A Nuxt module that wraps @sfxcode/nuxt-mongocamp-server with ready-made UI components, composables, and a runtime plugin",
5
5
  "repository": "sfxcode/nuxt-ui-mongocamp",
6
6
  "homepage": "https://sfxcode.github.io/nuxt-ui-mongocamp/",