@sfxcode/nuxt-ui-mongocamp 1.1.3 → 1.2.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 +31 -9
- package/dist/module.d.mts +22 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +41 -5
- package/dist/runtime/components/MongocampAccount.vue +21 -20
- package/dist/runtime/components/MongocampBucketFiles.d.vue.ts +6 -0
- package/dist/runtime/components/MongocampBucketFiles.vue +364 -0
- package/dist/runtime/components/MongocampBucketFiles.vue.d.ts +6 -0
- package/dist/runtime/components/MongocampCollectionData.vue +36 -35
- package/dist/runtime/components/MongocampCollectionInfos.vue +37 -36
- package/dist/runtime/components/MongocampCollections.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampCollections.vue +38 -28
- package/dist/runtime/components/MongocampCollections.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampDatabases.vue +13 -12
- package/dist/runtime/components/MongocampJobs.vue +43 -45
- package/dist/runtime/components/MongocampLogin.d.vue.ts +4 -1
- package/dist/runtime/components/MongocampLogin.vue +13 -9
- package/dist/runtime/components/MongocampLogin.vue.d.ts +4 -1
- package/dist/runtime/components/MongocampRoleGrants.vue +30 -28
- package/dist/runtime/components/MongocampRoles.vue +30 -31
- package/dist/runtime/components/MongocampUsers.vue +35 -36
- package/dist/runtime/components/MongocampVersion.vue +3 -1
- package/dist/runtime/composables/useMongocampAccount.js +6 -5
- package/dist/runtime/composables/useMongocampAdmin.js +2 -2
- package/dist/runtime/composables/useMongocampBucket.d.ts +20 -1
- package/dist/runtime/composables/useMongocampBucket.js +62 -13
- package/dist/runtime/composables/useMongocampClientApi.d.ts +13 -0
- package/dist/runtime/composables/useMongocampClientApi.js +8 -0
- package/dist/runtime/composables/useMongocampIndex.js +2 -2
- package/dist/runtime/composables/useMongocampJobs.js +2 -2
- package/dist/runtime/composables/useMongocampProxyApi.d.ts +13 -0
- package/dist/runtime/composables/useMongocampProxyApi.js +9 -0
- package/dist/runtime/composables/useMongocampRoles.d.ts +2 -0
- package/dist/runtime/composables/useMongocampRoles.js +4 -2
- package/dist/runtime/composables/useMongocampSystem.js +2 -2
- package/dist/runtime/locales/de.json +265 -0
- package/dist/runtime/locales/en.json +265 -0
- package/dist/runtime/plugin.js +8 -8
- package/dist/runtime/server/handlers/mongocampProxy.d.ts +2 -0
- package/dist/runtime/server/handlers/mongocampProxy.js +45 -0
- package/dist/runtime/utils/createProxyMongocampApis.d.ts +15 -0
- package/dist/runtime/utils/createProxyMongocampApis.js +28 -0
- package/package.json +13 -6
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { h, reactive, ref, resolveComponent } from "vue";
|
|
3
|
-
import { useMongocampJobs, useToast } from "#imports";
|
|
3
|
+
import { useI18n, useMongocampJobs, useToast } from "#imports";
|
|
4
|
+
const { t } = useI18n();
|
|
4
5
|
const { listJobs, listPossibleJobs, registerJob, updateJob, executeJob, deleteJob } = useMongocampJobs();
|
|
5
6
|
const toast = useToast();
|
|
6
7
|
const jobs = ref([]);
|
|
@@ -38,69 +39,69 @@ const addJobSchema = reactive([
|
|
|
38
39
|
{
|
|
39
40
|
$formkit: "nuxtUIInput",
|
|
40
41
|
name: "name",
|
|
41
|
-
label: "
|
|
42
|
+
label: t("nuxtUiMongocamp.jobs.name"),
|
|
42
43
|
validation: "required"
|
|
43
44
|
},
|
|
44
45
|
{
|
|
45
46
|
$formkit: "nuxtUIInput",
|
|
46
47
|
name: "group",
|
|
47
|
-
label: "
|
|
48
|
+
label: t("nuxtUiMongocamp.jobs.group"),
|
|
48
49
|
validation: "required"
|
|
49
50
|
},
|
|
50
51
|
{
|
|
51
52
|
$formkit: "nuxtUISelectMenu",
|
|
52
53
|
name: "className",
|
|
53
|
-
label: "
|
|
54
|
+
label: t("nuxtUiMongocamp.jobs.jobClass"),
|
|
54
55
|
options: [],
|
|
55
56
|
validation: "required"
|
|
56
57
|
},
|
|
57
58
|
{
|
|
58
59
|
$formkit: "nuxtUIInput",
|
|
59
60
|
name: "description",
|
|
60
|
-
label: "
|
|
61
|
+
label: t("nuxtUiMongocamp.jobs.description")
|
|
61
62
|
},
|
|
62
63
|
{
|
|
63
64
|
$formkit: "nuxtUIInput",
|
|
64
65
|
name: "cronExpression",
|
|
65
|
-
label: "
|
|
66
|
-
help: "
|
|
66
|
+
label: t("nuxtUiMongocamp.jobs.cronExpression"),
|
|
67
|
+
help: t("nuxtUiMongocamp.jobs.cronExpressionHelp"),
|
|
67
68
|
validation: "required"
|
|
68
69
|
},
|
|
69
70
|
{
|
|
70
71
|
$formkit: "nuxtUIInputNumber",
|
|
71
72
|
name: "priority",
|
|
72
|
-
label: "
|
|
73
|
+
label: t("nuxtUiMongocamp.jobs.priority")
|
|
73
74
|
}
|
|
74
75
|
]);
|
|
75
76
|
const editJobSchema = reactive([
|
|
76
77
|
{
|
|
77
78
|
$formkit: "nuxtUIInput",
|
|
78
79
|
name: "name",
|
|
79
|
-
label: "
|
|
80
|
+
label: t("nuxtUiMongocamp.jobs.name"),
|
|
80
81
|
validation: "required"
|
|
81
82
|
},
|
|
82
83
|
{
|
|
83
84
|
$formkit: "nuxtUIInput",
|
|
84
85
|
name: "group",
|
|
85
|
-
label: "
|
|
86
|
+
label: t("nuxtUiMongocamp.jobs.group"),
|
|
86
87
|
validation: "required"
|
|
87
88
|
},
|
|
88
89
|
{
|
|
89
90
|
$formkit: "nuxtUIInput",
|
|
90
91
|
name: "description",
|
|
91
|
-
label: "
|
|
92
|
+
label: t("nuxtUiMongocamp.jobs.description")
|
|
92
93
|
},
|
|
93
94
|
{
|
|
94
95
|
$formkit: "nuxtUIInput",
|
|
95
96
|
name: "cronExpression",
|
|
96
|
-
label: "
|
|
97
|
-
help: "
|
|
97
|
+
label: t("nuxtUiMongocamp.jobs.cronExpression"),
|
|
98
|
+
help: t("nuxtUiMongocamp.jobs.cronExpressionHelp"),
|
|
98
99
|
validation: "required"
|
|
99
100
|
},
|
|
100
101
|
{
|
|
101
102
|
$formkit: "nuxtUIInputNumber",
|
|
102
103
|
name: "priority",
|
|
103
|
-
label: "
|
|
104
|
+
label: t("nuxtUiMongocamp.jobs.priority")
|
|
104
105
|
}
|
|
105
106
|
]);
|
|
106
107
|
async function openAdd() {
|
|
@@ -117,7 +118,7 @@ async function handleAddJob() {
|
|
|
117
118
|
isAddModalOpen.value = false;
|
|
118
119
|
await fetchJobs();
|
|
119
120
|
} catch (e) {
|
|
120
|
-
errorMessage.value = e instanceof Error ? e.message : "
|
|
121
|
+
errorMessage.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.jobs.errorAdd");
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
124
|
function openEdit(job) {
|
|
@@ -141,7 +142,7 @@ async function handleEditJob() {
|
|
|
141
142
|
isEditModalOpen.value = false;
|
|
142
143
|
await fetchJobs();
|
|
143
144
|
} catch (e) {
|
|
144
|
-
errorMessage.value = e instanceof Error ? e.message : "
|
|
145
|
+
errorMessage.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.jobs.errorEdit");
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
148
|
const jobToDelete = ref({ group: "", name: "" });
|
|
@@ -159,9 +160,9 @@ async function handleExecuteJob(group, name) {
|
|
|
159
160
|
executingJobs.value.add(key);
|
|
160
161
|
try {
|
|
161
162
|
await executeJob(group, name);
|
|
162
|
-
toast.add({ title: "
|
|
163
|
-
} catch {
|
|
164
|
-
toast.add({ title: "
|
|
163
|
+
toast.add({ title: t("nuxtUiMongocamp.jobs.executedTitle"), description: t("nuxtUiMongocamp.jobs.executedDescription", { name }), color: "success" });
|
|
164
|
+
} catch (e) {
|
|
165
|
+
toast.add({ title: t("nuxtUiMongocamp.jobs.executionFailedTitle"), description: e instanceof Error ? e.message : t("nuxtUiMongocamp.jobs.executionFailedDescription", { name }), color: "error" });
|
|
165
166
|
} finally {
|
|
166
167
|
executingJobs.value.delete(key);
|
|
167
168
|
}
|
|
@@ -189,25 +190,25 @@ function sortHeader(column, label) {
|
|
|
189
190
|
const columns = [
|
|
190
191
|
{
|
|
191
192
|
accessorKey: "name",
|
|
192
|
-
header: ({ column }) => sortHeader(column, "
|
|
193
|
+
header: ({ column }) => sortHeader(column, t("nuxtUiMongocamp.jobs.columnName"))
|
|
193
194
|
},
|
|
194
195
|
{
|
|
195
196
|
accessorKey: "group",
|
|
196
|
-
header: ({ column }) => sortHeader(column, "
|
|
197
|
+
header: ({ column }) => sortHeader(column, t("nuxtUiMongocamp.jobs.columnGroup"))
|
|
197
198
|
},
|
|
198
199
|
{
|
|
199
200
|
accessorKey: "cronExpression",
|
|
200
|
-
header: "
|
|
201
|
+
header: t("nuxtUiMongocamp.jobs.columnCron"),
|
|
201
202
|
cell: ({ row }) => h("span", { class: "font-mono text-xs" }, row.original.cronExpression)
|
|
202
203
|
},
|
|
203
204
|
{
|
|
204
205
|
accessorKey: "nextScheduledFireTime",
|
|
205
|
-
header: "
|
|
206
|
+
header: t("nuxtUiMongocamp.jobs.columnNextFireTime"),
|
|
206
207
|
cell: ({ row }) => h("span", formatFireTime(row.original.nextScheduledFireTime))
|
|
207
208
|
},
|
|
208
209
|
{
|
|
209
210
|
accessorKey: "priority",
|
|
210
|
-
header: ({ column }) => sortHeader(column, "
|
|
211
|
+
header: ({ column }) => sortHeader(column, t("nuxtUiMongocamp.jobs.columnPriority"))
|
|
211
212
|
},
|
|
212
213
|
{
|
|
213
214
|
id: "actions",
|
|
@@ -215,29 +216,29 @@ const columns = [
|
|
|
215
216
|
cell: ({ row }) => {
|
|
216
217
|
const key = jobKey(row.original.group, row.original.name);
|
|
217
218
|
return h("div", { class: "flex gap-1 justify-end" }, [
|
|
218
|
-
withTooltip("
|
|
219
|
+
withTooltip(t("nuxtUiMongocamp.jobs.executeNowTooltip"), h(UButton, {
|
|
219
220
|
"icon": "i-lucide-play",
|
|
220
221
|
"color": "neutral",
|
|
221
222
|
"variant": "ghost",
|
|
222
223
|
"size": "sm",
|
|
223
|
-
"aria-label": "
|
|
224
|
+
"aria-label": t("nuxtUiMongocamp.jobs.executeNowTooltip"),
|
|
224
225
|
"loading": executingJobs.value.has(key),
|
|
225
226
|
"onClick": () => handleExecuteJob(row.original.group, row.original.name)
|
|
226
227
|
})),
|
|
227
|
-
withTooltip("
|
|
228
|
+
withTooltip(t("nuxtUiMongocamp.jobs.editJobTooltip"), h(UButton, {
|
|
228
229
|
"icon": "i-lucide-pencil",
|
|
229
230
|
"color": "neutral",
|
|
230
231
|
"variant": "ghost",
|
|
231
232
|
"size": "sm",
|
|
232
|
-
"aria-label": "
|
|
233
|
+
"aria-label": t("nuxtUiMongocamp.jobs.editJobTooltip"),
|
|
233
234
|
"onClick": () => openEdit(row.original)
|
|
234
235
|
})),
|
|
235
|
-
withTooltip("
|
|
236
|
+
withTooltip(t("nuxtUiMongocamp.jobs.deleteJobTooltip"), h(UButton, {
|
|
236
237
|
"icon": "i-lucide-trash-2",
|
|
237
238
|
"color": "error",
|
|
238
239
|
"variant": "ghost",
|
|
239
240
|
"size": "sm",
|
|
240
|
-
"aria-label": "
|
|
241
|
+
"aria-label": t("nuxtUiMongocamp.jobs.deleteJobTooltip"),
|
|
241
242
|
"onClick": () => confirmDelete(row.original.group, row.original.name)
|
|
242
243
|
}))
|
|
243
244
|
]);
|
|
@@ -251,22 +252,22 @@ fetchJobs();
|
|
|
251
252
|
<div class="flex flex-col gap-4">
|
|
252
253
|
<div class="flex items-center justify-between gap-4">
|
|
253
254
|
<h2 class="text-xl font-semibold">
|
|
254
|
-
|
|
255
|
+
{{ t("nuxtUiMongocamp.jobs.heading") }}
|
|
255
256
|
</h2>
|
|
256
257
|
<div class="flex items-center gap-2">
|
|
257
|
-
<UTooltip text="
|
|
258
|
+
<UTooltip :text="t('nuxtUiMongocamp.common.refresh')">
|
|
258
259
|
<UButton
|
|
259
260
|
icon="i-lucide-refresh-cw"
|
|
260
261
|
color="neutral"
|
|
261
262
|
variant="ghost"
|
|
262
263
|
:loading="loading"
|
|
263
|
-
aria-label="
|
|
264
|
+
:aria-label="t('nuxtUiMongocamp.common.refresh')"
|
|
264
265
|
@click="fetchJobs"
|
|
265
266
|
/>
|
|
266
267
|
</UTooltip>
|
|
267
268
|
<UButton
|
|
268
269
|
icon="i-lucide-plus"
|
|
269
|
-
label="
|
|
270
|
+
:label="t('nuxtUiMongocamp.jobs.addJob')"
|
|
270
271
|
@click="openAdd"
|
|
271
272
|
/>
|
|
272
273
|
</div>
|
|
@@ -282,13 +283,13 @@ fetchJobs();
|
|
|
282
283
|
<!-- Add Job Modal -->
|
|
283
284
|
<UModal
|
|
284
285
|
v-model:open="isAddModalOpen"
|
|
285
|
-
title="
|
|
286
|
+
:title="t('nuxtUiMongocamp.jobs.addJob')"
|
|
286
287
|
>
|
|
287
288
|
<template #body>
|
|
288
289
|
<FUDataEdit
|
|
289
290
|
:data="newJob"
|
|
290
291
|
:schema="addJobSchema"
|
|
291
|
-
submit-label="
|
|
292
|
+
:submit-label="t('nuxtUiMongocamp.jobs.addJob')"
|
|
292
293
|
submit-icon="i-lucide-plus"
|
|
293
294
|
@data-saved="handleAddJob"
|
|
294
295
|
/>
|
|
@@ -304,13 +305,13 @@ fetchJobs();
|
|
|
304
305
|
<!-- Edit Job Modal -->
|
|
305
306
|
<UModal
|
|
306
307
|
v-model:open="isEditModalOpen"
|
|
307
|
-
:title="
|
|
308
|
+
:title="t('nuxtUiMongocamp.jobs.editJobTitle', { name: editJobOriginal.name })"
|
|
308
309
|
>
|
|
309
310
|
<template #body>
|
|
310
311
|
<FUDataEdit
|
|
311
312
|
:data="editJob"
|
|
312
313
|
:schema="editJobSchema"
|
|
313
|
-
submit-label="
|
|
314
|
+
:submit-label="t('nuxtUiMongocamp.common.saveChanges')"
|
|
314
315
|
submit-icon="i-lucide-save"
|
|
315
316
|
@data-saved="handleEditJob"
|
|
316
317
|
/>
|
|
@@ -326,24 +327,21 @@ fetchJobs();
|
|
|
326
327
|
<!-- Delete Confirmation Modal -->
|
|
327
328
|
<UModal
|
|
328
329
|
v-model:open="isDeleteModalOpen"
|
|
329
|
-
title="
|
|
330
|
+
:title="t('nuxtUiMongocamp.jobs.deleteJobTitle')"
|
|
330
331
|
:ui="{ footer: 'justify-end' }"
|
|
331
332
|
>
|
|
332
333
|
<template #body>
|
|
333
|
-
<p>
|
|
334
|
-
Are you sure you want to delete job <strong>{{ jobToDelete.name }}</strong>?
|
|
335
|
-
This action cannot be undone.
|
|
336
|
-
</p>
|
|
334
|
+
<p>{{ t("nuxtUiMongocamp.jobs.confirmDelete", { name: jobToDelete.name }) }}</p>
|
|
337
335
|
</template>
|
|
338
336
|
<template #footer>
|
|
339
337
|
<UButton
|
|
340
|
-
label="
|
|
338
|
+
:label="t('nuxtUiMongocamp.common.cancel')"
|
|
341
339
|
color="neutral"
|
|
342
340
|
variant="ghost"
|
|
343
341
|
@click="isDeleteModalOpen = false"
|
|
344
342
|
/>
|
|
345
343
|
<UButton
|
|
346
|
-
label="
|
|
344
|
+
:label="t('nuxtUiMongocamp.common.delete')"
|
|
347
345
|
color="error"
|
|
348
346
|
icon="i-lucide-trash-2"
|
|
349
347
|
@click="handleDeleteJob"
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
redirectPath?: string;
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
2
5
|
declare const _default: typeof __VLS_export;
|
|
3
6
|
export default _default;
|
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { consola } from "consola";
|
|
3
3
|
import { ref, reactive } from "vue";
|
|
4
|
-
import { useMongocampAuth } from "#imports";
|
|
5
|
-
import { navigateTo, useCookie } from "#app";
|
|
4
|
+
import { useI18n, useMongocampAuth } from "#imports";
|
|
5
|
+
import { navigateTo, useCookie, useNuxtApp } from "#app";
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
redirectPath: { type: String, required: false }
|
|
8
|
+
});
|
|
9
|
+
const { t } = useI18n();
|
|
6
10
|
const { login } = useMongocampAuth();
|
|
7
11
|
const errorMessage = ref("");
|
|
12
|
+
const nuxtApp = useNuxtApp();
|
|
8
13
|
const loginMail = useCookie("mongocamp_login", { maxAge: 30 * 24 * 60 * 60 });
|
|
9
14
|
const data = ref({ userId: loginMail.value, password: "" });
|
|
10
15
|
const schema = reactive(
|
|
11
16
|
[
|
|
12
17
|
{
|
|
13
18
|
$el: "h3",
|
|
14
|
-
children: "
|
|
19
|
+
children: t("nuxtUiMongocamp.login.heading")
|
|
15
20
|
},
|
|
16
21
|
{
|
|
17
22
|
$formkit: "nuxtUIInput",
|
|
18
23
|
name: "userId",
|
|
19
|
-
label: "
|
|
24
|
+
label: t("nuxtUiMongocamp.login.email"),
|
|
20
25
|
validation: "required|email"
|
|
21
26
|
},
|
|
22
27
|
{
|
|
23
28
|
$formkit: "nuxtUIInput",
|
|
24
29
|
name: "password",
|
|
25
|
-
label: "
|
|
30
|
+
label: t("nuxtUiMongocamp.login.password"),
|
|
26
31
|
inputType: "password",
|
|
27
32
|
validation: "required|length:3"
|
|
28
33
|
}
|
|
@@ -34,10 +39,10 @@ async function actionLogin() {
|
|
|
34
39
|
try {
|
|
35
40
|
await login(loginId, data.value?.password);
|
|
36
41
|
loginMail.value = loginId;
|
|
37
|
-
navigateTo("/
|
|
42
|
+
await nuxtApp.runWithContext(() => navigateTo(props.redirectPath ?? "/"));
|
|
38
43
|
} catch (e) {
|
|
39
44
|
consola.log(e);
|
|
40
|
-
errorMessage.value = "
|
|
45
|
+
errorMessage.value = t("nuxtUiMongocamp.login.error");
|
|
41
46
|
}
|
|
42
47
|
}
|
|
43
48
|
</script>
|
|
@@ -48,8 +53,7 @@ async function actionLogin() {
|
|
|
48
53
|
<FUDataEdit
|
|
49
54
|
:data="data"
|
|
50
55
|
:schema="schema"
|
|
51
|
-
submit-label="
|
|
52
|
-
debug-data
|
|
56
|
+
:submit-label="t('nuxtUiMongocamp.login.submit')"
|
|
53
57
|
@data-saved="actionLogin"
|
|
54
58
|
/>
|
|
55
59
|
<div
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
redirectPath?: string;
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
2
5
|
declare const _default: typeof __VLS_export;
|
|
3
6
|
export default _default;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { h, reactive, ref, resolveComponent } from "vue";
|
|
3
|
+
import { useI18n } from "#imports";
|
|
3
4
|
import useMongocampAdmin from "../composables/useMongocampAdmin";
|
|
4
5
|
const props = defineProps({
|
|
5
6
|
roleName: { type: String, required: true }
|
|
6
7
|
});
|
|
8
|
+
const { t } = useI18n();
|
|
7
9
|
const { listRoles, updateRole, listCollections } = useMongocampAdmin();
|
|
8
10
|
const grants = ref([]);
|
|
9
11
|
const allCollections = ref([]);
|
|
@@ -20,7 +22,7 @@ const addGrantSchema = reactive([
|
|
|
20
22
|
{
|
|
21
23
|
$formkit: "nuxtUISelectMenu",
|
|
22
24
|
name: "collectionName",
|
|
23
|
-
label: "
|
|
25
|
+
label: t("nuxtUiMongocamp.roleGrants.collection"),
|
|
24
26
|
class: "w-full",
|
|
25
27
|
options: [],
|
|
26
28
|
validation: "required"
|
|
@@ -28,34 +30,34 @@ const addGrantSchema = reactive([
|
|
|
28
30
|
{
|
|
29
31
|
$formkit: "nuxtUISwitch",
|
|
30
32
|
name: "read",
|
|
31
|
-
label: "
|
|
33
|
+
label: t("nuxtUiMongocamp.roleGrants.read")
|
|
32
34
|
},
|
|
33
35
|
{
|
|
34
36
|
$formkit: "nuxtUISwitch",
|
|
35
37
|
name: "write",
|
|
36
|
-
label: "
|
|
38
|
+
label: t("nuxtUiMongocamp.roleGrants.write")
|
|
37
39
|
},
|
|
38
40
|
{
|
|
39
41
|
$formkit: "nuxtUISwitch",
|
|
40
42
|
name: "administrate",
|
|
41
|
-
label: "
|
|
43
|
+
label: t("nuxtUiMongocamp.roleGrants.administrate")
|
|
42
44
|
}
|
|
43
45
|
]);
|
|
44
46
|
const editGrantSchema = reactive([
|
|
45
47
|
{
|
|
46
48
|
$formkit: "nuxtUISwitch",
|
|
47
49
|
name: "read",
|
|
48
|
-
label: "
|
|
50
|
+
label: t("nuxtUiMongocamp.roleGrants.read")
|
|
49
51
|
},
|
|
50
52
|
{
|
|
51
53
|
$formkit: "nuxtUISwitch",
|
|
52
54
|
name: "write",
|
|
53
|
-
label: "
|
|
55
|
+
label: t("nuxtUiMongocamp.roleGrants.write")
|
|
54
56
|
},
|
|
55
57
|
{
|
|
56
58
|
$formkit: "nuxtUISwitch",
|
|
57
59
|
name: "administrate",
|
|
58
|
-
label: "
|
|
60
|
+
label: t("nuxtUiMongocamp.roleGrants.administrate")
|
|
59
61
|
}
|
|
60
62
|
]);
|
|
61
63
|
async function fetchRole() {
|
|
@@ -80,7 +82,7 @@ async function saveGrants() {
|
|
|
80
82
|
await updateRole(props.roleName, isAdmin.value, grants.value);
|
|
81
83
|
await fetchRole();
|
|
82
84
|
} catch (e) {
|
|
83
|
-
errorMessage.value = e instanceof Error ? e.message : "
|
|
85
|
+
errorMessage.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.roleGrants.errorSave");
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
88
|
async function handleAddGrant() {
|
|
@@ -133,11 +135,11 @@ function withTooltip(text, node) {
|
|
|
133
135
|
const columns = [
|
|
134
136
|
{
|
|
135
137
|
accessorKey: "name",
|
|
136
|
-
header: "
|
|
138
|
+
header: t("nuxtUiMongocamp.roleGrants.columnCollection")
|
|
137
139
|
},
|
|
138
140
|
{
|
|
139
141
|
accessorKey: "grantType",
|
|
140
|
-
header: "
|
|
142
|
+
header: t("nuxtUiMongocamp.roleGrants.columnType"),
|
|
141
143
|
cell: ({ row }) => h(UBadge, {
|
|
142
144
|
label: row.original.grantType,
|
|
143
145
|
color: "neutral",
|
|
@@ -146,27 +148,27 @@ const columns = [
|
|
|
146
148
|
},
|
|
147
149
|
{
|
|
148
150
|
accessorKey: "read",
|
|
149
|
-
header: "
|
|
151
|
+
header: t("nuxtUiMongocamp.roleGrants.columnRead"),
|
|
150
152
|
cell: ({ row }) => h(UBadge, {
|
|
151
|
-
label: row.original.read ? "
|
|
153
|
+
label: row.original.read ? t("nuxtUiMongocamp.common.yes") : t("nuxtUiMongocamp.common.no"),
|
|
152
154
|
color: row.original.read ? "success" : "neutral",
|
|
153
155
|
variant: "subtle"
|
|
154
156
|
})
|
|
155
157
|
},
|
|
156
158
|
{
|
|
157
159
|
accessorKey: "write",
|
|
158
|
-
header: "
|
|
160
|
+
header: t("nuxtUiMongocamp.roleGrants.columnWrite"),
|
|
159
161
|
cell: ({ row }) => h(UBadge, {
|
|
160
|
-
label: row.original.write ? "
|
|
162
|
+
label: row.original.write ? t("nuxtUiMongocamp.common.yes") : t("nuxtUiMongocamp.common.no"),
|
|
161
163
|
color: row.original.write ? "success" : "neutral",
|
|
162
164
|
variant: "subtle"
|
|
163
165
|
})
|
|
164
166
|
},
|
|
165
167
|
{
|
|
166
168
|
accessorKey: "administrate",
|
|
167
|
-
header: "
|
|
169
|
+
header: t("nuxtUiMongocamp.roleGrants.columnAdmin"),
|
|
168
170
|
cell: ({ row }) => h(UBadge, {
|
|
169
|
-
label: row.original.administrate ? "
|
|
171
|
+
label: row.original.administrate ? t("nuxtUiMongocamp.common.yes") : t("nuxtUiMongocamp.common.no"),
|
|
170
172
|
color: row.original.administrate ? "error" : "neutral",
|
|
171
173
|
variant: "subtle"
|
|
172
174
|
})
|
|
@@ -175,20 +177,20 @@ const columns = [
|
|
|
175
177
|
id: "actions",
|
|
176
178
|
header: "",
|
|
177
179
|
cell: ({ row }) => h("div", { class: "flex gap-1 justify-end" }, [
|
|
178
|
-
withTooltip("
|
|
180
|
+
withTooltip(t("nuxtUiMongocamp.roleGrants.editGrantTooltip"), h(UButton, {
|
|
179
181
|
"icon": "i-lucide-pencil",
|
|
180
182
|
"color": "neutral",
|
|
181
183
|
"variant": "ghost",
|
|
182
184
|
"size": "sm",
|
|
183
|
-
"aria-label": "
|
|
185
|
+
"aria-label": t("nuxtUiMongocamp.roleGrants.editGrantTooltip"),
|
|
184
186
|
"onClick": () => openEdit(row.index)
|
|
185
187
|
})),
|
|
186
|
-
withTooltip("
|
|
188
|
+
withTooltip(t("nuxtUiMongocamp.roleGrants.removeGrantTooltip"), h(UButton, {
|
|
187
189
|
"icon": "i-lucide-trash-2",
|
|
188
190
|
"color": "error",
|
|
189
191
|
"variant": "ghost",
|
|
190
192
|
"size": "sm",
|
|
191
|
-
"aria-label": "
|
|
193
|
+
"aria-label": t("nuxtUiMongocamp.roleGrants.removeGrantTooltip"),
|
|
192
194
|
"onClick": () => removeGrant(row.index)
|
|
193
195
|
}))
|
|
194
196
|
])
|
|
@@ -202,22 +204,22 @@ fetchCollections();
|
|
|
202
204
|
<div class="flex flex-col gap-4">
|
|
203
205
|
<div class="flex items-center justify-between">
|
|
204
206
|
<h2 class="text-xl font-semibold">
|
|
205
|
-
|
|
207
|
+
{{ t("nuxtUiMongocamp.roleGrants.heading", { roleName }) }}
|
|
206
208
|
</h2>
|
|
207
209
|
<div class="flex gap-2">
|
|
208
|
-
<UTooltip text="
|
|
210
|
+
<UTooltip :text="t('nuxtUiMongocamp.common.refresh')">
|
|
209
211
|
<UButton
|
|
210
212
|
icon="i-lucide-refresh-cw"
|
|
211
213
|
color="neutral"
|
|
212
214
|
variant="ghost"
|
|
213
215
|
:loading="loading"
|
|
214
|
-
aria-label="
|
|
216
|
+
:aria-label="t('nuxtUiMongocamp.common.refresh')"
|
|
215
217
|
@click="fetchRole"
|
|
216
218
|
/>
|
|
217
219
|
</UTooltip>
|
|
218
220
|
<UButton
|
|
219
221
|
icon="i-lucide-plus"
|
|
220
|
-
label="
|
|
222
|
+
:label="t('nuxtUiMongocamp.roleGrants.addGrant')"
|
|
221
223
|
@click="openAdd"
|
|
222
224
|
/>
|
|
223
225
|
</div>
|
|
@@ -232,13 +234,13 @@ fetchCollections();
|
|
|
232
234
|
<!-- Add Grant Modal -->
|
|
233
235
|
<UModal
|
|
234
236
|
v-model:open="isAddModalOpen"
|
|
235
|
-
title="
|
|
237
|
+
:title="t('nuxtUiMongocamp.roleGrants.addGrant')"
|
|
236
238
|
>
|
|
237
239
|
<template #body>
|
|
238
240
|
<FUDataEdit
|
|
239
241
|
:data="newGrant"
|
|
240
242
|
:schema="addGrantSchema"
|
|
241
|
-
submit-label="
|
|
243
|
+
:submit-label="t('nuxtUiMongocamp.roleGrants.addGrant')"
|
|
242
244
|
submit-icon="i-lucide-plus"
|
|
243
245
|
@data-saved="handleAddGrant"
|
|
244
246
|
/>
|
|
@@ -254,13 +256,13 @@ fetchCollections();
|
|
|
254
256
|
<!-- Edit Grant Modal -->
|
|
255
257
|
<UModal
|
|
256
258
|
v-model:open="isEditModalOpen"
|
|
257
|
-
:title="
|
|
259
|
+
:title="t('nuxtUiMongocamp.roleGrants.editGrantTitle', { name: editGrantName })"
|
|
258
260
|
>
|
|
259
261
|
<template #body>
|
|
260
262
|
<FUDataEdit
|
|
261
263
|
:data="editGrant"
|
|
262
264
|
:schema="editGrantSchema"
|
|
263
|
-
submit-label="
|
|
265
|
+
:submit-label="t('nuxtUiMongocamp.common.saveChanges')"
|
|
264
266
|
submit-icon="i-lucide-save"
|
|
265
267
|
@data-saved="handleEditGrant"
|
|
266
268
|
/>
|