@quazardous/qdadm 2.33.1 → 2.35.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.
@@ -13,6 +13,7 @@ core:
13
13
  submit: Valider
14
14
  reset: Réinitialiser
15
15
  back: Retour
16
+ view: Voir
16
17
  next: Suivant
17
18
  previous: Précédent
18
19
  close: Fermer
@@ -23,6 +24,8 @@ core:
23
24
  refresh: Actualiser
24
25
  export: Exporter
25
26
  import: Importer
27
+ logout: Se déconnecter
28
+ profile: Mon profil
26
29
  tooltips:
27
30
  saveAndContinue: Enregistrer et continuer la modification
28
31
  saveAndReturn: Enregistrer et revenir à la liste
@@ -46,6 +49,9 @@ core:
46
49
  created: Créé
47
50
  updated: Modifié
48
51
  confirmDelete: Êtes-vous sûr de vouloir supprimer cet élément ?
52
+ confirmDeleteTitle: Confirmer la suppression
53
+ confirmDeleteItem: "Supprimer {entity} « {label} » ?"
54
+ confirmDeleteThis: "Êtes-vous sûr de vouloir supprimer cet élément ({entity}) ?"
49
55
  errors:
50
56
  required: Requis
51
57
  tooShort: Trop court (min {min})
@@ -75,24 +81,24 @@ core:
75
81
  done: Terminé
76
82
  stopped: Arrêté
77
83
  failed: "Échec : {error}"
78
- lines: "{count} lignes"
84
+ lines: "{count} ligne | {count} lignes"
79
85
  search: Chercher dans le log
80
86
  previous: Occurrence précédente
81
87
  next: Occurrence suivante
82
88
  onlyMatches: Seulement les lignes trouvées
83
- errors: "{count} erreurs"
89
+ errors: "{count} erreur | {count} erreurs"
84
90
  firstError: Aller à la ligne d'erreur suivante
85
91
  wrap: Couper les lignes longues
86
92
  follow: Suivre la fin du log
87
93
  download: Télécharger le log
88
- newLines: "{count} nouvelles lignes, reprendre"
94
+ newLines: "{count} nouvelle ligne, reprendre | {count} nouvelles lignes, reprendre"
89
95
  empty: Rien pour l'instant
90
96
  # EntityTimeline (#4111)
91
97
  timeline:
92
98
  actors: Filtrer par acteur
93
99
  loading: Chargement…
94
100
  empty: Rien ne s'est encore passé
95
- newEvents: "{count} nouveaux événements"
101
+ newEvents: "{count} nouvel événement | {count} nouveaux événements"
96
102
  oldestFirst: Plus anciens d'abord
97
103
  newestFirst: Plus récents d'abord
98
104
  # PayloadViewer / PayloadDiff (#4112)
@@ -103,14 +109,14 @@ core:
103
109
  copied: Copié dans le presse-papiers
104
110
  copyFailed: Copie impossible
105
111
  download: Télécharger
106
- showAll: "Afficher les {count} lignes"
112
+ showAll: "Afficher {count} ligne | Afficher les {count} lignes"
107
113
  binary: "Contenu binaire, {size}. Premiers octets :"
108
114
  malformed: "{format} invalide ({error}), affiché comme texte"
109
115
  expected: Attendu
110
116
  captured: Capturé
111
117
  identical: Identiques
112
- unchanged: "{count} lignes inchangées"
113
- showSame: "Afficher les {count} lignes inchangées"
118
+ unchanged: "{count} ligne inchangée | {count} lignes inchangées"
119
+ showSame: "Afficher {count} ligne inchangée | Afficher les {count} lignes inchangées"
114
120
  inline: En ligne
115
121
  split: Côte à côte
116
122
  # EmailPreview (#4113)
@@ -127,7 +133,7 @@ core:
127
133
  html: HTML
128
134
  text: Texte
129
135
  source: Source
130
- imagesBlocked: "{count} images distantes bloquées"
136
+ imagesBlocked: "{count} image distante bloquée | {count} images distantes bloquées"
131
137
  loadImages: Charger les images
132
138
  blockImages: Bloquer les images
133
139
  empty: Ce mail n'a pas de contenu
@@ -151,10 +157,18 @@ core:
151
157
  start: Lancer
152
158
  dontStart: Ne pas lancer
153
159
  typeToConfirm: "Taper {value} pour confirmer"
154
- tray: "{count} tâches en cours"
160
+ tray: "{count} tâche en cours | {count} tâches en cours"
155
161
  trayDone: Tâches récentes
156
162
  clear: Effacer les terminées
157
- # The breadcrumb's View↔Edit toggle (useNavContext).
163
+ # NotFoundPage
164
+ notFound:
165
+ title: Page introuvable
166
+ message: La page demandée n'existe pas ou a été déplacée.
167
+ home: Retour à l'accueil
168
+ # The breadcrumb (useBreadcrumb, useNavContext, PageNav).
158
169
  breadcrumb:
