@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
package/dist/module.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
import { MongocampPaths } from '../dist/runtime/utils/paths.js';
|
|
3
|
+
import { MongocampUiThemeInput } from '../dist/runtime/utils/uiTheme.js';
|
|
3
4
|
|
|
4
5
|
interface ModuleOptions {
|
|
5
6
|
useGlobalAuthMiddleware?: boolean;
|
|
@@ -43,6 +44,15 @@ interface ModuleOptions {
|
|
|
43
44
|
* Default false.
|
|
44
45
|
*/
|
|
45
46
|
offline?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Opt-in: keep only `user`, `isAdmin` and `roles` of the user profile in the session cookie. Without it the cookie holds
|
|
49
|
+
* the whole profile of the last login or token refresh — every grant and the API key — and a user with many grants
|
|
50
|
+
* exceeds the browser's ~4 KB cookie limit, so the login silently fails. The module reads grants from the server
|
|
51
|
+
* (`useMongocampPermissions`), never from the session; only `useMongocampAuth().userGrants` of
|
|
52
|
+
* `@sfxcode/nuxt-mongocamp-server` comes back empty with it. A larger cookie from before is shrunk on the next start.
|
|
53
|
+
* Default false.
|
|
54
|
+
*/
|
|
55
|
+
compactSession?: boolean;
|
|
46
56
|
/**
|
|
47
57
|
* Path the session guard navigates to after clearing an expired session — e.g. '/login'. Always
|
|
48
58
|
* treated as allowed by the middleware itself, so it can never cause a redirect loop.
|
|
@@ -94,6 +104,13 @@ interface ModuleOptions {
|
|
|
94
104
|
interface ModulePublicRuntimeConfig {
|
|
95
105
|
nuxtUiMongocampOptions: ModuleOptions;
|
|
96
106
|
}
|
|
107
|
+
declare module '@nuxt/schema' {
|
|
108
|
+
interface AppConfigInput {
|
|
109
|
+
nuxtUiMongocamp?: {
|
|
110
|
+
ui?: MongocampUiThemeInput;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
97
114
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
98
115
|
|
|
99
116
|
export { _default as default };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { existsSync } from 'node:fs';
|
|
|
2
2
|
import { createResolver, defineNuxtModule, addPlugin, addComponentsDir, addImportsDir, addServerHandler } from '@nuxt/kit';
|
|
3
3
|
import { defu } from 'defu';
|
|
4
4
|
import { consola } from 'consola';
|
|
5
|
+
import { DEFAULT_UI } from '../dist/runtime/utils/uiTheme.js';
|
|
5
6
|
|
|
6
7
|
function optionWarnings(options) {
|
|
7
8
|
const warnings = [];
|
|
@@ -54,6 +55,7 @@ const module$1 = defineNuxtModule({
|
|
|
54
55
|
sessionGuard: false,
|
|
55
56
|
sessionGuardVerify: false,
|
|
56
57
|
offline: false,
|
|
58
|
+
compactSession: false,
|
|
57
59
|
loginPath: "/",
|
|
58
60
|
managerRoles: [],
|
|
59
61
|
securedRouteParts: [],
|
|
@@ -110,6 +112,8 @@ const module$1 = defineNuxtModule({
|
|
|
110
112
|
});
|
|
111
113
|
});
|
|
112
114
|
for (const warning of optionWarnings(options)) consola.warn(warning);
|
|
115
|
+
const appConfig = nuxt.options.appConfig;
|
|
116
|
+
appConfig.nuxtUiMongocamp = defu(appConfig.nuxtUiMongocamp, { ui: structuredClone(DEFAULT_UI) });
|
|
113
117
|
if (options.formkitStyles) nuxt.options.css.unshift(resolve(runtimeDir, "assets/formkit.css"));
|
|
114
118
|
addPlugin(resolve(runtimeDir, "plugin"));
|
|
115
119
|
addComponentsDir({ path: resolve(runtimeDir, "components") });
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { reactive, ref, resolveComponent } from "vue";
|
|
3
3
|
import { useI18n, useMongocampAccount, useToast } from "#imports";
|
|
4
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
4
5
|
const { t } = useI18n();
|
|
6
|
+
const ui = useMongocampUi();
|
|
5
7
|
const { fetchProfile, changePassword, regenerateApiKey } = useMongocampAccount();
|
|
6
8
|
const toast = useToast();
|
|
7
9
|
const UBadge = resolveComponent("UBadge");
|
|
@@ -59,7 +61,7 @@ loadProfile();
|
|
|
59
61
|
</script>
|
|
60
62
|
|
|
61
63
|
<template>
|
|
62
|
-
<div class="flex flex-col gap-4">
|
|
64
|
+
<div class="mongocamp-account flex flex-col gap-4">
|
|
63
65
|
<USkeleton
|
|
64
66
|
v-if="loading"
|
|
65
67
|
class="h-32 w-full"
|
|
@@ -90,8 +92,8 @@ loadProfile();
|
|
|
90
92
|
</div>
|
|
91
93
|
<UBadge
|
|
92
94
|
:label="profile.isAdmin ? t('nuxtUiMongocamp.common.admin') : t('nuxtUiMongocamp.common.standard')"
|
|
93
|
-
:color="profile.isAdmin ? '
|
|
94
|
-
variant="
|
|
95
|
+
:color="profile.isAdmin ? 'primary' : 'neutral'"
|
|
96
|
+
:variant="ui.badge.variant"
|
|
95
97
|
/>
|
|
96
98
|
</div>
|
|
97
99
|
<div>
|
|
@@ -107,7 +109,7 @@ loadProfile();
|
|
|
107
109
|
:key="role"
|
|
108
110
|
:label="role"
|
|
109
111
|
color="primary"
|
|
110
|
-
variant="
|
|
112
|
+
:variant="ui.badge.variant"
|
|
111
113
|
/>
|
|
112
114
|
</div>
|
|
113
115
|
<span
|
|
@@ -151,15 +153,13 @@ loadProfile();
|
|
|
151
153
|
<UButton
|
|
152
154
|
icon="i-lucide-copy"
|
|
153
155
|
:label="t('nuxtUiMongocamp.common.copy')"
|
|
154
|
-
|
|
155
|
-
variant="subtle"
|
|
156
|
+
v-bind="ui.secondaryAction"
|
|
156
157
|
@click="copyApiKey"
|
|
157
158
|
/>
|
|
158
159
|
</div>
|
|
159
160
|
<UButton
|
|
160
161
|
:label="t('nuxtUiMongocamp.common.dismiss')"
|
|
161
|
-
|
|
162
|
-
variant="ghost"
|
|
162
|
+
v-bind="ui.dialogCancel"
|
|
163
163
|
class="self-start"
|
|
164
164
|
@click="dismissApiKey"
|
|
165
165
|
/>
|
|
@@ -173,8 +173,7 @@ loadProfile();
|
|
|
173
173
|
</p>
|
|
174
174
|
<UButton
|
|
175
175
|
:label="t('nuxtUiMongocamp.account.regenerateApiKey')"
|
|
176
|
-
|
|
177
|
-
variant="subtle"
|
|
176
|
+
v-bind="{ ...ui.alertAction, color: 'error' }"
|
|
178
177
|
icon="i-lucide-key-round"
|
|
179
178
|
@click="openRegenerateModal"
|
|
180
179
|
/>
|
|
@@ -184,7 +183,7 @@ loadProfile();
|
|
|
184
183
|
<UModal
|
|
185
184
|
v-model:open="isRegenerateModalOpen"
|
|
186
185
|
:title="t('nuxtUiMongocamp.account.regenerateApiKey')"
|
|
187
|
-
:ui="{ footer:
|
|
186
|
+
:ui="{ footer: ui.modal.footer }"
|
|
188
187
|
>
|
|
189
188
|
<template #body>
|
|
190
189
|
<p>{{ t("nuxtUiMongocamp.account.confirmRegenerate") }}</p>
|
|
@@ -192,13 +191,12 @@ loadProfile();
|
|
|
192
191
|
<template #footer>
|
|
193
192
|
<UButton
|
|
194
193
|
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
195
|
-
|
|
196
|
-
variant="ghost"
|
|
194
|
+
v-bind="ui.dialogCancel"
|
|
197
195
|
@click="closeRegenerateModal"
|
|
198
196
|
/>
|
|
199
197
|
<UButton
|
|
200
198
|
:label="t('nuxtUiMongocamp.account.regenerate')"
|
|
201
|
-
|
|
199
|
+
v-bind="ui.dangerAction"
|
|
202
200
|
icon="i-lucide-key-round"
|
|
203
201
|
@click="handleRegenerateApiKey"
|
|
204
202
|
/>
|
|
@@ -16,6 +16,7 @@ import { previewPipeline } from "../utils/aggregationPreview";
|
|
|
16
16
|
import { DEFAULT_TOP, MAX_TOP, templateStages, TEMPLATES, validateTemplateInput } from "../utils/aggregationTemplates";
|
|
17
17
|
import { formatCell, resultColumns } from "../utils/aggregationResult";
|
|
18
18
|
import { downloadTextFile, rowsToCsv } from "../utils/exportRows";
|
|
19
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
19
20
|
const props = defineProps({
|
|
20
21
|
collectionName: { type: String, required: true },
|
|
21
22
|
filter: { type: String, required: false }
|
|
@@ -38,6 +39,7 @@ const DEFAULT_TEXT = {
|
|
|
38
39
|
$bucketAuto: '{ "groupBy": "$field", "buckets": 5 }'
|
|
39
40
|
};
|
|
40
41
|
const { t } = useI18n();
|
|
42
|
+
const ui = useMongocampUi();
|
|
41
43
|
const { runAggregation, describeAggregationError, listFieldNames } = useMongocampAggregation();
|
|
42
44
|
const { saved: savedPipelines, save: savePipeline, remove: removeSavedPipeline } = useMongocampSavedPipelines(() => props.collectionName);
|
|
43
45
|
let idCounter = 0;
|
|
@@ -270,7 +272,7 @@ const exportMenuItems = computed(() => [
|
|
|
270
272
|
</script>
|
|
271
273
|
|
|
272
274
|
<template>
|
|
273
|
-
<div class="flex flex-col gap-4">
|
|
275
|
+
<div class="mongocamp-aggregation-builder flex flex-col gap-4">
|
|
274
276
|
<div
|
|
275
277
|
v-if="appliedFilter"
|
|
276
278
|
class="flex flex-wrap items-center gap-2 text-sm"
|
|
@@ -280,14 +282,12 @@ const exportMenuItems = computed(() => [
|
|
|
280
282
|
<UBadge
|
|
281
283
|
:label="appliedFilter"
|
|
282
284
|
color="neutral"
|
|
283
|
-
variant="
|
|
285
|
+
:variant="ui.badge.variant"
|
|
284
286
|
class="font-mono"
|
|
285
287
|
/>
|
|
286
288
|
<UButton
|
|
287
289
|
icon="i-lucide-x"
|
|
288
|
-
|
|
289
|
-
variant="ghost"
|
|
290
|
-
size="xs"
|
|
290
|
+
v-bind="ui.compactButton"
|
|
291
291
|
:aria-label="t('nuxtUiMongocamp.aggregation.removeFilter')"
|
|
292
292
|
@click="appliedFilter = void 0"
|
|
293
293
|
/>
|
|
@@ -296,7 +296,7 @@ const exportMenuItems = computed(() => [
|
|
|
296
296
|
<div class="flex items-center gap-1">
|
|
297
297
|
<UButton
|
|
298
298
|
color="neutral"
|
|
299
|
-
size="
|
|
299
|
+
:size="ui.controlSize"
|
|
300
300
|
:variant="mode === 'visual' ? 'subtle' : 'ghost'"
|
|
301
301
|
:aria-pressed="mode === 'visual'"
|
|
302
302
|
:label="t('nuxtUiMongocamp.aggregation.modeVisual')"
|
|
@@ -304,7 +304,7 @@ const exportMenuItems = computed(() => [
|
|
|
304
304
|
/>
|
|
305
305
|
<UButton
|
|
306
306
|
color="neutral"
|
|
307
|
-
size="
|
|
307
|
+
:size="ui.controlSize"
|
|
308
308
|
:variant="mode === 'json' ? 'subtle' : 'ghost'"
|
|
309
309
|
:aria-pressed="mode === 'json'"
|
|
310
310
|
:label="t('nuxtUiMongocamp.aggregation.modeJson')"
|
|
@@ -329,7 +329,7 @@ const exportMenuItems = computed(() => [
|
|
|
329
329
|
icon="i-lucide-wand-sparkles"
|
|
330
330
|
color="neutral"
|
|
331
331
|
variant="soft"
|
|
332
|
-
size="
|
|
332
|
+
:size="ui.controlSize"
|
|
333
333
|
:label="t('nuxtUiMongocamp.aggregation.templatesButton')"
|
|
334
334
|
/>
|
|
335
335
|
<template #content>
|
|
@@ -417,7 +417,7 @@ const exportMenuItems = computed(() => [
|
|
|
417
417
|
icon="i-lucide-bookmark"
|
|
418
418
|
color="neutral"
|
|
419
419
|
variant="soft"
|
|
420
|
-
size="
|
|
420
|
+
:size="ui.controlSize"
|
|
421
421
|
:label="t('nuxtUiMongocamp.aggregation.savedButton')"
|
|
422
422
|
/>
|
|
423
423
|
<template #content>
|
|
@@ -440,18 +440,14 @@ const exportMenuItems = computed(() => [
|
|
|
440
440
|
class="flex items-center gap-1"
|
|
441
441
|
>
|
|
442
442
|
<UButton
|
|
443
|
-
|
|
444
|
-
variant="ghost"
|
|
445
|
-
size="sm"
|
|
443
|
+
v-bind="ui.iconButton"
|
|
446
444
|
class="min-w-0 flex-1 justify-start"
|
|
447
445
|
:label="entry.name"
|
|
448
446
|
@click="applySaved(entry)"
|
|
449
447
|
/>
|
|
450
448
|
<UButton
|
|
451
449
|
icon="i-lucide-trash-2"
|
|
452
|
-
|
|
453
|
-
variant="ghost"
|
|
454
|
-
size="sm"
|
|
450
|
+
v-bind="{ ...ui.iconButton, color: 'error' }"
|
|
455
451
|
:aria-label="t('nuxtUiMongocamp.aggregation.deleteSaved', { name: entry.name })"
|
|
456
452
|
@click="removeSavedPipeline(entry.name)"
|
|
457
453
|
/>
|
|
@@ -462,7 +458,7 @@ const exportMenuItems = computed(() => [
|
|
|
462
458
|
>
|
|
463
459
|
<UInput
|
|
464
460
|
v-model="saveName"
|
|
465
|
-
size="
|
|
461
|
+
:size="ui.controlSize"
|
|
466
462
|
class="min-w-0 flex-1"
|
|
467
463
|
maxlength="80"
|
|
468
464
|
:placeholder="t('nuxtUiMongocamp.aggregation.saveNamePlaceholder')"
|
|
@@ -471,7 +467,7 @@ const exportMenuItems = computed(() => [
|
|
|
471
467
|
<UButton
|
|
472
468
|
type="submit"
|
|
473
469
|
icon="i-lucide-save"
|
|
474
|
-
size="
|
|
470
|
+
:size="ui.controlSize"
|
|
475
471
|
:label="t('nuxtUiMongocamp.aggregation.save')"
|
|
476
472
|
:disabled="saveName.trim() === ''"
|
|
477
473
|
/>
|
|
@@ -494,7 +490,7 @@ const exportMenuItems = computed(() => [
|
|
|
494
490
|
<UAlert
|
|
495
491
|
v-if="modeError"
|
|
496
492
|
color="warning"
|
|
497
|
-
variant="
|
|
493
|
+
:variant="ui.alert.variant"
|
|
498
494
|
icon="i-lucide-triangle-alert"
|
|
499
495
|
:description="modeError"
|
|
500
496
|
/>
|
|
@@ -516,27 +512,21 @@ const exportMenuItems = computed(() => [
|
|
|
516
512
|
<div class="flex items-center">
|
|
517
513
|
<UButton
|
|
518
514
|
icon="i-lucide-arrow-up"
|
|
519
|
-
|
|
520
|
-
variant="ghost"
|
|
521
|
-
size="sm"
|
|
515
|
+
v-bind="ui.iconButton"
|
|
522
516
|
:disabled="index === 0"
|
|
523
517
|
:aria-label="t('nuxtUiMongocamp.aggregation.moveUp')"
|
|
524
518
|
@click="moveStage(index, -1)"
|
|
525
519
|
/>
|
|
526
520
|
<UButton
|
|
527
521
|
icon="i-lucide-arrow-down"
|
|
528
|
-
|
|
529
|
-
variant="ghost"
|
|
530
|
-
size="sm"
|
|
522
|
+
v-bind="ui.iconButton"
|
|
531
523
|
:disabled="index === drafts.length - 1"
|
|
532
524
|
:aria-label="t('nuxtUiMongocamp.aggregation.moveDown')"
|
|
533
525
|
@click="moveStage(index, 1)"
|
|
534
526
|
/>
|
|
535
527
|
<UButton
|
|
536
528
|
icon="i-lucide-x"
|
|
537
|
-
|
|
538
|
-
variant="ghost"
|
|
539
|
-
size="sm"
|
|
529
|
+
v-bind="ui.iconButton"
|
|
540
530
|
:aria-label="t('nuxtUiMongocamp.aggregation.removeStage')"
|
|
541
531
|
@click="removeStage(index)"
|
|
542
532
|
/>
|
|
@@ -558,9 +548,7 @@ const exportMenuItems = computed(() => [
|
|
|
558
548
|
<div class="flex flex-col gap-2">
|
|
559
549
|
<UButton
|
|
560
550
|
:icon="openPreviews.has(draft.id) ? 'i-lucide-eye-off' : 'i-lucide-eye'"
|
|
561
|
-
|
|
562
|
-
variant="ghost"
|
|
563
|
-
size="xs"
|
|
551
|
+
v-bind="ui.compactButton"
|
|
564
552
|
class="self-start"
|
|
565
553
|
:aria-pressed="openPreviews.has(draft.id)"
|
|
566
554
|
:label="openPreviews.has(draft.id) ? t('nuxtUiMongocamp.aggregation.previewHide') : t('nuxtUiMongocamp.aggregation.previewShow')"
|
|
@@ -579,15 +567,13 @@ const exportMenuItems = computed(() => [
|
|
|
579
567
|
<USelect
|
|
580
568
|
v-model="newStageType"
|
|
581
569
|
:items="stageTypeItems"
|
|
582
|
-
size="
|
|
570
|
+
:size="ui.controlSize"
|
|
583
571
|
class="w-72"
|
|
584
572
|
:aria-label="t('nuxtUiMongocamp.aggregation.newStageType')"
|
|
585
573
|
/>
|
|
586
574
|
<UButton
|
|
587
575
|
icon="i-lucide-plus"
|
|
588
|
-
|
|
589
|
-
variant="ghost"
|
|
590
|
-
size="sm"
|
|
576
|
+
v-bind="ui.iconButton"
|
|
591
577
|
:label="t('nuxtUiMongocamp.aggregation.addStage')"
|
|
592
578
|
@click="addStage"
|
|
593
579
|
/>
|
|
@@ -617,7 +603,7 @@ const exportMenuItems = computed(() => [
|
|
|
617
603
|
<UAlert
|
|
618
604
|
v-if="runError"
|
|
619
605
|
:color="runError.kind === 'retryable' ? 'warning' : 'error'"
|
|
620
|
-
variant="
|
|
606
|
+
:variant="ui.alert.variant"
|
|
621
607
|
icon="i-lucide-circle-alert"
|
|
622
608
|
:title="t('nuxtUiMongocamp.aggregation.runFailedTitle')"
|
|
623
609
|
:description="runError.message"
|
|
@@ -627,15 +613,14 @@ const exportMenuItems = computed(() => [
|
|
|
627
613
|
v-if="runError.kind === 'unauthorized'"
|
|
628
614
|
:label="t('nuxtUiMongocamp.errors.loginAgain')"
|
|
629
615
|
to="/"
|
|
630
|
-
|
|
631
|
-
variant="subtle"
|
|
616
|
+
v-bind="{ ...ui.alertAction, color: 'error' }"
|
|
632
617
|
icon="i-lucide-log-in"
|
|
633
618
|
/>
|
|
634
619
|
<UButton
|
|
635
620
|
v-else-if="runError.kind !== 'forbidden'"
|
|
636
621
|
:label="t('nuxtUiMongocamp.common.retry')"
|
|
637
622
|
:color="runError.kind === 'retryable' ? 'warning' : 'error'"
|
|
638
|
-
|
|
623
|
+
v-bind="ui.alertAction"
|
|
639
624
|
icon="i-lucide-refresh-cw"
|
|
640
625
|
@click="execute(page)"
|
|
641
626
|
/>
|
|
@@ -648,7 +633,7 @@ const exportMenuItems = computed(() => [
|
|
|
648
633
|
{{ t("nuxtUiMongocamp.aggregation.resultsCount", { count: result.total }, result.total) }}
|
|
649
634
|
</span>
|
|
650
635
|
<div class="flex flex-wrap items-center gap-2">
|
|
651
|
-
<UFieldGroup size="
|
|
636
|
+
<UFieldGroup :size="ui.controlSize">
|
|
652
637
|
<UButton
|
|
653
638
|
icon="i-lucide-table"
|
|
654
639
|
color="neutral"
|
|
@@ -670,9 +655,7 @@ const exportMenuItems = computed(() => [
|
|
|
670
655
|
<UDropdownMenu :items="exportMenuItems">
|
|
671
656
|
<UButton
|
|
672
657
|
icon="i-lucide-download"
|
|
673
|
-
|
|
674
|
-
variant="ghost"
|
|
675
|
-
size="sm"
|
|
658
|
+
v-bind="ui.iconButton"
|
|
676
659
|
:disabled="result.rows.length === 0"
|
|
677
660
|
:aria-label="t('nuxtUiMongocamp.aggregation.exportTooltip')"
|
|
678
661
|
/>
|
|
@@ -680,7 +663,7 @@ const exportMenuItems = computed(() => [
|
|
|
680
663
|
<USelect
|
|
681
664
|
:model-value="rowsPerPage"
|
|
682
665
|
:items="PAGE_SIZES"
|
|
683
|
-
size="
|
|
666
|
+
:size="ui.controlSize"
|
|
684
667
|
class="w-20"
|
|
685
668
|
:aria-label="t('nuxtUiMongocamp.aggregation.pageSize')"
|
|
686
669
|
@update:model-value="onPageSizeChange"
|
|
@@ -700,6 +683,7 @@ const exportMenuItems = computed(() => [
|
|
|
700
683
|
/>
|
|
701
684
|
<UTable
|
|
702
685
|
v-else
|
|
686
|
+
data-mongocamp-part="table"
|
|
703
687
|
:data="result.rows"
|
|
704
688
|
:columns="tableColumns"
|
|
705
689
|
:loading="running"
|
|
@@ -3,10 +3,12 @@ import { computed, ref, watch } from "vue";
|
|
|
3
3
|
import { useI18n } from "#imports";
|
|
4
4
|
import { resultColumns } from "../utils/aggregationResult";
|
|
5
5
|
import { buildResultChart, LABEL_KEY, MAX_CHART_ROWS, MAX_SERIES, valueColumns } from "../utils/resultChart";
|
|
6
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
6
7
|
const props = defineProps({
|
|
7
8
|
rows: { type: Array, required: true }
|
|
8
9
|
});
|
|
9
10
|
const { t } = useI18n();
|
|
11
|
+
const ui = useMongocampUi();
|
|
10
12
|
const columns = computed(() => resultColumns(props.rows));
|
|
11
13
|
const labelKey = ref(void 0);
|
|
12
14
|
const valueKeys = ref([]);
|
|
@@ -24,13 +26,13 @@ const categories = computed(() => (chart.value?.valueKeys ?? []).map((key) => ({
|
|
|
24
26
|
|
|
25
27
|
<template>
|
|
26
28
|
<div
|
|
27
|
-
class="flex flex-col gap-3"
|
|
29
|
+
class="mongocamp-aggregation-chart flex flex-col gap-3"
|
|
28
30
|
data-testid="aggregation-chart"
|
|
29
31
|
>
|
|
30
32
|
<UAlert
|
|
31
33
|
v-if="!chart"
|
|
32
34
|
color="neutral"
|
|
33
|
-
variant="
|
|
35
|
+
:variant="ui.alert.variant"
|
|
34
36
|
icon="i-lucide-chart-no-axes-column"
|
|
35
37
|
:title="t('nuxtUiMongocamp.aggregationChart.nothing')"
|
|
36
38
|
data-testid="chart-nothing"
|
|
@@ -41,7 +43,7 @@ const categories = computed(() => (chart.value?.valueKeys ?? []).map((key) => ({
|
|
|
41
43
|
<USelect
|
|
42
44
|
:model-value="chart.labelKey"
|
|
43
45
|
:items="columns"
|
|
44
|
-
size="
|
|
46
|
+
:size="ui.controlSize"
|
|
45
47
|
class="w-40"
|
|
46
48
|
@update:model-value="labelKey = $event;
|
|
47
49
|
valueKeys = []"
|
|
@@ -52,7 +54,7 @@ const categories = computed(() => (chart.value?.valueKeys ?? []).map((key) => ({
|
|
|
52
54
|
:model-value="chart.valueKeys"
|
|
53
55
|
:items="numberColumns"
|
|
54
56
|
multiple
|
|
55
|
-
size="
|
|
57
|
+
:size="ui.controlSize"
|
|
56
58
|
class="w-48"
|
|
57
59
|
@update:model-value="valueKeys = $event"
|
|
58
60
|
/>
|
|
@@ -61,7 +63,7 @@ const categories = computed(() => (chart.value?.valueKeys ?? []).map((key) => ({
|
|
|
61
63
|
<USelect
|
|
62
64
|
:model-value="chart.kind"
|
|
63
65
|
:items="kinds"
|
|
64
|
-
size="
|
|
66
|
+
:size="ui.controlSize"
|
|
65
67
|
class="w-28"
|
|
66
68
|
@update:model-value="kind = $event"
|
|
67
69
|
/>
|
|
@@ -73,7 +73,7 @@ const columns = computed(() => resultColumns(rows.value));
|
|
|
73
73
|
|
|
74
74
|
<template>
|
|
75
75
|
<div
|
|
76
|
-
class="flex flex-col gap-1 rounded-md bg-elevated/50 p-2"
|
|
76
|
+
class="mongocamp-aggregation-stage-preview flex flex-col gap-1 rounded-md bg-elevated/50 p-2"
|
|
77
77
|
data-test="stage-preview"
|
|
78
78
|
>
|
|
79
79
|
<p class="text-xs text-dimmed">
|
|
@@ -8,12 +8,14 @@ import { useMongocampPermissions } from "../composables/useMongocampPermissions"
|
|
|
8
8
|
import MongocampCollectionCharts from "./MongocampCollectionCharts.vue";
|
|
9
9
|
import { useMongocampQuery } from "../composables/useMongocampQuery";
|
|
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,
|
|
@@ -112,8 +114,7 @@ function withTooltip(text, node) {
|
|
|
112
114
|
function sortHeader(column, label) {
|
|
113
115
|
const isSorted = column.getIsSorted();
|
|
114
116
|
return h(UButton, {
|
|
115
|
-
|
|
116
|
-
variant: "ghost",
|
|
117
|
+
...ui.value.sortHeader,
|
|
117
118
|
label,
|
|
118
119
|
icon: isSorted === "asc" ? "i-lucide-arrow-up-narrow-wide" : isSorted === "desc" ? "i-lucide-arrow-down-wide-narrow" : "i-lucide-arrow-up-down",
|
|
119
120
|
class: "-mx-2.5",
|
|
@@ -151,9 +152,7 @@ function makeMetadataCell() {
|
|
|
151
152
|
const label = keys.length === 1 ? t("nuxtUiMongocamp.bucketFiles.keyCount") : t("nuxtUiMongocamp.bucketFiles.keysCount", { count: keys.length });
|
|
152
153
|
return withTooltip(t("nuxtUiMongocamp.bucketFiles.viewMetadataTooltip"), h(UButton, {
|
|
153
154
|
"icon": "i-lucide-braces",
|
|
154
|
-
|
|
155
|
-
"variant": "ghost",
|
|
156
|
-
"size": "xs",
|
|
155
|
+
...ui.value.compactButton,
|
|
157
156
|
label,
|
|
158
157
|
// Starts with the visible text, so voice control ("click 1 key") still finds it
|
|
159
158
|
"aria-label": `${label}: ${t("nuxtUiMongocamp.bucketFiles.viewMetadataTooltip")}`,
|
|
@@ -218,38 +217,31 @@ function makeActionsColumn() {
|
|
|
218
217
|
header: "",
|
|
219
218
|
cell: ({ row }) => {
|
|
220
219
|
const file = row.original;
|
|
221
|
-
return h("div", { class: "flex gap-1 justify-end" }, [
|
|
220
|
+
return h("div", { "class": "flex gap-1 justify-end", "data-mongocamp-part": "row-actions" }, [
|
|
222
221
|
withTooltip(t("nuxtUiMongocamp.bucketFiles.previewTooltip"), h(UButton, {
|
|
223
222
|
"icon": "i-lucide-eye",
|
|
224
|
-
|
|
225
|
-
"variant": "ghost",
|
|
226
|
-
"size": "sm",
|
|
223
|
+
...ui.value.iconButton,
|
|
227
224
|
"aria-label": t("nuxtUiMongocamp.bucketFiles.previewTooltip"),
|
|
228
225
|
"onClick": () => openPreview(file)
|
|
229
226
|
})),
|
|
230
227
|
withTooltip(t("nuxtUiMongocamp.bucketFiles.downloadFileTooltip"), h(UButton, {
|
|
231
228
|
"icon": "i-lucide-download",
|
|
232
|
-
|
|
233
|
-
"variant": "ghost",
|
|
234
|
-
"size": "sm",
|
|
229
|
+
...ui.value.iconButton,
|
|
235
230
|
"aria-label": t("nuxtUiMongocamp.bucketFiles.downloadFileTooltip"),
|
|
236
231
|
"loading": downloadingFileIds.value.has(file.id),
|
|
237
232
|
"onClick": () => downloadFile(props.bucketName, file.id)
|
|
238
233
|
})),
|
|
239
234
|
withTooltip(t("nuxtUiMongocamp.bucketFiles.renameTooltip"), h(UButton, {
|
|
240
235
|
"icon": "i-lucide-pencil",
|
|
241
|
-
|
|
242
|
-
"variant": "ghost",
|
|
243
|
-
"size": "sm",
|
|
236
|
+
...ui.value.iconButton,
|
|
244
237
|
"aria-label": t("nuxtUiMongocamp.bucketFiles.renameTooltip"),
|
|
245
238
|
"loading": fileActionInFlight.value.has(file.id),
|
|
246
239
|
"onClick": () => openRename(file)
|
|
247
240
|
})),
|
|
248
241
|
withTooltip(t("nuxtUiMongocamp.bucketFiles.deleteFileTooltip"), h(UButton, {
|
|
249
242
|
"icon": "i-lucide-trash-2",
|
|
243
|
+
...ui.value.iconButton,
|
|
250
244
|
"color": "error",
|
|
251
|
-
"variant": "ghost",
|
|
252
|
-
"size": "sm",
|
|
253
245
|
"aria-label": t("nuxtUiMongocamp.bucketFiles.deleteFileTooltip"),
|
|
254
246
|
"loading": fileActionInFlight.value.has(file.id),
|
|
255
247
|
"onClick": () => confirmDeleteFile(file)
|
|
@@ -339,7 +331,7 @@ defineExpose({ refresh: init });
|
|
|
339
331
|
|
|
340
332
|
<template>
|
|
341
333
|
<div
|
|
342
|
-
class="relative flex flex-col gap-4"
|
|
334
|
+
class="mongocamp-bucket-files relative flex flex-col gap-4"
|
|
343
335
|
@dragenter.prevent="onDragEnter"
|
|
344
336
|
@dragover.prevent
|
|
345
337
|
@dragleave.prevent="onDragLeave"
|
|
@@ -357,20 +349,21 @@ defineExpose({ refresh: init });
|
|
|
357
349
|
v-model="filterText"
|
|
358
350
|
icon="i-lucide-search"
|
|
359
351
|
:placeholder="t('nuxtUiMongocamp.bucketFiles.filterPlaceholder')"
|
|
360
|
-
size="
|
|
352
|
+
:size="ui.controlSize"
|
|
361
353
|
class="flex-1 max-w-xs"
|
|
362
354
|
@input="onFilterInput"
|
|
363
355
|
/>
|
|
364
|
-
<div
|
|
356
|
+
<div
|
|
357
|
+
data-mongocamp-part="toolbar"
|
|
358
|
+
class="flex items-center gap-2"
|
|
359
|
+
>
|
|
365
360
|
<span class="text-sm text-muted shrink-0">
|
|
366
361
|
{{ t("nuxtUiMongocamp.bucketFiles.filesCount", { count: total }) }}
|
|
367
362
|
</span>
|
|
368
363
|
<UTooltip :text="t('nuxtUiMongocamp.bucketFiles.uploadFileTooltip')">
|
|
369
364
|
<UButton
|
|
370
365
|
icon="i-lucide-upload"
|
|
371
|
-
|
|
372
|
-
variant="ghost"
|
|
373
|
-
size="sm"
|
|
366
|
+
v-bind="{ ...ui.iconButton, color: 'primary' }"
|
|
374
367
|
:loading="uploading"
|
|
375
368
|
:aria-label="t('nuxtUiMongocamp.bucketFiles.uploadFileTooltip')"
|
|
376
369
|
@click="openFilePicker"
|
|
@@ -389,8 +382,7 @@ defineExpose({ refresh: init });
|
|
|
389
382
|
>
|
|
390
383
|
<UButton
|
|
391
384
|
icon="i-lucide-refresh-cw"
|
|
392
|
-
|
|
393
|
-
variant="ghost"
|
|
385
|
+
v-bind="ui.toolbarButton"
|
|
394
386
|
:loading="loading"
|
|
395
387
|
:aria-label="t('nuxtUiMongocamp.bucketFiles.reloadTooltip')"
|
|
396
388
|
@click="init"
|
|
@@ -408,7 +400,7 @@ defineExpose({ refresh: init });
|
|
|
408
400
|
<UAlert
|
|
409
401
|
v-if="uploadProgress"
|
|
410
402
|
color="neutral"
|
|
411
|
-
variant="
|
|
403
|
+
:variant="ui.alert.variant"
|
|
412
404
|
icon="i-lucide-upload"
|
|
413
405
|
:title="t('nuxtUiMongocamp.bucketFiles.uploadProgress', { done: uploadProgress.done, total: uploadProgress.total })"
|
|
414
406
|
:description="uploadProgress.current"
|
|
@@ -416,7 +408,7 @@ defineExpose({ refresh: init });
|
|
|
416
408
|
<UAlert
|
|
417
409
|
v-else-if="uploadResult"
|
|
418
410
|
:color="uploadResult.failed.length ? 'warning' : 'success'"
|
|
419
|
-
variant="
|
|
411
|
+
:variant="ui.alert.variant"
|
|
420
412
|
:icon="uploadResult.failed.length ? 'i-lucide-triangle-alert' : 'i-lucide-circle-check'"
|
|
421
413
|
:title="t('nuxtUiMongocamp.bucketFiles.uploadSummary', { uploaded: uploadResult.uploaded, failed: uploadResult.failed.length })"
|
|
422
414
|
close
|
|
@@ -443,6 +435,7 @@ defineExpose({ refresh: init });
|
|
|
443
435
|
|
|
444
436
|
<UTable
|
|
445
437
|
v-model:sorting="sorting"
|
|
438
|
+
data-mongocamp-part="table"
|
|
446
439
|
:sorting-options="{ manualSorting: true }"
|
|
447
440
|
:data="files"
|
|
448
441
|
:columns="columns"
|
|
@@ -465,7 +458,7 @@ defineExpose({ refresh: init });
|
|
|
465
458
|
<UModal
|
|
466
459
|
v-model:open="isRenameModalOpen"
|
|
467
460
|
:title="t('nuxtUiMongocamp.bucketFiles.renameTitle')"
|
|
468
|
-
:ui="{ footer:
|
|
461
|
+
:ui="{ footer: ui.modal.footer }"
|
|
469
462
|
>
|
|
470
463
|
<template #body>
|
|
471
464
|
<div class="flex flex-col gap-4">
|
|
@@ -492,8 +485,7 @@ defineExpose({ refresh: init });
|
|
|
492
485
|
<template #footer>
|
|
493
486
|
<UButton
|
|
494
487
|
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
495
|
-
|
|
496
|
-
variant="ghost"
|
|
488
|
+
v-bind="ui.dialogCancel"
|
|
497
489
|
@click="isRenameModalOpen = false"
|
|
498
490
|
/>
|
|
499
491
|
<UButton
|
|
@@ -551,7 +543,7 @@ defineExpose({ refresh: init });
|
|
|
551
543
|
<UModal
|
|
552
544
|
v-model:open="isDeleteModalOpen"
|
|
553
545
|
:title="t('nuxtUiMongocamp.bucketFiles.deleteFileTitle')"
|
|
554
|
-
:ui="{ footer:
|
|
546
|
+
:ui="{ footer: ui.modal.footer }"
|
|
555
547
|
>
|
|
556
548
|
<template #body>
|
|
557
549
|
<p>{{ t("nuxtUiMongocamp.bucketFiles.confirmDeleteFile") }}</p>
|
|
@@ -559,13 +551,12 @@ defineExpose({ refresh: init });
|
|
|
559
551
|
<template #footer>
|
|
560
552
|
<UButton
|
|
561
553
|
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
562
|
-
|
|
563
|
-
variant="ghost"
|
|
554
|
+
v-bind="ui.dialogCancel"
|
|
564
555
|
@click="isDeleteModalOpen = false"
|
|
565
556
|
/>
|
|
566
557
|
<UButton
|
|
567
558
|
:label="t('nuxtUiMongocamp.common.delete')"
|
|
568
|
-
|
|
559
|
+
v-bind="ui.dangerAction"
|
|
569
560
|
icon="i-lucide-trash-2"
|
|
570
561
|
@click="handleDeleteFile"
|
|
571
562
|
/>
|