@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
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
} from "../utils/indexForm";
|
|
20
20
|
import { shortenLabel } from "../utils/chartData";
|
|
21
21
|
import MongocampConfirmByName from "./MongocampConfirmByName.vue";
|
|
22
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
22
23
|
const props = defineProps({
|
|
23
24
|
collectionName: { type: String, required: true },
|
|
24
25
|
canManage: { type: Boolean, required: false, default: true },
|
|
@@ -26,6 +27,7 @@ const props = defineProps({
|
|
|
26
27
|
});
|
|
27
28
|
const emit = defineEmits(["changed"]);
|
|
28
29
|
const { t } = useI18n();
|
|
30
|
+
const ui = useMongocampUi();
|
|
29
31
|
const toast = useToast();
|
|
30
32
|
const { describeServerError } = useMongocampError();
|
|
31
33
|
const { listIndexDetails, createOrderedIndex, createExpiringIndex, deleteIndex } = useMongocampIndex();
|
|
@@ -109,8 +111,8 @@ const columns = computed(() => [
|
|
|
109
111
|
if (row.original.hidden) flags.push({ label: "hidden", color: "warning" });
|
|
110
112
|
if (row.original.collation) flags.push({ label: "collation", color: "secondary" });
|
|
111
113
|
if (row.original.text && row.original.language) flags.push({ label: row.original.language, color: "info" });
|
|
112
|
-
const badges = flags.map((flag) => h(UBadge, { label: flag.label, color: flag.color, variant:
|
|
113
|
-
if (badges.length === 0) badges.push(h(UBadge, { label: t("nuxtUiMongocamp.collectionInfos.typeStandard"), color: "neutral", variant:
|
|
114
|
+
const badges = flags.map((flag) => h(UBadge, { label: flag.label, color: flag.color, variant: ui.value.badge.variant, size: "sm" }));
|
|
115
|
+
if (badges.length === 0) badges.push(h(UBadge, { label: t("nuxtUiMongocamp.collectionInfos.typeStandard"), color: "neutral", variant: ui.value.badge.variant, size: "sm" }));
|
|
114
116
|
return h("div", { class: "flex flex-wrap gap-1" }, badges);
|
|
115
117
|
}
|
|
116
118
|
},
|
|
@@ -129,7 +131,7 @@ const columns = computed(() => [
|
|
|
129
131
|
return withTooltip(t("nuxtUiMongocamp.indexes.neverUsedHint"), h(UBadge, {
|
|
130
132
|
label: t("nuxtUiMongocamp.indexes.neverUsed", { date: dateText(since) }),
|
|
131
133
|
color: "warning",
|
|
132
|
-
variant:
|
|
134
|
+
variant: ui.value.badge.variant,
|
|
133
135
|
size: "sm"
|
|
134
136
|
}));
|
|
135
137
|
}
|
|
@@ -145,13 +147,12 @@ const columns = computed(() => [
|
|
|
145
147
|
cell: ({ row }) => {
|
|
146
148
|
if (!props.canManage) return null;
|
|
147
149
|
if (!canDropIndex(row.original.name)) {
|
|
148
|
-
return h("div", { class: "flex justify-end" }, withTooltip(t("nuxtUiMongocamp.indexes.protectedHint"), h("span", { class: "text-dimmed text-xs" }, "\u2014")));
|
|
150
|
+
return h("div", { "class": "flex justify-end", "data-mongocamp-part": "row-actions" }, withTooltip(t("nuxtUiMongocamp.indexes.protectedHint"), h("span", { class: "text-dimmed text-xs" }, "\u2014")));
|
|
149
151
|
}
|
|
150
|
-
return h("div", { class: "flex justify-end" }, withTooltip(t("nuxtUiMongocamp.collectionInfos.deleteIndexTooltip"), h(UButton, {
|
|
152
|
+
return h("div", { "class": "flex justify-end", "data-mongocamp-part": "row-actions" }, withTooltip(t("nuxtUiMongocamp.collectionInfos.deleteIndexTooltip"), h(UButton, {
|
|
151
153
|
"icon": "i-lucide-trash-2",
|
|
154
|
+
...ui.value.iconButton,
|
|
152
155
|
"color": "error",
|
|
153
|
-
"variant": "ghost",
|
|
154
|
-
"size": "sm",
|
|
155
156
|
"aria-label": t("nuxtUiMongocamp.collectionInfos.deleteIndexTooltip"),
|
|
156
157
|
"onClick": () => askDrop(row.original.name)
|
|
157
158
|
})));
|
|
@@ -236,7 +237,7 @@ async function runDrop() {
|
|
|
236
237
|
</script>
|
|
237
238
|
|
|
238
239
|
<template>
|
|
239
|
-
<UCard>
|
|
240
|
+
<UCard class="mongocamp-indexes">
|
|
240
241
|
<template #header>
|
|
241
242
|
<div class="flex items-center justify-between gap-2">
|
|
242
243
|
<div class="flex items-center gap-2">
|
|
@@ -247,7 +248,7 @@ async function runDrop() {
|
|
|
247
248
|
<span class="font-semibold">{{ t("nuxtUiMongocamp.collectionInfos.indexes") }}</span>
|
|
248
249
|
<UBadge
|
|
249
250
|
:label="t('nuxtUiMongocamp.collectionInfos.indexesCount', { count: rows.length })"
|
|
250
|
-
variant="
|
|
251
|
+
:variant="ui.badge.variant"
|
|
251
252
|
color="neutral"
|
|
252
253
|
size="sm"
|
|
253
254
|
/>
|
|
@@ -256,9 +257,7 @@ async function runDrop() {
|
|
|
256
257
|
v-if="canManage"
|
|
257
258
|
icon="i-lucide-plus"
|
|
258
259
|
:label="t('nuxtUiMongocamp.collectionInfos.createIndex')"
|
|
259
|
-
|
|
260
|
-
variant="ghost"
|
|
261
|
-
size="sm"
|
|
260
|
+
v-bind="ui.iconButton"
|
|
262
261
|
@click="openCreate"
|
|
263
262
|
/>
|
|
264
263
|
</div>
|
|
@@ -275,6 +274,7 @@ async function runDrop() {
|
|
|
275
274
|
{{ t("nuxtUiMongocamp.indexes.usageUnavailable") }}
|
|
276
275
|
</p>
|
|
277
276
|
<UTable
|
|
277
|
+
data-mongocamp-part="table"
|
|
278
278
|
:data="rows"
|
|
279
279
|
:columns="columns"
|
|
280
280
|
:loading="loading"
|
|
@@ -354,8 +354,7 @@ async function runDrop() {
|
|
|
354
354
|
<UButton
|
|
355
355
|
v-if="!singleField && !textKind"
|
|
356
356
|
:icon="row.descending ? 'i-lucide-arrow-down-wide-narrow' : 'i-lucide-arrow-up-narrow-wide'"
|
|
357
|
-
|
|
358
|
-
variant="ghost"
|
|
357
|
+
v-bind="ui.toolbarButton"
|
|
359
358
|
:label="row.descending ? t('nuxtUiMongocamp.indexes.directionDesc') : t('nuxtUiMongocamp.indexes.directionAsc')"
|
|
360
359
|
:aria-label="t('nuxtUiMongocamp.indexes.directionLabel', { position: index + 1 })"
|
|
361
360
|
@click="row.descending = !row.descending"
|
|
@@ -363,8 +362,7 @@ async function runDrop() {
|
|
|
363
362
|
<UButton
|
|
364
363
|
v-if="!singleField && form.fields.length > 1"
|
|
365
364
|
icon="i-lucide-x"
|
|
366
|
-
|
|
367
|
-
variant="ghost"
|
|
365
|
+
v-bind="ui.toolbarButton"
|
|
368
366
|
:aria-label="t('nuxtUiMongocamp.indexes.removeField', { position: index + 1 })"
|
|
369
367
|
@click="removeField(index)"
|
|
370
368
|
/>
|
|
@@ -381,7 +379,7 @@ async function runDrop() {
|
|
|
381
379
|
icon="i-lucide-plus"
|
|
382
380
|
color="neutral"
|
|
383
381
|
variant="soft"
|
|
384
|
-
size="
|
|
382
|
+
:size="ui.controlSize"
|
|
385
383
|
class="self-start"
|
|
386
384
|
:label="t('nuxtUiMongocamp.indexes.addField')"
|
|
387
385
|
:disabled="form.fields.length >= MAX_INDEX_FIELDS"
|
|
@@ -4,6 +4,7 @@ import { useI18n, useMongocampError, useMongocampJobs, useToast } from "#imports
|
|
|
4
4
|
import { useMongocampAutoRefresh } from "../composables/useMongocampAutoRefresh";
|
|
5
5
|
import { useMongocampAdminGate } from "../composables/useMongocampAdminGate";
|
|
6
6
|
import { createListPagination } from "../utils/listPagination";
|
|
7
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
7
8
|
const props = defineProps({
|
|
8
9
|
autoRefresh: { type: Number, required: false, default: 0 },
|
|
9
10
|
hideHeading: { type: Boolean, required: false, default: false },
|
|
@@ -11,6 +12,7 @@ const props = defineProps({
|
|
|
11
12
|
});
|
|
12
13
|
const emit = defineEmits(["changed"]);
|
|
13
14
|
const { t } = useI18n();
|
|
15
|
+
const ui = useMongocampUi();
|
|
14
16
|
const { describeServerError } = useMongocampError();
|
|
15
17
|
const { listJobs, listPossibleJobs, registerJob, updateJob, executeJob, deleteJob } = useMongocampJobs();
|
|
16
18
|
const toast = useToast();
|
|
@@ -226,8 +228,7 @@ function withTooltip(text, node) {
|
|
|
226
228
|
function sortHeader(column, label) {
|
|
227
229
|
const isSorted = column.getIsSorted();
|
|
228
230
|
return h(UButton, {
|
|
229
|
-
|
|
230
|
-
variant: "ghost",
|
|
231
|
+
...ui.value.sortHeader,
|
|
231
232
|
label,
|
|
232
233
|
icon: isSorted === "asc" ? "i-lucide-arrow-up-narrow-wide" : isSorted === "desc" ? "i-lucide-arrow-down-wide-narrow" : "i-lucide-arrow-up-down",
|
|
233
234
|
class: "-mx-2.5",
|
|
@@ -262,29 +263,24 @@ const columns = computed(() => [
|
|
|
262
263
|
header: "",
|
|
263
264
|
cell: ({ row }) => {
|
|
264
265
|
const key = jobKey(row.original.group, row.original.name);
|
|
265
|
-
return h("div", { class: "flex gap-1 justify-end" }, [
|
|
266
|
+
return h("div", { "class": "flex gap-1 justify-end", "data-mongocamp-part": "row-actions" }, [
|
|
266
267
|
withTooltip(t("nuxtUiMongocamp.jobs.executeNowTooltip"), h(UButton, {
|
|
267
268
|
"icon": "i-lucide-play",
|
|
268
|
-
|
|
269
|
-
"variant": "ghost",
|
|
270
|
-
"size": "sm",
|
|
269
|
+
...ui.value.iconButton,
|
|
271
270
|
"aria-label": t("nuxtUiMongocamp.jobs.executeNowTooltip"),
|
|
272
271
|
"loading": executingJobs.value.has(key),
|
|
273
272
|
"onClick": () => handleExecuteJob(row.original.group, row.original.name)
|
|
274
273
|
})),
|
|
275
274
|
withTooltip(t("nuxtUiMongocamp.jobs.editJobTooltip"), h(UButton, {
|
|
276
275
|
"icon": "i-lucide-pencil",
|
|
277
|
-
|
|
278
|
-
"variant": "ghost",
|
|
279
|
-
"size": "sm",
|
|
276
|
+
...ui.value.iconButton,
|
|
280
277
|
"aria-label": t("nuxtUiMongocamp.jobs.editJobTooltip"),
|
|
281
278
|
"onClick": () => openEdit(row.original)
|
|
282
279
|
})),
|
|
283
280
|
withTooltip(t("nuxtUiMongocamp.jobs.deleteJobTooltip"), h(UButton, {
|
|
284
281
|
"icon": "i-lucide-trash-2",
|
|
282
|
+
...ui.value.iconButton,
|
|
285
283
|
"color": "error",
|
|
286
|
-
"variant": "ghost",
|
|
287
|
-
"size": "sm",
|
|
288
284
|
"aria-label": t("nuxtUiMongocamp.jobs.deleteJobTooltip"),
|
|
289
285
|
"onClick": () => confirmDelete(row.original.group, row.original.name)
|
|
290
286
|
}))
|
|
@@ -299,30 +295,34 @@ defineExpose({ refresh: fetchJobs });
|
|
|
299
295
|
<template>
|
|
300
296
|
<MongocampEmptyState
|
|
301
297
|
v-if="blocked"
|
|
298
|
+
class="mongocamp-jobs"
|
|
302
299
|
icon="i-lucide-shield-alert"
|
|
303
300
|
:title="message"
|
|
304
301
|
data-test="admin-only"
|
|
305
302
|
/>
|
|
306
303
|
<div
|
|
307
304
|
v-else
|
|
308
|
-
class="flex flex-col gap-4"
|
|
305
|
+
class="mongocamp-jobs flex flex-col gap-4"
|
|
309
306
|
>
|
|
310
307
|
<div class="flex items-center justify-between gap-4">
|
|
311
308
|
<h2
|
|
312
309
|
v-if="!hideHeading"
|
|
310
|
+
data-mongocamp-part="heading"
|
|
313
311
|
class="text-xl font-semibold"
|
|
314
312
|
>
|
|
315
313
|
{{ t("nuxtUiMongocamp.jobs.heading") }}
|
|
316
314
|
</h2>
|
|
317
|
-
<div
|
|
315
|
+
<div
|
|
316
|
+
data-mongocamp-part="toolbar"
|
|
317
|
+
class="ml-auto flex items-center gap-2"
|
|
318
|
+
>
|
|
318
319
|
<UTooltip
|
|
319
320
|
v-if="!hideRefresh"
|
|
320
321
|
:text="t('nuxtUiMongocamp.common.refresh')"
|
|
321
322
|
>
|
|
322
323
|
<UButton
|
|
323
324
|
icon="i-lucide-refresh-cw"
|
|
324
|
-
|
|
325
|
-
variant="ghost"
|
|
325
|
+
v-bind="ui.toolbarButton"
|
|
326
326
|
:loading="loading"
|
|
327
327
|
:aria-label="t('nuxtUiMongocamp.common.refresh')"
|
|
328
328
|
@click="fetchJobs"
|
|
@@ -345,6 +345,7 @@ defineExpose({ refresh: fetchJobs });
|
|
|
345
345
|
<UTable
|
|
346
346
|
v-model:sorting="sorting"
|
|
347
347
|
v-model:pagination="pagination"
|
|
348
|
+
data-mongocamp-part="table"
|
|
348
349
|
:pagination-options="paginationOptions"
|
|
349
350
|
:data="jobs"
|
|
350
351
|
:columns="columns"
|
|
@@ -413,7 +414,7 @@ defineExpose({ refresh: fetchJobs });
|
|
|
413
414
|
<UModal
|
|
414
415
|
v-model:open="isDeleteModalOpen"
|
|
415
416
|
:title="t('nuxtUiMongocamp.jobs.deleteJobTitle')"
|
|
416
|
-
:ui="{ footer:
|
|
417
|
+
:ui="{ footer: ui.modal.footer }"
|
|
417
418
|
>
|
|
418
419
|
<template #body>
|
|
419
420
|
<p>{{ t("nuxtUiMongocamp.jobs.confirmDelete", { name: jobToDelete.name }) }}</p>
|
|
@@ -421,7 +422,7 @@ defineExpose({ refresh: fetchJobs });
|
|
|
421
422
|
v-if="deleteError"
|
|
422
423
|
class="mt-3"
|
|
423
424
|
color="error"
|
|
424
|
-
variant="
|
|
425
|
+
:variant="ui.alert.variant"
|
|
425
426
|
icon="i-lucide-circle-alert"
|
|
426
427
|
:description="deleteError"
|
|
427
428
|
/>
|
|
@@ -429,14 +430,13 @@ defineExpose({ refresh: fetchJobs });
|
|
|
429
430
|
<template #footer>
|
|
430
431
|
<UButton
|
|
431
432
|
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
432
|
-
|
|
433
|
-
variant="ghost"
|
|
433
|
+
v-bind="ui.dialogCancel"
|
|
434
434
|
:disabled="deleting"
|
|
435
435
|
@click="isDeleteModalOpen = false"
|
|
436
436
|
/>
|
|
437
437
|
<UButton
|
|
438
438
|
:label="t('nuxtUiMongocamp.common.delete')"
|
|
439
|
-
|
|
439
|
+
v-bind="ui.dangerAction"
|
|
440
440
|
icon="i-lucide-trash-2"
|
|
441
441
|
:loading="deleting"
|
|
442
442
|
@click="handleDeleteJob"
|
|
@@ -18,6 +18,7 @@ const schema = reactive(
|
|
|
18
18
|
[
|
|
19
19
|
...props.hideHeading ? [] : [{
|
|
20
20
|
$el: "h3",
|
|
21
|
+
attrs: { "data-mongocamp-part": "heading" },
|
|
21
22
|
children: t("nuxtUiMongocamp.login.heading")
|
|
22
23
|
}],
|
|
23
24
|
{
|
|
@@ -52,7 +53,7 @@ async function actionLogin() {
|
|
|
52
53
|
</script>
|
|
53
54
|
|
|
54
55
|
<template>
|
|
55
|
-
<div class="flex flex-col items-center justify-center gap-4 p-4 w-full">
|
|
56
|
+
<div class="mongocamp-login flex flex-col items-center justify-center gap-4 p-4 w-full">
|
|
56
57
|
<UPageCard class="w-full max-w-md">
|
|
57
58
|
<!-- above the form: a logo, a title, a hint -->
|
|
58
59
|
<slot name="header" />
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from "../utils/permissionMatrix";
|
|
14
14
|
import { downloadTextFile, rowsToCsv } from "../utils/exportRows";
|
|
15
15
|
import { isBucketMemberCollection } from "../utils/collectionProtection";
|
|
16
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
16
17
|
const props = defineProps({
|
|
17
18
|
grantsPath: { type: String, required: false },
|
|
18
19
|
maxCollections: { type: Number, required: false, default: 60 },
|
|
@@ -21,6 +22,7 @@ const props = defineProps({
|
|
|
21
22
|
hideRefresh: { type: Boolean, required: false }
|
|
22
23
|
});
|
|
23
24
|
const { t } = useI18n();
|
|
25
|
+
const ui = useMongocampUi();
|
|
24
26
|
const paths = useMongocampPaths();
|
|
25
27
|
const { listUsers, listRoles, listCollections } = useMongocampAdmin();
|
|
26
28
|
const matrix = ref(null);
|
|
@@ -97,12 +99,13 @@ defineExpose({ refresh: load });
|
|
|
97
99
|
|
|
98
100
|
<template>
|
|
99
101
|
<div
|
|
100
|
-
class="flex flex-col gap-4"
|
|
102
|
+
class="mongocamp-permission-matrix flex flex-col gap-4"
|
|
101
103
|
data-test="permission-matrix"
|
|
102
104
|
>
|
|
103
105
|
<div class="flex flex-wrap items-start justify-between gap-2">
|
|
104
106
|
<div
|
|
105
107
|
v-if="!hideHeading"
|
|
108
|
+
data-mongocamp-part="heading"
|
|
106
109
|
class="flex flex-col gap-1"
|
|
107
110
|
>
|
|
108
111
|
<h2 class="text-xl font-semibold">
|
|
@@ -112,11 +115,13 @@ defineExpose({ refresh: load });
|
|
|
112
115
|
{{ t("nuxtUiMongocamp.permissionMatrix.subtitle") }}
|
|
113
116
|
</p>
|
|
114
117
|
</div>
|
|
115
|
-
<div
|
|
118
|
+
<div
|
|
119
|
+
data-mongocamp-part="toolbar"
|
|
120
|
+
class="ml-auto flex items-center gap-1"
|
|
121
|
+
>
|
|
116
122
|
<UButton
|
|
117
123
|
icon="i-lucide-arrow-left-right"
|
|
118
|
-
|
|
119
|
-
variant="ghost"
|
|
124
|
+
v-bind="ui.toolbarButton"
|
|
120
125
|
:aria-pressed="swapped"
|
|
121
126
|
:aria-label="t('nuxtUiMongocamp.permissionMatrix.swap')"
|
|
122
127
|
:disabled="!matrix"
|
|
@@ -124,8 +129,7 @@ defineExpose({ refresh: load });
|
|
|
124
129
|
/>
|
|
125
130
|
<UButton
|
|
126
131
|
icon="i-lucide-download"
|
|
127
|
-
|
|
128
|
-
variant="ghost"
|
|
132
|
+
v-bind="ui.toolbarButton"
|
|
129
133
|
:aria-label="t('nuxtUiMongocamp.permissionMatrix.exportCsv')"
|
|
130
134
|
:disabled="!shown || users.length === 0 || collections.length === 0"
|
|
131
135
|
@click="exportCsv"
|
|
@@ -133,8 +137,7 @@ defineExpose({ refresh: load });
|
|
|
133
137
|
<UButton
|
|
134
138
|
v-if="!hideRefresh"
|
|
135
139
|
icon="i-lucide-refresh-cw"
|
|
136
|
-
|
|
137
|
-
variant="ghost"
|
|
140
|
+
v-bind="ui.toolbarButton"
|
|
138
141
|
:loading="loading"
|
|
139
142
|
:aria-label="t('nuxtUiMongocamp.permissionMatrix.refresh')"
|
|
140
143
|
@click="load"
|
|
@@ -153,7 +156,7 @@ defineExpose({ refresh: load });
|
|
|
153
156
|
<UInput
|
|
154
157
|
v-model="text"
|
|
155
158
|
icon="i-lucide-search"
|
|
156
|
-
size="
|
|
159
|
+
:size="ui.controlSize"
|
|
157
160
|
class="w-64"
|
|
158
161
|
:placeholder="t('nuxtUiMongocamp.permissionMatrix.filterPlaceholder')"
|
|
159
162
|
:aria-label="t('nuxtUiMongocamp.permissionMatrix.filterPlaceholder')"
|
|
@@ -161,7 +164,7 @@ defineExpose({ refresh: load });
|
|
|
161
164
|
<USelect
|
|
162
165
|
v-model="role"
|
|
163
166
|
:items="roleItems"
|
|
164
|
-
size="
|
|
167
|
+
:size="ui.controlSize"
|
|
165
168
|
class="w-44"
|
|
166
169
|
:aria-label="t('nuxtUiMongocamp.permissionMatrix.roleLabel')"
|
|
167
170
|
/>
|
|
@@ -264,7 +267,7 @@ defineExpose({ refresh: load });
|
|
|
264
267
|
v-if="userByName.get(row).admin"
|
|
265
268
|
:label="t('nuxtUiMongocamp.permissionMatrix.adminBadge')"
|
|
266
269
|
color="primary"
|
|
267
|
-
variant="
|
|
270
|
+
:variant="ui.badge.variant"
|
|
268
271
|
size="sm"
|
|
269
272
|
/>
|
|
270
273
|
<NuxtLink
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
toSavedQuery,
|
|
20
20
|
usableProjection
|
|
21
21
|
} from "../utils/queryState";
|
|
22
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
22
23
|
const props = defineProps({
|
|
23
24
|
fields: { type: Array, required: true },
|
|
24
25
|
columns: { type: Array, required: true },
|
|
@@ -28,6 +29,7 @@ const props = defineProps({
|
|
|
28
29
|
const model = defineModel({ type: Object, ...{ required: true } });
|
|
29
30
|
const emit = defineEmits(["apply"]);
|
|
30
31
|
const { t } = useI18n();
|
|
32
|
+
const ui = useMongocampUi();
|
|
31
33
|
const { saved, recent, save, remove, record, clearRecent } = useMongocampSavedQueries(() => props.collection);
|
|
32
34
|
const fieldTypes = computed(() => Object.fromEntries(props.fields.map((f) => [f.key, f.type])));
|
|
33
35
|
const projectable = computed(() => props.columns.filter((c) => c !== "_id"));
|
|
@@ -113,7 +115,7 @@ function saveCurrent() {
|
|
|
113
115
|
</script>
|
|
114
116
|
|
|
115
117
|
<template>
|
|
116
|
-
<div class="flex flex-col gap-3">
|
|
118
|
+
<div class="mongocamp-query-bar flex flex-col gap-3">
|
|
117
119
|
<div class="flex flex-wrap items-center gap-1">
|
|
118
120
|
<UChip
|
|
119
121
|
:text="activeFilterCount"
|
|
@@ -124,7 +126,7 @@ function saveCurrent() {
|
|
|
124
126
|
icon="i-lucide-list-filter"
|
|
125
127
|
color="neutral"
|
|
126
128
|
:variant="filtersOpen ? 'subtle' : 'ghost'"
|
|
127
|
-
size="
|
|
129
|
+
:size="ui.controlSize"
|
|
128
130
|
:disabled="fields.length === 0"
|
|
129
131
|
:aria-pressed="filtersOpen"
|
|
130
132
|
:aria-label="t('nuxtUiMongocamp.collectionData.filtersTooltip')"
|
|
@@ -140,9 +142,7 @@ function saveCurrent() {
|
|
|
140
142
|
>
|
|
141
143
|
<UButton
|
|
142
144
|
icon="i-lucide-arrow-up-down"
|
|
143
|
-
|
|
144
|
-
variant="ghost"
|
|
145
|
-
size="sm"
|
|
145
|
+
v-bind="ui.iconButton"
|
|
146
146
|
:disabled="columns.length === 0"
|
|
147
147
|
:aria-label="t('nuxtUiMongocamp.queryBar.sortButton')"
|
|
148
148
|
/>
|
|
@@ -169,25 +169,21 @@ function saveCurrent() {
|
|
|
169
169
|
<USelect
|
|
170
170
|
:model-value="entry.field"
|
|
171
171
|
:items="sortFieldItems"
|
|
172
|
-
size="
|
|
172
|
+
:size="ui.controlSize"
|
|
173
173
|
class="min-w-0 flex-1"
|
|
174
174
|
:aria-label="t('nuxtUiMongocamp.queryBar.sortField', { position: index + 1 })"
|
|
175
175
|
@update:model-value="(v) => setSort(setSortField(model.sort, index, v))"
|
|
176
176
|
/>
|
|
177
177
|
<UButton
|
|
178
178
|
:icon="entry.desc ? 'i-lucide-arrow-down-wide-narrow' : 'i-lucide-arrow-up-narrow-wide'"
|
|
179
|
-
|
|
180
|
-
variant="ghost"
|
|
181
|
-
size="sm"
|
|
179
|
+
v-bind="ui.iconButton"
|
|
182
180
|
:label="entry.desc ? t('nuxtUiMongocamp.queryBar.sortDescending') : t('nuxtUiMongocamp.queryBar.sortAscending')"
|
|
183
181
|
:aria-label="t('nuxtUiMongocamp.queryBar.toggleSortDirection', { field: entry.field })"
|
|
184
182
|
@click="setSort(toggleSortDirection(model.sort, index))"
|
|
185
183
|
/>
|
|
186
184
|
<UButton
|
|
187
185
|
icon="i-lucide-x"
|
|
188
|
-
|
|
189
|
-
variant="ghost"
|
|
190
|
-
size="sm"
|
|
186
|
+
v-bind="ui.iconButton"
|
|
191
187
|
:aria-label="t('nuxtUiMongocamp.queryBar.removeSort', { field: entry.field })"
|
|
192
188
|
@click="setSort(removeSort(model.sort, index))"
|
|
193
189
|
/>
|
|
@@ -196,7 +192,7 @@ function saveCurrent() {
|
|
|
196
192
|
icon="i-lucide-plus"
|
|
197
193
|
color="neutral"
|
|
198
194
|
variant="soft"
|
|
199
|
-
size="
|
|
195
|
+
:size="ui.controlSize"
|
|
200
196
|
:label="t('nuxtUiMongocamp.queryBar.addSort')"
|
|
201
197
|
:disabled="!canAddSort"
|
|
202
198
|
@click="addSortRow"
|
|
@@ -213,9 +209,7 @@ function saveCurrent() {
|
|
|
213
209
|
>
|
|
214
210
|
<UButton
|
|
215
211
|
icon="i-lucide-columns-3"
|
|
216
|
-
|
|
217
|
-
variant="ghost"
|
|
218
|
-
size="sm"
|
|
212
|
+
v-bind="ui.iconButton"
|
|
219
213
|
:disabled="projectable.length === 0"
|
|
220
214
|
:title="projection.length > 0 ? t('nuxtUiMongocamp.queryBar.fieldsSome', { count: projection.length, total: projectable.length }) : t('nuxtUiMongocamp.queryBar.fieldsAll')"
|
|
221
215
|
:aria-label="t('nuxtUiMongocamp.queryBar.fieldsButton')"
|
|
@@ -226,9 +220,7 @@ function saveCurrent() {
|
|
|
226
220
|
<UPopover>
|
|
227
221
|
<UButton
|
|
228
222
|
icon="i-lucide-history"
|
|
229
|
-
|
|
230
|
-
variant="ghost"
|
|
231
|
-
size="sm"
|
|
223
|
+
v-bind="ui.iconButton"
|
|
232
224
|
:aria-label="t('nuxtUiMongocamp.queryBar.historyButton')"
|
|
233
225
|
/>
|
|
234
226
|
<template #content>
|
|
@@ -252,9 +244,7 @@ function saveCurrent() {
|
|
|
252
244
|
class="flex items-center gap-1"
|
|
253
245
|
>
|
|
254
246
|
<UButton
|
|
255
|
-
|
|
256
|
-
variant="ghost"
|
|
257
|
-
size="sm"
|
|
247
|
+
v-bind="ui.iconButton"
|
|
258
248
|
class="min-w-0 flex-1 justify-start"
|
|
259
249
|
:title="describe(entry.query)"
|
|
260
250
|
@click="restore(entry.query)"
|
|
@@ -264,9 +254,7 @@ function saveCurrent() {
|
|
|
264
254
|
</UButton>
|
|
265
255
|
<UButton
|
|
266
256
|
icon="i-lucide-trash-2"
|
|
267
|
-
|
|
268
|
-
variant="ghost"
|
|
269
|
-
size="sm"
|
|
257
|
+
v-bind="{ ...ui.iconButton, color: 'error' }"
|
|
270
258
|
:aria-label="t('nuxtUiMongocamp.queryBar.deleteSaved', { name: entry.name })"
|
|
271
259
|
@click="remove(entry.name)"
|
|
272
260
|
/>
|
|
@@ -277,7 +265,7 @@ function saveCurrent() {
|
|
|
277
265
|
>
|
|
278
266
|
<UInput
|
|
279
267
|
v-model="saveName"
|
|
280
|
-
size="
|
|
268
|
+
:size="ui.controlSize"
|
|
281
269
|
class="min-w-0 flex-1"
|
|
282
270
|
:placeholder="t('nuxtUiMongocamp.queryBar.saveNamePlaceholder')"
|
|
283
271
|
:aria-label="t('nuxtUiMongocamp.queryBar.saveName')"
|
|
@@ -286,7 +274,7 @@ function saveCurrent() {
|
|
|
286
274
|
<UButton
|
|
287
275
|
type="submit"
|
|
288
276
|
icon="i-lucide-save"
|
|
289
|
-
size="
|
|
277
|
+
:size="ui.controlSize"
|
|
290
278
|
:label="t('nuxtUiMongocamp.queryBar.save')"
|
|
291
279
|
:disabled="!canSave || saveName.trim() === ''"
|
|
292
280
|
:title="canSave ? void 0 : t('nuxtUiMongocamp.queryBar.nothingToSave')"
|
|
@@ -323,9 +311,7 @@ function saveCurrent() {
|
|
|
323
311
|
<UButton
|
|
324
312
|
v-for="(query, index) in recent"
|
|
325
313
|
:key="index"
|
|
326
|
-
|
|
327
|
-
variant="ghost"
|
|
328
|
-
size="sm"
|
|
314
|
+
v-bind="ui.iconButton"
|
|
329
315
|
class="justify-start"
|
|
330
316
|
:label="describe(query)"
|
|
331
317
|
data-test="recent-query"
|
|
@@ -352,14 +338,14 @@ function saveCurrent() {
|
|
|
352
338
|
<UBadge
|
|
353
339
|
v-if="model.filterGroup.negate"
|
|
354
340
|
color="warning"
|
|
355
|
-
variant="
|
|
341
|
+
:variant="ui.badge.variant"
|
|
356
342
|
:label="t('nuxtUiMongocamp.collectionData.filterExcluding')"
|
|
357
343
|
/>
|
|
358
344
|
<UBadge
|
|
359
345
|
v-for="chip in filterChips"
|
|
360
346
|
:key="chip.id"
|
|
361
347
|
color="neutral"
|
|
362
|
-
variant="
|
|
348
|
+
:variant="ui.badge.variant"
|
|
363
349
|
class="gap-1"
|
|
364
350
|
>
|
|
365
351
|
{{ chip.label }}
|