@sfxcode/nuxt-ui-mongocamp 1.1.4 → 1.2.1

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.
Files changed (38) hide show
  1. package/README.md +8 -4
  2. package/dist/module.d.mts +22 -0
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +41 -5
  5. package/dist/runtime/components/MongocampAccount.vue +21 -20
  6. package/dist/runtime/components/MongocampBucketFiles.vue +34 -32
  7. package/dist/runtime/components/MongocampCollectionData.vue +36 -35
  8. package/dist/runtime/components/MongocampCollectionInfos.vue +37 -36
  9. package/dist/runtime/components/MongocampCollections.vue +30 -29
  10. package/dist/runtime/components/MongocampDatabases.vue +13 -12
  11. package/dist/runtime/components/MongocampJobs.vue +43 -45
  12. package/dist/runtime/components/MongocampLogin.d.vue.ts +4 -1
  13. package/dist/runtime/components/MongocampLogin.vue +13 -9
  14. package/dist/runtime/components/MongocampLogin.vue.d.ts +4 -1
  15. package/dist/runtime/components/MongocampRoleGrants.vue +30 -28
  16. package/dist/runtime/components/MongocampRoles.vue +30 -31
  17. package/dist/runtime/components/MongocampUsers.vue +35 -36
  18. package/dist/runtime/components/MongocampVersion.vue +3 -1
  19. package/dist/runtime/composables/useMongocampAccount.js +6 -5
  20. package/dist/runtime/composables/useMongocampAdmin.js +2 -2
  21. package/dist/runtime/composables/useMongocampBucket.js +20 -19
  22. package/dist/runtime/composables/useMongocampClientApi.d.ts +13 -0
  23. package/dist/runtime/composables/useMongocampClientApi.js +8 -0
  24. package/dist/runtime/composables/useMongocampIndex.js +2 -2
  25. package/dist/runtime/composables/useMongocampJobs.js +2 -2
  26. package/dist/runtime/composables/useMongocampProxyApi.d.ts +13 -0
  27. package/dist/runtime/composables/useMongocampProxyApi.js +9 -0
  28. package/dist/runtime/composables/useMongocampRoles.d.ts +2 -0
  29. package/dist/runtime/composables/useMongocampRoles.js +4 -2
  30. package/dist/runtime/composables/useMongocampSystem.js +2 -2
  31. package/dist/runtime/locales/de.json +265 -0
  32. package/dist/runtime/locales/en.json +265 -0
  33. package/dist/runtime/plugin.js +8 -8
  34. package/dist/runtime/server/handlers/mongocampProxy.d.ts +2 -0
  35. package/dist/runtime/server/handlers/mongocampProxy.js +45 -0
  36. package/dist/runtime/utils/createProxyMongocampApis.d.ts +15 -0
  37. package/dist/runtime/utils/createProxyMongocampApis.js +28 -0
  38. package/package.json +11 -8
@@ -1,12 +1,13 @@
1
1
  <script setup>
2
2
  import { h, ref, resolveComponent } from "vue";
3
- import { useMongocampApi, useMongocampBucket } from "#imports";
3
+ import { useI18n, useMongocampClientApi, useMongocampBucket } from "#imports";
4
4
  const props = defineProps({
5
5
  infoPath: { type: String, required: false },
6
6
  dataPath: { type: String, required: false },
7
7
  bucketFilesPath: { type: String, required: false }
8
8
  });
9
- const { collectionApi } = useMongocampApi();
9
+ const { t } = useI18n();
10
+ const { collectionApi } = useMongocampClientApi();
10
11
  const { isBucketCollection, bucketNameFor, bucketActionInFlight, clearBucket, deleteBucket } = useMongocampBucket();
11
12
  const collections = ref([]);
12
13
  const loading = ref(false);
