@sfxcode/nuxt-ui-mongocamp 1.5.7 → 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 +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.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.vue +8 -9
- 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.vue +6 -6
- package/dist/runtime/components/MongocampCollectionData.vue +37 -62
- package/dist/runtime/components/MongocampCollectionInfos.vue +18 -23
- 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 +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/useMongocampUi.d.ts +8 -0
- package/dist/runtime/composables/useMongocampUi.js +7 -0
- package/dist/runtime/plugin.js +8 -0
- package/dist/runtime/utils/compactSession.d.ts +13 -0
- package/dist/runtime/utils/compactSession.js +12 -0
- package/dist/runtime/utils/uiTheme.d.ts +65 -0
- package/dist/runtime/utils/uiTheme.js +47 -0
- package/package.json +13 -13
|
@@ -3,12 +3,14 @@ import { computed, ref, watch } from "vue";
|
|
|
3
3
|
import { useI18n, useToast } from "#imports";
|
|
4
4
|
import { allContainerPaths, buildDocumentTree, defaultExpanded, nodeDisplay, visibleNodes } from "../utils/documentTree";
|
|
5
5
|
import { valueToJson } from "../utils/exportDocuments";
|
|
6
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
6
7
|
const props = defineProps({
|
|
7
8
|
document: { type: null, required: true }
|
|
8
9
|
});
|
|
9
10
|
const emit = defineEmits(["copy"]);
|
|
10
11
|
const mode = defineModel("mode", { type: String, ...{ default: "tree" } });
|
|
11
12
|
const { t } = useI18n();
|
|
13
|
+
const ui = useMongocampUi();
|
|
12
14
|
const toast = useToast();
|
|
13
15
|
const tree = computed(() => buildDocumentTree(props.document ?? {}));
|
|
14
16
|
const expanded = ref(/* @__PURE__ */ new Set());
|
|
@@ -59,7 +61,7 @@ const modeItems = computed(() => [
|
|
|
59
61
|
</script>
|
|
60
62
|
|
|
61
63
|
<template>
|
|
62
|
-
<div class="flex flex-col gap-3">
|
|
64
|
+
<div class="mongocamp-document-view flex flex-col gap-3">
|
|
63
65
|
<div class="flex flex-wrap items-center justify-between gap-2">
|
|
64
66
|
<div
|
|
65
67
|
class="inline-flex rounded-md border border-default p-0.5"
|
|
@@ -83,17 +85,13 @@ const modeItems = computed(() => [
|
|
|
83
85
|
v-if="mode === 'tree' && hasContainers"
|
|
84
86
|
:label="allOpen ? t('nuxtUiMongocamp.documentView.collapseAll') : t('nuxtUiMongocamp.documentView.expandAll')"
|
|
85
87
|
:icon="allOpen ? 'i-lucide-chevrons-down-up' : 'i-lucide-chevrons-up-down'"
|
|
86
|
-
|
|
87
|
-
color="neutral"
|
|
88
|
-
variant="ghost"
|
|
88
|
+
v-bind="ui.compactButton"
|
|
89
89
|
@click="toggleAll"
|
|
90
90
|
/>
|
|
91
91
|
<UButton
|
|
92
92
|
:label="t('nuxtUiMongocamp.documentView.copyDocument')"
|
|
93
93
|
icon="i-lucide-copy"
|
|
94
|
-
|
|
95
|
-
color="neutral"
|
|
96
|
-
variant="ghost"
|
|
94
|
+
v-bind="ui.compactButton"
|
|
97
95
|
:disabled="!document"
|
|
98
96
|
@click="copy('document', jsonText)"
|
|
99
97
|
/>
|
|
@@ -154,7 +152,7 @@ const modeItems = computed(() => [
|
|
|
154
152
|
<UBadge
|
|
155
153
|
:label="node.type"
|
|
156
154
|
:color="BADGE_COLORS[node.type]"
|
|
157
|
-
variant="
|
|
155
|
+
:variant="ui.badge.variant"
|
|
158
156
|
size="sm"
|
|
159
157
|
class="shrink-0"
|
|
160
158
|
:title="t('nuxtUiMongocamp.documentView.typeLabel', { type: node.type })"
|
|
@@ -9,7 +9,10 @@ const { t } = useI18n();
|
|
|
9
9
|
</script>
|
|
10
10
|
|
|
11
11
|
<template>
|
|
12
|
-
<div
|
|
12
|
+
<div
|
|
13
|
+
data-mongocamp-part="empty"
|
|
14
|
+
class="mongocamp-empty-state flex flex-col items-center gap-2 py-8 text-center"
|
|
15
|
+
>
|
|
13
16
|
<UIcon
|
|
14
17
|
:name="icon ?? 'i-lucide-inbox'"
|
|
15
18
|
class="size-8 text-dimmed"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, ref, watch } from "vue";
|
|
3
3
|
import { navigateTo, useI18n, useMongocampError, useMongocampRoles, useMongocampSession } from "#imports";
|
|
4
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
4
5
|
const props = defineProps({
|
|
5
6
|
error: { type: null, required: true },
|
|
6
7
|
title: { type: String, required: false },
|
|
@@ -9,6 +10,7 @@ const props = defineProps({
|
|
|
9
10
|
});
|
|
10
11
|
const emit = defineEmits(["retry", "clearFilters"]);
|
|
11
12
|
const { t } = useI18n();
|
|
13
|
+
const ui = useMongocampUi();
|
|
12
14
|
const { describeError, describeServerError } = useMongocampError();
|
|
13
15
|
const { invalidateSession } = useMongocampSession();
|
|
14
16
|
const { loginPath: configuredLoginPath } = useMongocampRoles();
|
|
@@ -36,8 +38,10 @@ async function loginAgain() {
|
|
|
36
38
|
<template>
|
|
37
39
|
<UAlert
|
|
38
40
|
v-if="error"
|
|
41
|
+
class="mongocamp-error-alert"
|
|
42
|
+
data-mongocamp-part="error"
|
|
39
43
|
color="error"
|
|
40
|
-
variant="
|
|
44
|
+
:variant="ui.alert.variant"
|
|
41
45
|
icon="i-lucide-circle-alert"
|
|
42
46
|
:title="filterRejected ? t('nuxtUiMongocamp.errors.filterRejectedTitle') : title ?? t('nuxtUiMongocamp.errors.loadFailedTitle')"
|
|
43
47
|
:description="description"
|
|
@@ -46,24 +50,21 @@ async function loginAgain() {
|
|
|
46
50
|
<UButton
|
|
47
51
|
v-if="filterRejected"
|
|
48
52
|
:label="t('nuxtUiMongocamp.errors.clearFilters')"
|
|
49
|
-
|
|
50
|
-
variant="subtle"
|
|
53
|
+
v-bind="{ ...ui.alertAction, color: 'error' }"
|
|
51
54
|
icon="i-lucide-filter-x"
|
|
52
55
|
@click="emit('clearFilters')"
|
|
53
56
|
/>
|
|
54
57
|
<UButton
|
|
55
58
|
v-else-if="sessionGone"
|
|
56
59
|
:label="t('nuxtUiMongocamp.errors.loginAgain')"
|
|
57
|
-
|
|
58
|
-
variant="subtle"
|
|
60
|
+
v-bind="{ ...ui.alertAction, color: 'error' }"
|
|
59
61
|
icon="i-lucide-log-in"
|
|
60
62
|
@click="loginAgain"
|
|
61
63
|
/>
|
|
62
64
|
<UButton
|
|
63
65
|
v-else
|
|
64
66
|
:label="t('nuxtUiMongocamp.common.retry')"
|
|
65
|
-
|
|
66
|
-
variant="subtle"
|
|
67
|
+
v-bind="{ ...ui.alertAction, color: 'error' }"
|
|
67
68
|
icon="i-lucide-refresh-cw"
|
|
68
69
|
@click="emit('retry')"
|
|
69
70
|
/>
|
|
@@ -3,6 +3,7 @@ import { computed, ref, watch } from "vue";
|
|
|
3
3
|
import { useI18n, useMongocampError } from "#imports";
|
|
4
4
|
import { useMongocampExportAll } from "../composables/useMongocampExportAll";
|
|
5
5
|
import { formatBytes } from "../utils/formatBytes";
|
|
6
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
6
7
|
const props = defineProps({
|
|
7
8
|
collection: { type: String, required: true },
|
|
8
9
|
filter: { type: String, required: false },
|
|
@@ -12,6 +13,7 @@ const props = defineProps({
|
|
|
12
13
|
});
|
|
13
14
|
const isOpen = defineModel("open", { type: Boolean, ...{ default: false } });
|
|
14
15
|
const { t } = useI18n();
|
|
16
|
+
const ui = useMongocampUi();
|
|
15
17
|
const { describeServerError } = useMongocampError();
|
|
16
18
|
const { exportCollection } = useMongocampExportAll();
|
|
17
19
|
const step = ref("form");
|
|
@@ -77,7 +79,7 @@ function cancel() {
|
|
|
77
79
|
<UModal
|
|
78
80
|
v-model:open="isOpen"
|
|
79
81
|
:title="t('nuxtUiMongocamp.exportAll.title')"
|
|
80
|
-
:ui="{
|
|
82
|
+
:ui="{ content: 'mongocamp-export-all', footer: ui.modal.footer }"
|
|
81
83
|
>
|
|
82
84
|
<template #body>
|
|
83
85
|
<div
|
|
@@ -141,7 +143,7 @@ function cancel() {
|
|
|
141
143
|
<UAlert
|
|
142
144
|
v-if="result.incomplete"
|
|
143
145
|
color="warning"
|
|
144
|
-
variant="
|
|
146
|
+
:variant="ui.alert.variant"
|
|
145
147
|
icon="i-lucide-circle-alert"
|
|
146
148
|
:title="t('nuxtUiMongocamp.exportAll.incomplete', { file: result.filename })"
|
|
147
149
|
data-test="export-incomplete"
|
|
@@ -149,7 +151,7 @@ function cancel() {
|
|
|
149
151
|
<UAlert
|
|
150
152
|
v-else
|
|
151
153
|
color="success"
|
|
152
|
-
variant="
|
|
154
|
+
:variant="ui.alert.variant"
|
|
153
155
|
icon="i-lucide-circle-check"
|
|
154
156
|
: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
157
|
/>
|
|
@@ -168,16 +170,14 @@ function cancel() {
|
|
|
168
170
|
<template v-else-if="step === 'done'">
|
|
169
171
|
<UButton
|
|
170
172
|
:label="t('nuxtUiMongocamp.exportAll.close')"
|
|
171
|
-
|
|
172
|
-
variant="ghost"
|
|
173
|
+
v-bind="ui.dialogCancel"
|
|
173
174
|
@click="isOpen = false"
|
|
174
175
|
/>
|
|
175
176
|
</template>
|
|
176
177
|
<template v-else>
|
|
177
178
|
<UButton
|
|
178
179
|
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
179
|
-
|
|
180
|
-
variant="ghost"
|
|
180
|
+
v-bind="ui.dialogCancel"
|
|
181
181
|
@click="isOpen = false"
|
|
182
182
|
/>
|
|
183
183
|
<UButton
|
|
@@ -5,12 +5,14 @@ import { useMongocampBucket } from "../composables/useMongocampBucket";
|
|
|
5
5
|
import { useMongocampError } from "../composables/useMongocampError";
|
|
6
6
|
import { canPreview, clipText, PREVIEW_LIMITS, prettyJson, previewKind } from "../utils/filePreview";
|
|
7
7
|
import { formatBytes } from "../utils/formatBytes";
|
|
8
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
8
9
|
const props = defineProps({
|
|
9
10
|
bucketName: { type: String, required: true },
|
|
10
11
|
file: { type: Object, required: false }
|
|
11
12
|
});
|
|
12
13
|
const open = defineModel("open", { type: Boolean, ...{ default: false } });
|
|
13
14
|
const { t } = useI18n();
|
|
15
|
+
const ui = useMongocampUi();
|
|
14
16
|
const { fetchFileBlob, downloadFile, downloadingFileIds } = useMongocampBucket();
|
|
15
17
|
const { describeError } = useMongocampError();
|
|
16
18
|
const loading = ref(false);
|
|
@@ -70,7 +72,7 @@ onBeforeUnmount(() => {
|
|
|
70
72
|
v-model:open="open"
|
|
71
73
|
:title="file?.filename ?? t('nuxtUiMongocamp.filePreview.title')"
|
|
72
74
|
:description="file ? formatBytes(file.length) : void 0"
|
|
73
|
-
:ui="{ content: 'max-w-3xl' }"
|
|
75
|
+
:ui="{ content: 'max-w-3xl mongocamp-file-preview' }"
|
|
74
76
|
>
|
|
75
77
|
<template #body>
|
|
76
78
|
<div
|
|
@@ -92,7 +94,7 @@ onBeforeUnmount(() => {
|
|
|
92
94
|
<UAlert
|
|
93
95
|
v-else-if="error"
|
|
94
96
|
color="error"
|
|
95
|
-
variant="
|
|
97
|
+
:variant="ui.alert.variant"
|
|
96
98
|
icon="i-lucide-circle-alert"
|
|
97
99
|
:title="t('nuxtUiMongocamp.filePreview.failed')"
|
|
98
100
|
:description="error"
|
|
@@ -101,7 +103,7 @@ onBeforeUnmount(() => {
|
|
|
101
103
|
<UAlert
|
|
102
104
|
v-else-if="kind === 'other'"
|
|
103
105
|
color="neutral"
|
|
104
|
-
variant="
|
|
106
|
+
:variant="ui.alert.variant"
|
|
105
107
|
icon="i-lucide-file"
|
|
106
108
|
:title="t('nuxtUiMongocamp.filePreview.noPreview')"
|
|
107
109
|
/>
|
|
@@ -109,7 +111,7 @@ onBeforeUnmount(() => {
|
|
|
109
111
|
<UAlert
|
|
110
112
|
v-else-if="tooLarge"
|
|
111
113
|
color="neutral"
|
|
112
|
-
variant="
|
|
114
|
+
:variant="ui.alert.variant"
|
|
113
115
|
icon="i-lucide-file-warning"
|
|
114
116
|
:title="t('nuxtUiMongocamp.filePreview.tooLarge', { max: limitLabel })"
|
|
115
117
|
/>
|
|
@@ -142,8 +144,7 @@ onBeforeUnmount(() => {
|
|
|
142
144
|
<div class="flex justify-end">
|
|
143
145
|
<UButton
|
|
144
146
|
icon="i-lucide-download"
|
|
145
|
-
|
|
146
|
-
variant="subtle"
|
|
147
|
+
v-bind="ui.secondaryAction"
|
|
147
148
|
:label="t('nuxtUiMongocamp.filePreview.download')"
|
|
148
149
|
:loading="downloadingFileIds.has(file.id)"
|
|
149
150
|
@click="downloadFile(bucketName, file.id)"
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
valueCountFor
|
|
10
10
|
} from "../utils/filterBuilder";
|
|
11
11
|
import { suggestionOptions, wantsSuggestions } from "../utils/filterSuggestions";
|
|
12
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
12
13
|
const props = defineProps({
|
|
13
14
|
fields: { type: Array, required: true },
|
|
14
15
|
loadDistinct: { type: Function, required: false }
|
|
@@ -16,6 +17,7 @@ const props = defineProps({
|
|
|
16
17
|
const model = defineModel({ type: Object, ...{ required: true } });
|
|
17
18
|
const emit = defineEmits(["apply"]);
|
|
18
19
|
const { t } = useI18n();
|
|
20
|
+
const ui = useMongocampUi();
|
|
19
21
|
let idCounter = 0;
|
|
20
22
|
function newId() {
|
|
21
23
|
return `filter-${Date.now()}-${idCounter++}`;
|
|
@@ -92,7 +94,7 @@ function clearAll() {
|
|
|
92
94
|
</script>
|
|
93
95
|
|
|
94
96
|
<template>
|
|
95
|
-
<div class="flex flex-col gap-3 rounded-md border border-default p-3">
|
|
97
|
+
<div class="mongocamp-filter-builder flex flex-col gap-3 rounded-md border border-default p-3">
|
|
96
98
|
<p
|
|
97
99
|
v-if="fields.length === 0"
|
|
98
100
|
class="text-sm text-dimmed"
|
|
@@ -109,7 +111,7 @@ function clearAll() {
|
|
|
109
111
|
<USelect
|
|
110
112
|
:model-value="model.match"
|
|
111
113
|
:items="matchItems"
|
|
112
|
-
size="
|
|
114
|
+
:size="ui.controlSize"
|
|
113
115
|
class="w-44"
|
|
114
116
|
:aria-label="t('nuxtUiMongocamp.filterBuilder.matchLabel')"
|
|
115
117
|
@update:model-value="(value) => setMatch(value)"
|
|
@@ -139,7 +141,7 @@ function clearAll() {
|
|
|
139
141
|
<USelect
|
|
140
142
|
:model-value="condition.field"
|
|
141
143
|
:items="fieldItems"
|
|
142
|
-
size="
|
|
144
|
+
:size="ui.controlSize"
|
|
143
145
|
class="w-44"
|
|
144
146
|
:aria-label="t('nuxtUiMongocamp.filterBuilder.field')"
|
|
145
147
|
@update:model-value="(value) => changeField(index, value)"
|
|
@@ -147,7 +149,7 @@ function clearAll() {
|
|
|
147
149
|
<USelect
|
|
148
150
|
:model-value="condition.operator"
|
|
149
151
|
:items="operatorItems(typeOf(condition.field))"
|
|
150
|
-
size="
|
|
152
|
+
:size="ui.controlSize"
|
|
151
153
|
class="w-44"
|
|
152
154
|
:aria-label="t('nuxtUiMongocamp.filterBuilder.operator')"
|
|
153
155
|
@update:model-value="(value) => updateCondition(index, { operator: value })"
|
|
@@ -159,7 +161,7 @@ function clearAll() {
|
|
|
159
161
|
:inputmode="typeOf(condition.field) === 'number' ? 'decimal' : void 0"
|
|
160
162
|
:placeholder="condition.operator === 'oneOf' ? t('nuxtUiMongocamp.filterBuilder.listPlaceholder') : void 0"
|
|
161
163
|
:list="listId(condition)"
|
|
162
|
-
size="
|
|
164
|
+
:size="ui.controlSize"
|
|
163
165
|
class="w-48"
|
|
164
166
|
:aria-label="t('nuxtUiMongocamp.filterBuilder.value')"
|
|
165
167
|
@focus="ensureSuggestions(condition)"
|
|
@@ -182,7 +184,7 @@ function clearAll() {
|
|
|
182
184
|
:model-value="condition.value2 ?? ''"
|
|
183
185
|
:type="typeOf(condition.field) === 'date-time' ? 'date' : 'text'"
|
|
184
186
|
:inputmode="typeOf(condition.field) === 'number' ? 'decimal' : void 0"
|
|
185
|
-
size="
|
|
187
|
+
:size="ui.controlSize"
|
|
186
188
|
class="w-48"
|
|
187
189
|
:aria-label="t('nuxtUiMongocamp.filterBuilder.valueTo')"
|
|
188
190
|
@update:model-value="(value) => updateCondition(index, { value2: String(value ?? '') })"
|
|
@@ -191,9 +193,7 @@ function clearAll() {
|
|
|
191
193
|
</template>
|
|
192
194
|
<UButton
|
|
193
195
|
icon="i-lucide-x"
|
|
194
|
-
|
|
195
|
-
variant="ghost"
|
|
196
|
-
size="sm"
|
|
196
|
+
v-bind="ui.iconButton"
|
|
197
197
|
:aria-label="t('nuxtUiMongocamp.filterBuilder.remove')"
|
|
198
198
|
@click="removeCondition(index)"
|
|
199
199
|
/>
|
|
@@ -217,22 +217,18 @@ function clearAll() {
|
|
|
217
217
|
<div class="flex flex-wrap items-center justify-between gap-2">
|
|
218
218
|
<UButton
|
|
219
219
|
icon="i-lucide-plus"
|
|
220
|
-
|
|
221
|
-
variant="ghost"
|
|
222
|
-
size="sm"
|
|
220
|
+
v-bind="ui.iconButton"
|
|
223
221
|
:label="t('nuxtUiMongocamp.filterBuilder.addCondition')"
|
|
224
222
|
@click="addCondition"
|
|
225
223
|
/>
|
|
226
224
|
<div class="flex items-center gap-2">
|
|
227
225
|
<UButton
|
|
228
|
-
|
|
229
|
-
variant="ghost"
|
|
230
|
-
size="sm"
|
|
226
|
+
v-bind="ui.iconButton"
|
|
231
227
|
:label="t('nuxtUiMongocamp.filterBuilder.clearAll')"
|
|
232
228
|
@click="clearAll"
|
|
233
229
|
/>
|
|
234
230
|
<UButton
|
|
235
|
-
size="
|
|
231
|
+
:size="ui.controlSize"
|
|
236
232
|
:label="t('nuxtUiMongocamp.filterBuilder.apply')"
|
|
237
233
|
@click="apply"
|
|
238
234
|
/>
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, h, resolveComponent } from "vue";
|
|
3
3
|
import { useI18n } from "#imports";
|
|
4
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
4
5
|
defineProps({
|
|
5
6
|
grants: { type: Array, required: true }
|
|
6
7
|
});
|
|
7
8
|
const { t } = useI18n();
|
|
9
|
+
const ui = useMongocampUi();
|
|
8
10
|
const UBadge = resolveComponent("UBadge");
|
|
9
11
|
function flag(value) {
|
|
10
12
|
return h(UBadge, {
|
|
11
13
|
label: value ? t("nuxtUiMongocamp.common.yes") : t("nuxtUiMongocamp.common.no"),
|
|
12
14
|
color: value ? "success" : "neutral",
|
|
13
|
-
variant:
|
|
15
|
+
variant: ui.value.badge.variant
|
|
14
16
|
});
|
|
15
17
|
}
|
|
16
18
|
const columns = computed(() => [
|
|
@@ -18,7 +20,7 @@ const columns = computed(() => [
|
|
|
18
20
|
{
|
|
19
21
|
accessorKey: "grantType",
|
|
20
22
|
header: t("nuxtUiMongocamp.roleGrants.columnType"),
|
|
21
|
-
cell: ({ row }) => h(UBadge, { label: row.original.grantType, color: "neutral", variant:
|
|
23
|
+
cell: ({ row }) => h(UBadge, { label: row.original.grantType, color: "neutral", variant: ui.value.badge.variant })
|
|
22
24
|
},
|
|
23
25
|
{ accessorKey: "read", header: t("nuxtUiMongocamp.roleGrants.columnRead"), cell: ({ row }) => flag(row.original.read) },
|
|
24
26
|
{ accessorKey: "write", header: t("nuxtUiMongocamp.roleGrants.columnWrite"), cell: ({ row }) => flag(row.original.write) },
|
|
@@ -28,6 +30,8 @@ const columns = computed(() => [
|
|
|
28
30
|
|
|
29
31
|
<template>
|
|
30
32
|
<UTable
|
|
33
|
+
data-mongocamp-part="table"
|
|
34
|
+
class="mongocamp-grant-list"
|
|
31
35
|
:data="grants"
|
|
32
36
|
:columns="columns"
|
|
33
37
|
>
|
|
@@ -5,6 +5,7 @@ import { useMongocampImport } from "../composables/useMongocampImport";
|
|
|
5
5
|
import { DEFAULT_IMPORT_LIMITS } from "../utils/importRows";
|
|
6
6
|
import { detectImportFormat, prepareImport } from "../utils/importPipeline";
|
|
7
7
|
import { formatBytes } from "../utils/formatBytes";
|
|
8
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
8
9
|
const props = defineProps({
|
|
9
10
|
collectionName: { type: String, required: true }
|
|
10
11
|
});
|
|
@@ -12,6 +13,7 @@ const emit = defineEmits(["imported"]);
|
|
|
12
13
|
const PREVIEW_ROWS = 5;
|
|
13
14
|
const ERROR_LIMIT = 10;
|
|
14
15
|
const { t } = useI18n();
|
|
16
|
+
const ui = useMongocampUi();
|
|
15
17
|
const { describeServerError } = useMongocampError();
|
|
16
18
|
const { importRows, importNdjson } = useMongocampImport();
|
|
17
19
|
const isOpen = ref(false);
|
|
@@ -269,12 +271,13 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
269
271
|
</script>
|
|
270
272
|
|
|
271
273
|
<template>
|
|
272
|
-
<UTooltip
|
|
274
|
+
<UTooltip
|
|
275
|
+
class="mongocamp-import"
|
|
276
|
+
:text="t('nuxtUiMongocamp.import.trigger')"
|
|
277
|
+
>
|
|
273
278
|
<UButton
|
|
274
279
|
icon="i-lucide-file-up"
|
|
275
|
-
|
|
276
|
-
variant="ghost"
|
|
277
|
-
size="sm"
|
|
280
|
+
v-bind="ui.iconButton"
|
|
278
281
|
:aria-label="t('nuxtUiMongocamp.import.trigger')"
|
|
279
282
|
@click="openModal"
|
|
280
283
|
/>
|
|
@@ -284,7 +287,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
284
287
|
v-model:open="isOpen"
|
|
285
288
|
:title="t('nuxtUiMongocamp.import.title')"
|
|
286
289
|
:dismissible="step !== 'importing'"
|
|
287
|
-
:ui="{ footer:
|
|
290
|
+
:ui="{ footer: ui.modal.footer, content: ui.modal.lg + ' mongocamp-import' }"
|
|
288
291
|
>
|
|
289
292
|
<template #body>
|
|
290
293
|
<div
|
|
@@ -313,7 +316,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
313
316
|
<UAlert
|
|
314
317
|
v-if="readError"
|
|
315
318
|
color="error"
|
|
316
|
-
variant="
|
|
319
|
+
:variant="ui.alert.variant"
|
|
317
320
|
icon="i-lucide-circle-alert"
|
|
318
321
|
:description="readError"
|
|
319
322
|
/>
|
|
@@ -327,14 +330,14 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
327
330
|
<span class="text-sm font-medium break-all">{{ fileName }} ({{ formatBytes(serverFile.size) }})</span>
|
|
328
331
|
<UAlert
|
|
329
332
|
color="info"
|
|
330
|
-
variant="
|
|
333
|
+
:variant="ui.alert.variant"
|
|
331
334
|
icon="i-lucide-info"
|
|
332
335
|
:description="t('nuxtUiMongocamp.import.ndjsonNote')"
|
|
333
336
|
/>
|
|
334
337
|
<UAlert
|
|
335
338
|
v-if="serverPreview.unreadable > 0"
|
|
336
339
|
color="warning"
|
|
337
|
-
variant="
|
|
340
|
+
:variant="ui.alert.variant"
|
|
338
341
|
icon="i-lucide-triangle-alert"
|
|
339
342
|
:description="t('nuxtUiMongocamp.import.ndjsonUnreadable', { count: serverPreview.unreadable }, serverPreview.unreadable)"
|
|
340
343
|
/>
|
|
@@ -343,6 +346,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
343
346
|
{{ t("nuxtUiMongocamp.import.previewTitle", { count: serverPreview.rows.length }) }}
|
|
344
347
|
</p>
|
|
345
348
|
<UTable
|
|
349
|
+
data-mongocamp-part="table"
|
|
346
350
|
:data="serverPreview.rows"
|
|
347
351
|
:columns="serverPreview.columns.map((column2) => ({ id: column2, header: column2, accessorFn: (row) => row[column2] }))"
|
|
348
352
|
class="max-h-64"
|
|
@@ -359,7 +363,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
359
363
|
<USelect
|
|
360
364
|
:model-value="format"
|
|
361
365
|
:items="formatItems"
|
|
362
|
-
size="
|
|
366
|
+
:size="ui.controlSize"
|
|
363
367
|
class="w-28"
|
|
364
368
|
:aria-label="t('nuxtUiMongocamp.import.format')"
|
|
365
369
|
@update:model-value="onFormatChange"
|
|
@@ -368,7 +372,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
368
372
|
v-if="format === 'csv'"
|
|
369
373
|
:model-value="delimiter"
|
|
370
374
|
:items="delimiterItems"
|
|
371
|
-
size="
|
|
375
|
+
:size="ui.controlSize"
|
|
372
376
|
class="w-40"
|
|
373
377
|
:aria-label="t('nuxtUiMongocamp.import.delimiter')"
|
|
374
378
|
@update:model-value="onDelimiterChange"
|
|
@@ -379,7 +383,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
379
383
|
v-for="error in fileErrors"
|
|
380
384
|
:key="error.code"
|
|
381
385
|
color="error"
|
|
382
|
-
variant="
|
|
386
|
+
:variant="ui.alert.variant"
|
|
383
387
|
icon="i-lucide-circle-alert"
|
|
384
388
|
:description="errorText(error)"
|
|
385
389
|
/>
|
|
@@ -391,7 +395,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
391
395
|
<UAlert
|
|
392
396
|
v-if="prepared.truncated"
|
|
393
397
|
color="warning"
|
|
394
|
-
variant="
|
|
398
|
+
:variant="ui.alert.variant"
|
|
395
399
|
icon="i-lucide-triangle-alert"
|
|
396
400
|
:description="t('nuxtUiMongocamp.import.truncated', { maxRows: limitsText.maxRows })"
|
|
397
401
|
/>
|
|
@@ -413,7 +417,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
413
417
|
<USelect
|
|
414
418
|
:model-value="columnTypes[column]"
|
|
415
419
|
:items="typeItems"
|
|
416
|
-
size="
|
|
420
|
+
:size="ui.controlSize"
|
|
417
421
|
class="w-32"
|
|
418
422
|
:aria-label="column"
|
|
419
423
|
@update:model-value="setColumnType(column, $event)"
|
|
@@ -429,7 +433,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
429
433
|
<UAlert
|
|
430
434
|
v-if="rowErrors.length > 0"
|
|
431
435
|
color="warning"
|
|
432
|
-
variant="
|
|
436
|
+
:variant="ui.alert.variant"
|
|
433
437
|
icon="i-lucide-triangle-alert"
|
|
434
438
|
:title="t('nuxtUiMongocamp.import.problems', { count: rowErrors.length }, rowErrors.length)"
|
|
435
439
|
>
|
|
@@ -456,6 +460,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
456
460
|
{{ t("nuxtUiMongocamp.import.previewTitle", { count: previewRows.length }) }}
|
|
457
461
|
</p>
|
|
458
462
|
<UTable
|
|
463
|
+
data-mongocamp-part="table"
|
|
459
464
|
:data="previewRows"
|
|
460
465
|
:columns="previewColumns"
|
|
461
466
|
class="max-h-64"
|
|
@@ -501,21 +506,21 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
501
506
|
<UAlert
|
|
502
507
|
v-if="serverError"
|
|
503
508
|
color="error"
|
|
504
|
-
variant="
|
|
509
|
+
:variant="ui.alert.variant"
|
|
505
510
|
icon="i-lucide-circle-alert"
|
|
506
511
|
:description="serverError"
|
|
507
512
|
/>
|
|
508
513
|
<template v-else-if="serverResult">
|
|
509
514
|
<UAlert
|
|
510
515
|
:color="serverResult.inserted > 0 ? 'success' : 'neutral'"
|
|
511
|
-
variant="
|
|
516
|
+
:variant="ui.alert.variant"
|
|
512
517
|
:icon="serverResult.inserted > 0 ? 'i-lucide-circle-check' : 'i-lucide-info'"
|
|
513
518
|
:title="t('nuxtUiMongocamp.import.result', { count: serverResult.inserted }, serverResult.inserted)"
|
|
514
519
|
/>
|
|
515
520
|
<UAlert
|
|
516
521
|
v-if="serverResult.failed > 0"
|
|
517
522
|
color="error"
|
|
518
|
-
variant="
|
|
523
|
+
:variant="ui.alert.variant"
|
|
519
524
|
icon="i-lucide-circle-alert"
|
|
520
525
|
:title="t('nuxtUiMongocamp.import.ndjsonFailed', { failed: serverResult.failed, read: serverResult.read })"
|
|
521
526
|
>
|
|
@@ -545,21 +550,21 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
545
550
|
>
|
|
546
551
|
<UAlert
|
|
547
552
|
:color="totalInserted > 0 ? 'success' : 'neutral'"
|
|
548
|
-
variant="
|
|
553
|
+
:variant="ui.alert.variant"
|
|
549
554
|
:icon="totalInserted > 0 ? 'i-lucide-circle-check' : 'i-lucide-info'"
|
|
550
555
|
:title="t('nuxtUiMongocamp.import.result', { count: totalInserted }, totalInserted)"
|
|
551
556
|
/>
|
|
552
557
|
<UAlert
|
|
553
558
|
v-if="skipped > 0"
|
|
554
559
|
color="warning"
|
|
555
|
-
variant="
|
|
560
|
+
:variant="ui.alert.variant"
|
|
556
561
|
icon="i-lucide-triangle-alert"
|
|
557
562
|
:description="t('nuxtUiMongocamp.import.aborted', { count: skipped })"
|
|
558
563
|
/>
|
|
559
564
|
<UAlert
|
|
560
565
|
v-if="failures.length > 0"
|
|
561
566
|
color="error"
|
|
562
|
-
variant="
|
|
567
|
+
:variant="ui.alert.variant"
|
|
563
568
|
icon="i-lucide-circle-alert"
|
|
564
569
|
>
|
|
565
570
|
<template #description>
|
|
@@ -586,8 +591,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
586
591
|
<template v-if="step === 'preview'">
|
|
587
592
|
<UButton
|
|
588
593
|
:label="t('nuxtUiMongocamp.import.back')"
|
|
589
|
-
|
|
590
|
-
variant="ghost"
|
|
594
|
+
v-bind="ui.dialogCancel"
|
|
591
595
|
@click="backToSelect"
|
|
592
596
|
/>
|
|
593
597
|
<UButton
|
|
@@ -606,8 +610,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
606
610
|
<template v-else-if="step === 'importing'">
|
|
607
611
|
<UButton
|
|
608
612
|
:label="t('nuxtUiMongocamp.import.stop')"
|
|
609
|
-
|
|
610
|
-
variant="subtle"
|
|
613
|
+
v-bind="ui.secondaryAction"
|
|
611
614
|
@click="stopImport"
|
|
612
615
|
/>
|
|
613
616
|
</template>
|
|
@@ -615,8 +618,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
615
618
|
<UButton
|
|
616
619
|
v-if="failures.length > 0 && !serverFile"
|
|
617
620
|
:label="t('nuxtUiMongocamp.import.retryFailed')"
|
|
618
|
-
|
|
619
|
-
variant="subtle"
|
|
621
|
+
v-bind="ui.secondaryAction"
|
|
620
622
|
@click="retryFailed"
|
|
621
623
|
/>
|
|
622
624
|
<UButton
|
|
@@ -627,8 +629,7 @@ const limitsText = computed(() => ({ maxRows: DEFAULT_IMPORT_LIMITS.maxRows, max
|
|
|
627
629
|
<template v-else>
|
|
628
630
|
<UButton
|
|
629
631
|
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
630
|
-
|
|
631
|
-
variant="ghost"
|
|
632
|
+
v-bind="ui.dialogCancel"
|
|
632
633
|
@click="isOpen = false"
|
|
633
634
|
/>
|
|
634
635
|
</template>
|