170
+ home: Accueil
171
+ dashboard: Tableau de bord
172
+ details: Détails
159
173
  view: Voir
160
174
  edit: Modifier
@@ -7,12 +7,19 @@
7
7
 
8
8
  import { computed, inject, type Ref, type ComputedRef } from 'vue'
9
9
  import type { I18n } from './I18n'
10
+ import { interpolate } from '@quazardous/qdcore'
10
11
  import type { TranslateParams } from './types'
11
12
 
12
13
  export const I18N_INJECTION_KEY = Symbol('qdadm.i18n')
13
14
 
14
15
  export interface UseI18nResult {
15
16
  t: (key: string, params?: TranslateParams) => string
17
+ /**
18
+ * The catalog's text for `key`, or `fallback` (interpolated) when the key
19
+ * is missing or there is no I18n: for labels that read as English text,
20
+ * not as a key, outside a kernel.
21
+ */
22
+ tOr: (key: string, fallback: string, params?: TranslateParams) => string
16
23
  locale: ComputedRef<string> | Ref<string>
17
24
  i18n: I18n | null
18
25
  }
@@ -22,12 +29,17 @@ export function useI18n(): UseI18nResult {
22
29
  if (!i18n) {
23
30
  return {
24
31
  t: (key: string) => key,
32
+ tOr: (_key, fallback, params) => interpolate(fallback, params),
25
33
  locale: computed(() => 'en'),
26
34
  i18n: null,
27
35
  }
28
36
  }
29
37
  return {
30
38
  t: (key, params) => i18n.t(key, params),
39
+ tOr: (key, fallback, params) => {
40
+ const trace = i18n.resolve(key, params)
41
+ return trace.hit ? trace.result : interpolate(fallback, params, i18n.locale.value)
42
+ },
31
43
  locale: i18n.locale,
32
44
  i18n,
33
45
  }
package/src/index.ts CHANGED
@@ -263,6 +263,7 @@ export {
263
263
  } from './composables/usePageTitle'
264
264
  export { useApp, type UseAppReturn } from './composables/useApp'
265
265
  export { useAuth, type UseAuthReturn } from './composables/useAuth'
266
+ export { useUserBox, resolveUserAvatar, isExternalUserLink, type UseUserBoxReturn, type UserAvatarResolver, type UserBoxUser } from './composables/useUserBox'
266
267
  export { useSecurity, type UseSecurityReturn } from './composables/useSecurity'
267
268
  export {
268
269
  useEntityItemPage,
@@ -4,7 +4,7 @@
4
4
  * Extracted from Kernel.ts for maintainability.
5
5
  */
6
6
  import type { Component } from 'vue'
7
- import type { RouteRecordRaw } from 'vue-router'
7
+ import type { RouteLocationRaw, RouteRecordRaw } from 'vue-router'
8
8
  import type { SignalBus } from './SignalBus'
9
9
  import type { RoutesConfig } from './EventRouter'
10
10
  import type { EntityManager } from '../entity/EntityManager'
@@ -14,6 +14,7 @@ import type { GrantJudge } from '../entity/auth/SecurityChecker'
14
14
  import type { I18nOptions } from '../i18n/types'
15
15
  import type { ApiClientSource } from '../api/apiClient'
16
16
  import type { RouteStatePersister } from '../routeState'
17
+ import type { UserAvatarResolver } from '../composables/useUserBox'
17
18
 
18
19
  /**
19
20
  * Auth adapter interface (app-level authentication)
@@ -45,6 +46,10 @@ export interface AppConfig {
45
46
  version?: string
46
47
  logo?: string
47
48
  theme?: string
49
+ /** The signed-in user's profile page, an app route or an absolute URL: the sidebar name and avatar link to it, the glyph logs out (#4157). */
50
+ userRoute?: RouteLocationRaw | string
51
+ /** The sidebar avatar picture; default `user.avatar` or `user.avatarUrl`, initials when none (#4157). */
52
+ userAvatar?: UserAvatarResolver
48
53
  }
49
54
 
50
55
  /**
package/src/plugin.ts CHANGED
@@ -5,7 +5,8 @@
5
5
  */
6
6
 
7
7
  import type { App } from 'vue'
8
- import type { Router, RouteLocationNormalized, NavigationGuardNext } from 'vue-router'
8
+ import type { Router, RouteLocationNormalized, RouteLocationRaw, NavigationGuardNext } from 'vue-router'
9
+ import type { UserAvatarResolver } from './composables/useUserBox'
9
10
  import { Orchestrator } from './orchestrator/Orchestrator'
10
11
  import { EntityManager } from './entity/EntityManager'
11
12
  import qdadmLogo from './assets/logo.svg'
@@ -53,6 +54,10 @@ export interface AppConfig {
53
54
  favicon?: string | null
54
55
  version?: string | null
55
56
  theme?: AppTheme
57
+ /** The signed-in user's profile page (#4157). */
58
+ userRoute?: RouteLocationRaw | null
59
+ /** The sidebar avatar picture (#4157). */
60
+ userAvatar?: UserAvatarResolver | null
56
61
  [key: string]: unknown
57
62
  }
58
63
 
@@ -53,6 +53,8 @@ export interface TaskKind {
53
53
  to?: (taskId: string | number) => unknown
54
54
  /** Toast when it ends. Default true. */
55
55
  notify?: boolean
56
+ /** Called once the run ends, whatever the outcome (read `run.status`). */
57
+ onSettled?: (run: TaskRun) => void
56
58
  }
57
59
 
58
60
  export interface TaskConfirm {
@@ -61,6 +63,8 @@ export interface TaskConfirm {
61
63
  typed?: string
62
64
  /** Label of the confirm button. */
63
65
  accept?: string
66
+ /** Severity of the confirm button. Default `danger` when `typed` is set, `primary` otherwise. */
67
+ severity?: 'primary' | 'secondary' | 'success' | 'info' | 'warn' | 'danger' | 'contrast'
64
68
  }
65
69
 
66
70
  export interface RunOptions extends Partial<TaskKind> {
@@ -87,6 +91,8 @@ export interface TaskRun {
87
91
  startedAt: number
88
92
  endedAt: number | null
89
93
  cancelling: boolean
94
+ /** Settles with the run once it ends: succeeded, failed or cancelled (it never rejects). */
95
+ finished: Promise<TaskRun>
90
96
  }
91
97
 
92
98
  interface TaskHostDeps {
@@ -150,6 +156,7 @@ function createTaskStore() {
150
156
  const defs = new Map<string, TaskKind>()
151
157
  const stops = new Map<string, () => void>()
152
158
  const pokes = new Map<string, () => void>()
159
+ const settles = new Map<string, (run: TaskRun) => void>()
153
160
  let deps: TaskHostDeps = {}
154
161
  let restored = false
155
162
 
@@ -188,8 +195,9 @@ function createTaskStore() {
188
195
  // --- Runs ---
189
196
 
190
197
  function addRun(partial: Partial<TaskRun> & Pick<TaskRun, 'label'>): TaskRun {
198
+ const id = partial.id ?? `task-${Date.now().toString(36)}-${++seq}`
191
199
  const run: TaskRun = {
192
- id: partial.id ?? `task-${Date.now().toString(36)}-${++seq}`,
200
+ id,
193
201
  kind: partial.kind ?? null,
194
202
  label: partial.label,
195
203
  taskId: partial.taskId ?? null,
@@ -201,6 +209,8 @@ function createTaskStore() {
201
209
  startedAt: partial.startedAt ?? Date.now(),
202
210
  endedAt: null,
203
211
  cancelling: false,
212
+ // A promise is not made reactive: run.finished stays the raw promise.
213
+ finished: new Promise<TaskRun>((resolve) => settles.set(id, resolve)),
204
214
  }
205
215
  state.runs.unshift(run)
206
216
  // Keep every active run, and the most recent finished ones.
@@ -223,6 +233,13 @@ function createTaskStore() {
223
233
  pokes.delete(id)
224
234
  persist()
225
235
  notifyEnd(run)
236
+ settles.get(id)?.(run)
237
+ settles.delete(id)
238
+ try {
239
+ defs.get(id)?.onSettled?.(run)
240
+ } catch (err) {
241
+ console.error(`[qdadm] Task "${run.label}": onSettled threw`, err)
242
+ }
226
243
  }
227
244
 
228
245
  function notifyEnd(run: TaskRun): void {
@@ -397,6 +414,7 @@ function createTaskStore() {
397
414
  stops.delete(id)
398
415
  pokes.delete(id)
399
416
  defs.delete(id)
417
+ settles.delete(id)
400
418
  const i = state.runs.findIndex((r) => r.id === id)
401
419
  if (i !== -1) state.runs.splice(i, 1)
402
420
  if (state.openId === id) state.openId = null
@@ -424,6 +442,8 @@ function createTaskStore() {
424
442
  dismiss,
425
443
  clearFinished,
426
444
  open: (id: string | null) => (state.openId = id),
445
+ /** Read the run's task record now, instead of at the next poll (a log that just ended, a page that knows better). */
446
+ poke: (id: string) => pokes.get(id)?.(),
427
447
  registerTaskKind,
428
448
  answerConfirm,
429
449
  attach,
@@ -434,6 +454,7 @@ function createTaskStore() {
434
454
  for (const stop of stops.values()) stop()
435
455
  stops.clear()
436
456
  pokes.clear()
457
+ settles.clear()
437
458
  defs.clear()
438
459
  kinds.clear()
439
460
  state.runs.splice(0)