@@ -76,72 +77,72 @@ function sortHeader(column, label) {
76
77
  const columns = [
77
78
  {
78
79
  accessorKey: "name",
79
- header: ({ column }) => sortHeader(column, "Collection"),
80
+ header: ({ column }) => sortHeader(column, t("nuxtUiMongocamp.collections.columnCollection")),
80
81
  cell: ({ row }) => h("div", { class: "flex items-center gap-2" }, [
81
82
  h("span", row.original.name),
82
- isBucketCollection(row.original.name) ? h(UBadge, { label: "bucket", color: "neutral", variant: "subtle", size: "sm" }) : null
83
+ isBucketCollection(row.original.name) ? h(UBadge, { label: t("nuxtUiMongocamp.collections.bucketBadge"), color: "neutral", variant: "subtle", size: "sm" }) : null
83
84
  ])
84
85
  },
85
86
  {
86
87
  accessorKey: "count",
87
- header: ({ column }) => sortHeader(column, "Documents")
88
+ header: ({ column }) => sortHeader(column, t("nuxtUiMongocamp.collections.columnDocuments"))
88
89
  },
89
90
  {
90
91
  accessorKey: "sizekb",
91
- header: ({ column }) => sortHeader(column, "Size (KB)")
92
+ header: ({ column }) => sortHeader(column, t("nuxtUiMongocamp.collections.columnSize"))
92
93
  },
93
94
  {
94
95
  accessorKey: "indexCount",
95
- header: ({ column }) => sortHeader(column, "Indexes")
96
+ header: ({ column }) => sortHeader(column, t("nuxtUiMongocamp.collections.columnIndexes"))
96
97
  },
97
98
  {
98
99
  id: "actions",
99
100
  header: "",
100
101
  cell: ({ row }) => {
101
102
  const buttons = [
102
- withTooltip("Collection info", h(UButton, {
103
+ withTooltip(t("nuxtUiMongocamp.collections.infoTooltip"), h(UButton, {
103
104
  "icon": "i-lucide-info",
104
105
  "color": "neutral",
105
106
  "variant": "ghost",
106
107
  "size": "sm",
107
- "aria-label": "Collection info",
108
+ "aria-label": t("nuxtUiMongocamp.collections.infoTooltip"),
108
109
  "to": `${props.infoPath ?? "/secured/admin/collections"}/${row.original.name}`
109
110
  })),
110
- withTooltip("Collection data", h(UButton, {
111
+ withTooltip(t("nuxtUiMongocamp.collections.dataTooltip"), h(UButton, {
111
112
  "icon": "i-lucide-table",
112
113
  "color": "neutral",
113
114
  "variant": "ghost",
114
115
  "size": "sm",
115
- "aria-label": "Collection data",
116
+ "aria-label": t("nuxtUiMongocamp.collections.dataTooltip"),
116
117
  "to": `${props.dataPath ?? "/secured/admin/collections"}/${row.original.name}/data`
117
118
  }))
118
119
  ];
119
120
  if (isBucketCollection(row.original.name)) {
120
121
  const bucketName = bucketNameFor(row.original.name);
121
122
  buttons.push(
122
- withTooltip("Browse files", h(UButton, {
123
+ withTooltip(t("nuxtUiMongocamp.collections.browseFilesTooltip"), h(UButton, {
123
124
  "icon": "i-lucide-folder-open",
124
125
  "color": "neutral",
125
126
  "variant": "ghost",
126
127
  "size": "sm",
127
- "aria-label": "Browse files",
128
+ "aria-label": t("nuxtUiMongocamp.collections.browseFilesTooltip"),
128
129
  "to": `${props.bucketFilesPath ?? "/secured/admin/buckets"}/${bucketName}`
129
130
  })),
130
- withTooltip("Clear bucket", h(UButton, {
131
+ withTooltip(t("nuxtUiMongocamp.collections.clearBucketTooltip"), h(UButton, {
131
132
  "icon": "i-lucide-eraser",
132
133
  "color": "warning",
133
134
  "variant": "ghost",
134
135
  "size": "sm",
135
- "aria-label": "Clear bucket",
136
+ "aria-label": t("nuxtUiMongocamp.collections.clearBucketTooltip"),
136
137
  "loading": bucketActionInFlight.value.has(bucketName),
137
138
  "onClick": () => confirmClearBucket(bucketName)
138
139
  })),
139
- withTooltip("Delete bucket", h(UButton, {
140
+ withTooltip(t("nuxtUiMongocamp.collections.deleteBucketTooltip"), h(UButton, {
140
141
  "icon": "i-lucide-trash-2",
141
142
  "color": "error",
142
143
  "variant": "ghost",
143
144
  "size": "sm",
144
- "aria-label": "Delete bucket",
145
+ "aria-label": t("nuxtUiMongocamp.collections.deleteBucketTooltip"),
145
146
  "loading": bucketActionInFlight.value.has(bucketName),
146
147
  "onClick": () => confirmDeleteBucket(bucketName)
147
148
  }))
@@ -158,23 +159,23 @@ fetchCollections();
158
159
  <div class="flex flex-col gap-4">
159
160
  <div class="flex items-center justify-between gap-4">
160
161
  <h2 class="text-xl font-semibold">
161
- Collections
162
+ {{ t("nuxtUiMongocamp.collections.heading") }}
162
163
  </h2>
163
164
  <div class="flex flex-1 items-center gap-2">
164
165
  <UInput
165
166
  v-model="globalFilter"
166
167
  icon="i-lucide-search"
167
- placeholder="Filter collections..."
168
+ :placeholder="t('nuxtUiMongocamp.collections.filterPlaceholder')"
168
169
  size="sm"
169
170
  class="flex-1 max-w-xs"
170
171
  />
171
- <UTooltip text="Refresh">
172
+ <UTooltip :text="t('nuxtUiMongocamp.common.refresh')">
172
173
  <UButton
173
174
  icon="i-lucide-refresh-cw"
174
175
  color="neutral"
175
176
  variant="ghost"
176
177
  :loading="loading"
177
- aria-label="Refresh"
178
+ :aria-label="t('nuxtUiMongocamp.common.refresh')"
178
179
  @click="fetchCollections"
179
180
  />
180
181
  </UTooltip>
@@ -191,21 +192,21 @@ fetchCollections();
191
192
 
192
193
  <UModal
193
194
  v-model:open="isClearBucketModalOpen"
194
- title="Clear Bucket"
195
+ :title="t('nuxtUiMongocamp.collections.clearBucketTitle')"
195
196
  :ui="{ footer: 'justify-end' }"
196
197
  >
197
198
  <template #body>
198
- <p>Are you sure you want to delete every file in the "{{ bucketToClear }}" bucket? The bucket itself is kept, but all files in it are permanently removed. This action cannot be undone.</p>
199
+ <p>{{ t("nuxtUiMongocamp.collections.confirmClearBucket", { bucketName: bucketToClear }) }}</p>
199
200
  </template>
200
201
  <template #footer>
201
202
  <UButton
202
- label="Cancel"
203
+ :label="t('nuxtUiMongocamp.common.cancel')"
203
204
  color="neutral"
204
205
  variant="ghost"
205
206
  @click="isClearBucketModalOpen = false"
206
207
  />
207
208
  <UButton
208
- label="Clear Bucket"
209
+ :label="t('nuxtUiMongocamp.collections.clearBucketTitle')"
209
210
  color="warning"
210
211
  icon="i-lucide-eraser"
211
212
  @click="handleClearBucket"
@@ -215,21 +216,21 @@ fetchCollections();
215
216
 
216
217
  <UModal
217
218
  v-model:open="isDeleteBucketModalOpen"
218
- title="Delete Bucket"
219
+ :title="t('nuxtUiMongocamp.collections.deleteBucketTitle')"
219
220
  :ui="{ footer: 'justify-end' }"
220
221
  >
221
222
  <template #body>
222
- <p>Are you sure you want to delete the "{{ bucketToDelete }}" bucket? This permanently removes both the "{{ bucketToDelete }}.files" and "{{ bucketToDelete }}.chunks" collections. This action cannot be undone.</p>
223
+ <p>{{ t("nuxtUiMongocamp.collections.confirmDeleteBucket", { bucketName: bucketToDelete }) }}</p>
223
224
  </template>
224
225
  <template #footer>
225
226
  <UButton
226
- label="Cancel"
227
+ :label="t('nuxtUiMongocamp.common.cancel')"
227
228
  color="neutral"
228
229
  variant="ghost"
229
230
  @click="isDeleteBucketModalOpen = false"
230
231
  />
231
232
  <UButton
232
- label="Delete Bucket"
233
+ :label="t('nuxtUiMongocamp.collections.deleteBucketTitle')"
233
234
  color="error"
234
235
  icon="i-lucide-trash-2"
235
236
  @click="handleDeleteBucket"
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  import { h, ref, resolveComponent } from "vue";
3
- import { useMongocampSystem } from "#imports";
3
+ import { useI18n, useMongocampSystem } from "#imports";
4
+ const { t } = useI18n();
4
5
  const { getDatabaseInfos, listCollectionsByDatabase } = useMongocampSystem();
5
6
  const databases = ref([]);
6
7
  const loading = ref(false);
@@ -24,7 +25,7 @@ async function fetchDatabases() {
24
25
  );
25
26
  databases.value = rows;
26
27
  } catch (e) {
27
- errorMessage.value = e instanceof Error ? e.message : "Failed to load databases";
28
+ errorMessage.value = e instanceof Error ? e.message : t("nuxtUiMongocamp.databases.errorLoad");
28
29
  } finally {
29
30
  loading.value = false;
30
31
  }
@@ -45,21 +46,21 @@ function sortHeader(column, label) {
45
46
  const columns = [
46
47
  {
47
48
  accessorKey: "name",
48
- header: ({ column }) => sortHeader(column, "Database")
49
+ header: ({ column }) => sortHeader(column, t("nuxtUiMongocamp.databases.columnDatabase"))
49
50
  },
50
51
  {
51
52
  accessorKey: "sizeKb",
52
- header: ({ column }) => sortHeader(column, "Size (KB)")
53
+ header: ({ column }) => sortHeader(column, t("nuxtUiMongocamp.databases.columnSize"))
53
54
  },
54
55
  {
55
56
  accessorKey: "collectionCount",
56
- header: "Collections",
57
+ header: t("nuxtUiMongocamp.databases.columnCollections"),
57
58
  cell: ({ row }) => h(UBadge, { label: String(row.original.collectionCount), color: "primary", variant: "subtle" })
58
59
  },
59
60
  {
60
61
  accessorKey: "empty",
61
- header: "Empty",
62
- cell: ({ row }) => row.original.empty ? h(UBadge, { label: "Empty", color: "neutral", variant: "subtle" }) : h("span", { class: "text-dimmed" }, "\u2014")
62
+ header: t("nuxtUiMongocamp.databases.columnEmpty"),
63
+ cell: ({ row }) => row.original.empty ? h(UBadge, { label: t("nuxtUiMongocamp.databases.emptyBadge"), color: "neutral", variant: "subtle" }) : h("span", { class: "text-dimmed" }, "\u2014")
63
64
  }
64
65
  ];
65
66
  fetchDatabases();
@@ -69,15 +70,15 @@ fetchDatabases();
69
70
  <div class="flex flex-col gap-4">
70
71
  <div class="flex items-center justify-between gap-4">
71
72
  <h2 class="text-xl font-semibold">
72
- Databases
73
+ {{ t("nuxtUiMongocamp.databases.heading") }}
73
74
  </h2>
74
- <UTooltip text="Refresh">
75
+ <UTooltip :text="t('nuxtUiMongocamp.common.refresh')">
75
76
  <UButton
76
77
  icon="i-lucide-refresh-cw"
77
78
  color="neutral"
78
79
  variant="ghost"
79
80
  :loading="loading"
80
- aria-label="Refresh"
81
+ :aria-label="t('nuxtUiMongocamp.common.refresh')"
81
82
  @click="fetchDatabases"
82
83
  />
83
84
  </UTooltip>
@@ -88,12 +89,12 @@ fetchDatabases();
88
89
  color="error"
89
90
  variant="subtle"
90
91
  icon="i-lucide-circle-alert"
91
- title="Failed to load databases"
92
+ :title="t('nuxtUiMongocamp.databases.loadFailedTitle')"
92
93
  :description="errorMessage"
93
94
  >
94
95
  <template #actions>
95
96
  <UButton
96
- label="Retry"
97
+ :label="t('nuxtUiMongocamp.common.retry')"
97
98
  color="error"
98
99
  variant="subtle"
99
100
  icon="i-lucide-refresh-cw"
@@ -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: "Name",
42
+ label: t("nuxtUiMongocamp.jobs.name"),
42
43
  validation: "required"
43
44
  },
44
45
  {
45
46
  $formkit: "nuxtUIInput",
46
47
  name: "group",
47
- label: "Group",
48
+ label: t("nuxtUiMongocamp.jobs.group"),
48
49
  validation: "required"
49
50
  },
50
51
  {
51
52
  $formkit: "nuxtUISelectMenu",
52
53
  name: "className",
53
- label: "Job Class",
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: "Description"
61
+ label: t("nuxtUiMongocamp.jobs.description")
61
62
  },
62
63
  {
63
64
  $formkit: "nuxtUIInput",
64
65
  name: "cronExpression",
65
- label: "Cron Expression",
66
- help: "Quartz cron syntax, e.g. 0 0 * * * ?",
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: "Priority"
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: "Name",
80
+ label: t("nuxtUiMongocamp.jobs.name"),
80
81
  validation: "required"
81
82
  },
82
83
  {
83
84
  $formkit: "nuxtUIInput",
84
85
  name: "group",
85
- label: "Group",
86
+ label: t("nuxtUiMongocamp.jobs.group"),
86
87
  validation: "required"
87
88
  },
88
89
  {
89
90
  $formkit: "nuxtUIInput",
90
91
  name: "description",
91
- label: "Description"
92
+ label: t("nuxtUiMongocamp.jobs.description")
92
93
  },
93
94
  {
94
95
  $formkit: "nuxtUIInput",
95
96
  name: "cronExpression",
96
- label: "Cron Expression",
97
- help: "Quartz cron syntax, e.g. 0 0 * * * ?",
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: "Priority"
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 : "Failed to register job";
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 : "Failed to update job";
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: "Job executed", description: `"${name}" was triggered.`, color: "success" });
163
- } catch {
164
- toast.add({ title: "Execution failed", description: `Could not execute "${name}".`, color: "error" });
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, "Name")
193
+ header: ({ column }) => sortHeader(column, t("nuxtUiMongocamp.jobs.columnName"))
193
194
  },
194
195
  {
195
196
  accessorKey: "group",
196
- header: ({ column }) => sortHeader(column, "Group")
197
+ header: ({ column }) => sortHeader(column, t("nuxtUiMongocamp.jobs.columnGroup"))
197
198
  },
198
199
  {
199
200
  accessorKey: "cronExpression",
200
- header: "Cron Expression",
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: "Next Fire Time",
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, "Priority")
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("Execute now", h(UButton, {
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": "Execute now",
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("Edit job", h(UButton, {
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": "Edit job",
233
+ "aria-label": t("nuxtUiMongocamp.jobs.editJobTooltip"),
233
234
  "onClick": () => openEdit(row.original)
234
235
  })),
235
- withTooltip("Delete job", h(UButton, {
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": "Delete job",
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
- Jobs
255
+ {{ t("nuxtUiMongocamp.jobs.heading") }}
255
256
  </h2>
256
257
  <div class="flex items-center gap-2">
257
- <UTooltip text="Refresh">
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="Refresh"
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="Add Job"
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="Add Job"
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="Add Job"
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="`Edit Job: ${editJobOriginal.name}`"
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="Save Changes"
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="Delete Job"
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="Cancel"
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="Delete"
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
- declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
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: "Mongocamp Login"
19
+ children: t("nuxtUiMongocamp.login.heading")
15
20
  },
16
21
  {
17
22
  $formkit: "nuxtUIInput",
18
23
  name: "userId",
19
- label: "Email",
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: "Password",
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("/secured");
42
+ await nuxtApp.runWithContext(() => navigateTo(props.redirectPath ?? "/"));
38
43
  } catch (e) {
39
44
  consola.log(e);
40
- errorMessage.value = "Wrong Login or Password !";
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="Login"
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
- declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
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;