@sfxcode/nuxt-ui-mongocamp 1.5.8 → 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.json +1 -1
- package/dist/runtime/components/MongocampAggregationBuilder.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampAggregationBuilder.vue +5 -2
- package/dist/runtime/components/MongocampAggregationBuilder.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampAggregationStagePreview.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampAggregationStagePreview.vue +4 -2
- package/dist/runtime/components/MongocampAggregationStagePreview.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampBucketFiles.vue +4 -6
- package/dist/runtime/components/MongocampCollectionCharts.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampCollectionCharts.vue +4 -2
- 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 +5 -3
- package/dist/runtime/components/MongocampCollectionCopy.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampCollectionData.vue +60 -25
- package/dist/runtime/components/MongocampCollectionInfos.vue +16 -1
- package/dist/runtime/components/MongocampDocumentView.vue +6 -1
- package/dist/runtime/components/MongocampExportAll.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampExportAll.vue +12 -0
- package/dist/runtime/components/MongocampExportAll.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampImport.vue +3 -0
- package/dist/runtime/components/MongocampIndexes.vue +7 -3
- package/dist/runtime/components/MongocampQueryBar.vue +15 -0
- package/dist/runtime/components/MongocampServerInfo.vue +1 -14
- package/dist/runtime/components/MongocampServerStatus.vue +7 -2
- package/dist/runtime/components/MongocampVersion.d.vue.ts +1 -1
- package/dist/runtime/components/MongocampVersion.vue +14 -7
- 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/locales/de.json +12 -4
- package/dist/runtime/locales/en.json +12 -4
- 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/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/package.json +12 -6
- 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.json
CHANGED
|
@@ -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,
|
|
@@ -19,7 +20,8 @@ import { downloadTextFile, rowsToCsv } from "../utils/exportRows";
|
|
|
19
20
|
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
20
21
|
const props = defineProps({
|
|
21
22
|
collectionName: { type: String, required: true },
|
|
22
|
-
filter: { type: String, required: false }
|
|
23
|
+
filter: { type: String, required: false },
|
|
24
|
+
matchCase: { type: Boolean, required: false }
|
|
23
25
|
});
|
|
24
26
|
const appliedFilter = ref(props.filter);
|
|
25
27
|
watch(() => props.filter, (next) => {
|
|
@@ -211,7 +213,7 @@ async function execute(pageNumber) {
|
|
|
211
213
|
running.value = true;
|
|
212
214
|
runError.value = null;
|
|
213
215
|
try {
|
|
214
|
-
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) });
|
|
215
217
|
if (run !== runCounter) return;
|
|
216
218
|
result.value = outcome;
|
|
217
219
|
page.value = outcome.page;
|
|
@@ -560,6 +562,7 @@ const exportMenuItems = computed(() => [
|
|
|
560
562
|
:pipeline="previewFor(index)"
|
|
561
563
|
:stage-number="index + 1"
|
|
562
564
|
:filter="appliedFilter"
|
|
565
|
+
:match-case="matchCase"
|
|
563
566
|
/>
|
|
564
567
|
</div>
|
|
565
568
|
</div>
|
|
@@ -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;
|
|
@@ -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) {
|
|
@@ -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;
|
|
@@ -6,7 +6,7 @@ import { useMongocampBucket } from "../composables/useMongocampBucket";
|
|
|
6
6
|
import { useMongocampFieldTypes } from "../composables/useMongocampFieldTypes";
|
|
7
7
|
import { useMongocampPermissions } from "../composables/useMongocampPermissions";
|
|
8
8
|
import MongocampCollectionCharts from "./MongocampCollectionCharts.vue";
|
|
9
|
-
import {
|
|
9
|
+
import { filenameFilter } from "../utils/fileFilter";
|
|
10
10
|
import { parseMetadataJson } from "../utils/filePreview";
|
|
11
11
|
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
12
12
|
const props = defineProps({
|
|
@@ -27,7 +27,6 @@ const {
|
|
|
27
27
|
uploading,
|
|
28
28
|
fileActionInFlight
|
|
29
29
|
} = useMongocampBucket();
|
|
30
|
-
const { like } = useMongocampQuery();
|
|
31
30
|
const fileInputRef = ref(null);
|
|
32
31
|
const filesCollection = computed(() => `${props.bucketName}.files`);
|
|
33
32
|
const fieldTypes = useMongocampFieldTypes(() => filesCollection.value);
|
|
@@ -279,9 +278,8 @@ const filterText = ref("");
|
|
|
279
278
|
const sorting = ref([]);
|
|
280
279
|
const isInitializing = ref(false);
|
|
281
280
|
let filterTimer;
|
|
282
|
-
function
|
|
283
|
-
|
|
284
|
-
return trimmed ? like("filename", trimmed) : void 0;
|
|
281
|
+
function buildFileFilter(term) {
|
|
282
|
+
return filenameFilter(term);
|
|
285
283
|
}
|
|
286
284
|
function onFilterInput() {
|
|
287
285
|
clearTimeout(filterTimer);
|
|
@@ -304,7 +302,7 @@ async function fetchFiles() {
|
|
|
304
302
|
rowsPerPage: pagination.value.pageSize,
|
|
305
303
|
page: pagination.value.pageIndex,
|
|
306
304
|
sort: sorting.value.length ? sortingToMongoSort(sorting.value).join(",") : void 0,
|
|
307
|
-
filter:
|
|
305
|
+
filter: buildFileFilter(filterText.value)
|
|
308
306
|
});
|
|
309
307
|
total.value = result.total;
|
|
310
308
|
files.value = result.files;
|
|
@@ -6,6 +6,7 @@ type __VLS_Props = {
|
|
|
6
6
|
top?: number;
|
|
7
7
|
buckets?: number;
|
|
8
8
|
filter?: string;
|
|
9
|
+
matchCase?: boolean;
|
|
9
10
|
};
|
|
10
11
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
11
12
|
filter: string;
|
|
@@ -2,6 +2,7 @@
|
|
|
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 { dominantKindOfField } from "../utils/fieldDetails";
|
|
6
7
|
import { chartKindFor, chartRequest, chartTypeFor, DEFAULT_BUCKETS, DEFAULT_TOP, highestPoint, MAX_PERIODS, rowsToPoints } from "../utils/collectionChart";
|
|
7
8
|
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
@@ -11,7 +12,8 @@ const props = defineProps({
|
|
|
11
12
|
kind: { type: String, required: false, default: void 0 },
|
|
12
13
|
top: { type: Number, required: false, default: DEFAULT_TOP },
|
|
13
14
|
buckets: { type: Number, required: false, default: DEFAULT_BUCKETS },
|
|
14
|
-
filter: { type: String, required: false, default: void 0 }
|
|
15
|
+
filter: { type: String, required: false, default: void 0 },
|
|
16
|
+
matchCase: { type: Boolean, required: false }
|
|
15
17
|
});
|
|
16
18
|
const { t } = useI18n();
|
|
17
19
|
const ui = useMongocampUi();
|
|
@@ -58,7 +60,7 @@ async function load() {
|
|
|
58
60
|
status.value = "invalid";
|
|
59
61
|
return;
|
|
60
62
|
}
|
|
61
|
-
const result = await runAggregation(props.collectionName, request.pipeline, { page: 1, rowsPerPage: request.rowsPerPage }, { signal: own.signal, filter: props.filter });
|
|
63
|
+
const result = await runAggregation(props.collectionName, request.pipeline, { page: 1, rowsPerPage: request.rowsPerPage }, { signal: own.signal, filter: props.filter, filterCaseInsensitive: caseInsensitiveFlag(props.filter, props.matchCase) });
|
|
62
64
|
if (mine !== run) return;
|
|
63
65
|
points.value = rowsToPoints(chartKind, result.rows, t("nuxtUiMongocamp.charts.noneLabel"));
|
|
64
66
|
total.value = result.total;
|
|
@@ -6,6 +6,7 @@ type __VLS_Props = {
|
|
|
6
6
|
top?: number;
|
|
7
7
|
buckets?: number;
|
|
8
8
|
filter?: string;
|
|
9
|
+
matchCase?: boolean;
|
|
9
10
|
};
|
|
10
11
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
11
12
|
filter: string;
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
import { computed, ref, watch } from "vue";
|
|
3
3
|
import { useI18n, useMongocampError } from "#imports";
|
|
4
4
|
import { useMongocampCollectionCopy } from "../composables/useMongocampCollectionCopy";
|
|
5
|
+
import { caseInsensitiveFlag } from "../utils/caseInsensitive";
|
|
5
6
|
import { backupName, canCopyCollection, MAX_COLLECTION_NAME_LENGTH, validateTargetName } from "../utils/collectionCopy";
|
|
6
7
|
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
7
8
|
const props = defineProps({
|
|
8
9
|
source: { type: String, required: true },
|
|
9
|
-
filter: { type: String, required: false }
|
|
10
|
+
filter: { type: String, required: false },
|
|
11
|
+
matchCase: { type: Boolean, required: false }
|
|
10
12
|
});
|
|
11
13
|
const emit = defineEmits(["done"]);
|
|
12
14
|
const isOpen = defineModel("open", { type: Boolean, ...{ default: false } });
|
|
@@ -32,7 +34,7 @@ watch(isOpen, async (open) => {
|
|
|
32
34
|
errorText.value = "";
|
|
33
35
|
sourceCount.value = void 0;
|
|
34
36
|
countFailed.value = false;
|
|
35
|
-
const [names, count] = await Promise.allSettled([listCollectionNames(), countDocuments(props.source, props.filter)]);
|
|
37
|
+
const [names, count] = await Promise.allSettled([listCollectionNames(), countDocuments(props.source, props.filter, { filterCaseInsensitive: caseInsensitiveFlag(props.filter, props.matchCase) })]);
|
|
36
38
|
if (mine !== opened) return;
|
|
37
39
|
existing.value = names.status === "fulfilled" ? names.value : [];
|
|
38
40
|
if (count.status === "fulfilled") sourceCount.value = count.value;
|
|
@@ -55,7 +57,7 @@ async function start(quick = false) {
|
|
|
55
57
|
errorText.value = "";
|
|
56
58
|
step.value = "running";
|
|
57
59
|
try {
|
|
58
|
-
const common = { source: props.source, filter: props.filter, withIndexes: withIndexes.value };
|
|
60
|
+
const common = { source: props.source, filter: props.filter, filterCaseInsensitive: caseInsensitiveFlag(props.filter, props.matchCase), withIndexes: withIndexes.value };
|
|
59
61
|
const outcome = quick ? await backupCollection({ ...common, onTarget: (name) => {
|
|
60
62
|
target.value = name;
|
|
61
63
|
} }) : await copyCollection({ ...common, target: targetName.value });
|
|
@@ -28,6 +28,11 @@ import MongocampQueryBar from "./MongocampQueryBar.vue";
|
|
|
28
28
|
import MongocampExportAll from "./MongocampExportAll.vue";
|
|
29
29
|
import MongocampCollectionCharts from "./MongocampCollectionCharts.vue";
|
|
30
30
|
import { isFilterTooLong } from "../utils/requestLimits";
|
|
31
|
+
import { idOf, isStringWrapper, isTextValue, leafWrapperText } from "../utils/relaxedValues";
|
|
32
|
+
import { caseInsensitiveFlag } from "../utils/caseInsensitive";
|
|
33
|
+
import { ignoringNotFound, isNotFound } from "../utils/serverError";
|
|
34
|
+
import { cursorFor, emptyCursorMemory, rememberNext, stableSort } from "../utils/cursorPaging";
|
|
35
|
+
import { sensitiveFieldsOf, withoutSensitiveFields } from "../utils/sensitiveFields";
|
|
31
36
|
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
32
37
|
const props = defineProps({
|
|
33
38
|
collectionName: { type: String, required: true },
|
|
@@ -62,7 +67,8 @@ const { createIndexForField } = useMongocampIndex();
|
|
|
62
67
|
const { isManager } = useMongocampRoles();
|
|
63
68
|
const { canWrite, load: loadPermissions } = useMongocampPermissions();
|
|
64
69
|
watch(() => props.collectionName, (name) => loadPermissions(name), { immediate: true });
|
|
65
|
-
const
|
|
70
|
+
const hidesSensitiveFields = computed(() => sensitiveFieldsOf(props.collectionName).length > 0);
|
|
71
|
+
const writable = computed(() => canWrite(props.collectionName) && !hidesSensitiveFields.value);
|
|
66
72
|
const toast = useToast();
|
|
67
73
|
const fileInputRef = ref(null);
|
|
68
74
|
function openFilePicker() {
|
|
@@ -126,7 +132,7 @@ async function loadTypedRow(row) {
|
|
|
126
132
|
const id = getDocId(row);
|
|
127
133
|
if (!id) return void 0;
|
|
128
134
|
const res = await documentApi.getDocumentRaw({ collectionName: props.collectionName, documentId: id, extendedJson: "canonical" });
|
|
129
|
-
return await readJsonKeepingLongs(res);
|
|
135
|
+
return withoutSensitiveFields(await readJsonKeepingLongs(res), props.collectionName);
|
|
130
136
|
}
|
|
131
137
|
async function openEdit(row) {
|
|
132
138
|
const projected = activeProjection.value.length > 0;
|
|
@@ -206,14 +212,15 @@ async function handleSave() {
|
|
|
206
212
|
await fetchDocuments();
|
|
207
213
|
emit("changed");
|
|
208
214
|
} catch (e) {
|
|
209
|
-
editError.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.collectionData.errorSave");
|
|
215
|
+
editError.value = isNotFound(e) ? t("nuxtUiMongocamp.collectionData.documentGone") : e instanceof Error ? e.message : t("nuxtUiMongocamp.collectionData.errorSave");
|
|
210
216
|
}
|
|
211
217
|
}
|
|
212
218
|
async function handleDelete() {
|
|
213
219
|
deleteError.value = "";
|
|
214
220
|
if (!docToDelete.value) return;
|
|
215
221
|
try {
|
|
216
|
-
|
|
222
|
+
const documentId = docToDelete.value;
|
|
223
|
+
await ignoringNotFound(() => documentApi._delete({ collectionName: props.collectionName, documentId }));
|
|
217
224
|
isDeleteModalOpen.value = false;
|
|
218
225
|
await fetchDocuments();
|
|
219
226
|
emit("changed");
|
|
@@ -343,7 +350,8 @@ const queryBar = ref(null);
|
|
|
343
350
|
const fieldTypes = useMongocampFieldTypes(() => props.collectionName);
|
|
344
351
|
const pageFilterFields = ref([]);
|
|
345
352
|
const filterFields = computed(() => {
|
|
346
|
-
const
|
|
353
|
+
const hidden = sensitiveFieldsOf(props.collectionName);
|
|
354
|
+
const fromServer = fieldTypes.filterFields().filter((f) => operatorsFor(f.type).length > 0 && !hidden.includes(f.key));
|
|
347
355
|
return fromServer.length > 0 ? fromServer : pageFilterFields.value;
|
|
348
356
|
});
|
|
349
357
|
const sorting = ref([]);
|
|
@@ -384,6 +392,9 @@ function openDetail(value) {
|
|
|
384
392
|
detailContent.value = JSON.stringify(value, null, 2);
|
|
385
393
|
detailOpen.value = true;
|
|
386
394
|
}
|
|
395
|
+
function insensitiveFor(filter) {
|
|
396
|
+
return caseInsensitiveFlag(filter, query.value.matchCase);
|
|
397
|
+
}
|
|
387
398
|
function buildLuceneFilter(term) {
|
|
388
399
|
const trimmed = term.trim();
|
|
389
400
|
const quick = trimmed && filterableColumns.value.length > 0 ? or(...filterableColumns.value.map((col) => like(col, trimmed))) : "";
|
|
@@ -457,6 +468,11 @@ function makeCell(key, type) {
|
|
|
457
468
|
if (!Array.isArray(raw)) {
|
|
458
469
|
const obj = raw;
|
|
459
470
|
if ("$oid" in obj) return h("span", { class: "font-mono text-xs" }, String(obj.$oid));
|
|
471
|
+
const leafText = leafWrapperText(obj);
|
|
472
|
+
if (leafText !== void 0) {
|
|
473
|
+
const shown = truncateText(leafText);
|
|
474
|
+
return h("span", { class: isStringWrapper(obj) ? void 0 : "font-mono text-xs", title: shown !== leafText ? leafText : void 0 }, shown);
|
|
475
|
+
}
|
|
460
476
|
const numberKey = Object.keys(obj).find((k) => k === "$numberLong" || k === "$numberDecimal" || k === "$numberInt" || k === "$numberDouble");
|
|
461
477
|
if (numberKey && Object.keys(obj).length === 1) return h("span", { class: "font-mono text-xs" }, String(obj[numberKey]));
|
|
462
478
|
if ("$date" in obj) return h("span", toDateDisplay(obj));
|
|
@@ -525,8 +541,9 @@ async function collectMatching() {
|
|
|
525
541
|
const filter = buildLuceneFilter(filterText.value);
|
|
526
542
|
counting.value = true;
|
|
527
543
|
try {
|
|
528
|
-
const
|
|
529
|
-
|
|
544
|
+
const insensitive = insensitiveFor(filter);
|
|
545
|
+
const count = await countDocuments(props.collectionName, filter, { filterCaseInsensitive: insensitive });
|
|
546
|
+
matching.value = { filter, count, insensitive };
|
|
530
547
|
rowSelection.value = {};
|
|
531
548
|
if (count !== total.value) bulkNote.value = t("nuxtUiMongocamp.bulk.matchingDrift", { counted: count, reported: total.value });
|
|
532
549
|
} catch (e) {
|
|
@@ -567,8 +584,8 @@ async function handleBulkDelete() {
|
|
|
567
584
|
bulkError.value = "";
|
|
568
585
|
try {
|
|
569
586
|
if (matching.value) {
|
|
570
|
-
const { filter, count } = matching.value;
|
|
571
|
-
const deleted = await deleteByFilter(props.collectionName, filter);
|
|
587
|
+
const { filter, count, insensitive } = matching.value;
|
|
588
|
+
const deleted = await deleteByFilter(props.collectionName, filter, { filterCaseInsensitive: insensitive });
|
|
572
589
|
clearMatching();
|
|
573
590
|
await fetchDocuments();
|
|
574
591
|
emit("changed");
|
|
@@ -578,7 +595,8 @@ async function handleBulkDelete() {
|
|
|
578
595
|
const ids = [...bulkIds.value];
|
|
579
596
|
const { failed } = await runBulkDelete(
|
|
580
597
|
ids,
|
|
581
|
-
|
|
598
|
+
// the one-by-one fallback also runs for ids a short chunk left behind — some may be gone already (404 = deleted)
|
|
599
|
+
(documentId) => ignoringNotFound(() => documentApi._delete({ collectionName: props.collectionName, documentId })),
|
|
582
600
|
void 0,
|
|
583
601
|
{
|
|
584
602
|
// one request per chunk for ids a filter can address; the rest (and any chunk that does not
|
|
@@ -621,8 +639,8 @@ async function handleBulkEdit(edit) {
|
|
|
621
639
|
const document = { [edit.field]: value };
|
|
622
640
|
try {
|
|
623
641
|
if (matching.value) {
|
|
624
|
-
const { filter, count } = matching.value;
|
|
625
|
-
const { modified } = await updateByFilter(props.collectionName, filter, document);
|
|
642
|
+
const { filter, count, insensitive } = matching.value;
|
|
643
|
+
const { modified } = await updateByFilter(props.collectionName, filter, document, { filterCaseInsensitive: insensitive });
|
|
626
644
|
clearMatching();
|
|
627
645
|
await fetchDocuments();
|
|
628
646
|
emit("changed");
|
|
@@ -653,6 +671,7 @@ async function handleBulkEdit(edit) {
|
|
|
653
671
|
}
|
|
654
672
|
const projectableKeys = computed(() => dataColumnKeys.value.filter((k) => k !== "_id"));
|
|
655
673
|
const activeProjection = computed(() => columns.value.length === 0 ? [] : usableProjection(query.value.projection, projectableKeys.value));
|
|
674
|
+
let cursorMemory = emptyCursorMemory();
|
|
656
675
|
async function fetchDocuments() {
|
|
657
676
|
loading.value = true;
|
|
658
677
|
loadError.value = null;
|
|
@@ -660,20 +679,25 @@ async function fetchDocuments() {
|
|
|
660
679
|
clearMatching();
|
|
661
680
|
filterRejected.value = false;
|
|
662
681
|
const filter = buildLuceneFilter(filterText.value);
|
|
682
|
+
const sort = stableSort(sorting.value.length ? sortingToMongoSort(sorting.value) : void 0);
|
|
683
|
+
const projection = activeProjection.value.length > 0 ? activeProjection.value : void 0;
|
|
684
|
+
const insensitive = insensitiveFor(filter);
|
|
685
|
+
const page = pagination.value.pageIndex;
|
|
686
|
+
const listKey = JSON.stringify([props.collectionName, filter, sort, projection, pagination.value.pageSize, insensitive]);
|
|
687
|
+
const after = cursorFor(cursorMemory, listKey, page);
|
|
663
688
|
try {
|
|
664
689
|
const res = await documentApi.searchDocumentsRaw({
|
|
665
690
|
collectionName: props.collectionName,
|
|
691
|
+
extendedJson: "relaxed",
|
|
692
|
+
filterCaseInsensitive: insensitive,
|
|
666
693
|
rowsPerPage: pagination.value.pageSize,
|
|
667
|
-
page
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
sort: sorting.value.length ? sortingToMongoSort(sorting.value) : void 0,
|
|
671
|
-
// only the fields asked for are loaded (the server always adds `_id`); never an empty list, which is a 500
|
|
672
|
-
projection: activeProjection.value.length > 0 ? activeProjection.value : void 0
|
|
673
|
-
}
|
|
694
|
+
// `after` and `page` together are a 400
|
|
695
|
+
...after !== void 0 ? { after } : { page },
|
|
696
|
+
searchRequest: { filter, sort, projection }
|
|
674
697
|
});
|
|
698
|
+
cursorMemory = rememberNext(cursorMemory, listKey, page, res.raw.headers.get("x-pagination-next") || void 0);
|
|
675
699
|
total.value = +(res.raw.headers.get("x-pagination-count-rows") ?? 0);
|
|
676
|
-
const rows = await readJsonKeepingLongs(res);
|
|
700
|
+
const rows = (await readJsonKeepingLongs(res)).map((row) => withoutSensitiveFields(row, props.collectionName));
|
|
677
701
|
documents.value = rows;
|
|
678
702
|
const firstRow = rows[0];
|
|
679
703
|
if (columns.value.length === 0 && firstRow) {
|
|
@@ -688,7 +712,7 @@ async function fetchDocuments() {
|
|
|
688
712
|
header: ({ column }) => columnHeader(column, key),
|
|
689
713
|
cell: makeCell(key, "string")
|
|
690
714
|
}));
|
|
691
|
-
filterableColumns.value = orderedKeys.filter((k) => k !== "_id" && k !== "metaData" &&
|
|
715
|
+
filterableColumns.value = orderedKeys.filter((k) => k !== "_id" && k !== "metaData" && isTextValue(firstRow[k]));
|
|
692
716
|
pageFilterFields.value = schemaFromSamples(rows.map((row) => unwrapExtendedJson(row, { exactLongs: false }))).map((c) => ({ key: c.columnKey, type: c.columnKey === "_id" ? "objectId" : toFilterFieldType(c.columnType) })).filter((f) => operatorsFor(f.type).length > 0);
|
|
693
717
|
if (!isBucketCollection(props.collectionName) && writable.value) {
|
|
694
718
|
columns.value.unshift(createSelectColumn(UCheckbox, { selectAll: t("nuxtUiMongocamp.bulk.selectAll"), selectRow: t("nuxtUiMongocamp.bulk.selectRow") }));
|
|
@@ -768,7 +792,8 @@ const exportAllOpen = ref(false);
|
|
|
768
792
|
const exportMenuItems = computed(() => [
|
|
769
793
|
{ label: t("nuxtUiMongocamp.collectionData.exportJson"), icon: "i-lucide-file-json", onSelect: () => exportPage("json") },
|
|
770
794
|
{ label: t("nuxtUiMongocamp.collectionData.exportCsv"), icon: "i-lucide-file-spreadsheet", onSelect: () => exportPage("csv") },
|
|
771
|
-
|
|
795
|
+
// the server's export file would contain the hidden fields
|
|
796
|
+
...hidesSensitiveFields.value ? [] : [{ label: t("nuxtUiMongocamp.exportAll.menuItem"), icon: "i-lucide-download-cloud", onSelect: () => exportAllOpen.value = true }]
|
|
772
797
|
]);
|
|
773
798
|
const DISTINCT_SUGGESTION_LIMIT = 100;
|
|
774
799
|
let distinctCache = /* @__PURE__ */ new Map();
|
|
@@ -920,7 +945,7 @@ defineExpose({ refresh: init });
|
|
|
920
945
|
icon="i-lucide-sigma"
|
|
921
946
|
v-bind="ui.iconButton"
|
|
922
947
|
:disabled="chartFilterTooLong"
|
|
923
|
-
:to="{ path: `${aggregatePath}/${collectionName}/aggregate`, query: chartFilter ? { filter: chartFilter } : {} }"
|
|
948
|
+
:to="{ path: `${aggregatePath}/${collectionName}/aggregate`, query: chartFilter ? { filter: chartFilter, ...query.matchCase ? { matchCase: 'true' } : {} } : {} }"
|
|
924
949
|
:aria-label="t('nuxtUiMongocamp.collectionData.aggregateTooltip')"
|
|
925
950
|
data-test="aggregate-link"
|
|
926
951
|
/>
|
|
@@ -966,6 +991,14 @@ defineExpose({ refresh: init });
|
|
|
966
991
|
@apply="onQueryApply"
|
|
967
992
|
/>
|
|
968
993
|
|
|
994
|
+
<p
|
|
995
|
+
v-if="hidesSensitiveFields"
|
|
996
|
+
class="text-sm text-muted"
|
|
997
|
+
data-test="sensitive-fields-note"
|
|
998
|
+
>
|
|
999
|
+
{{ t("nuxtUiMongocamp.collectionData.sensitiveFieldsNote") }}
|
|
1000
|
+
</p>
|
|
1001
|
+
|
|
969
1002
|
<MongocampErrorAlert
|
|
970
1003
|
:error="loadError"
|
|
971
1004
|
:filter-rejected="filterRejected"
|
|
@@ -1043,6 +1076,7 @@ defineExpose({ refresh: init });
|
|
|
1043
1076
|
v-model:open="exportAllOpen"
|
|
1044
1077
|
:collection="collectionName"
|
|
1045
1078
|
:filter="buildLuceneFilter(filterText)"
|
|
1079
|
+
:match-case="query.matchCase"
|
|
1046
1080
|
:sort="sortingToMongoSort(sorting)"
|
|
1047
1081
|
:projection="activeProjection"
|
|
1048
1082
|
:total="total"
|
|
@@ -1082,6 +1116,7 @@ defineExpose({ refresh: init });
|
|
|
1082
1116
|
:collection-name="collectionName"
|
|
1083
1117
|
:field="chartField"
|
|
1084
1118
|
:filter="chartFilter"
|
|
1119
|
+
:match-case="query.matchCase"
|
|
1085
1120
|
/>
|
|
1086
1121
|
</div>
|
|
1087
1122
|
</template>
|
|
@@ -1112,8 +1147,8 @@ defineExpose({ refresh: init });
|
|
|
1112
1147
|
<MongocampDocumentCompare
|
|
1113
1148
|
:left="typedPair?.[0] ?? compareRows[0]"
|
|
1114
1149
|
:right="typedPair?.[1] ?? compareRows[1]"
|
|
1115
|
-
:left-label="
|
|
1116
|
-
:right-label="
|
|
1150
|
+
:left-label="idOf(compareRows[0]._id) ?? ''"
|
|
1151
|
+
:right-label="idOf(compareRows[1]._id) ?? ''"
|
|
1117
1152
|
/>
|
|
1118
1153
|
</template>
|
|
1119
1154
|
</template>
|
|
@@ -25,17 +25,26 @@ const info = ref(null);
|
|
|
25
25
|
const chartField = ref("");
|
|
26
26
|
const columnDefinitions = ref([]);
|
|
27
27
|
const loading = ref(false);
|
|
28
|
+
const loadError = ref(null);
|
|
28
29
|
async function fetchInfo() {
|
|
29
30
|
if (!props.collectionName) return;
|
|
30
31
|
loading.value = true;
|
|
32
|
+
loadError.value = null;
|
|
31
33
|
try {
|
|
32
34
|
info.value = await collectionApi.getCollectionInformation({ collectionName: props.collectionName });
|
|
33
35
|
const samples = await documentApi.listDocuments({
|
|
34
36
|
collectionName: props.collectionName,
|
|
35
37
|
rowsPerPage: props.sampleSize,
|
|
36
|
-
page: 1
|
|
38
|
+
page: 1,
|
|
39
|
+
// the server's default, asked for by name: ids, dates and date-looking text keep their types for the inference
|
|
40
|
+
extendedJson: "relaxed",
|
|
41
|
+
// only the rows are used; the count is on the cards already
|
|
42
|
+
count: "none"
|
|
37
43
|
});
|
|
38
44
|
columnDefinitions.value = schemaFromSamples(samples);
|
|
45
|
+
} catch (e) {
|
|
46
|
+
info.value = null;
|
|
47
|
+
loadError.value = e;
|
|
39
48
|
} finally {
|
|
40
49
|
loading.value = false;
|
|
41
50
|
}
|
|
@@ -230,6 +239,12 @@ defineExpose({ refresh: fetchInfo });
|
|
|
230
239
|
|
|
231
240
|
<template>
|
|
232
241
|
<div class="mongocamp-collection-infos flex flex-col gap-4">
|
|
242
|
+
<MongocampErrorAlert
|
|
243
|
+
v-if="!loading"
|
|
244
|
+
:error="loadError"
|
|
245
|
+
:title="t('nuxtUiMongocamp.collectionInfos.loadFailedTitle', { name: collectionName })"
|
|
246
|
+
@retry="fetchInfo"
|
|
247
|
+
/>
|
|
233
248
|
<USkeleton
|
|
234
249
|
v-if="loading"
|
|
235
250
|
class="h-32 w-full"
|
|
@@ -32,7 +32,12 @@ const BADGE_COLORS = {
|
|
|
32
32
|
objectId: "info",
|
|
33
33
|
date: "info",
|
|
34
34
|
array: "primary",
|
|
35
|
-
object: "secondary"
|
|
35
|
+
object: "secondary",
|
|
36
|
+
binary: "neutral",
|
|
37
|
+
regex: "neutral",
|
|
38
|
+
timestamp: "info",
|
|
39
|
+
minKey: "neutral",
|
|
40
|
+
maxKey: "neutral"
|
|
36
41
|
};
|
|
37
42
|
function toggle(node) {
|
|
38
43
|
const next = new Set(expanded.value);
|
|
@@ -4,9 +4,11 @@ import { useI18n, useMongocampError } from "#imports";
|
|
|
4
4
|
import { useMongocampExportAll } from "../composables/useMongocampExportAll";
|
|
5
5
|
import { formatBytes } from "../utils/formatBytes";
|
|
6
6
|
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
7
|
+
import { caseInsensitiveFlag } from "../utils/caseInsensitive";
|
|
7
8
|
const props = defineProps({
|
|
8
9
|
collection: { type: String, required: true },
|
|
9
10
|
filter: { type: String, required: false },
|
|
11
|
+
matchCase: { type: Boolean, required: false },
|
|
10
12
|
sort: { type: Array, required: false },
|
|
11
13
|
projection: { type: Array, required: false },
|
|
12
14
|
total: { type: Number, required: false }
|
|
@@ -18,6 +20,7 @@ const { describeServerError } = useMongocampError();
|
|
|
18
20
|
const { exportCollection } = useMongocampExportAll();
|
|
19
21
|
const step = ref("form");
|
|
20
22
|
const format = ref("json");
|
|
23
|
+
const exactTypes = ref(false);
|
|
21
24
|
const progress = ref({ bytes: 0, lines: 0 });
|
|
22
25
|
const result = ref(null);
|
|
23
26
|
const cancelled = ref(false);
|
|
@@ -51,7 +54,9 @@ async function start() {
|
|
|
51
54
|
result.value = await exportCollection({
|
|
52
55
|
collection: props.collection,
|
|
53
56
|
format: format.value,
|
|
57
|
+
extendedJson: exactTypes.value ? "canonical" : "relaxed",
|
|
54
58
|
filter: props.filter,
|
|
59
|
+
filterCaseInsensitive: caseInsensitiveFlag(props.filter, props.matchCase),
|
|
55
60
|
sort: props.sort?.length ? props.sort : void 0,
|
|
56
61
|
projection: props.projection?.length ? props.projection : void 0,
|
|
57
62
|
expected: props.total,
|
|
@@ -106,6 +111,13 @@ function cancel() {
|
|
|
106
111
|
:aria-label="t('nuxtUiMongocamp.exportAll.formatLabel')"
|
|
107
112
|
/>
|
|
108
113
|
</UFormField>
|
|
114
|
+
<UCheckbox
|
|
115
|
+
v-if="format !== 'csv'"
|
|
116
|
+
v-model="exactTypes"
|
|
117
|
+
data-testid="export-exact-types"
|
|
118
|
+
:label="t('nuxtUiMongocamp.exportAll.exactTypes')"
|
|
119
|
+
:description="t('nuxtUiMongocamp.exportAll.exactTypesHint')"
|
|
120
|
+
/>
|
|
109
121
|
<p class="text-xs text-dimmed">
|
|
110
122
|
{{ t("nuxtUiMongocamp.exportAll.streamNote") }}
|
|
111
123
|
</p>
|