@sfxcode/nuxt-ui-mongocamp 1.3.5 → 1.5.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 +1 -1
- package/dist/module.d.mts +8 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +6 -0
- package/dist/runtime/components/MongocampAggregationBuilder.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampAggregationBuilder.vue +331 -5
- package/dist/runtime/components/MongocampAggregationBuilder.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampAggregationChart.d.vue.ts +6 -0
- package/dist/runtime/components/MongocampAggregationChart.vue +93 -0
- package/dist/runtime/components/MongocampAggregationChart.vue.d.ts +6 -0
- package/dist/runtime/components/MongocampAggregationStagePreview.d.vue.ts +10 -0
- package/dist/runtime/components/MongocampAggregationStagePreview.vue +149 -0
- package/dist/runtime/components/MongocampAggregationStagePreview.vue.d.ts +10 -0
- package/dist/runtime/components/MongocampBucketFiles.vue +230 -48
- package/dist/runtime/components/MongocampBulkDelete.d.vue.ts +9 -0
- package/dist/runtime/components/MongocampBulkDelete.vue +94 -25
- package/dist/runtime/components/MongocampBulkDelete.vue.d.ts +9 -0
- package/dist/runtime/components/MongocampBulkEdit.d.vue.ts +5 -0
- package/dist/runtime/components/MongocampBulkEdit.vue +41 -3
- package/dist/runtime/components/MongocampBulkEdit.vue.d.ts +5 -0
- package/dist/runtime/components/MongocampChart.d.vue.ts +29 -0
- package/dist/runtime/components/MongocampChart.vue +129 -0
- package/dist/runtime/components/MongocampChart.vue.d.ts +29 -0
- package/dist/runtime/components/MongocampCollectionCharts.d.vue.ts +17 -0
- package/dist/runtime/components/MongocampCollectionCharts.vue +200 -0
- package/dist/runtime/components/MongocampCollectionCharts.vue.d.ts +17 -0
- package/dist/runtime/components/MongocampCollectionCopy.d.vue.ts +23 -0
- package/dist/runtime/components/MongocampCollectionCopy.vue +206 -0
- package/dist/runtime/components/MongocampCollectionCopy.vue.d.ts +23 -0
- package/dist/runtime/components/MongocampCollectionData.d.vue.ts +6 -0
- package/dist/runtime/components/MongocampCollectionData.vue +423 -138
- package/dist/runtime/components/MongocampCollectionData.vue.d.ts +6 -0
- package/dist/runtime/components/MongocampCollectionInfos.vue +106 -238
- package/dist/runtime/components/MongocampCollectionRename.d.vue.ts +22 -0
- package/dist/runtime/components/MongocampCollectionRename.vue +116 -0
- package/dist/runtime/components/MongocampCollectionRename.vue.d.ts +22 -0
- package/dist/runtime/components/MongocampCollections.vue +93 -12
- package/dist/runtime/components/MongocampCommandPalette.d.vue.ts +40 -0
- package/dist/runtime/components/MongocampCommandPalette.vue +135 -0
- package/dist/runtime/components/MongocampCommandPalette.vue.d.ts +40 -0
- package/dist/runtime/components/MongocampConfirmByName.vue +2 -2
- package/dist/runtime/components/MongocampDashboard.d.vue.ts +3 -1
- package/dist/runtime/components/MongocampDashboard.vue +39 -5
- package/dist/runtime/components/MongocampDashboard.vue.d.ts +3 -1
- package/dist/runtime/components/MongocampDatabases.vue +35 -2
- package/dist/runtime/components/MongocampDocumentCompare.d.vue.ts +20 -0
- package/dist/runtime/components/MongocampDocumentCompare.vue +146 -0
- package/dist/runtime/components/MongocampDocumentCompare.vue.d.ts +20 -0
- package/dist/runtime/components/MongocampDocumentView.d.vue.ts +22 -0
- package/dist/runtime/components/MongocampDocumentView.vue +202 -0
- package/dist/runtime/components/MongocampDocumentView.vue.d.ts +22 -0
- package/dist/runtime/components/MongocampErrorAlert.vue +12 -4
- package/dist/runtime/components/MongocampExportAll.d.vue.ts +18 -0
- package/dist/runtime/components/MongocampExportAll.vue +191 -0
- package/dist/runtime/components/MongocampExportAll.vue.d.ts +18 -0
- package/dist/runtime/components/MongocampFilePreview.d.vue.ts +16 -0
- package/dist/runtime/components/MongocampFilePreview.vue +162 -0
- package/dist/runtime/components/MongocampFilePreview.vue.d.ts +16 -0
- package/dist/runtime/components/MongocampFilterBuilder.vue +11 -0
- package/dist/runtime/components/MongocampImport.vue +171 -13
- package/dist/runtime/components/MongocampIndexes.d.vue.ts +18 -0
- package/dist/runtime/components/MongocampIndexes.vue +496 -0
- package/dist/runtime/components/MongocampIndexes.vue.d.ts +18 -0
- package/dist/runtime/components/MongocampJobs.d.vue.ts +6 -1
- package/dist/runtime/components/MongocampJobs.vue +36 -5
- package/dist/runtime/components/MongocampJobs.vue.d.ts +6 -1
- package/dist/runtime/components/MongocampPermissionMatrix.d.vue.ts +12 -0
- package/dist/runtime/components/MongocampPermissionMatrix.vue +301 -0
- package/dist/runtime/components/MongocampPermissionMatrix.vue.d.ts +12 -0
- package/dist/runtime/components/MongocampQueryBar.d.vue.ts +26 -0
- package/dist/runtime/components/MongocampQueryBar.vue +398 -0
- package/dist/runtime/components/MongocampQueryBar.vue.d.ts +26 -0
- package/dist/runtime/components/MongocampRoleGrants.vue +18 -5
- package/dist/runtime/components/MongocampRoles.vue +16 -5
- package/dist/runtime/components/MongocampServerOverview.d.vue.ts +20 -0
- package/dist/runtime/components/MongocampServerOverview.vue +420 -0
- package/dist/runtime/components/MongocampServerOverview.vue.d.ts +20 -0
- package/dist/runtime/components/MongocampSettings.d.vue.ts +28 -1
- package/dist/runtime/components/MongocampSettings.vue +83 -10
- package/dist/runtime/components/MongocampSettings.vue.d.ts +28 -1
- package/dist/runtime/components/MongocampUsers.vue +19 -6
- package/dist/runtime/composables/useMongocampAdmin.d.ts +2 -1
- package/dist/runtime/composables/useMongocampAdmin.js +6 -1
- package/dist/runtime/composables/useMongocampAdminGate.d.ts +12 -0
- package/dist/runtime/composables/useMongocampAdminGate.js +12 -0
- package/dist/runtime/composables/useMongocampAggregation.d.ts +23 -1
- package/dist/runtime/composables/useMongocampAggregation.js +41 -26
- package/dist/runtime/composables/useMongocampAutoRefresh.d.ts +26 -0
- package/dist/runtime/composables/useMongocampAutoRefresh.js +78 -0
- package/dist/runtime/composables/useMongocampBucket.d.ts +13 -1
- package/dist/runtime/composables/useMongocampBucket.js +34 -0
- package/dist/runtime/composables/useMongocampBulkByFilter.d.ts +15 -0
- package/dist/runtime/composables/useMongocampBulkByFilter.js +32 -0
- package/dist/runtime/composables/useMongocampClientApi.js +2 -1
- package/dist/runtime/composables/useMongocampCollectionCopy.d.ts +45 -0
- package/dist/runtime/composables/useMongocampCollectionCopy.js +48 -0
- package/dist/runtime/composables/useMongocampCollectionStats.d.ts +10 -0
- package/dist/runtime/composables/useMongocampCollectionStats.js +17 -0
- package/dist/runtime/composables/useMongocampError.d.ts +2 -1
- package/dist/runtime/composables/useMongocampError.js +16 -1
- package/dist/runtime/composables/useMongocampExportAll.d.ts +53 -0
- package/dist/runtime/composables/useMongocampExportAll.js +57 -0
- package/dist/runtime/composables/useMongocampExtendedJson.d.ts +7 -2
- package/dist/runtime/composables/useMongocampExtendedJson.js +44 -11
- package/dist/runtime/composables/useMongocampFetchAll.d.ts +25 -0
- package/dist/runtime/composables/useMongocampFetchAll.js +27 -0
- package/dist/runtime/composables/useMongocampFieldTypes.d.ts +24 -0
- package/dist/runtime/composables/useMongocampFieldTypes.js +44 -0
- package/dist/runtime/composables/useMongocampImport.d.ts +4 -0
- package/dist/runtime/composables/useMongocampImport.js +5 -2
- package/dist/runtime/composables/useMongocampIndex.d.ts +6 -1
- package/dist/runtime/composables/useMongocampIndex.js +7 -1
- package/dist/runtime/composables/useMongocampPermissions.d.ts +17 -0
- package/dist/runtime/composables/useMongocampPermissions.js +43 -0
- package/dist/runtime/composables/useMongocampPersistedState.d.ts +15 -0
- package/dist/runtime/composables/useMongocampPersistedState.js +21 -0
- package/dist/runtime/composables/useMongocampProxyApi.js +2 -1
- package/dist/runtime/composables/useMongocampQuery.d.ts +50 -2
- package/dist/runtime/composables/useMongocampQuery.js +72 -1
- package/dist/runtime/composables/useMongocampSavedPipelines.d.ts +25 -0
- package/dist/runtime/composables/useMongocampSavedPipelines.js +23 -0
- package/dist/runtime/composables/useMongocampSavedQueries.d.ts +37 -0
- package/dist/runtime/composables/useMongocampSavedQueries.js +50 -0
- package/dist/runtime/composables/useMongocampServerOverview.d.ts +35 -0
- package/dist/runtime/composables/useMongocampServerOverview.js +51 -0
- package/dist/runtime/composables/useMongocampSession.d.ts +2 -0
- package/dist/runtime/composables/useMongocampSession.js +16 -2
- package/dist/runtime/composables/useMongocampSystem.d.ts +7 -2
- package/dist/runtime/composables/useMongocampSystem.js +6 -2
- package/dist/runtime/locales/de.json +509 -25
- package/dist/runtime/locales/en.json +509 -25
- package/dist/runtime/plugin.js +6 -3
- package/dist/runtime/utils/aggregationErrors.d.ts +4 -0
- package/dist/runtime/utils/aggregationErrors.js +7 -0
- package/dist/runtime/utils/aggregationPipeline.d.ts +5 -4
- package/dist/runtime/utils/aggregationPipeline.js +23 -9
- package/dist/runtime/utils/aggregationPreview.d.ts +13 -0
- package/dist/runtime/utils/aggregationPreview.js +10 -0
- package/dist/runtime/utils/aggregationResult.d.ts +5 -0
- package/dist/runtime/utils/aggregationResult.js +4 -0
- package/dist/runtime/utils/aggregationTemplates.d.ts +34 -0
- package/dist/runtime/utils/aggregationTemplates.js +47 -0
- package/dist/runtime/utils/analyzeSamples.d.ts +1 -0
- package/dist/runtime/utils/analyzeSamples.js +1 -1
- package/dist/runtime/utils/autoRefresh.d.ts +14 -0
- package/dist/runtime/utils/autoRefresh.js +15 -0
- package/dist/runtime/utils/batchInsert.d.ts +6 -0
- package/dist/runtime/utils/batchInsert.js +31 -3
- package/dist/runtime/utils/bigIntJson.d.ts +15 -0
- package/dist/runtime/utils/bigIntJson.js +55 -0
- package/dist/runtime/utils/bsonTypes.d.ts +10 -0
- package/dist/runtime/utils/bsonTypes.js +42 -0
- package/dist/runtime/utils/bulkDelete.d.ts +9 -1
- package/dist/runtime/utils/bulkDelete.js +15 -3
- package/dist/runtime/utils/bulkEdit.d.ts +6 -0
- package/dist/runtime/utils/bulkEdit.js +7 -0
- package/dist/runtime/utils/chartData.d.ts +11 -0
- package/dist/runtime/utils/chartData.js +9 -0
- package/dist/runtime/utils/collectionChart.d.ts +36 -0
- package/dist/runtime/utils/collectionChart.js +73 -0
- package/dist/runtime/utils/collectionCopy.d.ts +24 -0
- package/dist/runtime/utils/collectionCopy.js +37 -0
- package/dist/runtime/utils/collectionStats.d.ts +31 -0
- package/dist/runtime/utils/collectionStats.js +42 -0
- package/dist/runtime/utils/commandPalette.d.ts +48 -0
- package/dist/runtime/utils/commandPalette.js +39 -0
- package/dist/runtime/utils/configRows.d.ts +7 -0
- package/dist/runtime/utils/configRows.js +4 -0
- package/dist/runtime/utils/documentCompare.d.ts +31 -0
- package/dist/runtime/utils/documentCompare.js +71 -0
- package/dist/runtime/utils/documentDiff.d.ts +19 -0
- package/dist/runtime/utils/documentDiff.js +71 -0
- package/dist/runtime/utils/documentPaths.d.ts +41 -0
- package/dist/runtime/utils/documentPaths.js +139 -0
- package/dist/runtime/utils/documentTree.d.ts +40 -0
- package/dist/runtime/utils/documentTree.js +102 -0
- package/dist/runtime/utils/exportDocuments.d.ts +33 -0
- package/dist/runtime/utils/exportDocuments.js +53 -0
- package/dist/runtime/utils/exportRows.d.ts +2 -0
- package/dist/runtime/utils/exportRows.js +6 -3
- package/dist/runtime/utils/fieldDetails.d.ts +51 -0
- package/dist/runtime/utils/fieldDetails.js +113 -0
- package/dist/runtime/utils/filePreview.d.ts +27 -0
- package/dist/runtime/utils/filePreview.js +50 -0
- package/dist/runtime/utils/filterBuilder.d.ts +6 -1
- package/dist/runtime/utils/filterBuilder.js +6 -5
- package/dist/runtime/utils/formatBytes.d.ts +2 -0
- package/dist/runtime/utils/formatBytes.js +11 -0
- package/dist/runtime/utils/grantMatching.d.ts +8 -0
- package/dist/runtime/utils/grantMatching.js +15 -0
- package/dist/runtime/utils/importRows.js +12 -2
- package/dist/runtime/utils/indexForm.d.ts +83 -0
- package/dist/runtime/utils/indexForm.js +74 -0
- package/dist/runtime/utils/luceneExpression.d.ts +15 -0
- package/dist/runtime/utils/luceneExpression.js +74 -0
- package/dist/runtime/utils/pagedFetch.d.ts +46 -0
- package/dist/runtime/utils/pagedFetch.js +58 -0
- package/dist/runtime/utils/paginationHeaders.d.ts +4 -0
- package/dist/runtime/utils/paginationHeaders.js +4 -0
- package/dist/runtime/utils/permissionDenied.d.ts +10 -0
- package/dist/runtime/utils/permissionDenied.js +23 -0
- package/dist/runtime/utils/permissionMatrix.d.ts +55 -0
- package/dist/runtime/utils/permissionMatrix.js +85 -0
- package/dist/runtime/utils/persistedState.d.ts +25 -0
- package/dist/runtime/utils/persistedState.js +47 -0
- package/dist/runtime/utils/queryState.d.ts +45 -0
- package/dist/runtime/utils/queryState.js +75 -0
- package/dist/runtime/utils/requestLimits.d.ts +2 -0
- package/dist/runtime/utils/requestLimits.js +4 -0
- package/dist/runtime/utils/resultChart.d.ts +32 -0
- package/dist/runtime/utils/resultChart.js +59 -0
- package/dist/runtime/utils/savedPipelines.d.ts +22 -0
- package/dist/runtime/utils/savedPipelines.js +46 -0
- package/dist/runtime/utils/savedQueries.d.ts +60 -0
- package/dist/runtime/utils/savedQueries.js +143 -0
- package/dist/runtime/utils/schemaAnalysis.d.ts +16 -0
- package/dist/runtime/utils/schemaAnalysis.js +57 -0
- package/dist/runtime/utils/serverError.d.ts +19 -0
- package/dist/runtime/utils/serverError.js +19 -0
- package/dist/runtime/utils/serverOverview.d.ts +47 -0
- package/dist/runtime/utils/serverOverview.js +40 -0
- package/dist/runtime/utils/sessionGuard.d.ts +3 -0
- package/dist/runtime/utils/sessionGuard.js +18 -1
- package/package.json +15 -14
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 **1.
|
|
15
|
+
MongoCamp server **1.8.1 or later** (with `@sfxcode/nuxt-mongocamp-server` ^1.8.0). Older servers are not supported — the module uses the 1.7/1.8 endpoints directly (counts, search, batch info, copy/rename, ordered indexes, typed reads, streaming export/import). See [Server 1.8](/guide/server-1-8).
|
|
16
16
|
|
|
17
17
|
## Features
|
|
18
18
|
|
package/dist/module.d.mts
CHANGED
|
@@ -25,6 +25,14 @@ interface ModuleOptions {
|
|
|
25
25
|
* server proxy mode (there is no login).
|
|
26
26
|
*/
|
|
27
27
|
sessionGuard?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Opt-in, on top of `sessionGuard`: also ask the server (`GET /auth/authenticated`) whether a token that
|
|
30
|
+
* still looks valid is accepted, so a session invalidated server-side (e.g. by a logout elsewhere) is
|
|
31
|
+
* cleared on navigation instead of on the first failing request. One extra request per navigation, at most
|
|
32
|
+
* once per 30 s per token; only a readable 401 counts, a network failure never logs anyone out. Needs
|
|
33
|
+
* `sessionGuard`; no effect in server proxy mode.
|
|
34
|
+
*/
|
|
35
|
+
sessionGuardVerify?: boolean;
|
|
28
36
|
/**
|
|
29
37
|
* Path the session guard navigates to after clearing an expired session — e.g. '/login'. Always
|
|
30
38
|
* treated as allowed by the middleware itself, so it can never cause a redirect loop.
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -14,6 +14,11 @@ function optionWarnings(options) {
|
|
|
14
14
|
"[nuxt-ui-mongocamp] `sessionGuard` has no effect together with `useServerProxy`: server proxy mode has no login, token or session to guard."
|
|
15
15
|
);
|
|
16
16
|
}
|
|
17
|
+
if (options.sessionGuardVerify && !options.sessionGuard) {
|
|
18
|
+
warnings.push(
|
|
19
|
+
"[nuxt-ui-mongocamp] `sessionGuardVerify` has no effect without `sessionGuard`: the server check runs inside the session guard middleware."
|
|
20
|
+
);
|
|
21
|
+
}
|
|
17
22
|
return warnings;
|
|
18
23
|
}
|
|
19
24
|
|
|
@@ -34,6 +39,7 @@ const module$1 = defineNuxtModule({
|
|
|
34
39
|
logoutRedirectPath: "/",
|
|
35
40
|
logoutPath: "/logout",
|
|
36
41
|
sessionGuard: false,
|
|
42
|
+
sessionGuardVerify: false,
|
|
37
43
|
loginPath: "/",
|
|
38
44
|
managerRoles: [],
|
|
39
45
|
securedRouteParts: [],
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
collectionName: string;
|
|
3
|
+
filter?: string;
|
|
3
4
|
};
|
|
4
5
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
6
|
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 { useMongocampSavedPipelines } from "../composables/useMongocampSavedPipelines";
|
|
5
6
|
import {
|
|
6
7
|
VISUAL_STAGE_TYPES,
|
|
7
8
|
buildPipeline,
|
|
@@ -11,10 +12,17 @@ import {
|
|
|
11
12
|
toVisualStages,
|
|
12
13
|
validateStages
|
|
13
14
|
} from "../utils/aggregationPipeline";
|
|
15
|
+
import { previewPipeline } from "../utils/aggregationPreview";
|
|
16
|
+
import { DEFAULT_TOP, MAX_TOP, templateStages, TEMPLATES, validateTemplateInput } from "../utils/aggregationTemplates";
|
|
14
17
|
import { formatCell, resultColumns } from "../utils/aggregationResult";
|
|
15
18
|
import { downloadTextFile, rowsToCsv } from "../utils/exportRows";
|
|
16
19
|
const props = defineProps({
|
|
17
|
-
collectionName: { type: String, required: true }
|
|
20
|
+
collectionName: { type: String, required: true },
|
|
21
|
+
filter: { type: String, required: false }
|
|
22
|
+
});
|
|
23
|
+
const appliedFilter = ref(props.filter);
|
|
24
|
+
watch(() => props.filter, (next) => {
|
|
25
|
+
appliedFilter.value = next;
|
|
18
26
|
});
|
|
19
27
|
const PAGE_SIZES = [10, 20, 50, 100];
|
|
20
28
|
const JSON_PLACEHOLDER = '[ { "$match": { } }, { "$limit": 10 } ]';
|
|
@@ -23,10 +31,15 @@ const DEFAULT_TEXT = {
|
|
|
23
31
|
$group: '{ "_id": "$field", "count": { "$sum": 1 } }',
|
|
24
32
|
$sort: '{ "count": -1 }',
|
|
25
33
|
$project: "{}",
|
|
26
|
-
$limit: "10"
|
|
34
|
+
$limit: "10",
|
|
35
|
+
$unwind: '"$field"',
|
|
36
|
+
$addFields: '{ "newField": "$field" }',
|
|
37
|
+
$count: '"count"',
|
|
38
|
+
$bucketAuto: '{ "groupBy": "$field", "buckets": 5 }'
|
|
27
39
|
};
|
|
28
40
|
const { t } = useI18n();
|
|
29
|
-
const { runAggregation, describeAggregationError } = useMongocampAggregation();
|
|
41
|
+
const { runAggregation, describeAggregationError, listFieldNames } = useMongocampAggregation();
|
|
42
|
+
const { saved: savedPipelines, save: savePipeline, remove: removeSavedPipeline } = useMongocampSavedPipelines(() => props.collectionName);
|
|
30
43
|
let idCounter = 0;
|
|
31
44
|
function newId() {
|
|
32
45
|
return `stage-${idCounter++}`;
|
|
@@ -40,6 +53,7 @@ const rowsPerPage = ref(20);
|
|
|
40
53
|
const page = ref(1);
|
|
41
54
|
const running = ref(false);
|
|
42
55
|
const result = ref(null);
|
|
56
|
+
const resultView = ref("table");
|
|
43
57
|
const runError = ref(null);
|
|
44
58
|
let lastPipeline = null;
|
|
45
59
|
let runCounter = 0;
|
|
@@ -74,6 +88,83 @@ function moveStage(index, offset) {
|
|
|
74
88
|
[next[index], next[target]] = [next[target], next[index]];
|
|
75
89
|
drafts.value = next;
|
|
76
90
|
}
|
|
91
|
+
const openPreviews = ref(/* @__PURE__ */ new Set());
|
|
92
|
+
function togglePreview(id) {
|
|
93
|
+
const next = new Set(openPreviews.value);
|
|
94
|
+
if (!next.delete(id)) next.add(id);
|
|
95
|
+
openPreviews.value = next;
|
|
96
|
+
}
|
|
97
|
+
function previewFor(index) {
|
|
98
|
+
if (draftStates.value.slice(0, index + 1).some((state) => state.error)) return void 0;
|
|
99
|
+
return previewPipeline(draftStates.value.map((state) => state.stage), index);
|
|
100
|
+
}
|
|
101
|
+
const fieldNames = ref([]);
|
|
102
|
+
watch(() => props.collectionName, async (name) => {
|
|
103
|
+
fieldNames.value = [];
|
|
104
|
+
try {
|
|
105
|
+
const names = await listFieldNames(name);
|
|
106
|
+
if (name === props.collectionName) fieldNames.value = names;
|
|
107
|
+
} catch {
|
|
108
|
+
}
|
|
109
|
+
}, { immediate: true });
|
|
110
|
+
const templateKey = ref("count-by-field");
|
|
111
|
+
const templateField = ref("");
|
|
112
|
+
const templateValueField = ref("");
|
|
113
|
+
const templateTop = ref(DEFAULT_TOP);
|
|
114
|
+
const templateUnit = ref("month");
|
|
115
|
+
const templateProblem = ref("");
|
|
116
|
+
const TEMPLATE_LABEL_KEYS = {
|
|
117
|
+
"count-by-field": "templateCountByField",
|
|
118
|
+
"top-values": "templateTopValues",
|
|
119
|
+
"date-histogram": "templateDateHistogram",
|
|
120
|
+
"sum-avg-by-group": "templateSumAvg"
|
|
121
|
+
};
|
|
122
|
+
const templateItems = computed(() => TEMPLATES.map((info) => ({ value: info.key, label: t(`nuxtUiMongocamp.aggregation.${TEMPLATE_LABEL_KEYS[info.key]}`) })));
|
|
123
|
+
const templateInfo = computed(() => TEMPLATES.find((info) => info.key === templateKey.value));
|
|
124
|
+
const unitItems = computed(() => [{ value: "year", label: t("nuxtUiMongocamp.aggregation.unitYear") }, { value: "month", label: t("nuxtUiMongocamp.aggregation.unitMonth") }, { value: "day", label: t("nuxtUiMongocamp.aggregation.unitDay") }]);
|
|
125
|
+
const templateFieldLabel = computed(() => t(templateKey.value === "date-histogram" ? "nuxtUiMongocamp.aggregation.templateFieldDate" : templateInfo.value.needsValueField ? "nuxtUiMongocamp.aggregation.templateFieldGroup" : "nuxtUiMongocamp.aggregation.templateField"));
|
|
126
|
+
function isUntouched() {
|
|
127
|
+
return drafts.value.length === 1 && drafts.value[0].type === "$match" && drafts.value[0].text.trim() === DEFAULT_TEXT.$match;
|
|
128
|
+
}
|
|
129
|
+
function addTemplate() {
|
|
130
|
+
const input = { field: templateField.value, valueField: templateValueField.value, top: templateInfo.value.needsTop ? Number(templateTop.value) : void 0, unit: templateUnit.value };
|
|
131
|
+
const problem = validateTemplateInput(templateKey.value, input);
|
|
132
|
+
if (problem) {
|
|
133
|
+
templateProblem.value = t({ "field": "nuxtUiMongocamp.aggregation.templateProblemField", "value-field": "nuxtUiMongocamp.aggregation.templateProblemValue", "top": "nuxtUiMongocamp.aggregation.templateProblemTop" }[problem]);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
templateProblem.value = "";
|
|
137
|
+
const added = templateStages(templateKey.value, input).map((stage) => ({ id: newId(), type: stage.type, text: JSON.stringify(stage.value, null, 2) }));
|
|
138
|
+
drafts.value = [...isUntouched() ? [] : drafts.value, ...added];
|
|
139
|
+
}
|
|
140
|
+
const saveName = ref("");
|
|
141
|
+
const saveError = ref("");
|
|
142
|
+
function saveCurrent() {
|
|
143
|
+
saveError.value = "";
|
|
144
|
+
const pipeline = pipelineState.value.pipeline;
|
|
145
|
+
if (!pipeline || pipeline.length === 0) {
|
|
146
|
+
saveError.value = t("nuxtUiMongocamp.aggregation.saveFailedPipeline");
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const result2 = savePipeline(saveName.value, pipeline);
|
|
150
|
+
if (result2.ok) {
|
|
151
|
+
saveName.value = "";
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
saveError.value = t({ "invalid-name": "nuxtUiMongocamp.aggregation.saveFailedName", "invalid-pipeline": "nuxtUiMongocamp.aggregation.saveFailedPipeline", "limit": "nuxtUiMongocamp.aggregation.saveFailedLimit", "too-large": "nuxtUiMongocamp.aggregation.saveFailedSize" }[result2.reason]);
|
|
155
|
+
}
|
|
156
|
+
function applySaved(entry) {
|
|
157
|
+
modeError.value = "";
|
|
158
|
+
openPreviews.value = /* @__PURE__ */ new Set();
|
|
159
|
+
const stages = toVisualStages(entry.pipeline, () => newId());
|
|
160
|
+
if (stages) {
|
|
161
|
+
drafts.value = stages.map((stage) => ({ id: stage.id, type: stage.type, text: JSON.stringify(stage.value, null, 2) }));
|
|
162
|
+
mode.value = "visual";
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
rawText.value = pipelineToText(entry.pipeline);
|
|
166
|
+
mode.value = "json";
|
|
167
|
+
}
|
|
77
168
|
function pipelineErrorText(error) {
|
|
78
169
|
const n = (error.stageIndex ?? 0) + 1;
|
|
79
170
|
return t(`nuxtUiMongocamp.aggregation.pipelineErrors.${error.code}`, { n, operator: error.operator ?? "" });
|
|
@@ -118,7 +209,7 @@ async function execute(pageNumber) {
|
|
|
118
209
|
running.value = true;
|
|
119
210
|
runError.value = null;
|
|
120
211
|
try {
|
|
121
|
-
const outcome = await runAggregation(props.collectionName, lastPipeline, { page: pageNumber, rowsPerPage: rowsPerPage.value });
|
|
212
|
+
const outcome = await runAggregation(props.collectionName, lastPipeline, { page: pageNumber, rowsPerPage: rowsPerPage.value }, { filter: appliedFilter.value });
|
|
122
213
|
if (run !== runCounter) return;
|
|
123
214
|
result.value = outcome;
|
|
124
215
|
page.value = outcome.page;
|
|
@@ -180,6 +271,27 @@ const exportMenuItems = computed(() => [
|
|
|
180
271
|
|
|
181
272
|
<template>
|
|
182
273
|
<div class="flex flex-col gap-4">
|
|
274
|
+
<div
|
|
275
|
+
v-if="appliedFilter"
|
|
276
|
+
class="flex flex-wrap items-center gap-2 text-sm"
|
|
277
|
+
data-test="applied-filter"
|
|
278
|
+
>
|
|
279
|
+
<span class="text-dimmed">{{ t("nuxtUiMongocamp.aggregation.appliesTo") }}</span>
|
|
280
|
+
<UBadge
|
|
281
|
+
:label="appliedFilter"
|
|
282
|
+
color="neutral"
|
|
283
|
+
variant="subtle"
|
|
284
|
+
class="font-mono"
|
|
285
|
+
/>
|
|
286
|
+
<UButton
|
|
287
|
+
icon="i-lucide-x"
|
|
288
|
+
color="neutral"
|
|
289
|
+
variant="ghost"
|
|
290
|
+
size="xs"
|
|
291
|
+
:aria-label="t('nuxtUiMongocamp.aggregation.removeFilter')"
|
|
292
|
+
@click="appliedFilter = void 0"
|
|
293
|
+
/>
|
|
294
|
+
</div>
|
|
183
295
|
<div class="flex flex-wrap items-center justify-between gap-2">
|
|
184
296
|
<div class="flex items-center gap-1">
|
|
185
297
|
<UButton
|
|
@@ -208,6 +320,177 @@ const exportMenuItems = computed(() => [
|
|
|
208
320
|
/>
|
|
209
321
|
</div>
|
|
210
322
|
|
|
323
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
324
|
+
<UPopover
|
|
325
|
+
v-if="mode === 'visual'"
|
|
326
|
+
:content="{ align: 'start' }"
|
|
327
|
+
>
|
|
328
|
+
<UButton
|
|
329
|
+
icon="i-lucide-wand-sparkles"
|
|
330
|
+
color="neutral"
|
|
331
|
+
variant="soft"
|
|
332
|
+
size="sm"
|
|
333
|
+
:label="t('nuxtUiMongocamp.aggregation.templatesButton')"
|
|
334
|
+
/>
|
|
335
|
+
<template #content>
|
|
336
|
+
<form
|
|
337
|
+
class="flex w-80 flex-col gap-3 p-3"
|
|
338
|
+
data-test="templates-panel"
|
|
339
|
+
@submit.prevent="addTemplate"
|
|
340
|
+
>
|
|
341
|
+
<USelect
|
|
342
|
+
v-model="templateKey"
|
|
343
|
+
:items="templateItems"
|
|
344
|
+
:aria-label="t('nuxtUiMongocamp.aggregation.templateLabel')"
|
|
345
|
+
/>
|
|
346
|
+
<UFormField :label="templateFieldLabel">
|
|
347
|
+
<UInput
|
|
348
|
+
v-model="templateField"
|
|
349
|
+
class="w-full"
|
|
350
|
+
list="aggregation-fields"
|
|
351
|
+
:aria-label="templateFieldLabel"
|
|
352
|
+
/>
|
|
353
|
+
</UFormField>
|
|
354
|
+
<UFormField
|
|
355
|
+
v-if="templateInfo.needsValueField"
|
|
356
|
+
:label="t('nuxtUiMongocamp.aggregation.templateValueField')"
|
|
357
|
+
>
|
|
358
|
+
<UInput
|
|
359
|
+
v-model="templateValueField"
|
|
360
|
+
class="w-full"
|
|
361
|
+
list="aggregation-fields"
|
|
362
|
+
:aria-label="t('nuxtUiMongocamp.aggregation.templateValueField')"
|
|
363
|
+
/>
|
|
364
|
+
</UFormField>
|
|
365
|
+
<UFormField
|
|
366
|
+
v-if="templateInfo.needsTop"
|
|
367
|
+
:label="t('nuxtUiMongocamp.aggregation.templateTop')"
|
|
368
|
+
>
|
|
369
|
+
<UInput
|
|
370
|
+
v-model.number="templateTop"
|
|
371
|
+
type="number"
|
|
372
|
+
:min="1"
|
|
373
|
+
:max="MAX_TOP"
|
|
374
|
+
class="w-full"
|
|
375
|
+
:aria-label="t('nuxtUiMongocamp.aggregation.templateTop')"
|
|
376
|
+
/>
|
|
377
|
+
</UFormField>
|
|
378
|
+
<UFormField
|
|
379
|
+
v-if="templateInfo.needsUnit"
|
|
380
|
+
:label="t('nuxtUiMongocamp.aggregation.templateUnit')"
|
|
381
|
+
>
|
|
382
|
+
<USelect
|
|
383
|
+
v-model="templateUnit"
|
|
384
|
+
:items="unitItems"
|
|
385
|
+
class="w-full"
|
|
386
|
+
:aria-label="t('nuxtUiMongocamp.aggregation.templateUnit')"
|
|
387
|
+
/>
|
|
388
|
+
</UFormField>
|
|
389
|
+
<datalist id="aggregation-fields">
|
|
390
|
+
<option
|
|
391
|
+
v-for="name in fieldNames"
|
|
392
|
+
:key="name"
|
|
393
|
+
:value="name"
|
|
394
|
+
/>
|
|
395
|
+
</datalist>
|
|
396
|
+
<p
|
|
397
|
+
v-if="templateProblem"
|
|
398
|
+
class="text-sm text-error"
|
|
399
|
+
role="alert"
|
|
400
|
+
>
|
|
401
|
+
{{ templateProblem }}
|
|
402
|
+
</p>
|
|
403
|
+
<p class="text-xs text-dimmed">
|
|
404
|
+
{{ t("nuxtUiMongocamp.aggregation.templatesHelp") }}
|
|
405
|
+
</p>
|
|
406
|
+
<UButton
|
|
407
|
+
type="submit"
|
|
408
|
+
icon="i-lucide-plus"
|
|
409
|
+
:label="t('nuxtUiMongocamp.aggregation.addTemplate')"
|
|
410
|
+
/>
|
|
411
|
+
</form>
|
|
412
|
+
</template>
|
|
413
|
+
</UPopover>
|
|
414
|
+
|
|
415
|
+
<UPopover :content="{ align: 'start' }">
|
|
416
|
+
<UButton
|
|
417
|
+
icon="i-lucide-bookmark"
|
|
418
|
+
color="neutral"
|
|
419
|
+
variant="soft"
|
|
420
|
+
size="sm"
|
|
421
|
+
:label="t('nuxtUiMongocamp.aggregation.savedButton')"
|
|
422
|
+
/>
|
|
423
|
+
<template #content>
|
|
424
|
+
<div
|
|
425
|
+
class="flex w-96 max-w-[90vw] flex-col gap-2 p-3"
|
|
426
|
+
data-test="saved-panel"
|
|
427
|
+
>
|
|
428
|
+
<h3 class="text-sm font-semibold">
|
|
429
|
+
{{ t("nuxtUiMongocamp.aggregation.savedTitle") }}
|
|
430
|
+
</h3>
|
|
431
|
+
<p
|
|
432
|
+
v-if="savedPipelines.length === 0"
|
|
433
|
+
class="text-sm text-dimmed"
|
|
434
|
+
>
|
|
435
|
+
{{ t("nuxtUiMongocamp.aggregation.savedEmpty") }}
|
|
436
|
+
</p>
|
|
437
|
+
<div
|
|
438
|
+
v-for="entry in savedPipelines"
|
|
439
|
+
:key="entry.name"
|
|
440
|
+
class="flex items-center gap-1"
|
|
441
|
+
>
|
|
442
|
+
<UButton
|
|
443
|
+
color="neutral"
|
|
444
|
+
variant="ghost"
|
|
445
|
+
size="sm"
|
|
446
|
+
class="min-w-0 flex-1 justify-start"
|
|
447
|
+
:label="entry.name"
|
|
448
|
+
@click="applySaved(entry)"
|
|
449
|
+
/>
|
|
450
|
+
<UButton
|
|
451
|
+
icon="i-lucide-trash-2"
|
|
452
|
+
color="error"
|
|
453
|
+
variant="ghost"
|
|
454
|
+
size="sm"
|
|
455
|
+
:aria-label="t('nuxtUiMongocamp.aggregation.deleteSaved', { name: entry.name })"
|
|
456
|
+
@click="removeSavedPipeline(entry.name)"
|
|
457
|
+
/>
|
|
458
|
+
</div>
|
|
459
|
+
<form
|
|
460
|
+
class="mt-1 flex items-center gap-1"
|
|
461
|
+
@submit.prevent="saveCurrent"
|
|
462
|
+
>
|
|
463
|
+
<UInput
|
|
464
|
+
v-model="saveName"
|
|
465
|
+
size="sm"
|
|
466
|
+
class="min-w-0 flex-1"
|
|
467
|
+
maxlength="80"
|
|
468
|
+
:placeholder="t('nuxtUiMongocamp.aggregation.saveNamePlaceholder')"
|
|
469
|
+
:aria-label="t('nuxtUiMongocamp.aggregation.saveName')"
|
|
470
|
+
/>
|
|
471
|
+
<UButton
|
|
472
|
+
type="submit"
|
|
473
|
+
icon="i-lucide-save"
|
|
474
|
+
size="sm"
|
|
475
|
+
:label="t('nuxtUiMongocamp.aggregation.save')"
|
|
476
|
+
:disabled="saveName.trim() === ''"
|
|
477
|
+
/>
|
|
478
|
+
</form>
|
|
479
|
+
<p
|
|
480
|
+
v-if="saveError"
|
|
481
|
+
class="text-xs text-error"
|
|
482
|
+
role="alert"
|
|
483
|
+
>
|
|
484
|
+
{{ saveError }}
|
|
485
|
+
</p>
|
|
486
|
+
<p class="text-xs text-dimmed">
|
|
487
|
+
{{ t("nuxtUiMongocamp.aggregation.savedNote") }}
|
|
488
|
+
</p>
|
|
489
|
+
</div>
|
|
490
|
+
</template>
|
|
491
|
+
</UPopover>
|
|
492
|
+
</div>
|
|
493
|
+
|
|
211
494
|
<UAlert
|
|
212
495
|
v-if="modeError"
|
|
213
496
|
color="warning"
|
|
@@ -261,7 +544,7 @@ const exportMenuItems = computed(() => [
|
|
|
261
544
|
</div>
|
|
262
545
|
<UTextarea
|
|
263
546
|
v-model="draft.text"
|
|
264
|
-
:rows="
|
|
547
|
+
:rows="['$limit', '$count', '$unwind'].includes(draft.type) ? 1 : 3"
|
|
265
548
|
:color="draftStates[index]?.error ? 'error' : void 0"
|
|
266
549
|
class="w-full font-mono"
|
|
267
550
|
:aria-label="t('nuxtUiMongocamp.aggregation.stageValue', { type: draft.type })"
|
|
@@ -272,6 +555,25 @@ const exportMenuItems = computed(() => [
|
|
|
272
555
|
>
|
|
273
556
|
{{ draftStates[index]?.error }}
|
|
274
557
|
</p>
|
|
558
|
+
<div class="flex flex-col gap-2">
|
|
559
|
+
<UButton
|
|
560
|
+
:icon="openPreviews.has(draft.id) ? 'i-lucide-eye-off' : 'i-lucide-eye'"
|
|
561
|
+
color="neutral"
|
|
562
|
+
variant="ghost"
|
|
563
|
+
size="xs"
|
|
564
|
+
class="self-start"
|
|
565
|
+
:aria-pressed="openPreviews.has(draft.id)"
|
|
566
|
+
:label="openPreviews.has(draft.id) ? t('nuxtUiMongocamp.aggregation.previewHide') : t('nuxtUiMongocamp.aggregation.previewShow')"
|
|
567
|
+
@click="togglePreview(draft.id)"
|
|
568
|
+
/>
|
|
569
|
+
<MongocampAggregationStagePreview
|
|
570
|
+
v-if="openPreviews.has(draft.id)"
|
|
571
|
+
:collection-name="collectionName"
|
|
572
|
+
:pipeline="previewFor(index)"
|
|
573
|
+
:stage-number="index + 1"
|
|
574
|
+
:filter="appliedFilter"
|
|
575
|
+
/>
|
|
576
|
+
</div>
|
|
275
577
|
</div>
|
|
276
578
|
<div class="flex flex-wrap items-center gap-2">
|
|
277
579
|
<USelect
|
|
@@ -346,6 +648,25 @@ const exportMenuItems = computed(() => [
|
|
|
346
648
|
{{ t("nuxtUiMongocamp.aggregation.resultsCount", { count: result.total }, result.total) }}
|
|
347
649
|
</span>
|
|
348
650
|
<div class="flex flex-wrap items-center gap-2">
|
|
651
|
+
<UFieldGroup size="sm">
|
|
652
|
+
<UButton
|
|
653
|
+
icon="i-lucide-table"
|
|
654
|
+
color="neutral"
|
|
655
|
+
:variant="resultView === 'table' ? 'subtle' : 'ghost'"
|
|
656
|
+
:label="t('nuxtUiMongocamp.aggregationChart.viewTable')"
|
|
657
|
+
data-testid="view-table"
|
|
658
|
+
@click="resultView = 'table'"
|
|
659
|
+
/>
|
|
660
|
+
<UButton
|
|
661
|
+
icon="i-lucide-chart-column"
|
|
662
|
+
color="neutral"
|
|
663
|
+
:variant="resultView === 'chart' ? 'subtle' : 'ghost'"
|
|
664
|
+
:label="t('nuxtUiMongocamp.aggregationChart.viewChart')"
|
|
665
|
+
:disabled="result.rows.length === 0"
|
|
666
|
+
data-testid="view-chart"
|
|
667
|
+
@click="resultView = 'chart'"
|
|
668
|
+
/>
|
|
669
|
+
</UFieldGroup>
|
|
349
670
|
<UDropdownMenu :items="exportMenuItems">
|
|
350
671
|
<UButton
|
|
351
672
|
icon="i-lucide-download"
|
|
@@ -373,7 +694,12 @@ const exportMenuItems = computed(() => [
|
|
|
373
694
|
</div>
|
|
374
695
|
</div>
|
|
375
696
|
|
|
697
|
+
<MongocampAggregationChart
|
|
698
|
+
v-if="resultView === 'chart'"
|
|
699
|
+
:rows="result.rows"
|
|
700
|
+
/>
|
|
376
701
|
<UTable
|
|
702
|
+
v-else
|
|
377
703
|
:data="result.rows"
|
|
378
704
|
:columns="tableColumns"
|
|
379
705
|
:loading="running"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
collectionName: string;
|
|
3
|
+
filter?: string;
|
|
3
4
|
};
|
|
4
5
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
6
|
declare const _default: typeof __VLS_export;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
rows: Record<string, unknown>[];
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref, watch } from "vue";
|
|
3
|
+
import { useI18n } from "#imports";
|
|
4
|
+
import { resultColumns } from "../utils/aggregationResult";
|
|
5
|
+
import { buildResultChart, LABEL_KEY, MAX_CHART_ROWS, MAX_SERIES, valueColumns } from "../utils/resultChart";
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
rows: { type: Array, required: true }
|
|
8
|
+
});
|
|
9
|
+
const { t } = useI18n();
|
|
10
|
+
const columns = computed(() => resultColumns(props.rows));
|
|
11
|
+
const labelKey = ref(void 0);
|
|
12
|
+
const valueKeys = ref([]);
|
|
13
|
+
const kind = ref(void 0);
|
|
14
|
+
watch(() => props.rows, () => {
|
|
15
|
+
labelKey.value = void 0;
|
|
16
|
+
valueKeys.value = [];
|
|
17
|
+
kind.value = void 0;
|
|
18
|
+
});
|
|
19
|
+
const chart = computed(() => buildResultChart(props.rows, columns.value, { labelKey: labelKey.value, valueKeys: valueKeys.value, kind: kind.value }));
|
|
20
|
+
const numberColumns = computed(() => valueColumns(props.rows, columns.value, chart.value?.labelKey));
|
|
21
|
+
const kinds = computed(() => ["bar", "area", "donut"].map((value) => ({ value, label: t(`nuxtUiMongocamp.aggregationChart.kind.${value}`) })));
|
|
22
|
+
const categories = computed(() => (chart.value?.valueKeys ?? []).map((key) => ({ key, label: key })));
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<div
|
|
27
|
+
class="flex flex-col gap-3"
|
|
28
|
+
data-testid="aggregation-chart"
|
|
29
|
+
>
|
|
30
|
+
<UAlert
|
|
31
|
+
v-if="!chart"
|
|
32
|
+
color="neutral"
|
|
33
|
+
variant="subtle"
|
|
34
|
+
icon="i-lucide-chart-no-axes-column"
|
|
35
|
+
:title="t('nuxtUiMongocamp.aggregationChart.nothing')"
|
|
36
|
+
data-testid="chart-nothing"
|
|
37
|
+
/>
|
|
38
|
+
<template v-else>
|
|
39
|
+
<div class="flex flex-wrap items-end gap-3">
|
|
40
|
+
<UFormField :label="t('nuxtUiMongocamp.aggregationChart.labelColumn')">
|
|
41
|
+
<USelect
|
|
42
|
+
:model-value="chart.labelKey"
|
|
43
|
+
:items="columns"
|
|
44
|
+
size="sm"
|
|
45
|
+
class="w-40"
|
|
46
|
+
@update:model-value="labelKey = $event;
|
|
47
|
+
valueKeys = []"
|
|
48
|
+
/>
|
|
49
|
+
</UFormField>
|
|
50
|
+
<UFormField :label="t('nuxtUiMongocamp.aggregationChart.valueColumns', { max: MAX_SERIES })">
|
|
51
|
+
<USelect
|
|
52
|
+
:model-value="chart.valueKeys"
|
|
53
|
+
:items="numberColumns"
|
|
54
|
+
multiple
|
|
55
|
+
size="sm"
|
|
56
|
+
class="w-48"
|
|
57
|
+
@update:model-value="valueKeys = $event"
|
|
58
|
+
/>
|
|
59
|
+
</UFormField>
|
|
60
|
+
<UFormField :label="t('nuxtUiMongocamp.aggregationChart.type')">
|
|
61
|
+
<USelect
|
|
62
|
+
:model-value="chart.kind"
|
|
63
|
+
:items="kinds"
|
|
64
|
+
size="sm"
|
|
65
|
+
class="w-28"
|
|
66
|
+
@update:model-value="kind = $event"
|
|
67
|
+
/>
|
|
68
|
+
</UFormField>
|
|
69
|
+
</div>
|
|
70
|
+
<MongocampChart
|
|
71
|
+
:type="chart.kind"
|
|
72
|
+
:data="chart.data"
|
|
73
|
+
:index="LABEL_KEY"
|
|
74
|
+
:categories="categories"
|
|
75
|
+
:index-label="chart.labelKey"
|
|
76
|
+
:chart-label="t('nuxtUiMongocamp.aggregationChart.ariaLabel', { values: chart.valueKeys.join(', '), label: chart.labelKey })"
|
|
77
|
+
:chart-description="t('nuxtUiMongocamp.aggregationChart.ariaDescription', { count: chart.data.length })"
|
|
78
|
+
/>
|
|
79
|
+
<p
|
|
80
|
+
v-if="chart.cut || chart.skipped"
|
|
81
|
+
class="text-xs text-dimmed"
|
|
82
|
+
data-testid="chart-note"
|
|
83
|
+
>
|
|
84
|
+
<template v-if="chart.cut">
|
|
85
|
+
{{ t("nuxtUiMongocamp.aggregationChart.cut", { max: MAX_CHART_ROWS }) }}
|
|
86
|
+
</template>
|
|
87
|
+
<template v-if="chart.skipped">
|
|
88
|
+
{{ t("nuxtUiMongocamp.aggregationChart.skipped", { count: chart.skipped }) }}
|
|
89
|
+
</template>
|
|
90
|
+
</p>
|
|
91
|
+
</template>
|
|
92
|
+
</div>
|
|
93
|
+
</template>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
rows: Record<string, unknown>[];
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RequestStage } from '../utils/aggregationPipeline.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
collectionName: string;
|
|
4
|
+
pipeline: RequestStage[] | undefined;
|
|
5
|
+
stageNumber: number;
|
|
6
|
+
filter?: string;
|
|
7
|
+
};
|
|
8
|
+
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
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|