@sfxcode/nuxt-ui-mongocamp 1.5.7 → 2.0.0
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/README.md +5 -5
- 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.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampAggregationBuilder.vue +32 -45
- package/dist/runtime/components/MongocampAggregationBuilder.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampAggregationChart.vue +7 -5
- package/dist/runtime/components/MongocampAggregationStagePreview.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampAggregationStagePreview.vue +5 -3
- package/dist/runtime/components/MongocampAggregationStagePreview.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampBucketFiles.vue +29 -40
- 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.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampCollectionCharts.vue +10 -7
- package/dist/runtime/components/MongocampCollectionCharts.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampCollectionCopy.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampCollectionCopy.vue +11 -9
- package/dist/runtime/components/MongocampCollectionCopy.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampCollectionData.vue +97 -87
- package/dist/runtime/components/MongocampCollectionInfos.vue +34 -24
- 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 +12 -9
- package/dist/runtime/components/MongocampEmptyState.vue +4 -1
- package/dist/runtime/components/MongocampErrorAlert.vue +8 -7
- package/dist/runtime/components/MongocampExportAll.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampExportAll.vue +19 -7
- package/dist/runtime/components/MongocampExportAll.vue.d.ts +1 -0
- 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 +32 -28
- package/dist/runtime/components/MongocampIndexes.vue +21 -19
- 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 +33 -32
- package/dist/runtime/components/MongocampRoleGrants.vue +21 -17
- package/dist/runtime/components/MongocampRoles.vue +28 -32
- package/dist/runtime/components/MongocampServerInfo.vue +17 -25
- package/dist/runtime/components/MongocampServerOverview.vue +16 -12
- package/dist/runtime/components/MongocampServerStatus.vue +9 -3
- 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.d.vue.ts +1 -1
- package/dist/runtime/components/MongocampVersion.vue +20 -11
- package/dist/runtime/components/MongocampVersion.vue.d.ts +1 -1
- package/dist/runtime/composables/useMongocampAdmin.js +6 -5
- package/dist/runtime/composables/useMongocampAggregation.d.ts +10 -1
- package/dist/runtime/composables/useMongocampAggregation.js +17 -5
- package/dist/runtime/composables/useMongocampBucket.d.ts +4 -0
- package/dist/runtime/composables/useMongocampBucket.js +7 -6
- package/dist/runtime/composables/useMongocampBulkByFilter.d.ts +6 -4
- package/dist/runtime/composables/useMongocampBulkByFilter.js +11 -6
- package/dist/runtime/composables/useMongocampCollectionCopy.d.ts +3 -1
- package/dist/runtime/composables/useMongocampCollectionCopy.js +4 -2
- package/dist/runtime/composables/useMongocampCollectionStats.js +2 -4
- package/dist/runtime/composables/useMongocampError.d.ts +1 -1
- package/dist/runtime/composables/useMongocampError.js +4 -1
- package/dist/runtime/composables/useMongocampExportAll.d.ts +10 -1
- package/dist/runtime/composables/useMongocampExportAll.js +4 -1
- package/dist/runtime/composables/useMongocampFetchAll.d.ts +11 -5
- package/dist/runtime/composables/useMongocampFetchAll.js +8 -8
- package/dist/runtime/composables/useMongocampJobs.js +3 -2
- package/dist/runtime/composables/useMongocampQuery.d.ts +26 -36
- package/dist/runtime/composables/useMongocampQuery.js +45 -48
- package/dist/runtime/composables/useMongocampSchema.js +2 -0
- package/dist/runtime/composables/useMongocampUi.d.ts +8 -0
- package/dist/runtime/composables/useMongocampUi.js +7 -0
- package/dist/runtime/locales/de.json +12 -4
- package/dist/runtime/locales/en.json +12 -4
- package/dist/runtime/plugin.js +8 -0
- package/dist/runtime/publicUtils.d.ts +1 -0
- package/dist/runtime/publicUtils.js +1 -0
- package/dist/runtime/server/handlers/mongocampProxy.d.ts +1 -1
- package/dist/runtime/server/handlers/mongocampProxy.js +12 -12
- package/dist/runtime/utils/aggregationPipeline.d.ts +2 -1
- package/dist/runtime/utils/aggregationPipeline.js +2 -3
- package/dist/runtime/utils/caseInsensitive.d.ts +10 -0
- package/dist/runtime/utils/caseInsensitive.js +8 -0
- package/dist/runtime/utils/collectionStats.d.ts +4 -1
- package/dist/runtime/utils/collectionStats.js +2 -2
- package/dist/runtime/utils/compactSession.d.ts +13 -0
- package/dist/runtime/utils/compactSession.js +12 -0
- package/dist/runtime/utils/configRows.d.ts +3 -3
- package/dist/runtime/utils/cursorPaging.d.ts +16 -0
- package/dist/runtime/utils/cursorPaging.js +17 -0
- package/dist/runtime/utils/documentCompare.js +2 -3
- package/dist/runtime/utils/documentPaths.d.ts +5 -5
- package/dist/runtime/utils/documentPaths.js +9 -2
- package/dist/runtime/utils/documentTree.js +3 -0
- package/dist/runtime/utils/fileFilter.d.ts +7 -0
- package/dist/runtime/utils/fileFilter.js +11 -0
- package/dist/runtime/utils/filterBuilder.d.ts +1 -1
- package/dist/runtime/utils/filterBuilder.js +5 -11
- package/dist/runtime/utils/filterSuggestions.js +1 -1
- package/dist/runtime/utils/indexForm.d.ts +7 -0
- package/dist/runtime/utils/indexForm.js +9 -0
- package/dist/runtime/utils/pagedFetch.d.ts +13 -0
- package/dist/runtime/utils/pagedFetch.js +44 -0
- package/dist/runtime/utils/queryState.d.ts +5 -0
- package/dist/runtime/utils/queryState.js +3 -2
- package/dist/runtime/utils/relaxedValues.d.ts +17 -0
- package/dist/runtime/utils/relaxedValues.js +51 -0
- package/dist/runtime/utils/requestLimits.d.ts +1 -1
- package/dist/runtime/utils/requestLimits.js +1 -1
- package/dist/runtime/utils/savedQueries.d.ts +2 -0
- package/dist/runtime/utils/savedQueries.js +1 -0
- package/dist/runtime/utils/schemaAnalysis.d.ts +4 -4
- package/dist/runtime/utils/schemaAnalysis.js +2 -2
- package/dist/runtime/utils/sensitiveFields.d.ts +20 -0
- package/dist/runtime/utils/sensitiveFields.js +63 -0
- package/dist/runtime/utils/serverError.d.ts +7 -0
- package/dist/runtime/utils/serverError.js +11 -0
- package/dist/runtime/utils/serverStatus.d.ts +2 -2
- package/dist/runtime/utils/uiTheme.d.ts +65 -0
- package/dist/runtime/utils/uiTheme.js +47 -0
- package/package.json +22 -16
- package/dist/runtime/utils/luceneExpression.d.ts +0 -15
- package/dist/runtime/utils/luceneExpression.js +0 -74
|
@@ -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"));
|
|
@@ -42,6 +44,9 @@ function commit(next, options = {}) {
|
|
|
42
44
|
emit("apply", next);
|
|
43
45
|
if (options.remember !== false && !isEmptyQuery(next)) record(toSavedQuery(next));
|
|
44
46
|
}
|
|
47
|
+
function toggleMatchCase() {
|
|
48
|
+
commit({ ...model.value, matchCase: !model.value.matchCase }, { remember: false });
|
|
49
|
+
}
|
|
45
50
|
function onBuilderApply(lucene) {
|
|
46
51
|
commit({ ...model.value, filterGroup: cloneGroup(draft.value), lucene });
|
|
47
52
|
}
|
|
@@ -113,7 +118,7 @@ function saveCurrent() {
|
|
|
113
118
|
</script>
|
|
114
119
|
|
|
115
120
|
<template>
|
|
116
|
-
<div class="flex flex-col gap-3">
|
|
121
|
+
<div class="mongocamp-query-bar flex flex-col gap-3">
|
|
117
122
|
<div class="flex flex-wrap items-center gap-1">
|
|
118
123
|
<UChip
|
|
119
124
|
:text="activeFilterCount"
|
|
@@ -124,7 +129,7 @@ function saveCurrent() {
|
|
|
124
129
|
icon="i-lucide-list-filter"
|
|
125
130
|
color="neutral"
|
|
126
131
|
:variant="filtersOpen ? 'subtle' : 'ghost'"
|
|
127
|
-
size="
|
|
132
|
+
:size="ui.controlSize"
|
|
128
133
|
:disabled="fields.length === 0"
|
|
129
134
|
:aria-pressed="filtersOpen"
|
|
130
135
|
:aria-label="t('nuxtUiMongocamp.collectionData.filtersTooltip')"
|
|
@@ -132,6 +137,18 @@ function saveCurrent() {
|
|
|
132
137
|
/>
|
|
133
138
|
</UChip>
|
|
134
139
|
|
|
140
|
+
<UButton
|
|
141
|
+
icon="i-lucide-case-sensitive"
|
|
142
|
+
color="neutral"
|
|
143
|
+
:variant="model.matchCase ? 'subtle' : 'ghost'"
|
|
144
|
+
:size="ui.controlSize"
|
|
145
|
+
:aria-pressed="model.matchCase"
|
|
146
|
+
:aria-label="t('nuxtUiMongocamp.queryBar.matchCase')"
|
|
147
|
+
:title="t('nuxtUiMongocamp.queryBar.matchCaseHint')"
|
|
148
|
+
data-test="match-case"
|
|
149
|
+
@click="toggleMatchCase"
|
|
150
|
+
/>
|
|
151
|
+
|
|
135
152
|
<UPopover>
|
|
136
153
|
<UChip
|
|
137
154
|
:text="model.sort.length"
|
|
@@ -140,9 +157,7 @@ function saveCurrent() {
|
|
|
140
157
|
>
|
|
141
158
|
<UButton
|
|
142
159
|
icon="i-lucide-arrow-up-down"
|
|
143
|
-
|
|
144
|
-
variant="ghost"
|
|
145
|
-
size="sm"
|
|
160
|
+
v-bind="ui.iconButton"
|
|
146
161
|
:disabled="columns.length === 0"
|
|
147
162
|
:aria-label="t('nuxtUiMongocamp.queryBar.sortButton')"
|
|
148
163
|
/>
|
|
@@ -169,25 +184,21 @@ function saveCurrent() {
|
|
|
169
184
|
<USelect
|
|
170
185
|
:model-value="entry.field"
|
|
171
186
|
:items="sortFieldItems"
|
|
172
|
-
size="
|
|
187
|
+
:size="ui.controlSize"
|
|
173
188
|
class="min-w-0 flex-1"
|
|
174
189
|
:aria-label="t('nuxtUiMongocamp.queryBar.sortField', { position: index + 1 })"
|
|
175
190
|
@update:model-value="(v) => setSort(setSortField(model.sort, index, v))"
|
|
176
191
|
/>
|
|
177
192
|
<UButton
|
|
178
193
|
:icon="entry.desc ? 'i-lucide-arrow-down-wide-narrow' : 'i-lucide-arrow-up-narrow-wide'"
|
|
179
|
-
|
|
180
|
-
variant="ghost"
|
|
181
|
-
size="sm"
|
|
194
|
+
v-bind="ui.iconButton"
|
|
182
195
|
:label="entry.desc ? t('nuxtUiMongocamp.queryBar.sortDescending') : t('nuxtUiMongocamp.queryBar.sortAscending')"
|
|
183
196
|
:aria-label="t('nuxtUiMongocamp.queryBar.toggleSortDirection', { field: entry.field })"
|
|
184
197
|
@click="setSort(toggleSortDirection(model.sort, index))"
|
|
185
198
|
/>
|
|
186
199
|
<UButton
|
|
187
200
|
icon="i-lucide-x"
|
|
188
|
-
|
|
189
|
-
variant="ghost"
|
|
190
|
-
size="sm"
|
|
201
|
+
v-bind="ui.iconButton"
|
|
191
202
|
:aria-label="t('nuxtUiMongocamp.queryBar.removeSort', { field: entry.field })"
|
|
192
203
|
@click="setSort(removeSort(model.sort, index))"
|
|
193
204
|
/>
|
|
@@ -196,7 +207,7 @@ function saveCurrent() {
|
|
|
196
207
|
icon="i-lucide-plus"
|
|
197
208
|
color="neutral"
|
|
198
209
|
variant="soft"
|
|
199
|
-
size="
|
|
210
|
+
:size="ui.controlSize"
|
|
200
211
|
:label="t('nuxtUiMongocamp.queryBar.addSort')"
|
|
201
212
|
:disabled="!canAddSort"
|
|
202
213
|
@click="addSortRow"
|
|
@@ -213,9 +224,7 @@ function saveCurrent() {
|
|
|
213
224
|
>
|
|
214
225
|
<UButton
|
|
215
226
|
icon="i-lucide-columns-3"
|
|
216
|
-
|
|
217
|
-
variant="ghost"
|
|
218
|
-
size="sm"
|
|
227
|
+
v-bind="ui.iconButton"
|
|
219
228
|
:disabled="projectable.length === 0"
|
|
220
229
|
:title="projection.length > 0 ? t('nuxtUiMongocamp.queryBar.fieldsSome', { count: projection.length, total: projectable.length }) : t('nuxtUiMongocamp.queryBar.fieldsAll')"
|
|
221
230
|
:aria-label="t('nuxtUiMongocamp.queryBar.fieldsButton')"
|
|
@@ -226,9 +235,7 @@ function saveCurrent() {
|
|
|
226
235
|
<UPopover>
|
|
227
236
|
<UButton
|
|
228
237
|
icon="i-lucide-history"
|
|
229
|
-
|
|
230
|
-
variant="ghost"
|
|
231
|
-
size="sm"
|
|
238
|
+
v-bind="ui.iconButton"
|
|
232
239
|
:aria-label="t('nuxtUiMongocamp.queryBar.historyButton')"
|
|
233
240
|
/>
|
|
234
241
|
<template #content>
|
|
@@ -252,9 +259,7 @@ function saveCurrent() {
|
|
|
252
259
|
class="flex items-center gap-1"
|
|
253
260
|
>
|
|
254
261
|
<UButton
|
|
255
|
-
|
|
256
|
-
variant="ghost"
|
|
257
|
-
size="sm"
|
|
262
|
+
v-bind="ui.iconButton"
|
|
258
263
|
class="min-w-0 flex-1 justify-start"
|
|
259
264
|
:title="describe(entry.query)"
|
|
260
265
|
@click="restore(entry.query)"
|
|
@@ -264,9 +269,7 @@ function saveCurrent() {
|
|
|
264
269
|
</UButton>
|
|
265
270
|
<UButton
|
|
266
271
|
icon="i-lucide-trash-2"
|
|
267
|
-
|
|
268
|
-
variant="ghost"
|
|
269
|
-
size="sm"
|
|
272
|
+
v-bind="{ ...ui.iconButton, color: 'error' }"
|
|
270
273
|
:aria-label="t('nuxtUiMongocamp.queryBar.deleteSaved', { name: entry.name })"
|
|
271
274
|
@click="remove(entry.name)"
|
|
272
275
|
/>
|
|
@@ -277,7 +280,7 @@ function saveCurrent() {
|
|
|
277
280
|
>
|
|
278
281
|
<UInput
|
|
279
282
|
v-model="saveName"
|
|
280
|
-
size="
|
|
283
|
+
:size="ui.controlSize"
|
|
281
284
|
class="min-w-0 flex-1"
|
|
282
285
|
:placeholder="t('nuxtUiMongocamp.queryBar.saveNamePlaceholder')"
|
|
283
286
|
:aria-label="t('nuxtUiMongocamp.queryBar.saveName')"
|
|
@@ -286,7 +289,7 @@ function saveCurrent() {
|
|
|
286
289
|
<UButton
|
|
287
290
|
type="submit"
|
|
288
291
|
icon="i-lucide-save"
|
|
289
|
-
size="
|
|
292
|
+
:size="ui.controlSize"
|
|
290
293
|
:label="t('nuxtUiMongocamp.queryBar.save')"
|
|
291
294
|
:disabled="!canSave || saveName.trim() === ''"
|
|
292
295
|
:title="canSave ? void 0 : t('nuxtUiMongocamp.queryBar.nothingToSave')"
|
|
@@ -323,9 +326,7 @@ function saveCurrent() {
|
|
|
323
326
|
<UButton
|
|
324
327
|
v-for="(query, index) in recent"
|
|
325
328
|
:key="index"
|
|
326
|
-
|
|
327
|
-
variant="ghost"
|
|
328
|
-
size="sm"
|
|
329
|
+
v-bind="ui.iconButton"
|
|
329
330
|
class="justify-start"
|
|
330
331
|
:label="describe(query)"
|
|
331
332
|
data-test="recent-query"
|
|
@@ -352,14 +353,14 @@ function saveCurrent() {
|
|
|
352
353
|
<UBadge
|
|
353
354
|
v-if="model.filterGroup.negate"
|
|
354
355
|
color="warning"
|
|
355
|
-
variant="
|
|
356
|
+
:variant="ui.badge.variant"
|
|
356
357
|
:label="t('nuxtUiMongocamp.collectionData.filterExcluding')"
|
|
357
358
|
/>
|
|
358
359
|
<UBadge
|
|
359
360
|
v-for="chip in filterChips"
|
|
360
361
|
:key="chip.id"
|
|
361
362
|
color="neutral"
|
|
362
|
-
variant="
|
|
363
|
+
:variant="ui.badge.variant"
|
|
363
364
|
class="gap-1"
|
|
364
365
|
>
|
|
365
366
|
{{ 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
|
/>
|
|
@@ -6,6 +6,7 @@ import { runBulkDelete } from "../utils/bulkDelete";
|
|
|
6
6
|
import { createSelectColumn } from "../utils/createSelectColumn";
|
|
7
7
|
import { createListPagination } from "../utils/listPagination";
|
|
8
8
|
import { useMongocampAdminGate } from "../composables/useMongocampAdminGate";
|
|
9
|
+
import { useMongocampUi } from "../composables/useMongocampUi";
|
|
9
10
|
const props = defineProps({
|
|
10
11
|
grantsPath: { type: String, required: false },
|
|
11
12
|
hideHeading: { type: Boolean, required: false },
|
|
@@ -13,6 +14,7 @@ const props = defineProps({
|
|
|
13
14
|
});
|
|
14
15
|
const emit = defineEmits(["changed"]);
|
|
15
16
|
const { t } = useI18n();
|
|
17
|
+
const ui = useMongocampUi();
|
|
16
18
|
const paths = useMongocampPaths();
|
|
17
19
|
const { listRoles, addRole, updateRole, deleteRole } = useMongocampAdmin();
|
|
18
20
|
const roles = ref([]);
|
|
@@ -201,8 +203,7 @@ function withTooltip(text, node) {
|
|
|
201
203
|
function sortHeader(column, label) {
|
|
202
204
|
const isSorted = column.getIsSorted();
|
|
203
205
|
return h(UButton, {
|
|
204
|
-
|
|
205
|
-
variant: "ghost",
|
|
206
|
+
...ui.value.sortHeader,
|
|
206
207
|
label,
|
|
207
208
|
icon: isSorted === "asc" ? "i-lucide-arrow-up-narrow-wide" : isSorted === "desc" ? "i-lucide-arrow-down-wide-narrow" : "i-lucide-arrow-up-down",
|
|
208
209
|
class: "-mx-2.5",
|
|
@@ -221,7 +222,7 @@ const columns = computed(() => [
|
|
|
221
222
|
cell: ({ row }) => h(UBadge, {
|
|
222
223
|
label: row.original.isAdmin ? t("nuxtUiMongocamp.common.admin") : t("nuxtUiMongocamp.common.standard"),
|
|
223
224
|
color: row.original.isAdmin ? "primary" : "neutral",
|
|
224
|
-
variant:
|
|
225
|
+
variant: ui.value.badge.variant
|
|
225
226
|
})
|
|
226
227
|
},
|
|
227
228
|
{
|
|
@@ -229,50 +230,41 @@ const columns = computed(() => [
|
|
|
229
230
|
header: t("nuxtUiMongocamp.roles.columnGrants"),
|
|
230
231
|
cell: ({ row }) => {
|
|
231
232
|
const count = row.original.collectionGrants?.length ?? 0;
|
|
232
|
-
return count ? h(UBadge, { label: String(count), color: "primary", variant:
|
|
233
|
+
return count ? h(UBadge, { label: String(count), color: "primary", variant: ui.value.badge.variant }) : h("span", { class: "text-dimmed" }, "\u2014");
|
|
233
234
|
}
|
|
234
235
|
},
|
|
235
236
|
{
|
|
236
237
|
id: "actions",
|
|
237
238
|
header: "",
|
|
238
|
-
cell: ({ row }) => h("div", { class: "flex gap-1 justify-end" }, [
|
|
239
|
+
cell: ({ row }) => h("div", { "class": "flex gap-1 justify-end", "data-mongocamp-part": "row-actions" }, [
|
|
239
240
|
withTooltip(t("nuxtUiMongocamp.roles.detailsTooltip"), h(UButton, {
|
|
240
241
|
"icon": "i-lucide-info",
|
|
241
|
-
|
|
242
|
-
"variant": "ghost",
|
|
243
|
-
"size": "sm",
|
|
242
|
+
...ui.value.iconButton,
|
|
244
243
|
"aria-label": t("nuxtUiMongocamp.roles.detailsTooltip"),
|
|
245
244
|
"onClick": () => openDetail(row.original)
|
|
246
245
|
})),
|
|
247
246
|
withTooltip(t("nuxtUiMongocamp.roles.manageGrantsTooltip"), h(UButton, {
|
|
248
247
|
"icon": "i-lucide-key",
|
|
249
|
-
|
|
250
|
-
"variant": "ghost",
|
|
251
|
-
"size": "sm",
|
|
248
|
+
...ui.value.iconButton,
|
|
252
249
|
"aria-label": t("nuxtUiMongocamp.roles.manageGrantsTooltip"),
|
|
253
250
|
"to": `${props.grantsPath || paths.roles}/${row.original.name}`
|
|
254
251
|
})),
|
|
255
252
|
withTooltip(t("nuxtUiMongocamp.roles.editRoleTooltip"), h(UButton, {
|
|
256
253
|
"icon": "i-lucide-pencil",
|
|
257
|
-
|
|
258
|
-
"variant": "ghost",
|
|
259
|
-
"size": "sm",
|
|
254
|
+
...ui.value.iconButton,
|
|
260
255
|
"aria-label": t("nuxtUiMongocamp.roles.editRoleTooltip"),
|
|
261
256
|
"onClick": () => openEdit(row.original)
|
|
262
257
|
})),
|
|
263
258
|
withTooltip(t("nuxtUiMongocamp.roles.cloneRoleTooltip"), h(UButton, {
|
|
264
259
|
"icon": "i-lucide-copy",
|
|
265
|
-
|
|
266
|
-
"variant": "ghost",
|
|
267
|
-
"size": "sm",
|
|
260
|
+
...ui.value.iconButton,
|
|
268
261
|
"aria-label": t("nuxtUiMongocamp.roles.cloneRoleTooltip"),
|
|
269
262
|
"onClick": () => openClone(row.original)
|
|
270
263
|
})),
|
|
271
264
|
withTooltip(t("nuxtUiMongocamp.roles.deleteRoleTooltip"), h(UButton, {
|
|
272
265
|
"icon": "i-lucide-trash-2",
|
|
266
|
+
...ui.value.iconButton,
|
|
273
267
|
"color": "error",
|
|
274
|
-
"variant": "ghost",
|
|
275
|
-
"size": "sm",
|
|
276
268
|
"aria-label": t("nuxtUiMongocamp.roles.deleteRoleTooltip"),
|
|
277
269
|
"onClick": () => confirmDelete(row.original.name)
|
|
278
270
|
}))
|
|
@@ -286,27 +278,32 @@ defineExpose({ refresh: fetchRoles });
|
|
|
286
278
|
<template>
|
|
287
279
|
<MongocampEmptyState
|
|
288
280
|
v-if="blocked"
|
|
281
|
+
class="mongocamp-roles"
|
|
289
282
|
icon="i-lucide-shield-alert"
|
|
290
283
|
:title="message"
|
|
291
284
|
data-test="admin-only"
|
|
292
285
|
/>
|
|
293
286
|
<div
|
|
294
287
|
v-else
|
|
295
|
-
class="flex flex-col gap-4"
|
|
288
|
+
class="mongocamp-roles flex flex-col gap-4"
|
|
296
289
|
>
|
|
297
290
|
<div class="flex items-center justify-between gap-4">
|
|
298
291
|
<h2
|
|
299
292
|
v-if="!hideHeading"
|
|
293
|
+
data-mongocamp-part="heading"
|
|
300
294
|
class="text-xl font-semibold"
|
|
301
295
|
>
|
|
302
296
|
{{ t("nuxtUiMongocamp.roles.heading") }}
|
|
303
297
|
</h2>
|
|
304
|
-
<div
|
|
298
|
+
<div
|
|
299
|
+
data-mongocamp-part="toolbar"
|
|
300
|
+
class="flex flex-1 items-center gap-2"
|
|
301
|
+
>
|
|
305
302
|
<UInput
|
|
306
303
|
v-model="filterText"
|
|
307
304
|
icon="i-lucide-search"
|
|
308
305
|
:placeholder="t('nuxtUiMongocamp.roles.searchPlaceholder')"
|
|
309
|
-
size="
|
|
306
|
+
:size="ui.controlSize"
|
|
310
307
|
class="flex-1 max-w-xs"
|
|
311
308
|
@input="onFilterInput"
|
|
312
309
|
/>
|
|
@@ -316,8 +313,7 @@ defineExpose({ refresh: fetchRoles });
|
|
|
316
313
|
>
|
|
317
314
|
<UButton
|
|
318
315
|
icon="i-lucide-refresh-cw"
|
|
319
|
-
|
|
320
|
-
variant="ghost"
|
|
316
|
+
v-bind="ui.toolbarButton"
|
|
321
317
|
:loading="loading"
|
|
322
318
|
:aria-label="t('nuxtUiMongocamp.common.refresh')"
|
|
323
319
|
@click="fetchRoles"
|
|
@@ -350,6 +346,7 @@ defineExpose({ refresh: fetchRoles });
|
|
|
350
346
|
v-model:sorting="sorting"
|
|
351
347
|
v-model:row-selection="rowSelection"
|
|
352
348
|
v-model:pagination="pagination"
|
|
349
|
+
data-mongocamp-part="table"
|
|
353
350
|
:pagination-options="paginationOptions"
|
|
354
351
|
:get-row-id="(row) => row.name"
|
|
355
352
|
:data="roles"
|
|
@@ -435,7 +432,7 @@ defineExpose({ refresh: fetchRoles });
|
|
|
435
432
|
v-if="cloneError"
|
|
436
433
|
class="mt-3"
|
|
437
434
|
color="error"
|
|
438
|
-
variant="
|
|
435
|
+
:variant="ui.alert.variant"
|
|
439
436
|
icon="i-lucide-circle-alert"
|
|
440
437
|
:description="cloneError"
|
|
441
438
|
/>
|
|
@@ -446,7 +443,7 @@ defineExpose({ refresh: fetchRoles });
|
|
|
446
443
|
<UModal
|
|
447
444
|
v-model:open="isDeleteModalOpen"
|
|
448
445
|
:title="t('nuxtUiMongocamp.roles.deleteRoleTitle')"
|
|
449
|
-
:ui="{ footer:
|
|
446
|
+
:ui="{ footer: ui.modal.footer }"
|
|
450
447
|
>
|
|
451
448
|
<template #body>
|
|
452
449
|
<p>{{ t("nuxtUiMongocamp.roles.confirmDelete", { roleName: roleToDelete }) }}</p>
|
|
@@ -454,7 +451,7 @@ defineExpose({ refresh: fetchRoles });
|
|
|
454
451
|
v-if="deleteError"
|
|
455
452
|
class="mt-3"
|
|
456
453
|
color="error"
|
|
457
|
-
variant="
|
|
454
|
+
:variant="ui.alert.variant"
|
|
458
455
|
icon="i-lucide-circle-alert"
|
|
459
456
|
:description="deleteError"
|
|
460
457
|
/>
|
|
@@ -462,14 +459,13 @@ defineExpose({ refresh: fetchRoles });
|
|
|
462
459
|
<template #footer>
|
|
463
460
|
<UButton
|
|
464
461
|
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
465
|
-
|
|
466
|
-
variant="ghost"
|
|
462
|
+
v-bind="ui.dialogCancel"
|
|
467
463
|
:disabled="deleting"
|
|
468
464
|
@click="isDeleteModalOpen = false"
|
|
469
465
|
/>
|
|
470
466
|
<UButton
|
|
471
467
|
:label="t('nuxtUiMongocamp.common.delete')"
|
|
472
|
-
|
|
468
|
+
v-bind="ui.dangerAction"
|
|
473
469
|
:loading="deleting"
|
|
474
470
|
@click="handleDeleteRole"
|
|
475
471
|
/>
|
|
@@ -479,7 +475,7 @@ defineExpose({ refresh: fetchRoles });
|
|
|
479
475
|
<USlideover
|
|
480
476
|
v-model:open="isDetailOpen"
|
|
481
477
|
:title="t('nuxtUiMongocamp.roles.detailsTitle', { roleName: detail?.name ?? '' })"
|
|
482
|
-
:ui="{ content:
|
|
478
|
+
:ui="{ content: ui.modal.md }"
|
|
483
479
|
>
|
|
484
480
|
<template #body>
|
|
485
481
|
<div
|
|
@@ -490,7 +486,7 @@ defineExpose({ refresh: fetchRoles });
|
|
|
490
486
|
<UBadge
|
|
491
487
|
:label="detail.isAdmin ? t('nuxtUiMongocamp.common.admin') : t('nuxtUiMongocamp.common.standard')"
|
|
492
488
|
:color="detail.isAdmin ? 'primary' : 'neutral'"
|
|
493
|
-
variant="
|
|
489
|
+
:variant="ui.badge.variant"
|
|
494
490
|
/>
|
|
495
491
|
</div>
|
|
496
492
|
<section class="flex flex-col gap-2">
|