@sfxcode/nuxt-ui-mongocamp 1.5.6 → 1.5.8
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/dist/module.d.mts +26 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +5 -0
- package/dist/runtime/components/MongocampAccount.vue +12 -14
- package/dist/runtime/components/MongocampAggregationBuilder.vue +27 -43
- package/dist/runtime/components/MongocampAggregationChart.vue +7 -5
- package/dist/runtime/components/MongocampAggregationStagePreview.vue +1 -1
- package/dist/runtime/components/MongocampBucketFiles.vue +25 -34
- package/dist/runtime/components/MongocampBulkDelete.d.vue.ts +2 -2
- package/dist/runtime/components/MongocampBulkDelete.vue +8 -9
- package/dist/runtime/components/MongocampBulkDelete.vue.d.ts +2 -2
- package/dist/runtime/components/MongocampBulkEdit.vue +5 -4
- package/dist/runtime/components/MongocampChart.vue +1 -1
- package/dist/runtime/components/MongocampCollectionCharts.vue +6 -5
- package/dist/runtime/components/MongocampCollectionCopy.d.vue.ts +2 -2
- package/dist/runtime/components/MongocampCollectionCopy.vue +6 -6
- package/dist/runtime/components/MongocampCollectionCopy.vue.d.ts +2 -2
- package/dist/runtime/components/MongocampCollectionData.vue +37 -62
- package/dist/runtime/components/MongocampCollectionInfos.vue +18 -23
- package/dist/runtime/components/MongocampCollectionRename.d.vue.ts +2 -2
- package/dist/runtime/components/MongocampCollectionRename.vue +5 -4
- package/dist/runtime/components/MongocampCollectionRename.vue.d.ts +2 -2
- package/dist/runtime/components/MongocampCollections.vue +24 -33
- package/dist/runtime/components/MongocampCommandPalette.d.vue.ts +2 -2
- package/dist/runtime/components/MongocampCommandPalette.vue +3 -1
- package/dist/runtime/components/MongocampCommandPalette.vue.d.ts +2 -2
- 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 +6 -8
- package/dist/runtime/components/MongocampEmptyState.vue +4 -1
- package/dist/runtime/components/MongocampErrorAlert.vue +8 -7
- package/dist/runtime/components/MongocampExportAll.vue +7 -7
- 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 +29 -28
- package/dist/runtime/components/MongocampIndexes.vue +15 -17
- 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 +18 -32
- package/dist/runtime/components/MongocampRoleGrants.vue +21 -17
- package/dist/runtime/components/MongocampRoles.vue +28 -32
- package/dist/runtime/components/MongocampServerInfo.vue +17 -12
- package/dist/runtime/components/MongocampServerOverview.vue +16 -12
- package/dist/runtime/components/MongocampServerStatus.vue +2 -1
- 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.vue +6 -4
- package/dist/runtime/composables/useMongocampAdmin.d.ts +4 -4
- package/dist/runtime/composables/useMongocampClientApi.d.ts +13 -1
- package/dist/runtime/composables/useMongocampConnection.d.ts +25 -0
- package/dist/runtime/composables/useMongocampConnection.js +33 -0
- package/dist/runtime/composables/useMongocampRoles.d.ts +5 -5
- package/dist/runtime/composables/useMongocampUi.d.ts +8 -0
- package/dist/runtime/composables/useMongocampUi.js +7 -0
- package/dist/runtime/plugin.d.ts +5 -1
- package/dist/runtime/plugin.js +62 -2
- package/dist/runtime/publicUtils.d.ts +1 -0
- package/dist/runtime/publicUtils.js +1 -0
- package/dist/runtime/utils/compactSession.d.ts +13 -0
- package/dist/runtime/utils/compactSession.js +12 -0
- package/dist/runtime/utils/connection.d.ts +23 -0
- package/dist/runtime/utils/connection.js +31 -0
- package/dist/runtime/utils/sessionGuard.d.ts +1 -0
- package/dist/runtime/utils/sessionGuard.js +8 -0
- package/dist/runtime/utils/uiTheme.d.ts +65 -0
- package/dist/runtime/utils/uiTheme.js +47 -0
- package/package.json +13 -13
|
@@ -28,6 +28,7 @@ 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 { useMongocampUi } from "../composables/useMongocampUi";
|
|
31
32
|
const props = defineProps({
|
|
32
33
|
collectionName: { type: String, required: true },
|
|
33
34
|
infoPath: { type: String, required: false },
|
|
@@ -42,6 +43,7 @@ const props = defineProps({
|
|
|
42
43
|
});
|
|
43
44
|
const emit = defineEmits(["changed"]);
|
|
44
45
|
const { t } = useI18n();
|
|
46
|
+
const ui = useMongocampUi();
|
|
45
47
|
const paths = useMongocampPaths();
|
|
46
48
|
const { documentApi } = useMongocampClientApi();
|
|
47
49
|
const { pagination, total } = useMongocampCollection();
|
|
@@ -230,9 +232,7 @@ function makeActionsColumn() {
|
|
|
230
232
|
if (fileId) {
|
|
231
233
|
buttons.push(withTooltip(t("nuxtUiMongocamp.collectionData.downloadFileTooltip"), h(UButton, {
|
|
232
234
|
"icon": "i-lucide-download",
|
|
233
|
-
|
|
234
|
-
"variant": "ghost",
|
|
235
|
-
"size": "sm",
|
|
235
|
+
...ui.value.iconButton,
|
|
236
236
|
"aria-label": t("nuxtUiMongocamp.collectionData.downloadFileTooltip"),
|
|
237
237
|
"loading": downloadingFileIds.value.has(fileId),
|
|
238
238
|
"onClick": () => downloadFile(props.collectionName, fileId)
|
|
@@ -241,40 +241,34 @@ function makeActionsColumn() {
|
|
|
241
241
|
}
|
|
242
242
|
buttons.push(withTooltip(t("nuxtUiMongocamp.collectionData.viewDocumentTooltip"), h(UButton, {
|
|
243
243
|
"icon": "i-lucide-eye",
|
|
244
|
-
|
|
245
|
-
"variant": "ghost",
|
|
246
|
-
"size": "sm",
|
|
244
|
+
...ui.value.iconButton,
|
|
247
245
|
"aria-label": t("nuxtUiMongocamp.collectionData.viewDocumentTooltip"),
|
|
248
246
|
"onClick": () => openView(row.original)
|
|
249
247
|
})));
|
|
250
|
-
if (!writable.value) return h("div", { class: "flex gap-1 justify-end" }, buttons);
|
|
248
|
+
if (!writable.value) return h("div", { "class": "flex gap-1 justify-end", "data-mongocamp-part": "row-actions" }, buttons);
|
|
251
249
|
buttons.push(
|
|
252
250
|
withTooltip(t("nuxtUiMongocamp.collectionData.editDocumentTooltip"), h(UButton, {
|
|
253
251
|
"icon": "i-lucide-pencil",
|
|
254
|
-
|
|
255
|
-
"variant": "ghost",
|
|
256
|
-
"size": "sm",
|
|
252
|
+
...ui.value.iconButton,
|
|
257
253
|
"aria-label": t("nuxtUiMongocamp.collectionData.editDocumentTooltip"),
|
|
258
254
|
"onClick": () => openEdit(row.original)
|
|
259
255
|
})),
|
|
260
256
|
withTooltip(t("nuxtUiMongocamp.collectionData.deleteDocumentTooltip"), h(UButton, {
|
|
261
257
|
"icon": "i-lucide-trash-2",
|
|
258
|
+
...ui.value.iconButton,
|
|
262
259
|
"color": "error",
|
|
263
|
-
"variant": "ghost",
|
|
264
|
-
"size": "sm",
|
|
265
260
|
"aria-label": t("nuxtUiMongocamp.collectionData.deleteDocumentTooltip"),
|
|
266
261
|
"onClick": () => confirmDelete(row.original)
|
|
267
262
|
}))
|
|
268
263
|
);
|
|
269
|
-
return h("div", { class: "flex gap-1 justify-end" }, buttons);
|
|
264
|
+
return h("div", { "class": "flex gap-1 justify-end", "data-mongocamp-part": "row-actions" }, buttons);
|
|
270
265
|
}
|
|
271
266
|
};
|
|
272
267
|
}
|
|
273
268
|
function sortHeader(column, label) {
|
|
274
269
|
const isSorted = column.getIsSorted();
|
|
275
270
|
return h(UButton, {
|
|
276
|
-
|
|
277
|
-
variant: "ghost",
|
|
271
|
+
...ui.value.sortHeader,
|
|
278
272
|
label,
|
|
279
273
|
icon: isSorted === "asc" ? "i-lucide-arrow-up-narrow-wide" : isSorted === "desc" ? "i-lucide-arrow-down-wide-narrow" : "i-lucide-arrow-up-down",
|
|
280
274
|
class: "-mx-2.5",
|
|
@@ -321,9 +315,7 @@ function columnHeader(column, key) {
|
|
|
321
315
|
}, {
|
|
322
316
|
default: () => h(UButton, {
|
|
323
317
|
"icon": "i-lucide-list-tree",
|
|
324
|
-
|
|
325
|
-
"variant": "ghost",
|
|
326
|
-
"size": "xs",
|
|
318
|
+
...ui.value.compactButton,
|
|
327
319
|
"aria-label": label,
|
|
328
320
|
"loading": indexing.value.has(key)
|
|
329
321
|
})
|
|
@@ -494,9 +486,7 @@ function makeCell(key, type) {
|
|
|
494
486
|
const viewLabel = Array.isArray(raw) ? t("nuxtUiMongocamp.collectionData.viewArray") : t("nuxtUiMongocamp.collectionData.viewObject");
|
|
495
487
|
return withTooltip(viewLabel, h(UButton, {
|
|
496
488
|
"icon": Array.isArray(raw) ? "i-lucide-list" : "i-lucide-braces",
|
|
497
|
-
|
|
498
|
-
"variant": "ghost",
|
|
499
|
-
"size": "xs",
|
|
489
|
+
...ui.value.compactButton,
|
|
500
490
|
"aria-label": viewLabel,
|
|
501
491
|
"onClick": () => openDetail(raw)
|
|
502
492
|
}));
|
|
@@ -835,18 +825,21 @@ defineExpose({ refresh: init });
|
|
|
835
825
|
</script>
|
|
836
826
|
|
|
837
827
|
<template>
|
|
838
|
-
<div class="flex flex-col gap-4">
|
|
828
|
+
<div class="mongocamp-collection-data flex flex-col gap-4">
|
|
839
829
|
<div class="flex flex-wrap items-center justify-between gap-4">
|
|
840
830
|
<UInput
|
|
841
831
|
v-model="filterText"
|
|
842
832
|
icon="i-lucide-search"
|
|
843
833
|
:placeholder="t('nuxtUiMongocamp.collectionData.filterPlaceholder')"
|
|
844
|
-
size="
|
|
834
|
+
:size="ui.controlSize"
|
|
845
835
|
class="flex-1 max-w-xs"
|
|
846
836
|
:disabled="filterableColumns.length === 0"
|
|
847
837
|
@input="onFilterInput"
|
|
848
838
|
/>
|
|
849
|
-
<div
|
|
839
|
+
<div
|
|
840
|
+
data-mongocamp-part="toolbar"
|
|
841
|
+
class="flex flex-wrap items-center gap-2"
|
|
842
|
+
>
|
|
850
843
|
<span class="text-sm text-muted shrink-0">
|
|
851
844
|
{{ t("nuxtUiMongocamp.collectionData.documentsCount", { count: total }) }}
|
|
852
845
|
</span>
|
|
@@ -856,9 +849,7 @@ defineExpose({ refresh: init });
|
|
|
856
849
|
>
|
|
857
850
|
<UButton
|
|
858
851
|
icon="i-lucide-upload"
|
|
859
|
-
|
|
860
|
-
variant="ghost"
|
|
861
|
-
size="sm"
|
|
852
|
+
v-bind="{ ...ui.iconButton, color: 'primary' }"
|
|
862
853
|
:loading="uploading"
|
|
863
854
|
:aria-label="t('nuxtUiMongocamp.collectionData.uploadFileTooltip')"
|
|
864
855
|
@click="openFilePicker"
|
|
@@ -870,9 +861,7 @@ defineExpose({ refresh: init });
|
|
|
870
861
|
>
|
|
871
862
|
<UButton
|
|
872
863
|
icon="i-lucide-plus"
|
|
873
|
-
|
|
874
|
-
variant="ghost"
|
|
875
|
-
size="sm"
|
|
864
|
+
v-bind="{ ...ui.iconButton, color: 'primary' }"
|
|
876
865
|
:aria-label="t('nuxtUiMongocamp.collectionData.insertDocumentTooltip')"
|
|
877
866
|
@click="openInsert"
|
|
878
867
|
/>
|
|
@@ -894,8 +883,7 @@ defineExpose({ refresh: init });
|
|
|
894
883
|
>
|
|
895
884
|
<UButton
|
|
896
885
|
icon="i-lucide-refresh-cw"
|
|
897
|
-
|
|
898
|
-
variant="ghost"
|
|
886
|
+
v-bind="ui.toolbarButton"
|
|
899
887
|
:loading="loading"
|
|
900
888
|
:aria-label="t('nuxtUiMongocamp.collectionData.reloadTooltip')"
|
|
901
889
|
@click="init"
|
|
@@ -922,9 +910,7 @@ defineExpose({ refresh: init });
|
|
|
922
910
|
<UDropdownMenu :items="columnMenuItems">
|
|
923
911
|
<UButton
|
|
924
912
|
icon="i-lucide-columns-3"
|
|
925
|
-
|
|
926
|
-
variant="ghost"
|
|
927
|
-
size="sm"
|
|
913
|
+
v-bind="ui.iconButton"
|
|
928
914
|
:disabled="dataColumnKeys.length === 0"
|
|
929
915
|
:aria-label="t('nuxtUiMongocamp.collectionData.columnsTooltip')"
|
|
930
916
|
/>
|
|
@@ -932,9 +918,7 @@ defineExpose({ refresh: init });
|
|
|
932
918
|
<UButton
|
|
933
919
|
v-if="aggregatePath && !isBucketCollection(collectionName)"
|
|
934
920
|
icon="i-lucide-sigma"
|
|
935
|
-
|
|
936
|
-
variant="ghost"
|
|
937
|
-
size="sm"
|
|
921
|
+
v-bind="ui.iconButton"
|
|
938
922
|
:disabled="chartFilterTooLong"
|
|
939
923
|
:to="{ path: `${aggregatePath}/${collectionName}/aggregate`, query: chartFilter ? { filter: chartFilter } : {} }"
|
|
940
924
|
:aria-label="t('nuxtUiMongocamp.collectionData.aggregateTooltip')"
|
|
@@ -943,9 +927,7 @@ defineExpose({ refresh: init });
|
|
|
943
927
|
<UButton
|
|
944
928
|
v-if="!isBucketCollection(collectionName)"
|
|
945
929
|
icon="i-lucide-chart-column"
|
|
946
|
-
|
|
947
|
-
variant="ghost"
|
|
948
|
-
size="sm"
|
|
930
|
+
v-bind="ui.iconButton"
|
|
949
931
|
:disabled="chartFields.length === 0 || documents.length === 0"
|
|
950
932
|
:aria-label="t('nuxtUiMongocamp.collectionData.chartTooltip')"
|
|
951
933
|
@click="openChart"
|
|
@@ -953,9 +935,7 @@ defineExpose({ refresh: init });
|
|
|
953
935
|
<UDropdownMenu :items="exportMenuItems">
|
|
954
936
|
<UButton
|
|
955
937
|
icon="i-lucide-download"
|
|
956
|
-
|
|
957
|
-
variant="ghost"
|
|
958
|
-
size="sm"
|
|
938
|
+
v-bind="ui.iconButton"
|
|
959
939
|
:disabled="documents.length === 0"
|
|
960
940
|
:aria-label="t('nuxtUiMongocamp.collectionData.exportTooltip')"
|
|
961
941
|
/>
|
|
@@ -963,7 +943,7 @@ defineExpose({ refresh: init });
|
|
|
963
943
|
<USelect
|
|
964
944
|
v-model="pagination.pageSize"
|
|
965
945
|
:items="pageSizeOptions"
|
|
966
|
-
size="
|
|
946
|
+
:size="ui.controlSize"
|
|
967
947
|
class="w-20"
|
|
968
948
|
:aria-label="t('nuxtUiMongocamp.collectionData.pageSizeLabel')"
|
|
969
949
|
@update:model-value="onPageSizeChange"
|
|
@@ -1013,9 +993,7 @@ defineExpose({ refresh: init });
|
|
|
1013
993
|
<UButton
|
|
1014
994
|
v-if="compareRows.length === 2"
|
|
1015
995
|
icon="i-lucide-git-compare"
|
|
1016
|
-
|
|
1017
|
-
variant="subtle"
|
|
1018
|
-
size="sm"
|
|
996
|
+
v-bind="{ ...ui.secondaryAction, size: ui.controlSize }"
|
|
1019
997
|
:label="t('nuxtUiMongocamp.bulk.compareSelected')"
|
|
1020
998
|
data-testid="compare-selected"
|
|
1021
999
|
@click="openCompare"
|
|
@@ -1023,9 +1001,7 @@ defineExpose({ refresh: init });
|
|
|
1023
1001
|
<UButton
|
|
1024
1002
|
v-if="editableFields.length > 0"
|
|
1025
1003
|
icon="i-lucide-pencil"
|
|
1026
|
-
|
|
1027
|
-
variant="subtle"
|
|
1028
|
-
size="sm"
|
|
1004
|
+
v-bind="{ ...ui.secondaryAction, size: ui.controlSize }"
|
|
1029
1005
|
:label="t('nuxtUiMongocamp.bulk.editSelected')"
|
|
1030
1006
|
@click="openBulkEdit"
|
|
1031
1007
|
/>
|
|
@@ -1050,6 +1026,7 @@ defineExpose({ refresh: init });
|
|
|
1050
1026
|
v-else
|
|
1051
1027
|
v-model:sorting="sorting"
|
|
1052
1028
|
v-model:row-selection="rowSelection"
|
|
1029
|
+
data-mongocamp-part="table"
|
|
1053
1030
|
:column-visibility="effectiveVisibility"
|
|
1054
1031
|
:get-row-id="rowId"
|
|
1055
1032
|
:sorting-options="{ manualSorting: true }"
|
|
@@ -1074,7 +1051,7 @@ defineExpose({ refresh: init });
|
|
|
1074
1051
|
<UModal
|
|
1075
1052
|
v-model:open="chartOpen"
|
|
1076
1053
|
:title="t('nuxtUiMongocamp.collectionData.chartTitle')"
|
|
1077
|
-
:ui="{ content:
|
|
1054
|
+
:ui="{ content: ui.modal.lg }"
|
|
1078
1055
|
>
|
|
1079
1056
|
<template #body>
|
|
1080
1057
|
<div
|
|
@@ -1095,7 +1072,7 @@ defineExpose({ refresh: init });
|
|
|
1095
1072
|
<UAlert
|
|
1096
1073
|
v-if="chartFilterTooLong"
|
|
1097
1074
|
color="warning"
|
|
1098
|
-
variant="
|
|
1075
|
+
:variant="ui.alert.variant"
|
|
1099
1076
|
icon="i-lucide-triangle-alert"
|
|
1100
1077
|
:description="t('nuxtUiMongocamp.collectionData.chartTooLong')"
|
|
1101
1078
|
data-test="chart-too-long"
|
|
@@ -1113,7 +1090,7 @@ defineExpose({ refresh: init });
|
|
|
1113
1090
|
<UModal
|
|
1114
1091
|
v-model:open="compareOpen"
|
|
1115
1092
|
:title="t('nuxtUiMongocamp.documentCompare.title')"
|
|
1116
|
-
:ui="{ content:
|
|
1093
|
+
:ui="{ content: ui.modal.xl }"
|
|
1117
1094
|
>
|
|
1118
1095
|
<template #body>
|
|
1119
1096
|
<p
|
|
@@ -1145,7 +1122,7 @@ defineExpose({ refresh: init });
|
|
|
1145
1122
|
<USlideover
|
|
1146
1123
|
v-model:open="viewOpen"
|
|
1147
1124
|
:title="t('nuxtUiMongocamp.collectionData.viewDocumentTitle')"
|
|
1148
|
-
:ui="{ content:
|
|
1125
|
+
:ui="{ content: ui.modal.md }"
|
|
1149
1126
|
>
|
|
1150
1127
|
<template #body>
|
|
1151
1128
|
<MongocampDocumentView :document="viewDoc" />
|
|
@@ -1164,7 +1141,7 @@ defineExpose({ refresh: init });
|
|
|
1164
1141
|
<UModal
|
|
1165
1142
|
v-model:open="isEditModalOpen"
|
|
1166
1143
|
:title="editMode === 'insert' ? t('nuxtUiMongocamp.collectionData.insertDocumentTitle') : t('nuxtUiMongocamp.collectionData.editDocumentTitle')"
|
|
1167
|
-
:ui="{ footer:
|
|
1144
|
+
:ui="{ footer: ui.modal.footer }"
|
|
1168
1145
|
>
|
|
1169
1146
|
<template #body>
|
|
1170
1147
|
<FUAutoForm
|
|
@@ -1194,8 +1171,7 @@ defineExpose({ refresh: init });
|
|
|
1194
1171
|
>
|
|
1195
1172
|
<UButton
|
|
1196
1173
|
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
1197
|
-
|
|
1198
|
-
variant="ghost"
|
|
1174
|
+
v-bind="ui.dialogCancel"
|
|
1199
1175
|
@click="isEditModalOpen = false"
|
|
1200
1176
|
/>
|
|
1201
1177
|
<UButton
|
|
@@ -1209,7 +1185,7 @@ defineExpose({ refresh: init });
|
|
|
1209
1185
|
<UModal
|
|
1210
1186
|
v-model:open="isDeleteModalOpen"
|
|
1211
1187
|
:title="t('nuxtUiMongocamp.collectionData.deleteDocumentTitle')"
|
|
1212
|
-
:ui="{ footer:
|
|
1188
|
+
:ui="{ footer: ui.modal.footer }"
|
|
1213
1189
|
>
|
|
1214
1190
|
<template #body>
|
|
1215
1191
|
<p>{{ t("nuxtUiMongocamp.collectionData.confirmDeleteDocument") }}</p>
|
|
@@ -1223,13 +1199,12 @@ defineExpose({ refresh: init });
|
|
|
1223
1199
|
<template #footer>
|
|
1224
1200
|
<UButton
|
|
1225
1201
|
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
1226
|
-
|
|
1227
|
-
variant="ghost"
|
|
1202
|
+
v-bind="ui.dialogCancel"
|
|
1228
1203
|
@click="isDeleteModalOpen = false"
|
|
1229
1204
|
/>
|
|
1230
1205
|
<UButton
|
|
1231
1206
|
:label="t('nuxtUiMongocamp.common.delete')"
|
|
1232
|
-
|
|
1207
|
+
v-bind="ui.dangerAction"
|
|
1233
1208
|
icon="i-lucide-trash-2"
|
|
1234
1209
|
@click="handleDelete"
|
|
1235
1210
|
/>
|
|
@@ -8,11 +8,13 @@ import { analyzeSamples } from "../utils/analyzeSamples";
|
|
|
8
8
|
import { shortenLabel } from "../utils/chartData";
|
|
9
9
|
import { downloadTextFile } from "../utils/exportRows";
|
|
10
10
|
import { FULL_ANALYSIS_MAX_DOCUMENTS, statisticsFromSchemaAnalysis } from "../utils/schemaAnalysis";
|
|
11
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
11
12
|
const props = defineProps({
|
|
12
13
|
collectionName: { type: String, required: true },
|
|
13
14
|
sampleSize: { type: Number, required: false, default: 500 }
|
|
14
15
|
});
|
|
15
16
|
const { t } = useI18n();
|
|
17
|
+
const ui = useMongocampUi();
|
|
16
18
|
const { collectionApi, documentApi } = useMongocampClientApi();
|
|
17
19
|
const { schemaFromSamples, schemaToTsInterface } = useMongocampSchema();
|
|
18
20
|
const { sampleDocuments, describeAggregationError } = useMongocampAggregation();
|
|
@@ -112,7 +114,7 @@ const schemaTableColumns = computed(() => [
|
|
|
112
114
|
cell: ({ row }) => h(UBadge, {
|
|
113
115
|
label: row.original.type,
|
|
114
116
|
color: TYPE_COLORS[row.original.type] ?? "neutral",
|
|
115
|
-
variant:
|
|
117
|
+
variant: ui.value.badge.variant
|
|
116
118
|
})
|
|
117
119
|
},
|
|
118
120
|
{
|
|
@@ -203,7 +205,7 @@ const statsColumns = computed(() => [
|
|
|
203
205
|
({ type, count }) => h(UBadge, {
|
|
204
206
|
label: row.original.types.length > 1 ? `${type} ${percent(count / row.original.present)}` : type,
|
|
205
207
|
color: KIND_COLORS[type] ?? "neutral",
|
|
206
|
-
variant:
|
|
208
|
+
variant: ui.value.badge.variant,
|
|
207
209
|
size: "sm"
|
|
208
210
|
})
|
|
209
211
|
))
|
|
@@ -227,7 +229,7 @@ defineExpose({ refresh: fetchInfo });
|
|
|
227
229
|
</script>
|
|
228
230
|
|
|
229
231
|
<template>
|
|
230
|
-
<div class="flex flex-col gap-4">
|
|
232
|
+
<div class="mongocamp-collection-infos flex flex-col gap-4">
|
|
231
233
|
<USkeleton
|
|
232
234
|
v-if="loading"
|
|
233
235
|
class="h-32 w-full"
|
|
@@ -303,7 +305,7 @@ defineExpose({ refresh: fetchInfo });
|
|
|
303
305
|
<span class="font-semibold">{{ schemaTitle }}</span>
|
|
304
306
|
<UBadge
|
|
305
307
|
:label="t('nuxtUiMongocamp.collectionInfos.fieldsCount', { count: schemaRows.length })"
|
|
306
|
-
variant="
|
|
308
|
+
:variant="ui.badge.variant"
|
|
307
309
|
color="neutral"
|
|
308
310
|
size="sm"
|
|
309
311
|
/>
|
|
@@ -312,23 +314,20 @@ defineExpose({ refresh: fetchInfo });
|
|
|
312
314
|
<UButton
|
|
313
315
|
icon="i-lucide-file-json"
|
|
314
316
|
:label="t('nuxtUiMongocamp.collectionInfos.jsonSchema')"
|
|
315
|
-
|
|
316
|
-
variant="ghost"
|
|
317
|
-
size="sm"
|
|
317
|
+
v-bind="ui.iconButton"
|
|
318
318
|
@click="openJsonSchema"
|
|
319
319
|
/>
|
|
320
320
|
<UButton
|
|
321
321
|
icon="i-lucide-copy"
|
|
322
322
|
:label="t('nuxtUiMongocamp.collectionInfos.copyAsTs')"
|
|
323
|
-
|
|
324
|
-
variant="ghost"
|
|
325
|
-
size="sm"
|
|
323
|
+
v-bind="ui.iconButton"
|
|
326
324
|
@click="copySchemaAsTs"
|
|
327
325
|
/>
|
|
328
326
|
</div>
|
|
329
327
|
</div>
|
|
330
328
|
</template>
|
|
331
329
|
<UTable
|
|
330
|
+
data-mongocamp-part="table"
|
|
332
331
|
:data="schemaRows"
|
|
333
332
|
:columns="schemaTableColumns"
|
|
334
333
|
/>
|
|
@@ -372,7 +371,7 @@ defineExpose({ refresh: fetchInfo });
|
|
|
372
371
|
<UBadge
|
|
373
372
|
v-if="statsAnalysis"
|
|
374
373
|
:label="statsMode === 'server' ? t('nuxtUiMongocamp.collectionInfos.statsAnalysed', { count: statsAnalysis.sampled }) : t('nuxtUiMongocamp.collectionInfos.statsSampled', { sampled: statsAnalysis.sampled, total: info.count })"
|
|
375
|
-
variant="
|
|
374
|
+
:variant="ui.badge.variant"
|
|
376
375
|
color="neutral"
|
|
377
376
|
size="sm"
|
|
378
377
|
/>
|
|
@@ -381,16 +380,14 @@ defineExpose({ refresh: fetchInfo });
|
|
|
381
380
|
<USelect
|
|
382
381
|
v-model="statsSampleSize"
|
|
383
382
|
:items="STATS_SAMPLE_SIZES"
|
|
384
|
-
size="
|
|
383
|
+
:size="ui.controlSize"
|
|
385
384
|
class="w-24"
|
|
386
385
|
:aria-label="t('nuxtUiMongocamp.collectionInfos.statsSampleSize')"
|
|
387
386
|
/>
|
|
388
387
|
<UButton
|
|
389
388
|
icon="i-lucide-activity"
|
|
390
389
|
:label="t('nuxtUiMongocamp.collectionInfos.statsAnalyze')"
|
|
391
|
-
|
|
392
|
-
variant="subtle"
|
|
393
|
-
size="sm"
|
|
390
|
+
v-bind="{ ...ui.secondaryAction, size: ui.controlSize }"
|
|
394
391
|
:loading="statsLoading && statsMode === 'sample'"
|
|
395
392
|
:disabled="statsLoading"
|
|
396
393
|
@click="analyzeFields"
|
|
@@ -419,7 +416,7 @@ defineExpose({ refresh: fetchInfo });
|
|
|
419
416
|
<UAlert
|
|
420
417
|
v-if="statsError"
|
|
421
418
|
color="error"
|
|
422
|
-
variant="
|
|
419
|
+
:variant="ui.alert.variant"
|
|
423
420
|
icon="i-lucide-circle-alert"
|
|
424
421
|
:title="t('nuxtUiMongocamp.collectionInfos.statsFailed')"
|
|
425
422
|
:description="statsError.message"
|
|
@@ -429,15 +426,13 @@ defineExpose({ refresh: fetchInfo });
|
|
|
429
426
|
v-if="statsError.kind === 'unauthorized'"
|
|
430
427
|
:label="t('nuxtUiMongocamp.errors.loginAgain')"
|
|
431
428
|
to="/"
|
|
432
|
-
|
|
433
|
-
variant="subtle"
|
|
429
|
+
v-bind="{ ...ui.alertAction, color: 'error' }"
|
|
434
430
|
icon="i-lucide-log-in"
|
|
435
431
|
/>
|
|
436
432
|
<UButton
|
|
437
433
|
v-else
|
|
438
434
|
:label="t('nuxtUiMongocamp.common.retry')"
|
|
439
|
-
|
|
440
|
-
variant="subtle"
|
|
435
|
+
v-bind="{ ...ui.alertAction, color: 'error' }"
|
|
441
436
|
icon="i-lucide-refresh-cw"
|
|
442
437
|
@click="retryStats"
|
|
443
438
|
/>
|
|
@@ -451,6 +446,7 @@ defineExpose({ refresh: fetchInfo });
|
|
|
451
446
|
</template>
|
|
452
447
|
</p>
|
|
453
448
|
<UTable
|
|
449
|
+
data-mongocamp-part="table"
|
|
454
450
|
:data="statsAnalysis.fields"
|
|
455
451
|
:columns="statsColumns"
|
|
456
452
|
>
|
|
@@ -482,7 +478,7 @@ defineExpose({ refresh: fetchInfo });
|
|
|
482
478
|
<UModal
|
|
483
479
|
v-model:open="isSchemaOpen"
|
|
484
480
|
:title="t('nuxtUiMongocamp.collectionInfos.jsonSchemaTitle', { name: collectionName })"
|
|
485
|
-
:ui="{ content:
|
|
481
|
+
:ui="{ content: ui.modal.lg, footer: ui.modal.footer }"
|
|
486
482
|
>
|
|
487
483
|
<template #body>
|
|
488
484
|
<MongocampErrorAlert
|
|
@@ -510,8 +506,7 @@ defineExpose({ refresh: fetchInfo });
|
|
|
510
506
|
<UButton
|
|
511
507
|
icon="i-lucide-copy"
|
|
512
508
|
:label="t('nuxtUiMongocamp.common.copy')"
|
|
513
|
-
|
|
514
|
-
variant="ghost"
|
|
509
|
+
v-bind="ui.toolbarButton"
|
|
515
510
|
:disabled="!schemaJson"
|
|
516
511
|
@click="copyJsonSchema"
|
|
517
512
|
/>
|
|
@@ -6,17 +6,17 @@ type __VLS_ModelProps = {
|
|
|
6
6
|
};
|
|
7
7
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
8
8
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
"update:open": (value: boolean) => any;
|
|
9
10
|
done: (payload: {
|
|
10
11
|
source: string;
|
|
11
12
|
target: string;
|
|
12
13
|
}) => any;
|
|
13
|
-
"update:open": (value: boolean) => any;
|
|
14
14
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
15
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
15
16
|
onDone?: ((payload: {
|
|
16
17
|
source: string;
|
|
17
18
|
target: string;
|
|
18
19
|
}) => any) | undefined;
|
|
19
|
-
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
20
20
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
21
|
declare const _default: typeof __VLS_export;
|
|
22
22
|
export default _default;
|
|
@@ -3,12 +3,14 @@ import { computed, ref, watch } from "vue";
|
|
|
3
3
|
import { useI18n, useMongocampError } from "#imports";
|
|
4
4
|
import { useMongocampCollectionCopy } from "../composables/useMongocampCollectionCopy";
|
|
5
5
|
import { MAX_COLLECTION_NAME_LENGTH, validateTargetName } from "../utils/collectionCopy";
|
|
6
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
6
7
|
const props = defineProps({
|
|
7
8
|
source: { type: String, required: true }
|
|
8
9
|
});
|
|
9
10
|
const emit = defineEmits(["done"]);
|
|
10
11
|
const isOpen = defineModel("open", { type: Boolean, ...{ default: false } });
|
|
11
12
|
const { t } = useI18n();
|
|
13
|
+
const ui = useMongocampUi();
|
|
12
14
|
const { describeServerError } = useMongocampError();
|
|
13
15
|
const { renameCollection, listCollectionNames } = useMongocampCollectionCopy();
|
|
14
16
|
const target = ref("");
|
|
@@ -62,13 +64,13 @@ async function rename() {
|
|
|
62
64
|
v-model:open="isOpen"
|
|
63
65
|
:title="t('nuxtUiMongocamp.collectionRename.title', { source })"
|
|
64
66
|
:dismissible="!renaming"
|
|
65
|
-
:ui="{
|
|
67
|
+
:ui="{ content: 'mongocamp-collection-rename', footer: ui.modal.footer }"
|
|
66
68
|
>
|
|
67
69
|
<template #body>
|
|
68
70
|
<div class="flex flex-col gap-4">
|
|
69
71
|
<UAlert
|
|
70
72
|
color="warning"
|
|
71
|
-
variant="
|
|
73
|
+
:variant="ui.alert.variant"
|
|
72
74
|
icon="i-lucide-triangle-alert"
|
|
73
75
|
:description="t('nuxtUiMongocamp.collectionRename.grantsWarning')"
|
|
74
76
|
data-test="rename-grants-warning"
|
|
@@ -99,8 +101,7 @@ async function rename() {
|
|
|
99
101
|
<template #footer>
|
|
100
102
|
<UButton
|
|
101
103
|
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
102
|
-
|
|
103
|
-
variant="ghost"
|
|
104
|
+
v-bind="ui.dialogCancel"
|
|
104
105
|
:disabled="renaming"
|
|
105
106
|
@click="isOpen = false"
|
|
106
107
|
/>
|
|
@@ -6,17 +6,17 @@ type __VLS_ModelProps = {
|
|
|
6
6
|
};
|
|
7
7
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
8
8
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
"update:open": (value: boolean) => any;
|
|
9
10
|
done: (payload: {
|
|
10
11
|
source: string;
|
|
11
12
|
target: string;
|
|
12
13
|
}) => any;
|
|
13
|
-
"update:open": (value: boolean) => any;
|
|
14
14
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
15
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
15
16
|
onDone?: ((payload: {
|
|
16
17
|
source: string;
|
|
17
18
|
target: string;
|
|
18
19
|
}) => any) | undefined;
|
|
19
|
-
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
20
20
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
21
|
declare const _default: typeof __VLS_export;
|
|
22
22
|
export default _default;
|