@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.
- package/dist/module.d.mts +6 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +24 -4
- package/dist/runtime/assets/formkit.css +1 -0
- package/dist/runtime/components/MongocampAccount.vue +4 -4
- package/dist/runtime/components/MongocampBucketFiles.d.vue.ts +21 -1
- package/dist/runtime/components/MongocampBucketFiles.vue +17 -5
- package/dist/runtime/components/MongocampBucketFiles.vue.d.ts +21 -1
- package/dist/runtime/components/MongocampCollectionData.d.vue.ts +22 -1
- package/dist/runtime/components/MongocampCollectionData.vue +27 -6
- package/dist/runtime/components/MongocampCollectionData.vue.d.ts +22 -1
- package/dist/runtime/components/MongocampCollectionInfos.vue +12 -12
- package/dist/runtime/components/MongocampCollections.d.vue.ts +19 -1
- package/dist/runtime/components/MongocampCollections.vue +13 -3
- package/dist/runtime/components/MongocampCollections.vue.d.ts +19 -1
- package/dist/runtime/components/MongocampDashboard.d.vue.ts +3 -0
- package/dist/runtime/components/MongocampDashboard.vue +11 -5
- package/dist/runtime/components/MongocampDashboard.vue.d.ts +3 -0
- package/dist/runtime/components/MongocampDatabases.d.vue.ts +20 -1
- package/dist/runtime/components/MongocampDatabases.vue +15 -2
- package/dist/runtime/components/MongocampDatabases.vue.d.ts +20 -1
- package/dist/runtime/components/MongocampIndexes.vue +1 -1
- package/dist/runtime/components/MongocampJobs.d.vue.ts +23 -1
- package/dist/runtime/components/MongocampJobs.vue +18 -4
- package/dist/runtime/components/MongocampJobs.vue.d.ts +23 -1
- package/dist/runtime/components/MongocampLogin.d.vue.ts +16 -1
- package/dist/runtime/components/MongocampLogin.vue +13 -5
- package/dist/runtime/components/MongocampLogin.vue.d.ts +16 -1
- package/dist/runtime/components/MongocampPermissionMatrix.d.vue.ts +19 -1
- package/dist/runtime/components/MongocampPermissionMatrix.vue +11 -3
- package/dist/runtime/components/MongocampPermissionMatrix.vue.d.ts +19 -1
- package/dist/runtime/components/MongocampRoleGrants.d.vue.ts +22 -1
- package/dist/runtime/components/MongocampRoleGrants.vue +16 -4
- package/dist/runtime/components/MongocampRoleGrants.vue.d.ts +22 -1
- package/dist/runtime/components/MongocampRoles.d.vue.ts +22 -1
- package/dist/runtime/components/MongocampRoles.vue +19 -3
- package/dist/runtime/components/MongocampRoles.vue.d.ts +22 -1
- package/dist/runtime/components/MongocampServerInfo.d.vue.ts +2 -2
- package/dist/runtime/components/MongocampServerInfo.vue +14 -4
- package/dist/runtime/components/MongocampServerInfo.vue.d.ts +2 -2
- package/dist/runtime/components/MongocampServerOverview.d.vue.ts +18 -1
- package/dist/runtime/components/MongocampServerOverview.vue +25 -15
- package/dist/runtime/components/MongocampServerOverview.vue.d.ts +18 -1
- package/dist/runtime/components/MongocampSettings.d.vue.ts +1 -1
- package/dist/runtime/components/MongocampSettings.vue.d.ts +1 -1
- package/dist/runtime/components/MongocampUsers.d.vue.ts +24 -1
- package/dist/runtime/components/MongocampUsers.vue +22 -4
- package/dist/runtime/components/MongocampUsers.vue.d.ts +24 -1
- package/dist/runtime/formkit.config.d.ts +3 -0
- package/dist/runtime/formkit.config.js +9 -0
- package/package.json +1 -1
package/dist/module.d.mts
CHANGED
|
@@ -66,6 +66,12 @@ interface ModuleOptions {
|
|
|
66
66
|
* Local route prefix the proxy listens on when `useServerProxy` is enabled.
|
|
67
67
|
*/
|
|
68
68
|
serverProxyPath?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Load the module's default styles for FormKit's label, help text, validation message and form
|
|
71
|
+
* spacing (`runtime/assets/formkit.css`, built on Nuxt UI's `--ui-*` tokens). It is loaded before
|
|
72
|
+
* the app's own stylesheets, so any rule of the app overrides it. Default `true`.
|
|
73
|
+
*/
|
|
74
|
+
formkitStyles?: boolean;
|
|
69
75
|
}
|
|
70
76
|
interface ModulePublicRuntimeConfig {
|
|
71
77
|
nuxtUiMongocampOptions: ModuleOptions;
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
1
2
|
import { createResolver, defineNuxtModule, addPlugin, addComponentsDir, addImportsDir, addServerHandler } from '@nuxt/kit';
|
|
2
3
|
import { defu } from 'defu';
|
|
3
4
|
import { consola } from 'consola';
|
|
@@ -22,8 +23,20 @@ function optionWarnings(options) {
|
|
|
22
23
|
return warnings;
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
const EXTENSIONS = ["ts", "mjs", "js"];
|
|
27
|
+
function defaultFormkitConfigFile(rootDir, configuredFile, defaultFile, exists) {
|
|
28
|
+
if (configuredFile) return void 0;
|
|
29
|
+
const base = `${rootDir.replace(/[\\/]+$/, "")}/formkit.config`;
|
|
30
|
+
if (EXTENSIONS.some((extension) => exists(`${base}.${extension}`))) return void 0;
|
|
31
|
+
return defaultFile;
|
|
32
|
+
}
|
|
33
|
+
|
|
25
34
|
const { resolve } = createResolver(import.meta.url);
|
|
26
35
|
const runtimeDir = resolve("./runtime");
|
|
36
|
+
function formkitDefaults(rootDir, configuredFile) {
|
|
37
|
+
const configFile = defaultFormkitConfigFile(rootDir, configuredFile, resolve(runtimeDir, "formkit.config"), existsSync);
|
|
38
|
+
return configFile ? { configFile } : {};
|
|
39
|
+
}
|
|
27
40
|
const module$1 = defineNuxtModule({
|
|
28
41
|
meta: {
|
|
29
42
|
name: "nuxt-ui-mongocamp",
|
|
@@ -46,12 +59,18 @@ const module$1 = defineNuxtModule({
|
|
|
46
59
|
managementRouteParts: [],
|
|
47
60
|
adminRouteParts: [],
|
|
48
61
|
useServerProxy: false,
|
|
49
|
-
serverProxyPath: "/api/_mongocamp"
|
|
62
|
+
serverProxyPath: "/api/_mongocamp",
|
|
63
|
+
formkitStyles: true
|
|
50
64
|
},
|
|
51
|
-
|
|
65
|
+
// A function, not an object: the FormKit entry depends on the app (does it bring its own config?).
|
|
66
|
+
// It has to be decided here — `@formkit/nuxt` is set up before this module's `setup()` runs, the
|
|
67
|
+
// same ordering trap as the i18n locales below.
|
|
68
|
+
moduleDependencies: (nuxt) => ({
|
|
52
69
|
"@nuxt/ui": {},
|
|
53
70
|
"unocss-nuxt-ui": {},
|
|
54
|
-
"@formkit/nuxt": {
|
|
71
|
+
"@formkit/nuxt": {
|
|
72
|
+
defaults: formkitDefaults(nuxt.options.rootDir, nuxt.options.formkit?.configFile)
|
|
73
|
+
},
|
|
55
74
|
"@sfxcode/nuxt-ui-formkit": {},
|
|
56
75
|
"@sfxcode/nuxt-mongocamp-server": {
|
|
57
76
|
defaults: {
|
|
@@ -72,7 +91,7 @@ const module$1 = defineNuxtModule({
|
|
|
72
91
|
defaultLocale: "en"
|
|
73
92
|
}
|
|
74
93
|
}
|
|
75
|
-
},
|
|
94
|
+
}),
|
|
76
95
|
setup(options, nuxt) {
|
|
77
96
|
options.serverProxyPath = (options.serverProxyPath ?? "/api/_mongocamp").replace(/\/+$/, "") || "/api/_mongocamp";
|
|
78
97
|
nuxt.options.runtimeConfig.public.nuxtUiMongocampOptions = defu(
|
|
@@ -89,6 +108,7 @@ const module$1 = defineNuxtModule({
|
|
|
89
108
|
});
|
|
90
109
|
});
|
|
91
110
|
for (const warning of optionWarnings(options)) consola.warn(warning);
|
|
111
|
+
if (options.formkitStyles) nuxt.options.css.unshift(resolve(runtimeDir, "assets/formkit.css"));
|
|
92
112
|
addPlugin(resolve(runtimeDir, "plugin"));
|
|
93
113
|
addComponentsDir({ path: resolve(runtimeDir, "components") });
|
|
94
114
|
addImportsDir(resolve(runtimeDir, "composables"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.formkit-form>*+*{margin-top:.75rem}.formkit-label{color:var(--ui-text-muted);font-size:.8125rem;font-weight:500}.formkit-help{color:var(--ui-text-dimmed);font-size:.75rem}.formkit-message{color:var(--ui-error);font-size:.75rem}.formkit-debug{font-size:.75rem;padding-top:.5rem}
|
|
@@ -77,7 +77,7 @@ loadProfile();
|
|
|
77
77
|
</template>
|
|
78
78
|
<div class="flex flex-col gap-3">
|
|
79
79
|
<div>
|
|
80
|
-
<div class="text-sm text-
|
|
80
|
+
<div class="text-sm text-muted">
|
|
81
81
|
{{ t("nuxtUiMongocamp.account.user") }}
|
|
82
82
|
</div>
|
|
83
83
|
<div class="text-lg font-medium">
|
|
@@ -85,7 +85,7 @@ loadProfile();
|
|
|
85
85
|
</div>
|
|
86
86
|
</div>
|
|
87
87
|
<div>
|
|
88
|
-
<div class="text-sm text-
|
|
88
|
+
<div class="text-sm text-muted mb-1">
|
|
89
89
|
{{ t("nuxtUiMongocamp.account.role") }}
|
|
90
90
|
</div>
|
|
91
91
|
<UBadge
|
|
@@ -95,7 +95,7 @@ loadProfile();
|
|
|
95
95
|
/>
|
|
96
96
|
</div>
|
|
97
97
|
<div>
|
|
98
|
-
<div class="text-sm text-
|
|
98
|
+
<div class="text-sm text-muted mb-1">
|
|
99
99
|
{{ t("nuxtUiMongocamp.account.roles") }}
|
|
100
100
|
</div>
|
|
101
101
|
<div
|
|
@@ -168,7 +168,7 @@ loadProfile();
|
|
|
168
168
|
v-else
|
|
169
169
|
class="flex items-center justify-between gap-4"
|
|
170
170
|
>
|
|
171
|
-
<p class="text-sm text-
|
|
171
|
+
<p class="text-sm text-muted">
|
|
172
172
|
{{ t("nuxtUiMongocamp.account.regenerateWarning") }}
|
|
173
173
|
</p>
|
|
174
174
|
<UButton
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
bucketName: string;
|
|
3
|
+
hideRefresh?: boolean;
|
|
3
4
|
};
|
|
4
|
-
declare
|
|
5
|
+
declare function init(): 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 init;
|
|
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>;
|
|
5
20
|
declare const _default: typeof __VLS_export;
|
|
6
21
|
export default _default;
|
|
22
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
23
|
+
new (): {
|
|
24
|
+
$slots: S;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -9,8 +9,10 @@ import MongocampCollectionCharts from "./MongocampCollectionCharts.vue";
|
|
|
9
9
|
import { useMongocampQuery } from "../composables/useMongocampQuery";
|
|
10
10
|
import { parseMetadataJson } from "../utils/filePreview";
|
|
11
11
|
const props = defineProps({
|
|
12
|
-
bucketName: { type: String, required: true }
|
|
12
|
+
bucketName: { type: String, required: true },
|
|
13
|
+
hideRefresh: { type: Boolean, required: false }
|
|
13
14
|
});
|
|
15
|
+
const emit = defineEmits(["changed"]);
|
|
14
16
|
const { t } = useI18n();
|
|
15
17
|
const { pagination, total } = useMongocampCollection();
|
|
16
18
|
const {
|
|
@@ -65,7 +67,10 @@ async function handleFiles(list) {
|
|
|
65
67
|
}
|
|
66
68
|
});
|
|
67
69
|
uploadResult.value = { uploaded: result.uploaded.length, failed: result.failed };
|
|
68
|
-
if (result.uploaded.length)
|
|
70
|
+
if (result.uploaded.length) {
|
|
71
|
+
await fetchFiles();
|
|
72
|
+
emit("changed");
|
|
73
|
+
}
|
|
69
74
|
} finally {
|
|
70
75
|
uploadProgress.value = null;
|
|
71
76
|
}
|
|
@@ -184,6 +189,7 @@ async function handleRenameSave() {
|
|
|
184
189
|
if (success) {
|
|
185
190
|
isRenameModalOpen.value = false;
|
|
186
191
|
await fetchFiles();
|
|
192
|
+
emit("changed");
|
|
187
193
|
}
|
|
188
194
|
} finally {
|
|
189
195
|
renameSaving.value = false;
|
|
@@ -201,6 +207,7 @@ async function handleDeleteFile() {
|
|
|
201
207
|
if (success) {
|
|
202
208
|
isDeleteModalOpen.value = false;
|
|
203
209
|
await fetchFiles();
|
|
210
|
+
emit("changed");
|
|
204
211
|
}
|
|
205
212
|
}
|
|
206
213
|
function makeActionsColumn() {
|
|
@@ -258,7 +265,7 @@ const columns = computed(() => [
|
|
|
258
265
|
{
|
|
259
266
|
accessorKey: "length",
|
|
260
267
|
header: ({ column }) => sortHeader(column, t("nuxtUiMongocamp.bucketFiles.columnSize")),
|
|
261
|
-
cell: ({ row }) => h("span", formatBytes(row.original.length))
|
|
268
|
+
cell: ({ row }) => h("span", { class: "tabular-nums" }, formatBytes(row.original.length))
|
|
262
269
|
},
|
|
263
270
|
{
|
|
264
271
|
accessorKey: "uploadDate",
|
|
@@ -325,6 +332,7 @@ async function init() {
|
|
|
325
332
|
isInitializing.value = false;
|
|
326
333
|
}
|
|
327
334
|
watch(() => props.bucketName, init, { immediate: true });
|
|
335
|
+
defineExpose({ refresh: init });
|
|
328
336
|
</script>
|
|
329
337
|
|
|
330
338
|
<template>
|
|
@@ -352,7 +360,7 @@ watch(() => props.bucketName, init, { immediate: true });
|
|
|
352
360
|
@input="onFilterInput"
|
|
353
361
|
/>
|
|
354
362
|
<div class="flex items-center gap-2">
|
|
355
|
-
<span class="text-sm text-
|
|
363
|
+
<span class="text-sm text-muted shrink-0">
|
|
356
364
|
{{ t("nuxtUiMongocamp.bucketFiles.filesCount", { count: total }) }}
|
|
357
365
|
</span>
|
|
358
366
|
<UTooltip :text="t('nuxtUiMongocamp.bucketFiles.uploadFileTooltip')">
|
|
@@ -373,7 +381,10 @@ watch(() => props.bucketName, init, { immediate: true });
|
|
|
373
381
|
class="hidden"
|
|
374
382
|
@change="handleFileSelected"
|
|
375
383
|
>
|
|
376
|
-
<UTooltip
|
|
384
|
+
<UTooltip
|
|
385
|
+
v-if="!hideRefresh"
|
|
386
|
+
:text="t('nuxtUiMongocamp.bucketFiles.reloadTooltip')"
|
|
387
|
+
>
|
|
377
388
|
<UButton
|
|
378
389
|
icon="i-lucide-refresh-cw"
|
|
379
390
|
color="neutral"
|
|
@@ -383,6 +394,7 @@ watch(() => props.bucketName, init, { immediate: true });
|
|
|
383
394
|
@click="init"
|
|
384
395
|
/>
|
|
385
396
|
</UTooltip>
|
|
397
|
+
<slot name="toolbar" />
|
|
386
398
|
<UPagination
|
|
387
399
|
v-model:page="pagination.pageIndex"
|
|
388
400
|
:total="total"
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
bucketName: string;
|
|
3
|
+
hideRefresh?: boolean;
|
|
3
4
|
};
|
|
4
|
-
declare
|
|
5
|
+
declare function init(): 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 init;
|
|
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>;
|
|
5
20
|
declare const _default: typeof __VLS_export;
|
|
6
21
|
export default _default;
|
|
22
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
23
|
+
new (): {
|
|
24
|
+
$slots: S;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -4,12 +4,33 @@ type __VLS_Props = {
|
|
|
4
4
|
aggregatePath?: string;
|
|
5
5
|
persistState?: boolean;
|
|
6
6
|
stateKey?: string;
|
|
7
|
+
hideRefresh?: boolean;
|
|
7
8
|
};
|
|
8
|
-
declare
|
|
9
|
+
declare function init(): 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 init;
|
|
18
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
|
+
changed: () => any;
|
|
20
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
21
|
+
onChanged?: (() => any) | undefined;
|
|
22
|
+
}>, {
|
|
23
|
+
hideRefresh: boolean;
|
|
9
24
|
infoPath: string;
|
|
10
25
|
aggregatePath: string;
|
|
11
26
|
persistState: boolean;
|
|
12
27
|
stateKey: string;
|
|
13
28
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
29
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
14
30
|
declare const _default: typeof __VLS_export;
|
|
15
31
|
export default _default;
|
|
32
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
33
|
+
new (): {
|
|
34
|
+
$slots: S;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
@@ -33,8 +33,10 @@ const props = defineProps({
|
|
|
33
33
|
infoPath: { type: String, required: false, default: "/secured/admin/collections" },
|
|
34
34
|
aggregatePath: { type: String, required: false, default: "" },
|
|
35
35
|
persistState: { type: Boolean, required: false, default: true },
|
|
36
|
-
stateKey: { type: String, required: false, default: "" }
|
|
36
|
+
stateKey: { type: String, required: false, default: "" },
|
|
37
|
+
hideRefresh: { type: Boolean, required: false, default: false }
|
|
37
38
|
});
|
|
39
|
+
const emit = defineEmits(["changed"]);
|
|
38
40
|
const { t } = useI18n();
|
|
39
41
|
const { documentApi } = useMongocampClientApi();
|
|
40
42
|
const { pagination, total } = useMongocampCollection();
|
|
@@ -64,7 +66,10 @@ async function handleFileSelected(event) {
|
|
|
64
66
|
input.value = "";
|
|
65
67
|
if (!file) return;
|
|
66
68
|
const success = await uploadFile(props.collectionName, file);
|
|
67
|
-
if (success)
|
|
69
|
+
if (success) {
|
|
70
|
+
await fetchDocuments();
|
|
71
|
+
emit("changed");
|
|
72
|
+
}
|
|
68
73
|
}
|
|
69
74
|
const UButton = resolveComponent("UButton");
|
|
70
75
|
const UTooltip = resolveComponent("UTooltip");
|
|
@@ -182,6 +187,7 @@ async function handleSave() {
|
|
|
182
187
|
if (result.matchedCount === 0) throw new Error(t("nuxtUiMongocamp.collectionData.documentGone"));
|
|
183
188
|
isEditModalOpen.value = false;
|
|
184
189
|
await fetchDocuments();
|
|
190
|
+
emit("changed");
|
|
185
191
|
return;
|
|
186
192
|
}
|
|
187
193
|
const body = { ...payload };
|
|
@@ -190,6 +196,7 @@ async function handleSave() {
|
|
|
190
196
|
}
|
|
191
197
|
isEditModalOpen.value = false;
|
|
192
198
|
await fetchDocuments();
|
|
199
|
+
emit("changed");
|
|
193
200
|
} catch (e) {
|
|
194
201
|
editError.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.collectionData.errorSave");
|
|
195
202
|
}
|
|
@@ -201,6 +208,7 @@ async function handleDelete() {
|
|
|
201
208
|
await documentApi._delete({ collectionName: props.collectionName, documentId: docToDelete.value });
|
|
202
209
|
isDeleteModalOpen.value = false;
|
|
203
210
|
await fetchDocuments();
|
|
211
|
+
emit("changed");
|
|
204
212
|
} catch (e) {
|
|
205
213
|
deleteError.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.collectionData.errorDelete");
|
|
206
214
|
}
|
|
@@ -552,6 +560,7 @@ async function handleBulkDelete() {
|
|
|
552
560
|
const deleted = await deleteByFilter(props.collectionName, filter);
|
|
553
561
|
clearMatching();
|
|
554
562
|
await fetchDocuments();
|
|
563
|
+
emit("changed");
|
|
555
564
|
toast.add({ title: t("nuxtUiMongocamp.bulk.matchingDeleted", { deleted, total: count }), color: "success" });
|
|
556
565
|
return;
|
|
557
566
|
}
|
|
@@ -571,6 +580,7 @@ async function handleBulkDelete() {
|
|
|
571
580
|
}
|
|
572
581
|
);
|
|
573
582
|
await fetchDocuments();
|
|
583
|
+
emit("changed");
|
|
574
584
|
if (failed.length > 0) {
|
|
575
585
|
rowSelection.value = Object.fromEntries(failed.map((f) => [f.item, true]));
|
|
576
586
|
bulkError.value = t("nuxtUiMongocamp.bulk.partialFailure", { failed: failed.length, total: ids.length, reason: describeError(failed[0].error).message });
|
|
@@ -604,6 +614,7 @@ async function handleBulkEdit(edit) {
|
|
|
604
614
|
const { modified } = await updateByFilter(props.collectionName, filter, document);
|
|
605
615
|
clearMatching();
|
|
606
616
|
await fetchDocuments();
|
|
617
|
+
emit("changed");
|
|
607
618
|
toast.add({ title: t("nuxtUiMongocamp.bulk.matchingUpdated", { updated: modified, total: count }), color: "success" });
|
|
608
619
|
return;
|
|
609
620
|
}
|
|
@@ -616,6 +627,7 @@ async function handleBulkEdit(edit) {
|
|
|
616
627
|
})
|
|
617
628
|
);
|
|
618
629
|
await fetchDocuments();
|
|
630
|
+
emit("changed");
|
|
619
631
|
if (failed.length > 0) {
|
|
620
632
|
const failedIds = failed.flatMap((f) => f.ids);
|
|
621
633
|
const onScreen = new Set(documents.value.map((row) => getDocId(row)));
|
|
@@ -765,6 +777,10 @@ async function loadDistinctSuggestions(field) {
|
|
|
765
777
|
if (cache === distinctCache && collection === props.collectionName) cache.set(field, suggestions);
|
|
766
778
|
return suggestions;
|
|
767
779
|
}
|
|
780
|
+
async function onImported() {
|
|
781
|
+
await init();
|
|
782
|
+
emit("changed");
|
|
783
|
+
}
|
|
768
784
|
async function init() {
|
|
769
785
|
distinctCache = /* @__PURE__ */ new Map();
|
|
770
786
|
isInitializing.value = true;
|
|
@@ -796,6 +812,7 @@ watch(columnVisibility, (visibility) => {
|
|
|
796
812
|
if (!isInitializing.value) persisted.value = { ...persisted.value, hidden: Object.keys(visibility).filter((k) => visibility[k] === false) };
|
|
797
813
|
}, { deep: true });
|
|
798
814
|
watch(() => props.collectionName, init, { immediate: true });
|
|
815
|
+
defineExpose({ refresh: init });
|
|
799
816
|
</script>
|
|
800
817
|
|
|
801
818
|
<template>
|
|
@@ -811,7 +828,7 @@ watch(() => props.collectionName, init, { immediate: true });
|
|
|
811
828
|
@input="onFilterInput"
|
|
812
829
|
/>
|
|
813
830
|
<div class="flex flex-wrap items-center gap-2">
|
|
814
|
-
<span class="text-sm text-
|
|
831
|
+
<span class="text-sm text-muted shrink-0">
|
|
815
832
|
{{ t("nuxtUiMongocamp.collectionData.documentsCount", { count: total }) }}
|
|
816
833
|
</span>
|
|
817
834
|
<UTooltip
|
|
@@ -850,9 +867,12 @@ watch(() => props.collectionName, init, { immediate: true });
|
|
|
850
867
|
<MongocampImport
|
|
851
868
|
v-if="writable && !isBucketCollection(collectionName)"
|
|
852
869
|
:collection-name="collectionName"
|
|
853
|
-
@imported="
|
|
870
|
+
@imported="onImported"
|
|
854
871
|
/>
|
|
855
|
-
<UTooltip
|
|
872
|
+
<UTooltip
|
|
873
|
+
v-if="!hideRefresh"
|
|
874
|
+
:text="t('nuxtUiMongocamp.collectionData.reloadTooltip')"
|
|
875
|
+
>
|
|
856
876
|
<UButton
|
|
857
877
|
icon="i-lucide-refresh-cw"
|
|
858
878
|
color="neutral"
|
|
@@ -862,6 +882,7 @@ watch(() => props.collectionName, init, { immediate: true });
|
|
|
862
882
|
@click="init"
|
|
863
883
|
/>
|
|
864
884
|
</UTooltip>
|
|
885
|
+
<slot name="toolbar" />
|
|
865
886
|
<div
|
|
866
887
|
class="inline-flex rounded-md border border-default p-0.5"
|
|
867
888
|
role="group"
|
|
@@ -1138,7 +1159,7 @@ watch(() => props.collectionName, init, { immediate: true });
|
|
|
1138
1159
|
<textarea
|
|
1139
1160
|
v-else
|
|
1140
1161
|
v-model="editJson"
|
|
1141
|
-
class="w-full h-80 font-mono text-xs p-2 border rounded bg-
|
|
1162
|
+
class="w-full h-80 font-mono text-xs p-2 border rounded bg-muted border-default focus:outline-none resize-y"
|
|
1142
1163
|
spellcheck="false"
|
|
1143
1164
|
/>
|
|
1144
1165
|
<p
|
|
@@ -4,12 +4,33 @@ type __VLS_Props = {
|
|
|
4
4
|
aggregatePath?: string;
|
|
5
5
|
persistState?: boolean;
|
|
6
6
|
stateKey?: string;
|
|
7
|
+
hideRefresh?: boolean;
|
|
7
8
|
};
|
|
8
|
-
declare
|
|
9
|
+
declare function init(): 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 init;
|
|
18
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
|
+
changed: () => any;
|
|
20
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
21
|
+
onChanged?: (() => any) | undefined;
|
|
22
|
+
}>, {
|
|
23
|
+
hideRefresh: boolean;
|
|
9
24
|
infoPath: string;
|
|
10
25
|
aggregatePath: string;
|
|
11
26
|
persistState: boolean;
|
|
12
27
|
stateKey: string;
|
|
13
28
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
29
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
14
30
|
declare const _default: typeof __VLS_export;
|
|
15
31
|
export default _default;
|
|
32
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
33
|
+
new (): {
|
|
34
|
+
$slots: S;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
@@ -236,50 +236,50 @@ async function refreshInfo() {
|
|
|
236
236
|
class="grid grid-cols-2 gap-3 sm:grid-cols-3"
|
|
237
237
|
>
|
|
238
238
|
<UCard>
|
|
239
|
-
<div class="text-sm text-
|
|
239
|
+
<div class="text-sm text-muted">
|
|
240
240
|
{{ t("nuxtUiMongocamp.collectionInfos.documents") }}
|
|
241
241
|
</div>
|
|
242
|
-
<div class="text-2xl font-semibold">
|
|
242
|
+
<div class="tabular-nums text-2xl font-semibold">
|
|
243
243
|
{{ info.count }}
|
|
244
244
|
</div>
|
|
245
245
|
</UCard>
|
|
246
246
|
<UCard>
|
|
247
|
-
<div class="text-sm text-
|
|
247
|
+
<div class="text-sm text-muted">
|
|
248
248
|
{{ t("nuxtUiMongocamp.collectionInfos.dataSize") }}
|
|
249
249
|
</div>
|
|
250
|
-
<div class="text-2xl font-semibold">
|
|
250
|
+
<div class="tabular-nums text-2xl font-semibold">
|
|
251
251
|
{{ Math.round(info.size / 1024) }} KB
|
|
252
252
|
</div>
|
|
253
253
|
</UCard>
|
|
254
254
|
<UCard>
|
|
255
|
-
<div class="text-sm text-
|
|
255
|
+
<div class="text-sm text-muted">
|
|
256
256
|
{{ t("nuxtUiMongocamp.collectionInfos.storageSize") }}
|
|
257
257
|
</div>
|
|
258
|
-
<div class="text-2xl font-semibold">
|
|
258
|
+
<div class="tabular-nums text-2xl font-semibold">
|
|
259
259
|
{{ Math.round(info.storageSize / 1024) }} KB
|
|
260
260
|
</div>
|
|
261
261
|
</UCard>
|
|
262
262
|
<UCard>
|
|
263
|
-
<div class="text-sm text-
|
|
263
|
+
<div class="text-sm text-muted">
|
|
264
264
|
{{ t("nuxtUiMongocamp.collectionInfos.avgDocSize") }}
|
|
265
265
|
</div>
|
|
266
|
-
<div class="text-2xl font-semibold">
|
|
266
|
+
<div class="tabular-nums text-2xl font-semibold">
|
|
267
267
|
{{ Math.round(info.avgObjSize) }} B
|
|
268
268
|
</div>
|
|
269
269
|
</UCard>
|
|
270
270
|
<UCard>
|
|
271
|
-
<div class="text-sm text-
|
|
271
|
+
<div class="text-sm text-muted">
|
|
272
272
|
{{ t("nuxtUiMongocamp.collectionInfos.indexes") }}
|
|
273
273
|
</div>
|
|
274
|
-
<div class="text-2xl font-semibold">
|
|
274
|
+
<div class="tabular-nums text-2xl font-semibold">
|
|
275
275
|
{{ info.nindexes }}
|
|
276
276
|
</div>
|
|
277
277
|
</UCard>
|
|
278
278
|
<UCard>
|
|
279
|
-
<div class="text-sm text-
|
|
279
|
+
<div class="text-sm text-muted">
|
|
280
280
|
{{ t("nuxtUiMongocamp.collectionInfos.indexSize") }}
|
|
281
281
|
</div>
|
|
282
|
-
<div class="text-2xl font-semibold">
|
|
282
|
+
<div class="tabular-nums text-2xl font-semibold">
|
|
283
283
|
{{ Math.round(info.totalIndexSize / 1024) }} KB
|
|
284
284
|
</div>
|
|
285
285
|
</UCard>
|
|
@@ -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
|
|
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
|
+
};
|
|
@@ -9,7 +9,9 @@ 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();
|
|
@@ -245,12 +247,16 @@ function openRename(name) {
|
|
|
245
247
|
isRenameOpen.value = true;
|
|
246
248
|
}
|
|
247
249
|
fetchCollections();
|
|
250
|
+
defineExpose({ refresh: fetchCollections });
|
|
248
251
|
</script>
|
|
249
252
|
|
|
250
253
|
<template>
|
|
251
254
|
<div class="flex flex-col gap-4">
|
|
252
255
|
<div class="flex items-center justify-between gap-4">
|
|
253
|
-
<h2
|
|
256
|
+
<h2
|
|
257
|
+
v-if="!hideHeading"
|
|
258
|
+
class="text-xl font-semibold"
|
|
259
|
+
>
|
|
254
260
|
{{ t("nuxtUiMongocamp.collections.heading") }}
|
|
255
261
|
</h2>
|
|
256
262
|
<div class="flex flex-1 items-center gap-2">
|
|
@@ -261,7 +267,10 @@ fetchCollections();
|
|
|
261
267
|
size="sm"
|
|
262
268
|
class="flex-1 max-w-xs"
|
|
263
269
|
/>
|
|
264
|
-
<UTooltip
|
|
270
|
+
<UTooltip
|
|
271
|
+
v-if="!hideRefresh"
|
|
272
|
+
:text="t('nuxtUiMongocamp.common.refresh')"
|
|
273
|
+
>
|
|
265
274
|
<UButton
|
|
266
275
|
icon="i-lucide-refresh-cw"
|
|
267
276
|
color="neutral"
|
|
@@ -271,6 +280,7 @@ fetchCollections();
|
|
|
271
280
|
@click="fetchCollections"
|
|
272
281
|
/>
|
|
273
282
|
</UTooltip>
|
|
283
|
+
<slot name="toolbar" />
|
|
274
284
|
</div>
|
|
275
285
|
</div>
|
|
276
286
|
|
|
@@ -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
|
|
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
|
+
};
|