@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
|
@@ -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 }}
|
|
@@ -3,6 +3,7 @@ import { computed, h, reactive, ref, resolveComponent } from "vue";
|
|
|
3
3
|
import { useI18n, useMongocampError, useToast } from "#imports";
|
|
4
4
|
import useMongocampAdmin from "../composables/useMongocampAdmin";
|
|
5
5
|
import { useMongocampAdminGate } from "../composables/useMongocampAdminGate";
|
|
6
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
6
7
|
const props = defineProps({
|
|
7
8
|
roleName: { type: String, required: true },
|
|
8
9
|
hideHeading: { type: Boolean, required: false },
|
|
@@ -10,6 +11,7 @@ const props = defineProps({
|
|
|
10
11
|
});
|
|
11
12
|
const emit = defineEmits(["changed"]);
|
|
12
13
|
const { t } = useI18n();
|
|
14
|
+
const ui = useMongocampUi();
|
|
13
15
|
const { describeServerError } = useMongocampError();
|
|
14
16
|
const { listRoles, updateRole, listCollections } = useMongocampAdmin();
|
|
15
17
|
const grants = ref([]);
|
|
@@ -181,7 +183,7 @@ const columns = computed(() => [
|
|
|
181
183
|
cell: ({ row }) => h(UBadge, {
|
|
182
184
|
label: row.original.grantType,
|
|
183
185
|
color: "neutral",
|
|
184
|
-
variant:
|
|
186
|
+
variant: ui.value.badge.variant
|
|
185
187
|
})
|
|
186
188
|
},
|
|
187
189
|
{
|
|
@@ -190,7 +192,7 @@ const columns = computed(() => [
|
|
|
190
192
|
cell: ({ row }) => h(UBadge, {
|
|
191
193
|
label: row.original.read ? t("nuxtUiMongocamp.common.yes") : t("nuxtUiMongocamp.common.no"),
|
|
192
194
|
color: row.original.read ? "success" : "neutral",
|
|
193
|
-
variant:
|
|
195
|
+
variant: ui.value.badge.variant
|
|
194
196
|
})
|
|
195
197
|
},
|
|
196
198
|
{
|
|
@@ -199,7 +201,7 @@ const columns = computed(() => [
|
|
|
199
201
|
cell: ({ row }) => h(UBadge, {
|
|
200
202
|
label: row.original.write ? t("nuxtUiMongocamp.common.yes") : t("nuxtUiMongocamp.common.no"),
|
|
201
203
|
color: row.original.write ? "success" : "neutral",
|
|
202
|
-
variant:
|
|
204
|
+
variant: ui.value.badge.variant
|
|
203
205
|
})
|
|
204
206
|
},
|
|
205
207
|
{
|
|
@@ -208,27 +210,24 @@ const columns = computed(() => [
|
|
|
208
210
|
cell: ({ row }) => h(UBadge, {
|
|
209
211
|
label: row.original.administrate ? t("nuxtUiMongocamp.common.yes") : t("nuxtUiMongocamp.common.no"),
|
|
210
212
|
color: row.original.administrate ? "primary" : "neutral",
|
|
211
|
-
variant:
|
|
213
|
+
variant: ui.value.badge.variant
|
|
212
214
|
})
|
|
213
215
|
},
|
|
214
216
|
{
|
|
215
217
|
id: "actions",
|
|
216
218
|
header: "",
|
|
217
|
-
cell: ({ row }) => h("div", { class: "flex gap-1 justify-end" }, [
|
|
219
|
+
cell: ({ row }) => h("div", { "class": "flex gap-1 justify-end", "data-mongocamp-part": "row-actions" }, [
|
|
218
220
|
withTooltip(t("nuxtUiMongocamp.roleGrants.editGrantTooltip"), h(UButton, {
|
|
219
221
|
"icon": "i-lucide-pencil",
|
|
220
|
-
|
|
221
|
-
"variant": "ghost",
|
|
222
|
-
"size": "sm",
|
|
222
|
+
...ui.value.iconButton,
|
|
223
223
|
"aria-label": t("nuxtUiMongocamp.roleGrants.editGrantTooltip"),
|
|
224
224
|
"disabled": saving.value,
|
|
225
225
|
"onClick": () => openEdit(row.index)
|
|
226
226
|
})),
|
|
227
227
|
withTooltip(t("nuxtUiMongocamp.roleGrants.removeGrantTooltip"), h(UButton, {
|
|
228
228
|
"icon": "i-lucide-trash-2",
|
|
229
|
+
...ui.value.iconButton,
|
|
229
230
|
"color": "error",
|
|
230
|
-
"variant": "ghost",
|
|
231
|
-
"size": "sm",
|
|
232
231
|
"aria-label": t("nuxtUiMongocamp.roleGrants.removeGrantTooltip"),
|
|
233
232
|
"disabled": saving.value,
|
|
234
233
|
"onClick": () => removeGrant(row.index)
|
|
@@ -246,30 +245,34 @@ defineExpose({ refresh: fetchRole });
|
|
|
246
245
|
<template>
|
|
247
246
|
<MongocampEmptyState
|
|
248
247
|
v-if="blocked"
|
|
248
|
+
class="mongocamp-role-grants"
|
|
249
249
|
icon="i-lucide-shield-alert"
|
|
250
250
|
:title="message"
|
|
251
251
|
data-test="admin-only"
|
|
252
252
|
/>
|
|
253
253
|
<div
|
|
254
254
|
v-else
|
|
255
|
-
class="flex flex-col gap-4"
|
|
255
|
+
class="mongocamp-role-grants flex flex-col gap-4"
|
|
256
256
|
>
|
|
257
257
|
<div class="flex items-center justify-between">
|
|
258
258
|
<h2
|
|
259
259
|
v-if="!hideHeading"
|
|
260
|
+
data-mongocamp-part="heading"
|
|
260
261
|
class="text-xl font-semibold"
|
|
261
262
|
>
|
|
262
263
|
{{ t("nuxtUiMongocamp.roleGrants.heading", { roleName }) }}
|
|
263
264
|
</h2>
|
|
264
|
-
<div
|
|
265
|
+
<div
|
|
266
|
+
data-mongocamp-part="toolbar"
|
|
267
|
+
class="ml-auto flex gap-2"
|
|
268
|
+
>
|
|
265
269
|
<UTooltip
|
|
266
270
|
v-if="!hideRefresh"
|
|
267
271
|
:text="t('nuxtUiMongocamp.common.refresh')"
|
|
268
272
|
>
|
|
269
273
|
<UButton
|
|
270
274
|
icon="i-lucide-refresh-cw"
|
|
271
|
-
|
|
272
|
-
variant="ghost"
|
|
275
|
+
v-bind="ui.toolbarButton"
|
|
273
276
|
:loading="loading"
|
|
274
277
|
:aria-label="t('nuxtUiMongocamp.common.refresh')"
|
|
275
278
|
@click="fetchRole"
|
|
@@ -307,7 +310,7 @@ defineExpose({ refresh: fetchRole });
|
|
|
307
310
|
<UAlert
|
|
308
311
|
v-if="saveError && !isAddModalOpen && !isEditModalOpen"
|
|
309
312
|
color="error"
|
|
310
|
-
variant="
|
|
313
|
+
:variant="ui.alert.variant"
|
|
311
314
|
icon="i-lucide-circle-alert"
|
|
312
315
|
:title="t('nuxtUiMongocamp.roleGrants.errorSave')"
|
|
313
316
|
:description="saveError"
|
|
@@ -323,6 +326,7 @@ defineExpose({ refresh: fetchRole });
|
|
|
323
326
|
|
|
324
327
|
<UTable
|
|
325
328
|
v-else
|
|
329
|
+
data-mongocamp-part="table"
|
|
326
330
|
:data="grants"
|
|
327
331
|
:columns="columns"
|
|
328
332
|
:loading="loading"
|
|
@@ -349,7 +353,7 @@ defineExpose({ refresh: fetchRole });
|
|
|
349
353
|
v-if="saveError"
|
|
350
354
|
class="mt-3"
|
|
351
355
|
color="error"
|
|
352
|
-
variant="
|
|
356
|
+
:variant="ui.alert.variant"
|
|
353
357
|
icon="i-lucide-circle-alert"
|
|
354
358
|
:description="saveError"
|
|
355
359
|
/>
|
|
@@ -373,7 +377,7 @@ defineExpose({ refresh: fetchRole });
|
|
|
373
377
|
v-if="saveError"
|
|
374
378
|
class="mt-3"
|
|
375
379
|
color="error"
|
|
376
|
-
variant="
|
|
380
|
+
:variant="ui.alert.variant"
|
|
377
381
|
icon="i-lucide-circle-alert"
|
|
378
382
|
:description="saveError"
|
|
379
383
|
/>
|