@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
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;
|
|
@@ -34,6 +35,24 @@ interface ModuleOptions {
|
|
|
34
35
|
* `sessionGuard`; no effect in server proxy mode.
|
|
35
36
|
*/
|
|
36
37
|
sessionGuardVerify?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Opt-in for apps that keep working without a network (e.g. an installable PWA with its own local data):
|
|
40
|
+
* - `useMongocampConnection()` is kept current in the browser (online / offline / server unreachable, with retries);
|
|
41
|
+
* - the session guard clears a session only while the server can be reached, so an expired token never logs the
|
|
42
|
+
* user out while offline (nothing could renew it; the next navigation after the server is back decides);
|
|
43
|
+
* - the server version (`$mongocampVersion`) loads in the background with a timeout and never holds up the start.
|
|
44
|
+
* Default false.
|
|
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;
|
|
37
56
|
/**
|
|
38
57
|
* Path the session guard navigates to after clearing an expired session — e.g. '/login'. Always
|
|
39
58
|
* treated as allowed by the middleware itself, so it can never cause a redirect loop.
|
|
@@ -85,6 +104,13 @@ interface ModuleOptions {
|
|
|
85
104
|
interface ModulePublicRuntimeConfig {
|
|
86
105
|
nuxtUiMongocampOptions: ModuleOptions;
|
|
87
106
|
}
|
|
107
|
+
declare module '@nuxt/schema' {
|
|
108
|
+
interface AppConfigInput {
|
|
109
|
+
nuxtUiMongocamp?: {
|
|
110
|
+
ui?: MongocampUiThemeInput;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
88
114
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
89
115
|
|
|
90
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 = [];
|
|
@@ -53,6 +54,8 @@ const module$1 = defineNuxtModule({
|
|
|
53
54
|
logoutPath: "/logout",
|
|
54
55
|
sessionGuard: false,
|
|
55
56
|
sessionGuardVerify: false,
|
|
57
|
+
offline: false,
|
|
58
|
+
compactSession: false,
|
|
56
59
|
loginPath: "/",
|
|
57
60
|
managerRoles: [],
|
|
58
61
|
securedRouteParts: [],
|
|
@@ -109,6 +112,8 @@ const module$1 = defineNuxtModule({
|
|
|
109
112
|
});
|
|
110
113
|
});
|
|
111
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) });
|
|
112
117
|
if (options.formkitStyles) nuxt.options.css.unshift(resolve(runtimeDir, "assets/formkit.css"));
|
|
113
118
|
addPlugin(resolve(runtimeDir, "plugin"));
|
|
114
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">
|