@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
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { useI18n } from "#imports";
|
|
4
|
+
import { compareDocuments, compareText } from "../utils/documentCompare";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
left: { type: null, required: true },
|
|
7
|
+
right: { type: null, required: true },
|
|
8
|
+
leftLabel: { type: String, required: false, default: void 0 },
|
|
9
|
+
rightLabel: { type: String, required: false, default: void 0 }
|
|
10
|
+
});
|
|
11
|
+
const onlyDifferences = defineModel("onlyDifferences", { type: Boolean, ...{ default: false } });
|
|
12
|
+
const { t } = useI18n();
|
|
13
|
+
const result = computed(() => compareDocuments(props.left, props.right));
|
|
14
|
+
const visibleRows = computed(() => onlyDifferences.value ? result.value.rows.filter((r) => r.status !== "same") : result.value.rows);
|
|
15
|
+
const identical = computed(() => result.value.rows.every((r) => r.status === "same"));
|
|
16
|
+
const STATUS = {
|
|
17
|
+
same: { color: "neutral", icon: "i-lucide-equal", row: "" },
|
|
18
|
+
changed: { color: "warning", icon: "i-lucide-pencil", row: "bg-warning/10" },
|
|
19
|
+
added: { color: "success", icon: "i-lucide-plus", row: "bg-success/10" },
|
|
20
|
+
removed: { color: "error", icon: "i-lucide-minus", row: "bg-error/10" }
|
|
21
|
+
};
|
|
22
|
+
const statusLabel = (status) => t(`nuxtUiMongocamp.documentCompare.status.${status}`);
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<div
|
|
27
|
+
class="flex flex-col gap-3"
|
|
28
|
+
data-testid="document-compare"
|
|
29
|
+
>
|
|
30
|
+
<div class="flex flex-wrap items-center justify-between gap-3">
|
|
31
|
+
<div
|
|
32
|
+
class="flex flex-wrap gap-2"
|
|
33
|
+
data-testid="compare-summary"
|
|
34
|
+
>
|
|
35
|
+
<UBadge
|
|
36
|
+
v-for="status in ['changed', 'added', 'removed', 'same']"
|
|
37
|
+
:key="status"
|
|
38
|
+
:color="STATUS[status].color"
|
|
39
|
+
variant="subtle"
|
|
40
|
+
:icon="STATUS[status].icon"
|
|
41
|
+
:label="`${result.counts[status]} ${statusLabel(status)}`"
|
|
42
|
+
/>
|
|
43
|
+
</div>
|
|
44
|
+
<USwitch
|
|
45
|
+
v-model="onlyDifferences"
|
|
46
|
+
:label="t('nuxtUiMongocamp.documentCompare.onlyDifferences')"
|
|
47
|
+
data-testid="only-differences"
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<UAlert
|
|
52
|
+
v-if="result.truncated"
|
|
53
|
+
color="warning"
|
|
54
|
+
variant="subtle"
|
|
55
|
+
icon="i-lucide-triangle-alert"
|
|
56
|
+
:title="t('nuxtUiMongocamp.documentCompare.truncated')"
|
|
57
|
+
/>
|
|
58
|
+
|
|
59
|
+
<p
|
|
60
|
+
v-if="identical"
|
|
61
|
+
class="text-sm text-dimmed"
|
|
62
|
+
data-testid="compare-identical"
|
|
63
|
+
>
|
|
64
|
+
{{ t("nuxtUiMongocamp.documentCompare.identical") }}
|
|
65
|
+
</p>
|
|
66
|
+
|
|
67
|
+
<div class="overflow-auto max-h-[65vh] rounded border border-default">
|
|
68
|
+
<table class="w-full text-xs">
|
|
69
|
+
<thead class="sticky top-0 bg-elevated text-left">
|
|
70
|
+
<tr>
|
|
71
|
+
<th class="p-2 font-medium">
|
|
72
|
+
{{ t("nuxtUiMongocamp.documentCompare.path") }}
|
|
73
|
+
</th>
|
|
74
|
+
<th class="p-2 font-medium">
|
|
75
|
+
{{ leftLabel ?? t("nuxtUiMongocamp.documentCompare.left") }}
|
|
76
|
+
</th>
|
|
77
|
+
<th class="p-2 font-medium">
|
|
78
|
+
{{ rightLabel ?? t("nuxtUiMongocamp.documentCompare.right") }}
|
|
79
|
+
</th>
|
|
80
|
+
<th class="p-2 font-medium">
|
|
81
|
+
{{ t("nuxtUiMongocamp.documentCompare.state") }}
|
|
82
|
+
</th>
|
|
83
|
+
</tr>
|
|
84
|
+
</thead>
|
|
85
|
+
<tbody>
|
|
86
|
+
<tr
|
|
87
|
+
v-for="row in visibleRows"
|
|
88
|
+
:key="row.path"
|
|
89
|
+
:class="STATUS[row.status].row"
|
|
90
|
+
:data-path="row.path"
|
|
91
|
+
:data-status="row.status"
|
|
92
|
+
>
|
|
93
|
+
<td class="p-2 font-mono align-top break-all">
|
|
94
|
+
{{ row.path || t("nuxtUiMongocamp.documentCompare.root") }}
|
|
95
|
+
</td>
|
|
96
|
+
<td class="p-2 font-mono align-top break-all">
|
|
97
|
+
<template v-if="row.status === 'added'">
|
|
98
|
+
<span class="text-dimmed">—</span>
|
|
99
|
+
</template>
|
|
100
|
+
<template v-else>
|
|
101
|
+
{{ compareText(row.left) }}
|
|
102
|
+
<UBadge
|
|
103
|
+
v-if="row.typeDiffers"
|
|
104
|
+
:label="row.leftType"
|
|
105
|
+
color="neutral"
|
|
106
|
+
variant="outline"
|
|
107
|
+
size="sm"
|
|
108
|
+
/>
|
|
109
|
+
</template>
|
|
110
|
+
</td>
|
|
111
|
+
<td class="p-2 font-mono align-top break-all">
|
|
112
|
+
<template v-if="row.status === 'removed'">
|
|
113
|
+
<span class="text-dimmed">—</span>
|
|
114
|
+
</template>
|
|
115
|
+
<template v-else>
|
|
116
|
+
{{ compareText(row.right) }}
|
|
117
|
+
<UBadge
|
|
118
|
+
v-if="row.typeDiffers"
|
|
119
|
+
:label="row.rightType"
|
|
120
|
+
color="neutral"
|
|
121
|
+
variant="outline"
|
|
122
|
+
size="sm"
|
|
123
|
+
/>
|
|
124
|
+
</template>
|
|
125
|
+
</td>
|
|
126
|
+
<td class="p-2 align-top">
|
|
127
|
+
<UBadge
|
|
128
|
+
:color="STATUS[row.status].color"
|
|
129
|
+
variant="subtle"
|
|
130
|
+
:label="statusLabel(row.status)"
|
|
131
|
+
/>
|
|
132
|
+
</td>
|
|
133
|
+
</tr>
|
|
134
|
+
<tr v-if="!visibleRows.length">
|
|
135
|
+
<td
|
|
136
|
+
colspan="4"
|
|
137
|
+
class="p-3 text-center text-dimmed"
|
|
138
|
+
>
|
|
139
|
+
{{ t("nuxtUiMongocamp.documentCompare.nothing") }}
|
|
140
|
+
</td>
|
|
141
|
+
</tr>
|
|
142
|
+
</tbody>
|
|
143
|
+
</table>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
left: unknown;
|
|
3
|
+
right: unknown;
|
|
4
|
+
leftLabel?: string;
|
|
5
|
+
rightLabel?: string;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_ModelProps = {
|
|
8
|
+
'onlyDifferences'?: boolean;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
"update:onlyDifferences": (value: boolean) => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
14
|
+
"onUpdate:onlyDifferences"?: ((value: boolean) => any) | undefined;
|
|
15
|
+
}>, {
|
|
16
|
+
leftLabel: string;
|
|
17
|
+
rightLabel: string;
|
|
18
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
document: Record<string, unknown> | null | undefined;
|
|
3
|
+
};
|
|
4
|
+
type __VLS_ModelProps = {
|
|
5
|
+
'mode'?: 'tree' | 'json';
|
|
6
|
+
};
|
|
7
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
copy: (payload: {
|
|
10
|
+
kind: "path" | "value" | "document";
|
|
11
|
+
text: string;
|
|
12
|
+
}) => any;
|
|
13
|
+
"update:mode": (value: "json" | "tree") => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
15
|
+
onCopy?: ((payload: {
|
|
16
|
+
kind: "path" | "value" | "document";
|
|
17
|
+
text: string;
|
|
18
|
+
}) => any) | undefined;
|
|
19
|
+
"onUpdate:mode"?: ((value: "json" | "tree") => any) | undefined;
|
|
20
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
declare const _default: typeof __VLS_export;
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref, watch } from "vue";
|
|
3
|
+
import { useI18n, useToast } from "#imports";
|
|
4
|
+
import { allContainerPaths, buildDocumentTree, defaultExpanded, nodeDisplay, visibleNodes } from "../utils/documentTree";
|
|
5
|
+
import { valueToJson } from "../utils/exportDocuments";
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
document: { type: null, required: true }
|
|
8
|
+
});
|
|
9
|
+
const emit = defineEmits(["copy"]);
|
|
10
|
+
const mode = defineModel("mode", { type: String, ...{ default: "tree" } });
|
|
11
|
+
const { t } = useI18n();
|
|
12
|
+
const toast = useToast();
|
|
13
|
+
const tree = computed(() => buildDocumentTree(props.document ?? {}));
|
|
14
|
+
const expanded = ref(/* @__PURE__ */ new Set());
|
|
15
|
+
watch(tree, (value) => expanded.value = defaultExpanded(value), { immediate: true });
|
|
16
|
+
const rows = computed(() => visibleNodes(tree.value, expanded.value));
|
|
17
|
+
const hasContainers = computed(() => allContainerPaths(tree.value).size > 0);
|
|
18
|
+
const allOpen = computed(() => hasContainers.value && expanded.value.size >= allContainerPaths(tree.value).size);
|
|
19
|
+
const isLarge = computed(() => tree.value.total > 200);
|
|
20
|
+
const jsonText = computed(() => props.document ? valueToJson(props.document, true) : "");
|
|
21
|
+
const BADGE_COLORS = {
|
|
22
|
+
null: "neutral",
|
|
23
|
+
string: "neutral",
|
|
24
|
+
boolean: "success",
|
|
25
|
+
number: "warning",
|
|
26
|
+
int: "warning",
|
|
27
|
+
long: "warning",
|
|
28
|
+
double: "warning",
|
|
29
|
+
decimal: "warning",
|
|
30
|
+
objectId: "info",
|
|
31
|
+
date: "info",
|
|
32
|
+
array: "primary",
|
|
33
|
+
object: "secondary"
|
|
34
|
+
};
|
|
35
|
+
function toggle(node) {
|
|
36
|
+
const next = new Set(expanded.value);
|
|
37
|
+
if (!next.delete(node.path)) next.add(node.path);
|
|
38
|
+
expanded.value = next;
|
|
39
|
+
}
|
|
40
|
+
function toggleAll() {
|
|
41
|
+
expanded.value = allOpen.value ? /* @__PURE__ */ new Set() : allContainerPaths(tree.value);
|
|
42
|
+
}
|
|
43
|
+
async function copy(kind, text) {
|
|
44
|
+
try {
|
|
45
|
+
await navigator.clipboard.writeText(text);
|
|
46
|
+
toast.add({ title: t("nuxtUiMongocamp.documentView.copied"), color: "success" });
|
|
47
|
+
} catch {
|
|
48
|
+
toast.add({ title: t("nuxtUiMongocamp.documentView.copyFailed"), color: "error" });
|
|
49
|
+
}
|
|
50
|
+
emit("copy", { kind, text });
|
|
51
|
+
}
|
|
52
|
+
function valueText(node) {
|
|
53
|
+
return node.children || node.type === "array" || node.type === "object" ? valueToJson(node.value, true) : nodeDisplay(node).text;
|
|
54
|
+
}
|
|
55
|
+
const modeItems = computed(() => [
|
|
56
|
+
{ label: t("nuxtUiMongocamp.documentView.modeTree"), value: "tree", icon: "i-lucide-list-tree" },
|
|
57
|
+
{ label: t("nuxtUiMongocamp.documentView.modeJson"), value: "json", icon: "i-lucide-braces" }
|
|
58
|
+
]);
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<template>
|
|
62
|
+
<div class="flex flex-col gap-3">
|
|
63
|
+
<div class="flex flex-wrap items-center justify-between gap-2">
|
|
64
|
+
<div
|
|
65
|
+
class="inline-flex rounded-md border border-default p-0.5"
|
|
66
|
+
role="group"
|
|
67
|
+
:aria-label="t('nuxtUiMongocamp.documentView.modeLabel')"
|
|
68
|
+
>
|
|
69
|
+
<UButton
|
|
70
|
+
v-for="item in modeItems"
|
|
71
|
+
:key="item.value"
|
|
72
|
+
:label="item.label"
|
|
73
|
+
:icon="item.icon"
|
|
74
|
+
size="xs"
|
|
75
|
+
color="neutral"
|
|
76
|
+
:variant="mode === item.value ? 'subtle' : 'ghost'"
|
|
77
|
+
:aria-pressed="mode === item.value"
|
|
78
|
+
@click="mode = item.value"
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
<div class="flex items-center gap-1">
|
|
82
|
+
<UButton
|
|
83
|
+
v-if="mode === 'tree' && hasContainers"
|
|
84
|
+
:label="allOpen ? t('nuxtUiMongocamp.documentView.collapseAll') : t('nuxtUiMongocamp.documentView.expandAll')"
|
|
85
|
+
:icon="allOpen ? 'i-lucide-chevrons-down-up' : 'i-lucide-chevrons-up-down'"
|
|
86
|
+
size="xs"
|
|
87
|
+
color="neutral"
|
|
88
|
+
variant="ghost"
|
|
89
|
+
@click="toggleAll"
|
|
90
|
+
/>
|
|
91
|
+
<UButton
|
|
92
|
+
:label="t('nuxtUiMongocamp.documentView.copyDocument')"
|
|
93
|
+
icon="i-lucide-copy"
|
|
94
|
+
size="xs"
|
|
95
|
+
color="neutral"
|
|
96
|
+
variant="ghost"
|
|
97
|
+
:disabled="!document"
|
|
98
|
+
@click="copy('document', jsonText)"
|
|
99
|
+
/>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
<p
|
|
104
|
+
v-if="!document"
|
|
105
|
+
class="text-sm text-dimmed"
|
|
106
|
+
>
|
|
107
|
+
{{ t("nuxtUiMongocamp.documentView.empty") }}
|
|
108
|
+
</p>
|
|
109
|
+
|
|
110
|
+
<pre
|
|
111
|
+
v-else-if="mode === 'json'"
|
|
112
|
+
class="max-h-[70vh] overflow-auto rounded-md bg-elevated p-3 text-xs whitespace-pre-wrap break-all"
|
|
113
|
+
data-test="document-json"
|
|
114
|
+
>{{ jsonText }}</pre>
|
|
115
|
+
|
|
116
|
+
<template v-else>
|
|
117
|
+
<p
|
|
118
|
+
v-if="isLarge"
|
|
119
|
+
class="text-xs text-dimmed"
|
|
120
|
+
>
|
|
121
|
+
{{ t("nuxtUiMongocamp.documentView.collapsedNote") }}
|
|
122
|
+
</p>
|
|
123
|
+
<ul
|
|
124
|
+
class="flex flex-col text-sm"
|
|
125
|
+
role="tree"
|
|
126
|
+
data-test="document-tree"
|
|
127
|
+
>
|
|
128
|
+
<li
|
|
129
|
+
v-for="node in rows"
|
|
130
|
+
:key="node.path"
|
|
131
|
+
class="group flex items-start gap-1 rounded px-1 py-0.5 hover:bg-elevated"
|
|
132
|
+
:style="{ paddingLeft: `${node.depth * 16 + 4}px` }"
|
|
133
|
+
role="treeitem"
|
|
134
|
+
:aria-expanded="node.children ? expanded.has(node.path) : void 0"
|
|
135
|
+
:data-path="node.path"
|
|
136
|
+
>
|
|
137
|
+
<button
|
|
138
|
+
v-if="node.children"
|
|
139
|
+
type="button"
|
|
140
|
+
class="inline-flex size-6 shrink-0 items-center justify-center rounded text-muted hover:bg-accented focus-visible:outline-2 focus-visible:outline-primary"
|
|
141
|
+
:aria-label="expanded.has(node.path) ? t('nuxtUiMongocamp.documentView.collapse') : t('nuxtUiMongocamp.documentView.expand')"
|
|
142
|
+
@click="toggle(node)"
|
|
143
|
+
>
|
|
144
|
+
<UIcon
|
|
145
|
+
:name="expanded.has(node.path) ? 'i-lucide-chevron-down' : 'i-lucide-chevron-right'"
|
|
146
|
+
class="size-4"
|
|
147
|
+
/>
|
|
148
|
+
</button>
|
|
149
|
+
<span
|
|
150
|
+
v-else
|
|
151
|
+
class="inline-block size-6 shrink-0"
|
|
152
|
+
/>
|
|
153
|
+
<span class="shrink-0 font-medium">{{ node.key }}</span>
|
|
154
|
+
<UBadge
|
|
155
|
+
:label="node.type"
|
|
156
|
+
:color="BADGE_COLORS[node.type]"
|
|
157
|
+
variant="subtle"
|
|
158
|
+
size="sm"
|
|
159
|
+
class="shrink-0"
|
|
160
|
+
:title="t('nuxtUiMongocamp.documentView.typeLabel', { type: node.type })"
|
|
161
|
+
/>
|
|
162
|
+
<span
|
|
163
|
+
class="min-w-0 break-all text-dimmed"
|
|
164
|
+
:title="nodeDisplay(node).title"
|
|
165
|
+
>{{ nodeDisplay(node).text }}</span>
|
|
166
|
+
<span class="ml-auto flex shrink-0 gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100">
|
|
167
|
+
<button
|
|
168
|
+
type="button"
|
|
169
|
+
class="inline-flex size-6 items-center justify-center rounded text-muted hover:bg-accented focus-visible:outline-2 focus-visible:outline-primary"
|
|
170
|
+
:aria-label="t('nuxtUiMongocamp.documentView.copyPath')"
|
|
171
|
+
:title="t('nuxtUiMongocamp.documentView.copyPath')"
|
|
172
|
+
@click="copy('path', node.path)"
|
|
173
|
+
>
|
|
174
|
+
<UIcon
|
|
175
|
+
name="i-lucide-route"
|
|
176
|
+
class="size-4"
|
|
177
|
+
/>
|
|
178
|
+
</button>
|
|
179
|
+
<button
|
|
180
|
+
type="button"
|
|
181
|
+
class="inline-flex size-6 items-center justify-center rounded text-muted hover:bg-accented focus-visible:outline-2 focus-visible:outline-primary"
|
|
182
|
+
:aria-label="t('nuxtUiMongocamp.documentView.copyValue')"
|
|
183
|
+
:title="t('nuxtUiMongocamp.documentView.copyValue')"
|
|
184
|
+
@click="copy('value', valueText(node))"
|
|
185
|
+
>
|
|
186
|
+
<UIcon
|
|
187
|
+
name="i-lucide-copy"
|
|
188
|
+
class="size-4"
|
|
189
|
+
/>
|
|
190
|
+
</button>
|
|
191
|
+
</span>
|
|
192
|
+
</li>
|
|
193
|
+
</ul>
|
|
194
|
+
<p
|
|
195
|
+
v-if="tree.truncated"
|
|
196
|
+
class="text-xs text-warning"
|
|
197
|
+
>
|
|
198
|
+
{{ t("nuxtUiMongocamp.documentView.truncated", { count: tree.total }) }}
|
|
199
|
+
</p>
|
|
200
|
+
</template>
|
|
201
|
+
</div>
|
|
202
|
+
</template>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
document: Record<string, unknown> | null | undefined;
|
|
3
|
+
};
|
|
4
|
+
type __VLS_ModelProps = {
|
|
5
|
+
'mode'?: 'tree' | 'json';
|
|
6
|
+
};
|
|
7
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
copy: (payload: {
|
|
10
|
+
kind: "path" | "value" | "document";
|
|
11
|
+
text: string;
|
|
12
|
+
}) => any;
|
|
13
|
+
"update:mode": (value: "json" | "tree") => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
15
|
+
onCopy?: ((payload: {
|
|
16
|
+
kind: "path" | "value" | "document";
|
|
17
|
+
text: string;
|
|
18
|
+
}) => any) | undefined;
|
|
19
|
+
"onUpdate:mode"?: ((value: "json" | "tree") => any) | undefined;
|
|
20
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
declare const _default: typeof __VLS_export;
|
|
22
|
+
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
2
|
+
import { computed, ref, watch } from "vue";
|
|
3
3
|
import { navigateTo, useI18n, useMongocampError, useMongocampRoles, useMongocampSession } from "#imports";
|
|
4
4
|
const props = defineProps({
|
|
5
5
|
error: { type: null, required: true },
|
|
@@ -9,13 +9,21 @@ const props = defineProps({
|
|
|
9
9
|
});
|
|
10
10
|
const emit = defineEmits(["retry", "clearFilters"]);
|
|
11
11
|
const { t } = useI18n();
|
|
12
|
-
const { describeError } = useMongocampError();
|
|
12
|
+
const { describeError, describeServerError } = useMongocampError();
|
|
13
13
|
const { invalidateSession } = useMongocampSession();
|
|
14
14
|
const { loginPath: configuredLoginPath } = useMongocampRoles();
|
|
15
|
-
const described =
|
|
15
|
+
const described = ref(describeError(props.error));
|
|
16
|
+
watch(() => props.error, async (error) => {
|
|
17
|
+
described.value = describeError(error);
|
|
18
|
+
const withServerText = await describeServerError(error);
|
|
19
|
+
if (props.error === error) described.value = withServerText;
|
|
20
|
+
}, { immediate: true });
|
|
16
21
|
const sessionGone = computed(() => described.value.kind === "unauthorized");
|
|
17
22
|
const description = computed(() => {
|
|
18
|
-
if (props.filterRejected)
|
|
23
|
+
if (props.filterRejected) {
|
|
24
|
+
const reason = described.value.kind === "invalid" ? ` ${t("nuxtUiMongocamp.errors.serverMessage", { message: described.value.message })}` : "";
|
|
25
|
+
return t("nuxtUiMongocamp.errors.filterRejected") + reason;
|
|
26
|
+
}
|
|
19
27
|
if (sessionGone.value) return t("nuxtUiMongocamp.errors.unauthorized");
|
|
20
28
|
return described.value.message;
|
|
21
29
|
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
collection: string;
|
|
3
|
+
filter?: string;
|
|
4
|
+
sort?: string[];
|
|
5
|
+
projection?: string[];
|
|
6
|
+
total?: number;
|
|
7
|
+
};
|
|
8
|
+
type __VLS_ModelProps = {
|
|
9
|
+
'open'?: boolean;
|
|
10
|
+
};
|
|
11
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
"update:open": (value: boolean) => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
15
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
16
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const _default: typeof __VLS_export;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref, watch } from "vue";
|
|
3
|
+
import { useI18n, useMongocampError } from "#imports";
|
|
4
|
+
import { useMongocampExportAll } from "../composables/useMongocampExportAll";
|
|
5
|
+
import { formatBytes } from "../utils/formatBytes";
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
collection: { type: String, required: true },
|
|
8
|
+
filter: { type: String, required: false },
|
|
9
|
+
sort: { type: Array, required: false },
|
|
10
|
+
projection: { type: Array, required: false },
|
|
11
|
+
total: { type: Number, required: false }
|
|
12
|
+
});
|
|
13
|
+
const isOpen = defineModel("open", { type: Boolean, ...{ default: false } });
|
|
14
|
+
const { t } = useI18n();
|
|
15
|
+
const { describeServerError } = useMongocampError();
|
|
16
|
+
const { exportCollection } = useMongocampExportAll();
|
|
17
|
+
const step = ref("form");
|
|
18
|
+
const format = ref("json");
|
|
19
|
+
const progress = ref({ bytes: 0, lines: 0 });
|
|
20
|
+
const result = ref(null);
|
|
21
|
+
const cancelled = ref(false);
|
|
22
|
+
const errorText = ref("");
|
|
23
|
+
let controller;
|
|
24
|
+
watch(isOpen, (open) => {
|
|
25
|
+
if (!open) {
|
|
26
|
+
controller?.abort();
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
step.value = "form";
|
|
30
|
+
result.value = null;
|
|
31
|
+
cancelled.value = false;
|
|
32
|
+
errorText.value = "";
|
|
33
|
+
});
|
|
34
|
+
const formatItems = computed(() => [
|
|
35
|
+
{ label: t("nuxtUiMongocamp.exportAll.formatJson"), value: "json" },
|
|
36
|
+
{ label: t("nuxtUiMongocamp.exportAll.formatNdjson"), value: "ndjson" },
|
|
37
|
+
{ label: t("nuxtUiMongocamp.exportAll.formatCsv"), value: "csv" }
|
|
38
|
+
]);
|
|
39
|
+
const received = computed(() => formatBytes(progress.value.bytes));
|
|
40
|
+
async function start() {
|
|
41
|
+
errorText.value = "";
|
|
42
|
+
cancelled.value = false;
|
|
43
|
+
result.value = null;
|
|
44
|
+
step.value = "running";
|
|
45
|
+
progress.value = { bytes: 0, lines: 0 };
|
|
46
|
+
const run = new AbortController();
|
|
47
|
+
controller = run;
|
|
48
|
+
try {
|
|
49
|
+
result.value = await exportCollection({
|
|
50
|
+
collection: props.collection,
|
|
51
|
+
format: format.value,
|
|
52
|
+
filter: props.filter,
|
|
53
|
+
sort: props.sort?.length ? props.sort : void 0,
|
|
54
|
+
projection: props.projection?.length ? props.projection : void 0,
|
|
55
|
+
expected: props.total,
|
|
56
|
+
signal: run.signal,
|
|
57
|
+
onProgress: (p) => {
|
|
58
|
+
progress.value = p;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
step.value = "done";
|
|
62
|
+
} catch (e) {
|
|
63
|
+
if (!isOpen.value) return;
|
|
64
|
+
if (e?.name === "AbortError") cancelled.value = true;
|
|
65
|
+
else errorText.value = (await describeServerError(e, "nuxtUiMongocamp.exportAll.failed")).message;
|
|
66
|
+
step.value = "done";
|
|
67
|
+
} finally {
|
|
68
|
+
if (controller === run) controller = void 0;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function cancel() {
|
|
72
|
+
controller?.abort();
|
|
73
|
+
}
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<template>
|
|
77
|
+
<UModal
|
|
78
|
+
v-model:open="isOpen"
|
|
79
|
+
:title="t('nuxtUiMongocamp.exportAll.title')"
|
|
80
|
+
:ui="{ footer: 'justify-end' }"
|
|
81
|
+
>
|
|
82
|
+
<template #body>
|
|
83
|
+
<div
|
|
84
|
+
v-if="step === 'form'"
|
|
85
|
+
class="flex flex-col gap-4"
|
|
86
|
+
>
|
|
87
|
+
<p class="text-sm text-dimmed">
|
|
88
|
+
{{ t("nuxtUiMongocamp.exportAll.intro") }}
|
|
89
|
+
</p>
|
|
90
|
+
<p
|
|
91
|
+
class="text-sm"
|
|
92
|
+
data-test="export-scope"
|
|
93
|
+
>
|
|
94
|
+
{{ filter ? t("nuxtUiMongocamp.exportAll.scopeFiltered", { collection }) : t("nuxtUiMongocamp.exportAll.scopeAll", { collection }) }}
|
|
95
|
+
<template v-if="total !== void 0">
|
|
96
|
+
({{ t("nuxtUiMongocamp.exportAll.count", { count: total }, total) }})
|
|
97
|
+
</template>
|
|
98
|
+
</p>
|
|
99
|
+
<UFormField :label="t('nuxtUiMongocamp.exportAll.formatLabel')">
|
|
100
|
+
<USelect
|
|
101
|
+
v-model="format"
|
|
102
|
+
:items="formatItems"
|
|
103
|
+
class="w-full"
|
|
104
|
+
:aria-label="t('nuxtUiMongocamp.exportAll.formatLabel')"
|
|
105
|
+
/>
|
|
106
|
+
</UFormField>
|
|
107
|
+
<p class="text-xs text-dimmed">
|
|
108
|
+
{{ t("nuxtUiMongocamp.exportAll.streamNote") }}
|
|
109
|
+
</p>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<div
|
|
113
|
+
v-else-if="step === 'running'"
|
|
114
|
+
class="flex flex-col gap-2"
|
|
115
|
+
role="status"
|
|
116
|
+
data-test="export-progress"
|
|
117
|
+
>
|
|
118
|
+
<UProgress />
|
|
119
|
+
<span class="text-sm text-dimmed">{{ t("nuxtUiMongocamp.exportAll.receiving", { size: received }) }}</span>
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<div
|
|
123
|
+
v-else
|
|
124
|
+
class="flex flex-col gap-3"
|
|
125
|
+
data-test="export-result"
|
|
126
|
+
>
|
|
127
|
+
<p
|
|
128
|
+
v-if="cancelled"
|
|
129
|
+
class="text-sm"
|
|
130
|
+
>
|
|
131
|
+
{{ t("nuxtUiMongocamp.exportAll.cancelled") }}
|
|
132
|
+
</p>
|
|
133
|
+
<p
|
|
134
|
+
v-else-if="errorText"
|
|
135
|
+
class="text-sm text-error"
|
|
136
|
+
role="alert"
|
|
137
|
+
>
|
|
138
|
+
{{ errorText }}
|
|
139
|
+
</p>
|
|
140
|
+
<template v-else-if="result">
|
|
141
|
+
<UAlert
|
|
142
|
+
v-if="result.incomplete"
|
|
143
|
+
color="warning"
|
|
144
|
+
variant="subtle"
|
|
145
|
+
icon="i-lucide-circle-alert"
|
|
146
|
+
:title="t('nuxtUiMongocamp.exportAll.incomplete', { file: result.filename })"
|
|
147
|
+
data-test="export-incomplete"
|
|
148
|
+
/>
|
|
149
|
+
<UAlert
|
|
150
|
+
v-else
|
|
151
|
+
color="success"
|
|
152
|
+
variant="subtle"
|
|
153
|
+
icon="i-lucide-circle-check"
|
|
154
|
+
:title="result.documents === void 0 ? t('nuxtUiMongocamp.exportAll.doneSize', { size: formatBytes(result.bytes), file: result.filename }) : t('nuxtUiMongocamp.exportAll.done', { count: result.documents, file: result.filename }, result.documents)"
|
|
155
|
+
/>
|
|
156
|
+
</template>
|
|
157
|
+
</div>
|
|
158
|
+
</template>
|
|
159
|
+
|
|
160
|
+
<template #footer>
|
|
161
|
+
<UButton
|
|
162
|
+
v-if="step === 'running'"
|
|
163
|
+
:label="t('nuxtUiMongocamp.exportAll.stop')"
|
|
164
|
+
color="neutral"
|
|
165
|
+
variant="soft"
|
|
166
|
+
@click="cancel"
|
|
167
|
+
/>
|
|
168
|
+
<template v-else-if="step === 'done'">
|
|
169
|
+
<UButton
|
|
170
|
+
:label="t('nuxtUiMongocamp.exportAll.close')"
|
|
171
|
+
color="neutral"
|
|
172
|
+
variant="ghost"
|
|
173
|
+
@click="isOpen = false"
|
|
174
|
+
/>
|
|
175
|
+
</template>
|
|
176
|
+
<template v-else>
|
|
177
|
+
<UButton
|
|
178
|
+
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
179
|
+
color="neutral"
|
|
180
|
+
variant="ghost"
|
|
181
|
+
@click="isOpen = false"
|
|
182
|
+
/>
|
|
183
|
+
<UButton
|
|
184
|
+
:label="t('nuxtUiMongocamp.exportAll.start')"
|
|
185
|
+
icon="i-lucide-download"
|
|
186
|
+
@click="start"
|
|
187
|
+
/>
|
|
188
|
+
</template>
|
|
189
|
+
</template>
|
|
190
|
+
</UModal>
|
|
191
|
+
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
collection: string;
|
|
3
|
+
filter?: string;
|
|
4
|
+
sort?: string[];
|
|
5
|
+
projection?: string[];
|
|
6
|
+
total?: number;
|
|
7
|
+
};
|
|
8
|
+
type __VLS_ModelProps = {
|
|
9
|
+
'open'?: boolean;
|
|
10
|
+
};
|
|
11
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
"update:open": (value: boolean) => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
15
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
16
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const _default: typeof __VLS_export;
|
|
18
|
+
export default _default;
|