@sfxcode/nuxt-ui-mongocamp 1.5.7 → 2.0.0
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/README.md +5 -5
- package/dist/module.d.mts +17 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +4 -0
- package/dist/runtime/components/MongocampAccount.vue +12 -14
- package/dist/runtime/components/MongocampAggregationBuilder.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampAggregationBuilder.vue +32 -45
- package/dist/runtime/components/MongocampAggregationBuilder.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampAggregationChart.vue +7 -5
- package/dist/runtime/components/MongocampAggregationStagePreview.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampAggregationStagePreview.vue +5 -3
- package/dist/runtime/components/MongocampAggregationStagePreview.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampBucketFiles.vue +29 -40
- package/dist/runtime/components/MongocampBulkDelete.vue +8 -9
- package/dist/runtime/components/MongocampBulkEdit.vue +5 -4
- package/dist/runtime/components/MongocampChart.vue +1 -1
- package/dist/runtime/components/MongocampCollectionCharts.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampCollectionCharts.vue +10 -7
- package/dist/runtime/components/MongocampCollectionCharts.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampCollectionCopy.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampCollectionCopy.vue +11 -9
- package/dist/runtime/components/MongocampCollectionCopy.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampCollectionData.vue +97 -87
- package/dist/runtime/components/MongocampCollectionInfos.vue +34 -24
- package/dist/runtime/components/MongocampCollectionRename.vue +5 -4
- package/dist/runtime/components/MongocampCollections.vue +24 -33
- package/dist/runtime/components/MongocampCommandPalette.vue +3 -1
- package/dist/runtime/components/MongocampConfirmByName.vue +5 -4
- package/dist/runtime/components/MongocampDashboard.vue +5 -3
- package/dist/runtime/components/MongocampDatabases.vue +14 -8
- package/dist/runtime/components/MongocampDocumentCompare.vue +6 -4
- package/dist/runtime/components/MongocampDocumentView.vue +12 -9
- package/dist/runtime/components/MongocampEmptyState.vue +4 -1
- package/dist/runtime/components/MongocampErrorAlert.vue +8 -7
- package/dist/runtime/components/MongocampExportAll.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampExportAll.vue +19 -7
- package/dist/runtime/components/MongocampExportAll.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampFilePreview.vue +7 -6
- package/dist/runtime/components/MongocampFilterBuilder.vue +12 -16
- package/dist/runtime/components/MongocampGrantList.vue +6 -2
- package/dist/runtime/components/MongocampImport.vue +32 -28
- package/dist/runtime/components/MongocampIndexes.vue +21 -19
- package/dist/runtime/components/MongocampJobs.vue +20 -20
- package/dist/runtime/components/MongocampLogin.vue +2 -1
- package/dist/runtime/components/MongocampPermissionMatrix.vue +14 -11
- package/dist/runtime/components/MongocampQueryBar.vue +33 -32
- package/dist/runtime/components/MongocampRoleGrants.vue +21 -17
- package/dist/runtime/components/MongocampRoles.vue +28 -32
- package/dist/runtime/components/MongocampServerInfo.vue +17 -25
- package/dist/runtime/components/MongocampServerOverview.vue +16 -12
- package/dist/runtime/components/MongocampServerStatus.vue +9 -3
- package/dist/runtime/components/MongocampSettings.vue +15 -11
- package/dist/runtime/components/MongocampUserAccess.vue +11 -6
- package/dist/runtime/components/MongocampUsers.vue +32 -35
- package/dist/runtime/components/MongocampVersion.d.vue.ts +1 -1
- package/dist/runtime/components/MongocampVersion.vue +20 -11
- package/dist/runtime/components/MongocampVersion.vue.d.ts +1 -1
- package/dist/runtime/composables/useMongocampAdmin.js +6 -5
- package/dist/runtime/composables/useMongocampAggregation.d.ts +10 -1
- package/dist/runtime/composables/useMongocampAggregation.js +17 -5
- package/dist/runtime/composables/useMongocampBucket.d.ts +4 -0
- package/dist/runtime/composables/useMongocampBucket.js +7 -6
- package/dist/runtime/composables/useMongocampBulkByFilter.d.ts +6 -4
- package/dist/runtime/composables/useMongocampBulkByFilter.js +11 -6
- package/dist/runtime/composables/useMongocampCollectionCopy.d.ts +3 -1
- package/dist/runtime/composables/useMongocampCollectionCopy.js +4 -2
- package/dist/runtime/composables/useMongocampCollectionStats.js +2 -4
- package/dist/runtime/composables/useMongocampError.d.ts +1 -1
- package/dist/runtime/composables/useMongocampError.js +4 -1
- package/dist/runtime/composables/useMongocampExportAll.d.ts +10 -1
- package/dist/runtime/composables/useMongocampExportAll.js +4 -1
- package/dist/runtime/composables/useMongocampFetchAll.d.ts +11 -5
- package/dist/runtime/composables/useMongocampFetchAll.js +8 -8
- package/dist/runtime/composables/useMongocampJobs.js +3 -2
- package/dist/runtime/composables/useMongocampQuery.d.ts +26 -36
- package/dist/runtime/composables/useMongocampQuery.js +45 -48
- package/dist/runtime/composables/useMongocampSchema.js +2 -0
- package/dist/runtime/composables/useMongocampUi.d.ts +8 -0
- package/dist/runtime/composables/useMongocampUi.js +7 -0
- package/dist/runtime/locales/de.json +12 -4
- package/dist/runtime/locales/en.json +12 -4
- package/dist/runtime/plugin.js +8 -0
- package/dist/runtime/publicUtils.d.ts +1 -0
- package/dist/runtime/publicUtils.js +1 -0
- package/dist/runtime/server/handlers/mongocampProxy.d.ts +1 -1
- package/dist/runtime/server/handlers/mongocampProxy.js +12 -12
- package/dist/runtime/utils/aggregationPipeline.d.ts +2 -1
- package/dist/runtime/utils/aggregationPipeline.js +2 -3
- package/dist/runtime/utils/caseInsensitive.d.ts +10 -0
- package/dist/runtime/utils/caseInsensitive.js +8 -0
- package/dist/runtime/utils/collectionStats.d.ts +4 -1
- package/dist/runtime/utils/collectionStats.js +2 -2
- package/dist/runtime/utils/compactSession.d.ts +13 -0
- package/dist/runtime/utils/compactSession.js +12 -0
- package/dist/runtime/utils/configRows.d.ts +3 -3
- package/dist/runtime/utils/cursorPaging.d.ts +16 -0
- package/dist/runtime/utils/cursorPaging.js +17 -0
- package/dist/runtime/utils/documentCompare.js +2 -3
- package/dist/runtime/utils/documentPaths.d.ts +5 -5
- package/dist/runtime/utils/documentPaths.js +9 -2
- package/dist/runtime/utils/documentTree.js +3 -0
- package/dist/runtime/utils/fileFilter.d.ts +7 -0
- package/dist/runtime/utils/fileFilter.js +11 -0
- package/dist/runtime/utils/filterBuilder.d.ts +1 -1
- package/dist/runtime/utils/filterBuilder.js +5 -11
- package/dist/runtime/utils/filterSuggestions.js +1 -1
- package/dist/runtime/utils/indexForm.d.ts +7 -0
- package/dist/runtime/utils/indexForm.js +9 -0
- package/dist/runtime/utils/pagedFetch.d.ts +13 -0
- package/dist/runtime/utils/pagedFetch.js +44 -0
- package/dist/runtime/utils/queryState.d.ts +5 -0
- package/dist/runtime/utils/queryState.js +3 -2
- package/dist/runtime/utils/relaxedValues.d.ts +17 -0
- package/dist/runtime/utils/relaxedValues.js +51 -0
- package/dist/runtime/utils/requestLimits.d.ts +1 -1
- package/dist/runtime/utils/requestLimits.js +1 -1
- package/dist/runtime/utils/savedQueries.d.ts +2 -0
- package/dist/runtime/utils/savedQueries.js +1 -0
- package/dist/runtime/utils/schemaAnalysis.d.ts +4 -4
- package/dist/runtime/utils/schemaAnalysis.js +2 -2
- package/dist/runtime/utils/sensitiveFields.d.ts +20 -0
- package/dist/runtime/utils/sensitiveFields.js +63 -0
- package/dist/runtime/utils/serverError.d.ts +7 -0
- package/dist/runtime/utils/serverError.js +11 -0
- package/dist/runtime/utils/serverStatus.d.ts +2 -2
- package/dist/runtime/utils/uiTheme.d.ts +65 -0
- package/dist/runtime/utils/uiTheme.js +47 -0
- package/package.json +22 -16
- package/dist/runtime/utils/luceneExpression.d.ts +0 -15
- package/dist/runtime/utils/luceneExpression.js +0 -74
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ A Nuxt module that wraps [`@sfxcode/nuxt-mongocamp-server`](https://www.npmjs.co
|
|
|
12
12
|
|
|
13
13
|
## Requirements
|
|
14
14
|
|
|
15
|
-
MongoCamp server **
|
|
15
|
+
MongoCamp server **2.0** (`mongocamp-nitro-server`, with `@sfxcode/nuxt-mongocamp-server` ^2.0.0) — embedded in your Nuxt app (`mongocamp.server.enabled`) or as the standalone image. The Scala server and the 1.x line are not supported. The dependency runs on **Nitro 3**: add `nitro` to your app's dependencies. See [Server 2.0](https://sfxcode.github.io/nuxt-ui-mongocamp/guide/server-2-0).
|
|
16
16
|
|
|
17
17
|
## Features
|
|
18
18
|
|
|
@@ -37,22 +37,22 @@ These modules are declared as `moduleDependencies` and are automatically set up
|
|
|
37
37
|
## Quick Setup
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
npm install @sfxcode/nuxt-ui-mongocamp
|
|
40
|
+
npm install @sfxcode/nuxt-ui-mongocamp nitro
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
Add the module to `nuxt.config.ts
|
|
43
|
+
Add the module to `nuxt.config.ts` — with the MongoCamp server embedded in your app:
|
|
44
44
|
|
|
45
45
|
```ts
|
|
46
46
|
export default defineNuxtConfig({
|
|
47
47
|
modules: ['@sfxcode/nuxt-ui-mongocamp'],
|
|
48
48
|
|
|
49
49
|
mongocamp: {
|
|
50
|
-
|
|
50
|
+
server: { enabled: true, config: { CONNECTION_DATABASE: 'mongocamp' } },
|
|
51
51
|
},
|
|
52
52
|
})
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
The `mongocamp` key is forwarded to `@sfxcode/nuxt-mongocamp-server
|
|
55
|
+
or with `mongocamp: { url: process.env.MONGOCAMP_URL }` for a running MongoCamp 2.0 server. The `mongocamp` key is forwarded to `@sfxcode/nuxt-mongocamp-server`; the embedded server uses MongoDB at `CONNECTION_HOST`/`CONNECTION_PORT` (default `localhost:27017`).
|
|
56
56
|
|
|
57
57
|
## Components
|
|
58
58
|
|
package/dist/module.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
import { MongocampPaths } from '../dist/runtime/utils/paths.js';
|
|
3
|
+
import { MongocampUiThemeInput } from '../dist/runtime/utils/uiTheme.js';
|
|
3
4
|
|
|
4
5
|
interface ModuleOptions {
|
|
5
6
|
useGlobalAuthMiddleware?: boolean;
|
|
@@ -43,6 +44,15 @@ interface ModuleOptions {
|
|
|
43
44
|
* Default false.
|
|
44
45
|
*/
|
|
45
46
|
offline?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Opt-in: keep only `user`, `isAdmin` and `roles` of the user profile in the session cookie. Without it the cookie holds
|
|
49
|
+
* the whole profile of the last login or token refresh — every grant and the API key — and a user with many grants
|
|
50
|
+
* exceeds the browser's ~4 KB cookie limit, so the login silently fails. The module reads grants from the server
|
|
51
|
+
* (`useMongocampPermissions`), never from the session; only `useMongocampAuth().userGrants` of
|
|
52
|
+
* `@sfxcode/nuxt-mongocamp-server` comes back empty with it. A larger cookie from before is shrunk on the next start.
|
|
53
|
+
* Default false.
|
|
54
|
+
*/
|
|
55
|
+
compactSession?: boolean;
|
|
46
56
|
/**
|
|
47
57
|
* Path the session guard navigates to after clearing an expired session — e.g. '/login'. Always
|
|
48
58
|
* treated as allowed by the middleware itself, so it can never cause a redirect loop.
|
|
@@ -94,6 +104,13 @@ interface ModuleOptions {
|
|
|
94
104
|
interface ModulePublicRuntimeConfig {
|
|
95
105
|
nuxtUiMongocampOptions: ModuleOptions;
|
|
96
106
|
}
|
|
107
|
+
declare module '@nuxt/schema' {
|
|
108
|
+
interface AppConfigInput {
|
|
109
|
+
nuxtUiMongocamp?: {
|
|
110
|
+
ui?: MongocampUiThemeInput;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
97
114
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
98
115
|
|
|
99
116
|
export { _default as default };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { existsSync } from 'node:fs';
|
|
|
2
2
|
import { createResolver, defineNuxtModule, addPlugin, addComponentsDir, addImportsDir, addServerHandler } from '@nuxt/kit';
|
|
3
3
|
import { defu } from 'defu';
|
|
4
4
|
import { consola } from 'consola';
|
|
5
|
+
import { DEFAULT_UI } from '../dist/runtime/utils/uiTheme.js';
|
|
5
6
|
|
|
6
7
|
function optionWarnings(options) {
|
|
7
8
|
const warnings = [];
|
|
@@ -54,6 +55,7 @@ const module$1 = defineNuxtModule({
|
|
|
54
55
|
sessionGuard: false,
|
|
55
56
|
sessionGuardVerify: false,
|
|
56
57
|
offline: false,
|
|
58
|
+
compactSession: false,
|
|
57
59
|
loginPath: "/",
|
|
58
60
|
managerRoles: [],
|
|
59
61
|
securedRouteParts: [],
|
|
@@ -110,6 +112,8 @@ const module$1 = defineNuxtModule({
|
|
|
110
112
|
});
|
|
111
113
|
});
|
|
112
114
|
for (const warning of optionWarnings(options)) consola.warn(warning);
|
|
115
|
+
const appConfig = nuxt.options.appConfig;
|
|
116
|
+
appConfig.nuxtUiMongocamp = defu(appConfig.nuxtUiMongocamp, { ui: structuredClone(DEFAULT_UI) });
|
|
113
117
|
if (options.formkitStyles) nuxt.options.css.unshift(resolve(runtimeDir, "assets/formkit.css"));
|
|
114
118
|
addPlugin(resolve(runtimeDir, "plugin"));
|
|
115
119
|
addComponentsDir({ path: resolve(runtimeDir, "components") });
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { reactive, ref, resolveComponent } from "vue";
|
|
3
3
|
import { useI18n, useMongocampAccount, useToast } from "#imports";
|
|
4
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
4
5
|
const { t } = useI18n();
|
|
6
|
+
const ui = useMongocampUi();
|
|
5
7
|
const { fetchProfile, changePassword, regenerateApiKey } = useMongocampAccount();
|
|
6
8
|
const toast = useToast();
|
|
7
9
|
const UBadge = resolveComponent("UBadge");
|
|
@@ -59,7 +61,7 @@ loadProfile();
|
|
|
59
61
|
</script>
|
|
60
62
|
|
|
61
63
|
<template>
|
|
62
|
-
<div class="flex flex-col gap-4">
|
|
64
|
+
<div class="mongocamp-account flex flex-col gap-4">
|
|
63
65
|
<USkeleton
|
|
64
66
|
v-if="loading"
|
|
65
67
|
class="h-32 w-full"
|
|
@@ -90,8 +92,8 @@ loadProfile();
|
|
|
90
92
|
</div>
|
|
91
93
|
<UBadge
|
|
92
94
|
:label="profile.isAdmin ? t('nuxtUiMongocamp.common.admin') : t('nuxtUiMongocamp.common.standard')"
|
|
93
|
-
:color="profile.isAdmin ? '
|
|
94
|
-
variant="
|
|
95
|
+
:color="profile.isAdmin ? 'primary' : 'neutral'"
|
|
96
|
+
:variant="ui.badge.variant"
|
|
95
97
|
/>
|
|
96
98
|
</div>
|
|
97
99
|
<div>
|
|
@@ -107,7 +109,7 @@ loadProfile();
|
|
|
107
109
|
:key="role"
|
|
108
110
|
:label="role"
|
|
109
111
|
color="primary"
|
|
110
|
-
variant="
|
|
112
|
+
:variant="ui.badge.variant"
|
|
111
113
|
/>
|
|
112
114
|
</div>
|
|
113
115
|
<span
|
|
@@ -151,15 +153,13 @@ loadProfile();
|
|
|
151
153
|
<UButton
|
|
152
154
|
icon="i-lucide-copy"
|
|
153
155
|
:label="t('nuxtUiMongocamp.common.copy')"
|
|
154
|
-
|
|
155
|
-
variant="subtle"
|
|
156
|
+
v-bind="ui.secondaryAction"
|
|
156
157
|
@click="copyApiKey"
|
|
157
158
|
/>
|
|
158
159
|
</div>
|
|
159
160
|
<UButton
|
|
160
161
|
:label="t('nuxtUiMongocamp.common.dismiss')"
|
|
161
|
-
|
|
162
|
-
variant="ghost"
|
|
162
|
+
v-bind="ui.dialogCancel"
|
|
163
163
|
class="self-start"
|
|
164
164
|
@click="dismissApiKey"
|
|
165
165
|
/>
|
|
@@ -173,8 +173,7 @@ loadProfile();
|
|
|
173
173
|
</p>
|
|
174
174
|
<UButton
|
|
175
175
|
:label="t('nuxtUiMongocamp.account.regenerateApiKey')"
|
|
176
|
-
|
|
177
|
-
variant="subtle"
|
|
176
|
+
v-bind="{ ...ui.alertAction, color: 'error' }"
|
|
178
177
|
icon="i-lucide-key-round"
|
|
179
178
|
@click="openRegenerateModal"
|
|
180
179
|
/>
|
|
@@ -184,7 +183,7 @@ loadProfile();
|
|
|
184
183
|
<UModal
|
|
185
184
|
v-model:open="isRegenerateModalOpen"
|
|
186
185
|
:title="t('nuxtUiMongocamp.account.regenerateApiKey')"
|
|
187
|
-
:ui="{ footer:
|
|
186
|
+
:ui="{ footer: ui.modal.footer }"
|
|
188
187
|
>
|
|
189
188
|
<template #body>
|
|
190
189
|
<p>{{ t("nuxtUiMongocamp.account.confirmRegenerate") }}</p>
|
|
@@ -192,13 +191,12 @@ loadProfile();
|
|
|
192
191
|
<template #footer>
|
|
193
192
|
<UButton
|
|
194
193
|
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
195
|
-
|
|
196
|
-
variant="ghost"
|
|
194
|
+
v-bind="ui.dialogCancel"
|
|
197
195
|
@click="closeRegenerateModal"
|
|
198
196
|
/>
|
|
199
197
|
<UButton
|
|
200
198
|
:label="t('nuxtUiMongocamp.account.regenerate')"
|
|
201
|
-
|
|
199
|
+
v-bind="ui.dangerAction"
|
|
202
200
|
icon="i-lucide-key-round"
|
|
203
201
|
@click="handleRegenerateApiKey"
|
|
204
202
|
/>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
collectionName: string;
|
|
3
3
|
filter?: string;
|
|
4
|
+
matchCase?: boolean;
|
|
4
5
|
};
|
|
5
6
|
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
7
|
declare const _default: typeof __VLS_export;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { computed, h, ref, watch } from "vue";
|
|
3
3
|
import { useI18n } from "#imports";
|
|
4
4
|
import { useMongocampAggregation } from "../composables/useMongocampAggregation";
|
|
5
|
+
import { caseInsensitiveFlag } from "../utils/caseInsensitive";
|
|
5
6
|
import { useMongocampSavedPipelines } from "../composables/useMongocampSavedPipelines";
|
|
6
7
|
import {
|
|
7
8
|
VISUAL_STAGE_TYPES,
|
|
@@ -16,9 +17,11 @@ import { previewPipeline } from "../utils/aggregationPreview";
|
|
|
16
17
|
import { DEFAULT_TOP, MAX_TOP, templateStages, TEMPLATES, validateTemplateInput } from "../utils/aggregationTemplates";
|
|
17
18
|
import { formatCell, resultColumns } from "../utils/aggregationResult";
|
|
18
19
|
import { downloadTextFile, rowsToCsv } from "../utils/exportRows";
|
|
20
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
19
21
|
const props = defineProps({
|
|
20
22
|
collectionName: { type: String, required: true },
|
|
21
|
-
filter: { type: String, required: false }
|
|
23
|
+
filter: { type: String, required: false },
|
|
24
|
+
matchCase: { type: Boolean, required: false }
|
|
22
25
|
});
|
|
23
26
|
const appliedFilter = ref(props.filter);
|
|
24
27
|
watch(() => props.filter, (next) => {
|
|
@@ -38,6 +41,7 @@ const DEFAULT_TEXT = {
|
|
|
38
41
|
$bucketAuto: '{ "groupBy": "$field", "buckets": 5 }'
|
|
39
42
|
};
|
|
40
43
|
const { t } = useI18n();
|
|
44
|
+
const ui = useMongocampUi();
|
|
41
45
|
const { runAggregation, describeAggregationError, listFieldNames } = useMongocampAggregation();
|
|
42
46
|
const { saved: savedPipelines, save: savePipeline, remove: removeSavedPipeline } = useMongocampSavedPipelines(() => props.collectionName);
|
|
43
47
|
let idCounter = 0;
|
|
@@ -209,7 +213,7 @@ async function execute(pageNumber) {
|
|
|
209
213
|
running.value = true;
|
|
210
214
|
runError.value = null;
|
|
211
215
|
try {
|
|
212
|
-
const outcome = await runAggregation(props.collectionName, lastPipeline, { page: pageNumber, rowsPerPage: rowsPerPage.value }, { filter: appliedFilter.value });
|
|
216
|
+
const outcome = await runAggregation(props.collectionName, lastPipeline, { page: pageNumber, rowsPerPage: rowsPerPage.value }, { filter: appliedFilter.value, filterCaseInsensitive: caseInsensitiveFlag(appliedFilter.value, props.matchCase) });
|
|
213
217
|
if (run !== runCounter) return;
|
|
214
218
|
result.value = outcome;
|
|
215
219
|
page.value = outcome.page;
|
|
@@ -270,7 +274,7 @@ const exportMenuItems = computed(() => [
|
|
|
270
274
|
</script>
|
|
271
275
|
|
|
272
276
|
<template>
|
|
273
|
-
<div class="flex flex-col gap-4">
|
|
277
|
+
<div class="mongocamp-aggregation-builder flex flex-col gap-4">
|
|
274
278
|
<div
|
|
275
279
|
v-if="appliedFilter"
|
|
276
280
|
class="flex flex-wrap items-center gap-2 text-sm"
|
|
@@ -280,14 +284,12 @@ const exportMenuItems = computed(() => [
|
|
|
280
284
|
<UBadge
|
|
281
285
|
:label="appliedFilter"
|
|
282
286
|
color="neutral"
|
|
283
|
-
variant="
|
|
287
|
+
:variant="ui.badge.variant"
|
|
284
288
|
class="font-mono"
|
|
285
289
|
/>
|
|
286
290
|
<UButton
|
|
287
291
|
icon="i-lucide-x"
|
|
288
|
-
|
|
289
|
-
variant="ghost"
|
|
290
|
-
size="xs"
|
|
292
|
+
v-bind="ui.compactButton"
|
|
291
293
|
:aria-label="t('nuxtUiMongocamp.aggregation.removeFilter')"
|
|
292
294
|
@click="appliedFilter = void 0"
|
|
293
295
|
/>
|
|
@@ -296,7 +298,7 @@ const exportMenuItems = computed(() => [
|
|
|
296
298
|
<div class="flex items-center gap-1">
|
|
297
299
|
<UButton
|
|
298
300
|
color="neutral"
|
|
299
|
-
size="
|
|
301
|
+
:size="ui.controlSize"
|
|
300
302
|
:variant="mode === 'visual' ? 'subtle' : 'ghost'"
|
|
301
303
|
:aria-pressed="mode === 'visual'"
|
|
302
304
|
:label="t('nuxtUiMongocamp.aggregation.modeVisual')"
|
|
@@ -304,7 +306,7 @@ const exportMenuItems = computed(() => [
|
|
|
304
306
|
/>
|
|
305
307
|
<UButton
|
|
306
308
|
color="neutral"
|
|
307
|
-
size="
|
|
309
|
+
:size="ui.controlSize"
|
|
308
310
|
:variant="mode === 'json' ? 'subtle' : 'ghost'"
|
|
309
311
|
:aria-pressed="mode === 'json'"
|
|
310
312
|
:label="t('nuxtUiMongocamp.aggregation.modeJson')"
|
|
@@ -329,7 +331,7 @@ const exportMenuItems = computed(() => [
|
|
|
329
331
|
icon="i-lucide-wand-sparkles"
|
|
330
332
|
color="neutral"
|
|
331
333
|
variant="soft"
|
|
332
|
-
size="
|
|
334
|
+
:size="ui.controlSize"
|
|
333
335
|
:label="t('nuxtUiMongocamp.aggregation.templatesButton')"
|
|
334
336
|
/>
|
|
335
337
|
<template #content>
|
|
@@ -417,7 +419,7 @@ const exportMenuItems = computed(() => [
|
|
|
417
419
|
icon="i-lucide-bookmark"
|
|
418
420
|
color="neutral"
|
|
419
421
|
variant="soft"
|
|
420
|
-
size="
|
|
422
|
+
:size="ui.controlSize"
|
|
421
423
|
:label="t('nuxtUiMongocamp.aggregation.savedButton')"
|
|
422
424
|
/>
|
|
423
425
|
<template #content>
|
|
@@ -440,18 +442,14 @@ const exportMenuItems = computed(() => [
|
|
|
440
442
|
class="flex items-center gap-1"
|
|
441
443
|
>
|
|
442
444
|
<UButton
|
|
443
|
-
|
|
444
|
-
variant="ghost"
|
|
445
|
-
size="sm"
|
|
445
|
+
v-bind="ui.iconButton"
|
|
446
446
|
class="min-w-0 flex-1 justify-start"
|
|
447
447
|
:label="entry.name"
|
|
448
448
|
@click="applySaved(entry)"
|
|
449
449
|
/>
|
|
450
450
|
<UButton
|
|
451
451
|
icon="i-lucide-trash-2"
|
|
452
|
-
|
|
453
|
-
variant="ghost"
|
|
454
|
-
size="sm"
|
|
452
|
+
v-bind="{ ...ui.iconButton, color: 'error' }"
|
|
455
453
|
:aria-label="t('nuxtUiMongocamp.aggregation.deleteSaved', { name: entry.name })"
|
|
456
454
|
@click="removeSavedPipeline(entry.name)"
|
|
457
455
|
/>
|
|
@@ -462,7 +460,7 @@ const exportMenuItems = computed(() => [
|
|
|
462
460
|
>
|
|
463
461
|
<UInput
|
|
464
462
|
v-model="saveName"
|
|
465
|
-
size="
|
|
463
|
+
:size="ui.controlSize"
|
|
466
464
|
class="min-w-0 flex-1"
|
|
467
465
|
maxlength="80"
|
|
468
466
|
:placeholder="t('nuxtUiMongocamp.aggregation.saveNamePlaceholder')"
|
|
@@ -471,7 +469,7 @@ const exportMenuItems = computed(() => [
|
|
|
471
469
|
<UButton
|
|
472
470
|
type="submit"
|
|
473
471
|
icon="i-lucide-save"
|
|
474
|
-
size="
|
|
472
|
+
:size="ui.controlSize"
|
|
475
473
|
:label="t('nuxtUiMongocamp.aggregation.save')"
|
|
476
474
|
:disabled="saveName.trim() === ''"
|
|
477
475
|
/>
|
|
@@ -494,7 +492,7 @@ const exportMenuItems = computed(() => [
|
|
|
494
492
|
<UAlert
|
|
495
493
|
v-if="modeError"
|
|
496
494
|
color="warning"
|
|
497
|
-
variant="
|
|
495
|
+
:variant="ui.alert.variant"
|
|
498
496
|
icon="i-lucide-triangle-alert"
|
|
499
497
|
:description="modeError"
|
|
500
498
|
/>
|
|
@@ -516,27 +514,21 @@ const exportMenuItems = computed(() => [
|
|
|
516
514
|
<div class="flex items-center">
|
|
517
515
|
<UButton
|
|
518
516
|
icon="i-lucide-arrow-up"
|
|
519
|
-
|
|
520
|
-
variant="ghost"
|
|
521
|
-
size="sm"
|
|
517
|
+
v-bind="ui.iconButton"
|
|
522
518
|
:disabled="index === 0"
|
|
523
519
|
:aria-label="t('nuxtUiMongocamp.aggregation.moveUp')"
|
|
524
520
|
@click="moveStage(index, -1)"
|
|
525
521
|
/>
|
|
526
522
|
<UButton
|
|
527
523
|
icon="i-lucide-arrow-down"
|
|
528
|
-
|
|
529
|
-
variant="ghost"
|
|
530
|
-
size="sm"
|
|
524
|
+
v-bind="ui.iconButton"
|
|
531
525
|
:disabled="index === drafts.length - 1"
|
|
532
526
|
:aria-label="t('nuxtUiMongocamp.aggregation.moveDown')"
|
|
533
527
|
@click="moveStage(index, 1)"
|
|
534
528
|
/>
|
|
535
529
|
<UButton
|
|
536
530
|
icon="i-lucide-x"
|
|
537
|
-
|
|
538
|
-
variant="ghost"
|
|
539
|
-
size="sm"
|
|
531
|
+
v-bind="ui.iconButton"
|
|
540
532
|
:aria-label="t('nuxtUiMongocamp.aggregation.removeStage')"
|
|
541
533
|
@click="removeStage(index)"
|
|
542
534
|
/>
|
|
@@ -558,9 +550,7 @@ const exportMenuItems = computed(() => [
|
|
|
558
550
|
<div class="flex flex-col gap-2">
|
|
559
551
|
<UButton
|
|
560
552
|
:icon="openPreviews.has(draft.id) ? 'i-lucide-eye-off' : 'i-lucide-eye'"
|
|
561
|
-
|
|
562
|
-
variant="ghost"
|
|
563
|
-
size="xs"
|
|
553
|
+
v-bind="ui.compactButton"
|
|
564
554
|
class="self-start"
|
|
565
555
|
:aria-pressed="openPreviews.has(draft.id)"
|
|
566
556
|
:label="openPreviews.has(draft.id) ? t('nuxtUiMongocamp.aggregation.previewHide') : t('nuxtUiMongocamp.aggregation.previewShow')"
|
|
@@ -572,6 +562,7 @@ const exportMenuItems = computed(() => [
|
|
|
572
562
|
:pipeline="previewFor(index)"
|
|
573
563
|
:stage-number="index + 1"
|
|
574
564
|
:filter="appliedFilter"
|
|
565
|
+
:match-case="matchCase"
|
|
575
566
|
/>
|
|
576
567
|
</div>
|
|
577
568
|
</div>
|
|
@@ -579,15 +570,13 @@ const exportMenuItems = computed(() => [
|
|
|
579
570
|
<USelect
|
|
580
571
|
v-model="newStageType"
|
|
581
572
|
:items="stageTypeItems"
|
|
582
|
-
size="
|
|
573
|
+
:size="ui.controlSize"
|
|
583
574
|
class="w-72"
|
|
584
575
|
:aria-label="t('nuxtUiMongocamp.aggregation.newStageType')"
|
|
585
576
|
/>
|
|
586
577
|
<UButton
|
|
587
578
|
icon="i-lucide-plus"
|
|
588
|
-
|
|
589
|
-
variant="ghost"
|
|
590
|
-
size="sm"
|
|
579
|
+
v-bind="ui.iconButton"
|
|
591
580
|
:label="t('nuxtUiMongocamp.aggregation.addStage')"
|
|
592
581
|
@click="addStage"
|
|
593
582
|
/>
|
|
@@ -617,7 +606,7 @@ const exportMenuItems = computed(() => [
|
|
|
617
606
|
<UAlert
|
|
618
607
|
v-if="runError"
|
|
619
608
|
:color="runError.kind === 'retryable' ? 'warning' : 'error'"
|
|
620
|
-
variant="
|
|
609
|
+
:variant="ui.alert.variant"
|
|
621
610
|
icon="i-lucide-circle-alert"
|
|
622
611
|
:title="t('nuxtUiMongocamp.aggregation.runFailedTitle')"
|
|
623
612
|
:description="runError.message"
|
|
@@ -627,15 +616,14 @@ const exportMenuItems = computed(() => [
|
|
|
627
616
|
v-if="runError.kind === 'unauthorized'"
|
|
628
617
|
:label="t('nuxtUiMongocamp.errors.loginAgain')"
|
|
629
618
|
to="/"
|
|
630
|
-
|
|
631
|
-
variant="subtle"
|
|
619
|
+
v-bind="{ ...ui.alertAction, color: 'error' }"
|
|
632
620
|
icon="i-lucide-log-in"
|
|
633
621
|
/>
|
|
634
622
|
<UButton
|
|
635
623
|
v-else-if="runError.kind !== 'forbidden'"
|
|
636
624
|
:label="t('nuxtUiMongocamp.common.retry')"
|
|
637
625
|
:color="runError.kind === 'retryable' ? 'warning' : 'error'"
|
|
638
|
-
|
|
626
|
+
v-bind="ui.alertAction"
|
|
639
627
|
icon="i-lucide-refresh-cw"
|
|
640
628
|
@click="execute(page)"
|
|
641
629
|
/>
|
|
@@ -648,7 +636,7 @@ const exportMenuItems = computed(() => [
|
|
|
648
636
|
{{ t("nuxtUiMongocamp.aggregation.resultsCount", { count: result.total }, result.total) }}
|
|
649
637
|
</span>
|
|
650
638
|
<div class="flex flex-wrap items-center gap-2">
|
|
651
|
-
<UFieldGroup size="
|
|
639
|
+
<UFieldGroup :size="ui.controlSize">
|
|
652
640
|
<UButton
|
|
653
641
|
icon="i-lucide-table"
|
|
654
642
|
color="neutral"
|
|
@@ -670,9 +658,7 @@ const exportMenuItems = computed(() => [
|
|
|
670
658
|
<UDropdownMenu :items="exportMenuItems">
|
|
671
659
|
<UButton
|
|
672
660
|
icon="i-lucide-download"
|
|
673
|
-
|
|
674
|
-
variant="ghost"
|
|
675
|
-
size="sm"
|
|
661
|
+
v-bind="ui.iconButton"
|
|
676
662
|
:disabled="result.rows.length === 0"
|
|
677
663
|
:aria-label="t('nuxtUiMongocamp.aggregation.exportTooltip')"
|
|
678
664
|
/>
|
|
@@ -680,7 +666,7 @@ const exportMenuItems = computed(() => [
|
|
|
680
666
|
<USelect
|
|
681
667
|
:model-value="rowsPerPage"
|
|
682
668
|
:items="PAGE_SIZES"
|
|
683
|
-
size="
|
|
669
|
+
:size="ui.controlSize"
|
|
684
670
|
class="w-20"
|
|
685
671
|
:aria-label="t('nuxtUiMongocamp.aggregation.pageSize')"
|
|
686
672
|
@update:model-value="onPageSizeChange"
|
|
@@ -700,6 +686,7 @@ const exportMenuItems = computed(() => [
|
|
|
700
686
|
/>
|
|
701
687
|
<UTable
|
|
702
688
|
v-else
|
|
689
|
+
data-mongocamp-part="table"
|
|
703
690
|
:data="result.rows"
|
|
704
691
|
:columns="tableColumns"
|
|
705
692
|
:loading="running"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
collectionName: string;
|
|
3
3
|
filter?: string;
|
|
4
|
+
matchCase?: boolean;
|
|
4
5
|
};
|
|
5
6
|
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
7
|
declare const _default: typeof __VLS_export;
|
|
@@ -3,10 +3,12 @@ import { computed, ref, watch } from "vue";
|
|
|
3
3
|
import { useI18n } from "#imports";
|
|
4
4
|
import { resultColumns } from "../utils/aggregationResult";
|
|
5
5
|
import { buildResultChart, LABEL_KEY, MAX_CHART_ROWS, MAX_SERIES, valueColumns } from "../utils/resultChart";
|
|
6
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
6
7
|
const props = defineProps({
|
|
7
8
|
rows: { type: Array, required: true }
|
|
8
9
|
});
|
|
9
10
|
const { t } = useI18n();
|
|
11
|
+
const ui = useMongocampUi();
|
|
10
12
|
const columns = computed(() => resultColumns(props.rows));
|
|
11
13
|
const labelKey = ref(void 0);
|
|
12
14
|
const valueKeys = ref([]);
|
|
@@ -24,13 +26,13 @@ const categories = computed(() => (chart.value?.valueKeys ?? []).map((key) => ({
|
|
|
24
26
|
|
|
25
27
|
<template>
|
|
26
28
|
<div
|
|
27
|
-
class="flex flex-col gap-3"
|
|
29
|
+
class="mongocamp-aggregation-chart flex flex-col gap-3"
|
|
28
30
|
data-testid="aggregation-chart"
|
|
29
31
|
>
|
|
30
32
|
<UAlert
|
|
31
33
|
v-if="!chart"
|
|
32
34
|
color="neutral"
|
|
33
|
-
variant="
|
|
35
|
+
:variant="ui.alert.variant"
|
|
34
36
|
icon="i-lucide-chart-no-axes-column"
|
|
35
37
|
:title="t('nuxtUiMongocamp.aggregationChart.nothing')"
|
|
36
38
|
data-testid="chart-nothing"
|
|
@@ -41,7 +43,7 @@ const categories = computed(() => (chart.value?.valueKeys ?? []).map((key) => ({
|
|
|
41
43
|
<USelect
|
|
42
44
|
:model-value="chart.labelKey"
|
|
43
45
|
:items="columns"
|
|
44
|
-
size="
|
|
46
|
+
:size="ui.controlSize"
|
|
45
47
|
class="w-40"
|
|
46
48
|
@update:model-value="labelKey = $event;
|
|
47
49
|
valueKeys = []"
|
|
@@ -52,7 +54,7 @@ const categories = computed(() => (chart.value?.valueKeys ?? []).map((key) => ({
|
|
|
52
54
|
:model-value="chart.valueKeys"
|
|
53
55
|
:items="numberColumns"
|
|
54
56
|
multiple
|
|
55
|
-
size="
|
|
57
|
+
:size="ui.controlSize"
|
|
56
58
|
class="w-48"
|
|
57
59
|
@update:model-value="valueKeys = $event"
|
|
58
60
|
/>
|
|
@@ -61,7 +63,7 @@ const categories = computed(() => (chart.value?.valueKeys ?? []).map((key) => ({
|
|
|
61
63
|
<USelect
|
|
62
64
|
:model-value="chart.kind"
|
|
63
65
|
:items="kinds"
|
|
64
|
-
size="
|
|
66
|
+
:size="ui.controlSize"
|
|
65
67
|
class="w-28"
|
|
66
68
|
@update:model-value="kind = $event"
|
|
67
69
|
/>
|
|
@@ -4,6 +4,7 @@ type __VLS_Props = {
|
|
|
4
4
|
pipeline: RequestStage[] | undefined;
|
|
5
5
|
stageNumber: number;
|
|
6
6
|
filter?: string;
|
|
7
|
+
matchCase?: boolean;
|
|
7
8
|
};
|
|
8
9
|
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>;
|
|
9
10
|
declare const _default: typeof __VLS_export;
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
import { computed, onBeforeUnmount, ref, watch } from "vue";
|
|
3
3
|
import { useI18n } from "#imports";
|
|
4
4
|
import { useMongocampAggregation } from "../composables/useMongocampAggregation";
|
|
5
|
+
import { caseInsensitiveFlag } from "../utils/caseInsensitive";
|
|
5
6
|
import { PREVIEW_DEBOUNCE_MS, PREVIEW_LIMIT, pipelineKey } from "../utils/aggregationPreview";
|
|
6
7
|
import { formatCell, resultColumns } from "../utils/aggregationResult";
|
|
7
8
|
const props = defineProps({
|
|
8
9
|
collectionName: { type: String, required: true },
|
|
9
10
|
pipeline: { type: null, required: true },
|
|
10
11
|
stageNumber: { type: Number, required: true },
|
|
11
|
-
filter: { type: String, required: false }
|
|
12
|
+
filter: { type: String, required: false },
|
|
13
|
+
matchCase: { type: Boolean, required: false }
|
|
12
14
|
});
|
|
13
15
|
const { t } = useI18n();
|
|
14
16
|
const { runAggregation, describeAggregationError } = useMongocampAggregation();
|
|
@@ -31,7 +33,7 @@ async function execute(pipeline) {
|
|
|
31
33
|
loading.value = true;
|
|
32
34
|
error.value = null;
|
|
33
35
|
try {
|
|
34
|
-
const result = await runAggregation(props.collectionName, pipeline, { page: 1, rowsPerPage: PREVIEW_LIMIT }, { signal: own.signal, filter: props.filter });
|
|
36
|
+
const result = await runAggregation(props.collectionName, pipeline, { page: 1, rowsPerPage: PREVIEW_LIMIT }, { signal: own.signal, filter: props.filter, filterCaseInsensitive: caseInsensitiveFlag(props.filter, props.matchCase), skipCount: true });
|
|
35
37
|
if (mine !== run) return;
|
|
36
38
|
rows.value = result.rows;
|
|
37
39
|
} catch (e) {
|
|
@@ -73,7 +75,7 @@ const columns = computed(() => resultColumns(rows.value));
|
|
|
73
75
|
|
|
74
76
|
<template>
|
|
75
77
|
<div
|
|
76
|
-
class="flex flex-col gap-1 rounded-md bg-elevated/50 p-2"
|
|
78
|
+
class="mongocamp-aggregation-stage-preview flex flex-col gap-1 rounded-md bg-elevated/50 p-2"
|
|
77
79
|
data-test="stage-preview"
|
|
78
80
|
>
|
|
79
81
|
<p class="text-xs text-dimmed">
|
|
@@ -4,6 +4,7 @@ type __VLS_Props = {
|
|
|
4
4
|
pipeline: RequestStage[] | undefined;
|
|
5
5
|
stageNumber: number;
|
|
6
6
|
filter?: string;
|
|
7
|
+
matchCase?: boolean;
|
|
7
8
|
};
|
|
8
9
|
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>;
|
|
9
10
|
declare const _default: typeof __VLS_export;
|