@sfxcode/nuxt-ui-mongocamp 1.5.7 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/module.d.mts +17 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +4 -0
- package/dist/runtime/components/MongocampAccount.vue +12 -14
- package/dist/runtime/components/MongocampAggregationBuilder.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampAggregationBuilder.vue +32 -45
- package/dist/runtime/components/MongocampAggregationBuilder.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampAggregationChart.vue +7 -5
- package/dist/runtime/components/MongocampAggregationStagePreview.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampAggregationStagePreview.vue +5 -3
- package/dist/runtime/components/MongocampAggregationStagePreview.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampBucketFiles.vue +29 -40
- package/dist/runtime/components/MongocampBulkDelete.vue +8 -9
- package/dist/runtime/components/MongocampBulkEdit.vue +5 -4
- package/dist/runtime/components/MongocampChart.vue +1 -1
- package/dist/runtime/components/MongocampCollectionCharts.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampCollectionCharts.vue +10 -7
- package/dist/runtime/components/MongocampCollectionCharts.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampCollectionCopy.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampCollectionCopy.vue +11 -9
- package/dist/runtime/components/MongocampCollectionCopy.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampCollectionData.vue +97 -87
- package/dist/runtime/components/MongocampCollectionInfos.vue +34 -24
- package/dist/runtime/components/MongocampCollectionRename.vue +5 -4
- package/dist/runtime/components/MongocampCollections.vue +24 -33
- package/dist/runtime/components/MongocampCommandPalette.vue +3 -1
- package/dist/runtime/components/MongocampConfirmByName.vue +5 -4
- package/dist/runtime/components/MongocampDashboard.vue +5 -3
- package/dist/runtime/components/MongocampDatabases.vue +14 -8
- package/dist/runtime/components/MongocampDocumentCompare.vue +6 -4
- package/dist/runtime/components/MongocampDocumentView.vue +12 -9
- package/dist/runtime/components/MongocampEmptyState.vue +4 -1
- package/dist/runtime/components/MongocampErrorAlert.vue +8 -7
- package/dist/runtime/components/MongocampExportAll.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampExportAll.vue +19 -7
- package/dist/runtime/components/MongocampExportAll.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampFilePreview.vue +7 -6
- package/dist/runtime/components/MongocampFilterBuilder.vue +12 -16
- package/dist/runtime/components/MongocampGrantList.vue +6 -2
- package/dist/runtime/components/MongocampImport.vue +32 -28
- package/dist/runtime/components/MongocampIndexes.vue +21 -19
- package/dist/runtime/components/MongocampJobs.vue +20 -20
- package/dist/runtime/components/MongocampLogin.vue +2 -1
- package/dist/runtime/components/MongocampPermissionMatrix.vue +14 -11
- package/dist/runtime/components/MongocampQueryBar.vue +33 -32
- package/dist/runtime/components/MongocampRoleGrants.vue +21 -17
- package/dist/runtime/components/MongocampRoles.vue +28 -32
- package/dist/runtime/components/MongocampServerInfo.vue +17 -25
- package/dist/runtime/components/MongocampServerOverview.vue +16 -12
- package/dist/runtime/components/MongocampServerStatus.vue +9 -3
- package/dist/runtime/components/MongocampSettings.vue +15 -11
- package/dist/runtime/components/MongocampUserAccess.vue +11 -6
- package/dist/runtime/components/MongocampUsers.vue +32 -35
- package/dist/runtime/components/MongocampVersion.d.vue.ts +1 -1
- package/dist/runtime/components/MongocampVersion.vue +20 -11
- package/dist/runtime/components/MongocampVersion.vue.d.ts +1 -1
- package/dist/runtime/composables/useMongocampAdmin.js +6 -5
- package/dist/runtime/composables/useMongocampAggregation.d.ts +10 -1
- package/dist/runtime/composables/useMongocampAggregation.js +17 -5
- package/dist/runtime/composables/useMongocampBucket.d.ts +4 -0
- package/dist/runtime/composables/useMongocampBucket.js +7 -6
- package/dist/runtime/composables/useMongocampBulkByFilter.d.ts +6 -4
- package/dist/runtime/composables/useMongocampBulkByFilter.js +11 -6
- package/dist/runtime/composables/useMongocampCollectionCopy.d.ts +3 -1
- package/dist/runtime/composables/useMongocampCollectionCopy.js +4 -2
- package/dist/runtime/composables/useMongocampCollectionStats.js +2 -4
- package/dist/runtime/composables/useMongocampError.d.ts +1 -1
- package/dist/runtime/composables/useMongocampError.js +4 -1
- package/dist/runtime/composables/useMongocampExportAll.d.ts +10 -1
- package/dist/runtime/composables/useMongocampExportAll.js +4 -1
- package/dist/runtime/composables/useMongocampFetchAll.d.ts +11 -5
- package/dist/runtime/composables/useMongocampFetchAll.js +8 -8
- package/dist/runtime/composables/useMongocampJobs.js +3 -2
- package/dist/runtime/composables/useMongocampQuery.d.ts +26 -36
- package/dist/runtime/composables/useMongocampQuery.js +45 -48
- package/dist/runtime/composables/useMongocampSchema.js +2 -0
- package/dist/runtime/composables/useMongocampUi.d.ts +8 -0
- package/dist/runtime/composables/useMongocampUi.js +7 -0
- package/dist/runtime/locales/de.json +12 -4
- package/dist/runtime/locales/en.json +12 -4
- package/dist/runtime/plugin.js +8 -0
- package/dist/runtime/publicUtils.d.ts +1 -0
- package/dist/runtime/publicUtils.js +1 -0
- package/dist/runtime/server/handlers/mongocampProxy.d.ts +1 -1
- package/dist/runtime/server/handlers/mongocampProxy.js +12 -12
- package/dist/runtime/utils/aggregationPipeline.d.ts +2 -1
- package/dist/runtime/utils/aggregationPipeline.js +2 -3
- package/dist/runtime/utils/caseInsensitive.d.ts +10 -0
- package/dist/runtime/utils/caseInsensitive.js +8 -0
- package/dist/runtime/utils/collectionStats.d.ts +4 -1
- package/dist/runtime/utils/collectionStats.js +2 -2
- package/dist/runtime/utils/compactSession.d.ts +13 -0
- package/dist/runtime/utils/compactSession.js +12 -0
- package/dist/runtime/utils/configRows.d.ts +3 -3
- package/dist/runtime/utils/cursorPaging.d.ts +16 -0
- package/dist/runtime/utils/cursorPaging.js +17 -0
- package/dist/runtime/utils/documentCompare.js +2 -3
- package/dist/runtime/utils/documentPaths.d.ts +5 -5
- package/dist/runtime/utils/documentPaths.js +9 -2
- package/dist/runtime/utils/documentTree.js +3 -0
- package/dist/runtime/utils/fileFilter.d.ts +7 -0
- package/dist/runtime/utils/fileFilter.js +11 -0
- package/dist/runtime/utils/filterBuilder.d.ts +1 -1
- package/dist/runtime/utils/filterBuilder.js +5 -11
- package/dist/runtime/utils/filterSuggestions.js +1 -1
- package/dist/runtime/utils/indexForm.d.ts +7 -0
- package/dist/runtime/utils/indexForm.js +9 -0
- package/dist/runtime/utils/pagedFetch.d.ts +13 -0
- package/dist/runtime/utils/pagedFetch.js +44 -0
- package/dist/runtime/utils/queryState.d.ts +5 -0
- package/dist/runtime/utils/queryState.js +3 -2
- package/dist/runtime/utils/relaxedValues.d.ts +17 -0
- package/dist/runtime/utils/relaxedValues.js +51 -0
- package/dist/runtime/utils/requestLimits.d.ts +1 -1
- package/dist/runtime/utils/requestLimits.js +1 -1
- package/dist/runtime/utils/savedQueries.d.ts +2 -0
- package/dist/runtime/utils/savedQueries.js +1 -0
- package/dist/runtime/utils/schemaAnalysis.d.ts +4 -4
- package/dist/runtime/utils/schemaAnalysis.js +2 -2
- package/dist/runtime/utils/sensitiveFields.d.ts +20 -0
- package/dist/runtime/utils/sensitiveFields.js +63 -0
- package/dist/runtime/utils/serverError.d.ts +7 -0
- package/dist/runtime/utils/serverError.js +11 -0
- package/dist/runtime/utils/serverStatus.d.ts +2 -2
- package/dist/runtime/utils/uiTheme.d.ts +65 -0
- package/dist/runtime/utils/uiTheme.js +47 -0
- package/package.json +22 -16
- package/dist/runtime/utils/luceneExpression.d.ts +0 -15
- package/dist/runtime/utils/luceneExpression.js +0 -74
|
@@ -6,14 +6,16 @@ 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
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
11
12
|
const props = defineProps({
|
|
12
13
|
bucketName: { type: String, required: true },
|
|
13
14
|
hideRefresh: { type: Boolean, required: false }
|
|
14
15
|
});
|
|
15
16
|
const emit = defineEmits(["changed"]);
|
|
16
17
|
const { t } = useI18n();
|
|
18
|
+
const ui = useMongocampUi();
|
|
17
19
|
const { pagination, total } = useMongocampCollection();
|
|
18
20
|
const {
|
|
19
21
|
listFiles,
|
|
@@ -25,7 +27,6 @@ const {
|
|
|
25
27
|
uploading,
|
|
26
28
|
fileActionInFlight
|
|
27
29
|
} = useMongocampBucket();
|
|
28
|
-
const { like } = useMongocampQuery();
|
|
29
30
|
const fileInputRef = ref(null);
|
|
30
31
|
const filesCollection = computed(() => `${props.bucketName}.files`);
|
|
31
32
|
const fieldTypes = useMongocampFieldTypes(() => filesCollection.value);
|
|
@@ -112,8 +113,7 @@ function withTooltip(text, node) {
|
|
|
112
113
|
function sortHeader(column, label) {
|
|
113
114
|
const isSorted = column.getIsSorted();
|
|
114
115
|
return h(UButton, {
|
|
115
|
-
|
|
116
|
-
variant: "ghost",
|
|
116
|
+
...ui.value.sortHeader,
|
|
117
117
|
label,
|
|
118
118
|
icon: isSorted === "asc" ? "i-lucide-arrow-up-narrow-wide" : isSorted === "desc" ? "i-lucide-arrow-down-wide-narrow" : "i-lucide-arrow-up-down",
|
|
119
119
|
class: "-mx-2.5",
|
|
@@ -151,9 +151,7 @@ function makeMetadataCell() {
|
|
|
151
151
|
const label = keys.length === 1 ? t("nuxtUiMongocamp.bucketFiles.keyCount") : t("nuxtUiMongocamp.bucketFiles.keysCount", { count: keys.length });
|
|
152
152
|
return withTooltip(t("nuxtUiMongocamp.bucketFiles.viewMetadataTooltip"), h(UButton, {
|
|
153
153
|
"icon": "i-lucide-braces",
|
|
154
|
-
|
|
155
|
-
"variant": "ghost",
|
|
156
|
-
"size": "xs",
|
|
154
|
+
...ui.value.compactButton,
|
|
157
155
|
label,
|
|
158
156
|
// Starts with the visible text, so voice control ("click 1 key") still finds it
|
|
159
157
|
"aria-label": `${label}: ${t("nuxtUiMongocamp.bucketFiles.viewMetadataTooltip")}`,
|
|
@@ -218,38 +216,31 @@ function makeActionsColumn() {
|
|
|
218
216
|
header: "",
|
|
219
217
|
cell: ({ row }) => {
|
|
220
218
|
const file = row.original;
|
|
221
|
-
return h("div", { class: "flex gap-1 justify-end" }, [
|
|
219
|
+
return h("div", { "class": "flex gap-1 justify-end", "data-mongocamp-part": "row-actions" }, [
|
|
222
220
|
withTooltip(t("nuxtUiMongocamp.bucketFiles.previewTooltip"), h(UButton, {
|
|
223
221
|
"icon": "i-lucide-eye",
|
|
224
|
-
|
|
225
|
-
"variant": "ghost",
|
|
226
|
-
"size": "sm",
|
|
222
|
+
...ui.value.iconButton,
|
|
227
223
|
"aria-label": t("nuxtUiMongocamp.bucketFiles.previewTooltip"),
|
|
228
224
|
"onClick": () => openPreview(file)
|
|
229
225
|
})),
|
|
230
226
|
withTooltip(t("nuxtUiMongocamp.bucketFiles.downloadFileTooltip"), h(UButton, {
|
|
231
227
|
"icon": "i-lucide-download",
|
|
232
|
-
|
|
233
|
-
"variant": "ghost",
|
|
234
|
-
"size": "sm",
|
|
228
|
+
...ui.value.iconButton,
|
|
235
229
|
"aria-label": t("nuxtUiMongocamp.bucketFiles.downloadFileTooltip"),
|
|
236
230
|
"loading": downloadingFileIds.value.has(file.id),
|
|
237
231
|
"onClick": () => downloadFile(props.bucketName, file.id)
|
|
238
232
|
})),
|
|
239
233
|
withTooltip(t("nuxtUiMongocamp.bucketFiles.renameTooltip"), h(UButton, {
|
|
240
234
|
"icon": "i-lucide-pencil",
|
|
241
|
-
|
|
242
|
-
"variant": "ghost",
|
|
243
|
-
"size": "sm",
|
|
235
|
+
...ui.value.iconButton,
|
|
244
236
|
"aria-label": t("nuxtUiMongocamp.bucketFiles.renameTooltip"),
|
|
245
237
|
"loading": fileActionInFlight.value.has(file.id),
|
|
246
238
|
"onClick": () => openRename(file)
|
|
247
239
|
})),
|
|
248
240
|
withTooltip(t("nuxtUiMongocamp.bucketFiles.deleteFileTooltip"), h(UButton, {
|
|
249
241
|
"icon": "i-lucide-trash-2",
|
|
242
|
+
...ui.value.iconButton,
|
|
250
243
|
"color": "error",
|
|
251
|
-
"variant": "ghost",
|
|
252
|
-
"size": "sm",
|
|
253
244
|
"aria-label": t("nuxtUiMongocamp.bucketFiles.deleteFileTooltip"),
|
|
254
245
|
"loading": fileActionInFlight.value.has(file.id),
|
|
255
246
|
"onClick": () => confirmDeleteFile(file)
|
|
@@ -287,9 +278,8 @@ const filterText = ref("");
|
|
|
287
278
|
const sorting = ref([]);
|
|
288
279
|
const isInitializing = ref(false);
|
|
289
280
|
let filterTimer;
|
|
290
|
-
function
|
|
291
|
-
|
|
292
|
-
return trimmed ? like("filename", trimmed) : void 0;
|
|
281
|
+
function buildFileFilter(term) {
|
|
282
|
+
return filenameFilter(term);
|
|
293
283
|
}
|
|
294
284
|
function onFilterInput() {
|
|
295
285
|
clearTimeout(filterTimer);
|
|
@@ -312,7 +302,7 @@ async function fetchFiles() {
|
|
|
312
302
|
rowsPerPage: pagination.value.pageSize,
|
|
313
303
|
page: pagination.value.pageIndex,
|
|
314
304
|
sort: sorting.value.length ? sortingToMongoSort(sorting.value).join(",") : void 0,
|
|
315
|
-
filter:
|
|
305
|
+
filter: buildFileFilter(filterText.value)
|
|
316
306
|
});
|
|
317
307
|
total.value = result.total;
|
|
318
308
|
files.value = result.files;
|
|
@@ -339,7 +329,7 @@ defineExpose({ refresh: init });
|
|
|
339
329
|
|
|
340
330
|
<template>
|
|
341
331
|
<div
|
|
342
|
-
class="relative flex flex-col gap-4"
|
|
332
|
+
class="mongocamp-bucket-files relative flex flex-col gap-4"
|
|
343
333
|
@dragenter.prevent="onDragEnter"
|
|
344
334
|
@dragover.prevent
|
|
345
335
|
@dragleave.prevent="onDragLeave"
|
|
@@ -357,20 +347,21 @@ defineExpose({ refresh: init });
|
|
|
357
347
|
v-model="filterText"
|
|
358
348
|
icon="i-lucide-search"
|
|
359
349
|
:placeholder="t('nuxtUiMongocamp.bucketFiles.filterPlaceholder')"
|
|
360
|
-
size="
|
|
350
|
+
:size="ui.controlSize"
|
|
361
351
|
class="flex-1 max-w-xs"
|
|
362
352
|
@input="onFilterInput"
|
|
363
353
|
/>
|
|
364
|
-
<div
|
|
354
|
+
<div
|
|
355
|
+
data-mongocamp-part="toolbar"
|
|
356
|
+
class="flex items-center gap-2"
|
|
357
|
+
>
|
|
365
358
|
<span class="text-sm text-muted shrink-0">
|
|
366
359
|
{{ t("nuxtUiMongocamp.bucketFiles.filesCount", { count: total }) }}
|
|
367
360
|
</span>
|
|
368
361
|
<UTooltip :text="t('nuxtUiMongocamp.bucketFiles.uploadFileTooltip')">
|
|
369
362
|
<UButton
|
|
370
363
|
icon="i-lucide-upload"
|
|
371
|
-
|
|
372
|
-
variant="ghost"
|
|
373
|
-
size="sm"
|
|
364
|
+
v-bind="{ ...ui.iconButton, color: 'primary' }"
|
|
374
365
|
:loading="uploading"
|
|
375
366
|
:aria-label="t('nuxtUiMongocamp.bucketFiles.uploadFileTooltip')"
|
|
376
367
|
@click="openFilePicker"
|
|
@@ -389,8 +380,7 @@ defineExpose({ refresh: init });
|
|
|
389
380
|
>
|
|
390
381
|
<UButton
|
|
391
382
|
icon="i-lucide-refresh-cw"
|
|
392
|
-
|
|
393
|
-
variant="ghost"
|
|
383
|
+
v-bind="ui.toolbarButton"
|
|
394
384
|
:loading="loading"
|
|
395
385
|
:aria-label="t('nuxtUiMongocamp.bucketFiles.reloadTooltip')"
|
|
396
386
|
@click="init"
|
|
@@ -408,7 +398,7 @@ defineExpose({ refresh: init });
|
|
|
408
398
|
<UAlert
|
|
409
399
|
v-if="uploadProgress"
|
|
410
400
|
color="neutral"
|
|
411
|
-
variant="
|
|
401
|
+
:variant="ui.alert.variant"
|
|
412
402
|
icon="i-lucide-upload"
|
|
413
403
|
:title="t('nuxtUiMongocamp.bucketFiles.uploadProgress', { done: uploadProgress.done, total: uploadProgress.total })"
|
|
414
404
|
:description="uploadProgress.current"
|
|
@@ -416,7 +406,7 @@ defineExpose({ refresh: init });
|
|
|
416
406
|
<UAlert
|
|
417
407
|
v-else-if="uploadResult"
|
|
418
408
|
:color="uploadResult.failed.length ? 'warning' : 'success'"
|
|
419
|
-
variant="
|
|
409
|
+
:variant="ui.alert.variant"
|
|
420
410
|
:icon="uploadResult.failed.length ? 'i-lucide-triangle-alert' : 'i-lucide-circle-check'"
|
|
421
411
|
:title="t('nuxtUiMongocamp.bucketFiles.uploadSummary', { uploaded: uploadResult.uploaded, failed: uploadResult.failed.length })"
|
|
422
412
|
close
|
|
@@ -443,6 +433,7 @@ defineExpose({ refresh: init });
|
|
|
443
433
|
|
|
444
434
|
<UTable
|
|
445
435
|
v-model:sorting="sorting"
|
|
436
|
+
data-mongocamp-part="table"
|
|
446
437
|
:sorting-options="{ manualSorting: true }"
|
|
447
438
|
:data="files"
|
|
448
439
|
:columns="columns"
|
|
@@ -465,7 +456,7 @@ defineExpose({ refresh: init });
|
|
|
465
456
|
<UModal
|
|
466
457
|
v-model:open="isRenameModalOpen"
|
|
467
458
|
:title="t('nuxtUiMongocamp.bucketFiles.renameTitle')"
|
|
468
|
-
:ui="{ footer:
|
|
459
|
+
:ui="{ footer: ui.modal.footer }"
|
|
469
460
|
>
|
|
470
461
|
<template #body>
|
|
471
462
|
<div class="flex flex-col gap-4">
|
|
@@ -492,8 +483,7 @@ defineExpose({ refresh: init });
|
|
|
492
483
|
<template #footer>
|
|
493
484
|
<UButton
|
|
494
485
|
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
495
|
-
|
|
496
|
-
variant="ghost"
|
|
486
|
+
v-bind="ui.dialogCancel"
|
|
497
487
|
@click="isRenameModalOpen = false"
|
|
498
488
|
/>
|
|
499
489
|
<UButton
|
|
@@ -551,7 +541,7 @@ defineExpose({ refresh: init });
|
|
|
551
541
|
<UModal
|
|
552
542
|
v-model:open="isDeleteModalOpen"
|
|
553
543
|
:title="t('nuxtUiMongocamp.bucketFiles.deleteFileTitle')"
|
|
554
|
-
:ui="{ footer:
|
|
544
|
+
:ui="{ footer: ui.modal.footer }"
|
|
555
545
|
>
|
|
556
546
|
<template #body>
|
|
557
547
|
<p>{{ t("nuxtUiMongocamp.bucketFiles.confirmDeleteFile") }}</p>
|
|
@@ -559,13 +549,12 @@ defineExpose({ refresh: init });
|
|
|
559
549
|
<template #footer>
|
|
560
550
|
<UButton
|
|
561
551
|
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
562
|
-
|
|
563
|
-
variant="ghost"
|
|
552
|
+
v-bind="ui.dialogCancel"
|
|
564
553
|
@click="isDeleteModalOpen = false"
|
|
565
554
|
/>
|
|
566
555
|
<UButton
|
|
567
556
|
:label="t('nuxtUiMongocamp.common.delete')"
|
|
568
|
-
|
|
557
|
+
v-bind="ui.dangerAction"
|
|
569
558
|
icon="i-lucide-trash-2"
|
|
570
559
|
@click="handleDeleteFile"
|
|
571
560
|
/>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, ref, watch } from "vue";
|
|
3
3
|
import { useI18n } from "#imports";
|
|
4
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
4
5
|
const PREVIEW_LIMIT = 5;
|
|
5
6
|
const props = defineProps({
|
|
6
7
|
selected: { type: Array, required: true },
|
|
@@ -16,6 +17,7 @@ const props = defineProps({
|
|
|
16
17
|
});
|
|
17
18
|
const emit = defineEmits(["confirm", "clear", "open", "selectAll"]);
|
|
18
19
|
const { t } = useI18n();
|
|
20
|
+
const ui = useMongocampUi();
|
|
19
21
|
const isOpen = ref(false);
|
|
20
22
|
const typed = ref("");
|
|
21
23
|
const confirmed = computed(() => !props.confirmName || typed.value.trim() === props.confirmName);
|
|
@@ -38,7 +40,7 @@ watch(() => props.deleting, (now, before) => {
|
|
|
38
40
|
<template>
|
|
39
41
|
<div
|
|
40
42
|
v-if="count > 0 || counting || note"
|
|
41
|
-
class="flex flex-col gap-1"
|
|
43
|
+
class="mongocamp-bulk-delete flex flex-col gap-1"
|
|
42
44
|
>
|
|
43
45
|
<div
|
|
44
46
|
v-if="count > 0"
|
|
@@ -57,9 +59,7 @@ watch(() => props.deleting, (now, before) => {
|
|
|
57
59
|
/>
|
|
58
60
|
<slot name="actions" />
|
|
59
61
|
<UButton
|
|
60
|
-
|
|
61
|
-
variant="ghost"
|
|
62
|
-
size="sm"
|
|
62
|
+
v-bind="ui.iconButton"
|
|
63
63
|
:label="t('nuxtUiMongocamp.bulk.clearSelection')"
|
|
64
64
|
@click="emit('clear')"
|
|
65
65
|
/>
|
|
@@ -104,7 +104,7 @@ watch(() => props.deleting, (now, before) => {
|
|
|
104
104
|
<UModal
|
|
105
105
|
v-model:open="isOpen"
|
|
106
106
|
:title="t('nuxtUiMongocamp.bulk.deleteTitle', { count }, count)"
|
|
107
|
-
:ui="{
|
|
107
|
+
:ui="{ content: 'mongocamp-bulk-delete', footer: ui.modal.footer }"
|
|
108
108
|
>
|
|
109
109
|
<template #body>
|
|
110
110
|
<p>{{ t("nuxtUiMongocamp.bulk.deleteDescription") }}</p>
|
|
@@ -141,7 +141,7 @@ watch(() => props.deleting, (now, before) => {
|
|
|
141
141
|
v-if="error"
|
|
142
142
|
class="mt-3"
|
|
143
143
|
color="error"
|
|
144
|
-
variant="
|
|
144
|
+
:variant="ui.alert.variant"
|
|
145
145
|
icon="i-lucide-circle-alert"
|
|
146
146
|
:description="error"
|
|
147
147
|
/>
|
|
@@ -149,14 +149,13 @@ watch(() => props.deleting, (now, before) => {
|
|
|
149
149
|
<template #footer>
|
|
150
150
|
<UButton
|
|
151
151
|
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
152
|
-
|
|
153
|
-
variant="ghost"
|
|
152
|
+
v-bind="ui.dialogCancel"
|
|
154
153
|
:disabled="deleting"
|
|
155
154
|
@click="isOpen = false"
|
|
156
155
|
/>
|
|
157
156
|
<UButton
|
|
158
157
|
:label="t('nuxtUiMongocamp.bulk.confirmDelete', { count })"
|
|
159
|
-
|
|
158
|
+
v-bind="ui.dangerAction"
|
|
160
159
|
:loading="deleting"
|
|
161
160
|
:disabled="!confirmed"
|
|
162
161
|
@click="emit('confirm')"
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { computed, ref, watch } from "vue";
|
|
3
3
|
import { useI18n } from "#imports";
|
|
4
4
|
import { coerceRow } from "../utils/importRows";
|
|
5
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
5
6
|
const props = defineProps({
|
|
6
7
|
selected: { type: Number, required: true },
|
|
7
8
|
fields: { type: Array, required: true },
|
|
@@ -11,6 +12,7 @@ const props = defineProps({
|
|
|
11
12
|
const emit = defineEmits(["apply"]);
|
|
12
13
|
const isOpen = defineModel("open", { type: Boolean, ...{ default: false } });
|
|
13
14
|
const { t } = useI18n();
|
|
15
|
+
const ui = useMongocampUi();
|
|
14
16
|
const field = ref("");
|
|
15
17
|
const type = ref("string");
|
|
16
18
|
const text = ref("");
|
|
@@ -92,7 +94,7 @@ watch(() => props.saving, (now, before) => {
|
|
|
92
94
|
<UModal
|
|
93
95
|
v-model:open="isOpen"
|
|
94
96
|
:title="t('nuxtUiMongocamp.bulk.editTitle', { count: selected }, selected)"
|
|
95
|
-
:ui="{
|
|
97
|
+
:ui="{ content: 'mongocamp-bulk-edit', footer: ui.modal.footer }"
|
|
96
98
|
>
|
|
97
99
|
<template #body>
|
|
98
100
|
<div class="flex flex-col gap-3">
|
|
@@ -151,7 +153,7 @@ watch(() => props.saving, (now, before) => {
|
|
|
151
153
|
<UAlert
|
|
152
154
|
v-if="error"
|
|
153
155
|
color="error"
|
|
154
|
-
variant="
|
|
156
|
+
:variant="ui.alert.variant"
|
|
155
157
|
icon="i-lucide-circle-alert"
|
|
156
158
|
:description="error"
|
|
157
159
|
/>
|
|
@@ -160,8 +162,7 @@ watch(() => props.saving, (now, before) => {
|
|
|
160
162
|
<template #footer>
|
|
161
163
|
<UButton
|
|
162
164
|
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
163
|
-
|
|
164
|
-
variant="ghost"
|
|
165
|
+
v-bind="ui.dialogCancel"
|
|
165
166
|
:disabled="saving"
|
|
166
167
|
@click="isOpen = false"
|
|
167
168
|
/>
|
|
@@ -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,17 +2,21 @@
|
|
|
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";
|
|
8
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
7
9
|
const props = defineProps({
|
|
8
10
|
collectionName: { type: String, required: true },
|
|
9
11
|
field: { type: String, required: true },
|
|
10
12
|
kind: { type: String, required: false, default: void 0 },
|
|
11
13
|
top: { type: Number, required: false, default: DEFAULT_TOP },
|
|
12
14
|
buckets: { type: Number, required: false, default: DEFAULT_BUCKETS },
|
|
13
|
-
filter: { type: String, required: false, default: void 0 }
|
|
15
|
+
filter: { type: String, required: false, default: void 0 },
|
|
16
|
+
matchCase: { type: Boolean, required: false }
|
|
14
17
|
});
|
|
15
18
|
const { t } = useI18n();
|
|
19
|
+
const ui = useMongocampUi();
|
|
16
20
|
const { runAggregation, listFieldDetails, describeAggregationError } = useMongocampAggregation();
|
|
17
21
|
const status = ref("loading");
|
|
18
22
|
const current = ref(void 0);
|
|
@@ -56,7 +60,7 @@ async function load() {
|
|
|
56
60
|
status.value = "invalid";
|
|
57
61
|
return;
|
|
58
62
|
}
|
|
59
|
-
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) });
|
|
60
64
|
if (mine !== run) return;
|
|
61
65
|
points.value = rowsToPoints(chartKind, result.rows, t("nuxtUiMongocamp.charts.noneLabel"));
|
|
62
66
|
total.value = result.total;
|
|
@@ -97,7 +101,7 @@ const unsupportedType = computed(() => t(`nuxtUiMongocamp.charts.type${(detected
|
|
|
97
101
|
|
|
98
102
|
<template>
|
|
99
103
|
<div
|
|
100
|
-
class="flex flex-col gap-3"
|
|
104
|
+
class="mongocamp-collection-charts flex flex-col gap-3"
|
|
101
105
|
data-test="collection-chart"
|
|
102
106
|
>
|
|
103
107
|
<div class="flex flex-wrap items-center justify-between gap-2">
|
|
@@ -112,7 +116,7 @@ const unsupportedType = computed(() => t(`nuxtUiMongocamp.charts.type${(detected
|
|
|
112
116
|
<USelect
|
|
113
117
|
v-model="unit"
|
|
114
118
|
:items="unitItems"
|
|
115
|
-
size="
|
|
119
|
+
:size="ui.controlSize"
|
|
116
120
|
class="w-28"
|
|
117
121
|
:aria-label="t('nuxtUiMongocamp.charts.unitLabel')"
|
|
118
122
|
/>
|
|
@@ -131,7 +135,7 @@ const unsupportedType = computed(() => t(`nuxtUiMongocamp.charts.type${(detected
|
|
|
131
135
|
<UAlert
|
|
132
136
|
v-else-if="status === 'error' && error"
|
|
133
137
|
color="error"
|
|
134
|
-
variant="
|
|
138
|
+
:variant="ui.alert.variant"
|
|
135
139
|
icon="i-lucide-circle-alert"
|
|
136
140
|
:title="t('nuxtUiMongocamp.charts.failedTitle')"
|
|
137
141
|
:description="error.message"
|
|
@@ -140,8 +144,7 @@ const unsupportedType = computed(() => t(`nuxtUiMongocamp.charts.type${(detected
|
|
|
140
144
|
<template #actions>
|
|
141
145
|
<UButton
|
|
142
146
|
:label="t('nuxtUiMongocamp.charts.retry')"
|
|
143
|
-
|
|
144
|
-
variant="subtle"
|
|
147
|
+
v-bind="{ ...ui.alertAction, color: 'error' }"
|
|
145
148
|
icon="i-lucide-refresh-cw"
|
|
146
149
|
@click="load"
|
|
147
150
|
/>
|
|
@@ -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,14 +2,18 @@
|
|
|
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";
|
|
7
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
6
8
|
const props = defineProps({
|
|
7
9
|
source: { type: String, required: true },
|
|
8
|
-
filter: { type: String, required: false }
|
|
10
|
+
filter: { type: String, required: false },
|
|
11
|
+
matchCase: { type: Boolean, required: false }
|
|
9
12
|
});
|
|
10
13
|
const emit = defineEmits(["done"]);
|
|
11
14
|
const isOpen = defineModel("open", { type: Boolean, ...{ default: false } });
|
|
12
15
|
const { t } = useI18n();
|
|
16
|
+
const ui = useMongocampUi();
|
|
13
17
|
const { describeServerError } = useMongocampError();
|
|
14
18
|
const { copyCollection, backupCollection, listCollectionNames, countDocuments } = useMongocampCollectionCopy();
|
|
15
19
|
const step = ref("form");
|
|
@@ -30,7 +34,7 @@ watch(isOpen, async (open) => {
|
|
|
30
34
|
errorText.value = "";
|
|
31
35
|
sourceCount.value = void 0;
|
|
32
36
|
countFailed.value = false;
|
|
33
|
-
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) })]);
|
|
34
38
|
if (mine !== opened) return;
|
|
35
39
|
existing.value = names.status === "fulfilled" ? names.value : [];
|
|
36
40
|
if (count.status === "fulfilled") sourceCount.value = count.value;
|
|
@@ -53,7 +57,7 @@ async function start(quick = false) {
|
|
|
53
57
|
errorText.value = "";
|
|
54
58
|
step.value = "running";
|
|
55
59
|
try {
|
|
56
|
-
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 };
|
|
57
61
|
const outcome = quick ? await backupCollection({ ...common, onTarget: (name) => {
|
|
58
62
|
target.value = name;
|
|
59
63
|
} }) : await copyCollection({ ...common, target: targetName.value });
|
|
@@ -78,7 +82,7 @@ async function start(quick = false) {
|
|
|
78
82
|
v-model:open="isOpen"
|
|
79
83
|
:title="filter ? t('nuxtUiMongocamp.collectionCopy.titleFiltered', { source }) : t('nuxtUiMongocamp.collectionCopy.title', { source })"
|
|
80
84
|
:dismissible="step !== 'running'"
|
|
81
|
-
:ui="{
|
|
85
|
+
:ui="{ content: 'mongocamp-collection-copy', footer: ui.modal.footer }"
|
|
82
86
|
>
|
|
83
87
|
<template #body>
|
|
84
88
|
<div
|
|
@@ -153,7 +157,7 @@ async function start(quick = false) {
|
|
|
153
157
|
>
|
|
154
158
|
<UAlert
|
|
155
159
|
color="success"
|
|
156
|
-
variant="
|
|
160
|
+
:variant="ui.alert.variant"
|
|
157
161
|
icon="i-lucide-circle-check"
|
|
158
162
|
:title="t('nuxtUiMongocamp.collectionCopy.doneTitle', { count: result?.count ?? 0, target: result?.target ?? targetName }, result?.count ?? 0)"
|
|
159
163
|
/>
|
|
@@ -172,16 +176,14 @@ async function start(quick = false) {
|
|
|
172
176
|
<template v-else-if="step === 'done'">
|
|
173
177
|
<UButton
|
|
174
178
|
:label="t('nuxtUiMongocamp.collectionCopy.close')"
|
|
175
|
-
|
|
176
|
-
variant="ghost"
|
|
179
|
+
v-bind="ui.dialogCancel"
|
|
177
180
|
@click="isOpen = false"
|
|
178
181
|
/>
|
|
179
182
|
</template>
|
|
180
183
|
<template v-else>
|
|
181
184
|
<UButton
|
|
182
185
|
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
183
|
-
|
|
184
|
-
variant="ghost"
|
|
186
|
+
v-bind="ui.dialogCancel"
|
|
185
187
|
@click="isOpen = false"
|
|
186
188
|
/>
|
|
187
189
|
<UButton
|