@quazardous/qdadm 2.41.0 → 2.43.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/dist/styles/qdadm.css +1 -1
- package/package.json +3 -3
- package/src/components/display/EmailPreview.vue +2 -1
- package/src/components/display/LogStream.vue +59 -2
- package/src/components/display/PayloadViewer.vue +2 -1
- package/src/components/editors/yaml/VanillaYamlEditor.vue +16 -7
- package/src/components/editors/yaml/YamlConfigEditor.vue +9 -1
- package/src/components/layout/CardsDashboard.vue +53 -11
- package/src/components/show/ShowDisplay.vue +18 -1
- package/src/components/tasks/TaskDialog.vue +8 -2
- package/src/composables/createShowFieldResolver.ts +2 -0
- package/src/composables/index.ts +1 -0
- package/src/composables/useCardsArrangement.ts +164 -28
- package/src/composables/useFormatBytes.ts +20 -0
- package/src/dashboard/dashboardConfig.ts +36 -0
- package/src/i18n/defaults/core.en.generated.ts +19 -2
- package/src/i18n/defaults/core.en.yml +19 -2
- package/src/i18n/defaults/core.fr.generated.ts +19 -2
- package/src/i18n/defaults/core.fr.yml +19 -2
- package/src/index.ts +7 -0
- package/src/styles/_cards-dashboard.scss +6 -0
- package/src/styles/_log-stream.scss +13 -0
- package/src/tasks/taskStore.ts +3 -1
- package/src/tasks/taskUi.ts +23 -3
- package/src/utils/formatters.ts +27 -8
- package/src/utils/index.ts +1 -0
|
@@ -93,6 +93,9 @@ export default `core:
|
|
|
93
93
|
wrap: Couper les lignes longues
|
|
94
94
|
follow: Suivre la fin du log
|
|
95
95
|
download: Télécharger le log
|
|
96
|
+
copy: Copier tout le log
|
|
97
|
+
copied: "Copié ({count} ligne) | Copié ({count} lignes)"
|
|
98
|
+
copyFailed: "Échec de la copie : {error}"
|
|
96
99
|
newLines: "{count} nouvelle ligne, reprendre | {count} nouvelles lignes, reprendre"
|
|
97
100
|
empty: Rien pour l'instant
|
|
98
101
|
# EntityTimeline (#4111)
|
|
@@ -182,6 +185,8 @@ export default `core:
|
|
|
182
185
|
noSso: Aucun parcours de connexion configuré pour ce bouton
|
|
183
186
|
# CardsDashboard (#4320)
|
|
184
187
|
cardsDashboard:
|
|
188
|
+
saveFailed: La disposition n'a pas pu être enregistrée
|
|
189
|
+
saveFailedDetail: Elle reste telle qu'affichée ; réessayez.
|
|
185
190
|
customise: Personnaliser
|
|
186
191
|
done: Terminé
|
|
187
192
|
reset: Réinitialiser
|
|
@@ -257,13 +262,25 @@ export default `core:
|
|
|
257
262
|
next: Message suivant
|
|
258
263
|
position: "{index} sur {count}"
|
|
259
264
|
close: Fermer ce message
|
|
265
|
+
# formatBytes in qdadm's own components (#4384)
|
|
266
|
+
units:
|
|
267
|
+
bytes:
|
|
268
|
+
b: o
|
|
269
|
+
kb: ko
|
|
270
|
+
mb: Mo
|
|
271
|
+
gb: Go
|
|
272
|
+
tb: To
|
|
260
273
|
# VanillaYamlEditor and YamlConfigEditor (#4303)
|
|
261
274
|
yamlEditor:
|
|
262
275
|
text: Texte
|
|
263
|
-
tree:
|
|
276
|
+
tree: Arbre
|
|
277
|
+
form: Formulaire
|
|
264
278
|
modes: Vue
|
|
265
|
-
syntaxBlocked: Corrigez les erreurs de syntaxe avant de passer au formulaire
|
|
279
|
+
syntaxBlocked: "Corrigez les erreurs de syntaxe avant de passer à l'arbre ou au formulaire"
|
|
266
280
|
syntaxErrors: "{count} erreur de syntaxe | {count} erreurs de syntaxe"
|
|
281
|
+
warnings: "{count} avertissement | {count} avertissements"
|
|
282
|
+
colonKey: 'La clé est « {key} » : vouliez-vous dire « {suggestion}: » ?'
|
|
283
|
+
spacedKey: 'La clé « {key} » commence ou finit par une espace'
|
|
267
284
|
addItem: Ajouter un élément
|
|
268
285
|
addKey: Ajouter
|
|
269
286
|
newKey: nouvelle clé
|
|
@@ -91,6 +91,9 @@ core:
|
|
|
91
91
|
wrap: Couper les lignes longues
|
|
92
92
|
follow: Suivre la fin du log
|
|
93
93
|
download: Télécharger le log
|
|
94
|
+
copy: Copier tout le log
|
|
95
|
+
copied: "Copié ({count} ligne) | Copié ({count} lignes)"
|
|
96
|
+
copyFailed: "Échec de la copie : {error}"
|
|
94
97
|
newLines: "{count} nouvelle ligne, reprendre | {count} nouvelles lignes, reprendre"
|
|
95
98
|
empty: Rien pour l'instant
|
|
96
99
|
# EntityTimeline (#4111)
|
|
@@ -180,6 +183,8 @@ core:
|
|
|
180
183
|
noSso: Aucun parcours de connexion configuré pour ce bouton
|
|
181
184
|
# CardsDashboard (#4320)
|
|
182
185
|
cardsDashboard:
|
|
186
|
+
saveFailed: La disposition n'a pas pu être enregistrée
|
|
187
|
+
saveFailedDetail: Elle reste telle qu'affichée ; réessayez.
|
|
183
188
|
customise: Personnaliser
|
|
184
189
|
done: Terminé
|
|
185
190
|
reset: Réinitialiser
|
|
@@ -255,13 +260,25 @@ core:
|
|
|
255
260
|
next: Message suivant
|
|
256
261
|
position: "{index} sur {count}"
|
|
257
262
|
close: Fermer ce message
|
|
263
|
+
# formatBytes in qdadm's own components (#4384)
|
|
264
|
+
units:
|
|
265
|
+
bytes:
|
|
266
|
+
b: o
|
|
267
|
+
kb: ko
|
|
268
|
+
mb: Mo
|
|
269
|
+
gb: Go
|
|
270
|
+
tb: To
|
|
258
271
|
# VanillaYamlEditor and YamlConfigEditor (#4303)
|
|
259
272
|
yamlEditor:
|
|
260
273
|
text: Texte
|
|
261
|
-
tree:
|
|
274
|
+
tree: Arbre
|
|
275
|
+
form: Formulaire
|
|
262
276
|
modes: Vue
|
|
263
|
-
syntaxBlocked: Corrigez les erreurs de syntaxe avant de passer au formulaire
|
|
277
|
+
syntaxBlocked: "Corrigez les erreurs de syntaxe avant de passer à l'arbre ou au formulaire"
|
|
264
278
|
syntaxErrors: "{count} erreur de syntaxe | {count} erreurs de syntaxe"
|
|
279
|
+
warnings: "{count} avertissement | {count} avertissements"
|
|
280
|
+
colonKey: 'La clé est « {key} » : vouliez-vous dire « {suggestion}: » ?'
|
|
281
|
+
spacedKey: 'La clé « {key} » commence ou finit par une espace'
|
|
265
282
|
addItem: Ajouter un élément
|
|
266
283
|
addKey: Ajouter
|
|
267
284
|
newKey: nouvelle clé
|
package/src/index.ts
CHANGED
|
@@ -261,6 +261,7 @@ export {
|
|
|
261
261
|
type TitleParts,
|
|
262
262
|
type TitleInput,
|
|
263
263
|
} from './composables/usePageTitle'
|
|
264
|
+
export { useFormatBytes } from './composables/useFormatBytes'
|
|
264
265
|
export { useApp, type UseAppReturn } from './composables/useApp'
|
|
265
266
|
export { useAuth, type UseAuthReturn } from './composables/useAuth'
|
|
266
267
|
export { useUserBox, resolveUserAvatar, isExternalUserLink, type UseUserBoxReturn, type UserAvatarResolver, type UserBoxUser } from './composables/useUserBox'
|
|
@@ -385,11 +386,15 @@ export {
|
|
|
385
386
|
useCardsArrangement,
|
|
386
387
|
reconcileArrangement,
|
|
387
388
|
defaultArrangement,
|
|
389
|
+
localArrangementStorage,
|
|
390
|
+
type CardsArrangementStorage,
|
|
391
|
+
type UseCardsArrangementOptions,
|
|
388
392
|
type CardDef,
|
|
389
393
|
type CardsArrangement,
|
|
390
394
|
type CardsGroups,
|
|
391
395
|
type UseCardsArrangementReturn,
|
|
392
396
|
} from './composables/useCardsArrangement'
|
|
397
|
+
export { configureDashboards, getDashboardsConfig, resetDashboards, type DashboardsOptions } from './dashboard/dashboardConfig'
|
|
393
398
|
export {
|
|
394
399
|
useUserImpersonator,
|
|
395
400
|
type UseUserImpersonatorOptions,
|
|
@@ -453,6 +458,8 @@ export {
|
|
|
453
458
|
getTaskUi,
|
|
454
459
|
resolveTaskUi,
|
|
455
460
|
TASK_DIALOG_DEFAULTS,
|
|
461
|
+
TASK_LOG_DEFAULTS,
|
|
462
|
+
type TaskLogPatterns,
|
|
456
463
|
type TaskDialogOptions,
|
|
457
464
|
type TaskDialogSlotName,
|
|
458
465
|
type TaskUiOptions,
|
|
@@ -22,6 +22,12 @@
|
|
|
22
22
|
gap: 1rem;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
// An async arrangement in its grace (#4338): held back, room kept, so the
|
|
26
|
+
// saved order shows without a jump from the default one
|
|
27
|
+
.qd-cards-grid.qd-cards-loading {
|
|
28
|
+
visibility: hidden;
|
|
29
|
+
}
|
|
30
|
+
|
|
25
31
|
.qd-cards-slot {
|
|
26
32
|
grid-column: span var(--qd-card-span, 1);
|
|
27
33
|
display: flex;
|
|
@@ -75,6 +75,19 @@
|
|
|
75
75
|
font-variant-numeric: tabular-nums;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
.qd-log-copy-status {
|
|
79
|
+
color: var(--p-green-600);
|
|
80
|
+
font-size: $font-size-xs;
|
|
81
|
+
|
|
82
|
+
&:empty {
|
|
83
|
+
display: none;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&--error {
|
|
87
|
+
color: var(--p-red-500);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
78
91
|
.qd-log-search {
|
|
79
92
|
display: inline-flex;
|
|
80
93
|
align-items: center;
|
package/src/tasks/taskStore.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* they live in. Runs of a registered kind survive a reload (sessionStorage).
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import type { TaskDialogOptions, TaskUiOptions } from './taskUi'
|
|
15
|
+
import type { TaskDialogOptions, TaskLogPatterns, TaskUiOptions } from './taskUi'
|
|
16
16
|
import { reactive, computed, type ComputedRef } from 'vue'
|
|
17
17
|
import type { LogSource } from '../composables/useLogStream'
|
|
18
18
|
|
|
@@ -58,6 +58,8 @@ export interface TaskKind {
|
|
|
58
58
|
onSettled?: (run: TaskRun) => void
|
|
59
59
|
/** The follow dialog's window options for this kind, over the app's (#4334). */
|
|
60
60
|
dialog?: TaskDialogOptions
|
|
61
|
+
/** What the log flags as an error or a timestamp for this kind, over the app's (#4386). */
|
|
62
|
+
logPatterns?: TaskLogPatterns
|
|
61
63
|
/** Slot components for this kind's dialog, over the app's. */
|
|
62
64
|
slots?: TaskUiOptions['slots']
|
|
63
65
|
/** A dialog of its own for this kind, instead of TaskDialog. */
|
package/src/tasks/taskUi.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* How the TaskRunner looks (#4334): the follow dialog's window options, slot
|
|
3
|
-
* components, a replacement dialog,
|
|
3
|
+
* components, a replacement dialog, the tray's row, and what its log flags as
|
|
4
|
+
* an error or a timestamp (#4386). Layered: qdadm's
|
|
4
5
|
* defaults, then the app's (configureTasks), then the task kind's
|
|
5
6
|
* (registerTaskKind / run options), then a page's own TaskDialog props.
|
|
6
7
|
*
|
|
7
8
|
* configureTasks({ dialog: { width: '56rem', modal: false }, slots: { 'after-log': DeliverySummary } })
|
|
8
9
|
* registerTaskKind('deploy', { task, log, dialog: { maximizable: false }, component: DeployDialog })
|
|
10
|
+
* registerTaskKind('deliver', { task, log, logPatterns: { errorPattern: /\[error\]|^→ failed/ } })
|
|
9
11
|
*/
|
|
10
12
|
import { shallowReactive, type Component } from 'vue'
|
|
11
13
|
|
|
@@ -29,8 +31,17 @@ export interface TaskDialogOptions {
|
|
|
29
31
|
/** The TaskDialog slots an app fills with components; each gets `{ run, kind, final }`. */
|
|
30
32
|
export type TaskDialogSlotName = 'header' | 'before-log' | 'after-log' | 'actions' | 'result'
|
|
31
33
|
|
|
34
|
+
/** The follow dialog's log (LogStream): a string is a case-insensitive pattern; null turns it off. */
|
|
35
|
+
export interface TaskLogPatterns {
|
|
36
|
+
/** The lines flagged as errors, and counted by the "N errors" button */
|
|
37
|
+
errorPattern?: RegExp | string | null
|
|
38
|
+
/** The timestamp at the start of a line, shown dimmed */
|
|
39
|
+
timestampPattern?: RegExp | string | null
|
|
40
|
+
}
|
|
41
|
+
|
|
32
42
|
export interface TaskUiOptions {
|
|
33
43
|
dialog?: TaskDialogOptions
|
|
44
|
+
logPatterns?: TaskLogPatterns
|
|
34
45
|
slots?: Partial<Record<TaskDialogSlotName, Component>>
|
|
35
46
|
/**
|
|
36
47
|
* Renders instead of TaskDialog, with props `{ runId, options }` and a
|
|
@@ -54,12 +65,19 @@ export const TASK_DIALOG_DEFAULTS: Required<Omit<TaskDialogOptions, 'position' |
|
|
|
54
65
|
class: undefined,
|
|
55
66
|
}
|
|
56
67
|
|
|
68
|
+
// Whole words only, so a file name such as shipping_error.php is not an error
|
|
69
|
+
export const TASK_LOG_DEFAULTS: Required<TaskLogPatterns> = {
|
|
70
|
+
errorPattern: /\b(error|fatal|failed)\b/i,
|
|
71
|
+
timestampPattern: null,
|
|
72
|
+
}
|
|
73
|
+
|
|
57
74
|
const app = shallowReactive<TaskUiOptions>({})
|
|
58
75
|
|
|
59
76
|
/** The app's TaskRunner look, once at boot. Later calls merge over earlier ones. */
|
|
60
77
|
export function configureTasks(options: TaskUiOptions): void {
|
|
61
78
|
if (options.dialog) app.dialog = { ...app.dialog, ...options.dialog }
|
|
62
79
|
if (options.slots) app.slots = { ...app.slots, ...options.slots }
|
|
80
|
+
if (options.logPatterns) app.logPatterns = { ...app.logPatterns, ...options.logPatterns }
|
|
63
81
|
if (options.component !== undefined) app.component = options.component
|
|
64
82
|
if (options.tray) app.tray = { ...app.tray, ...options.tray }
|
|
65
83
|
}
|
|
@@ -68,6 +86,7 @@ export function configureTasks(options: TaskUiOptions): void {
|
|
|
68
86
|
export function resetTaskUi(): void {
|
|
69
87
|
delete app.dialog
|
|
70
88
|
delete app.slots
|
|
89
|
+
delete app.logPatterns
|
|
71
90
|
delete app.component
|
|
72
91
|
delete app.tray
|
|
73
92
|
}
|
|
@@ -79,10 +98,11 @@ export function getTaskUi(): Readonly<TaskUiOptions> {
|
|
|
79
98
|
|
|
80
99
|
/** One run's look: defaults, then the app's, then the kind's, then a page's props. */
|
|
81
100
|
export function resolveTaskUi(kind?: TaskUiOptions | null, page?: TaskDialogOptions | null) {
|
|
82
|
-
const strip = (o?:
|
|
83
|
-
Object.fromEntries(Object.entries(o ?? {}).filter(([, v]) => v !== undefined)) as TaskDialogOptions
|
|
101
|
+
const strip = <T extends object>(o?: T | null) => Object.fromEntries(Object.entries(o ?? {}).filter(([, v]) => v !== undefined)) as T
|
|
84
102
|
return {
|
|
85
103
|
dialog: { ...TASK_DIALOG_DEFAULTS, ...strip(app.dialog), ...strip(kind?.dialog), ...strip(page) },
|
|
104
|
+
// null is kept: it turns a pattern off
|
|
105
|
+
logPatterns: { ...TASK_LOG_DEFAULTS, ...strip(app.logPatterns), ...strip(kind?.logPatterns) } as Required<TaskLogPatterns>,
|
|
86
106
|
slots: { ...app.slots, ...kind?.slots } as Partial<Record<TaskDialogSlotName, Component>>,
|
|
87
107
|
component: kind?.component ?? app.component ?? null,
|
|
88
108
|
}
|
package/src/utils/formatters.ts
CHANGED
|
@@ -201,18 +201,37 @@ export function formatCurrency(
|
|
|
201
201
|
return new Intl.NumberFormat(locale, { style: 'currency', currency: currencyCode }).format(value)
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
+
/** Size units by language (octets in French); any other language gets the English ones. */
|
|
205
|
+
const BYTE_UNITS: Record<string, string[]> = {
|
|
206
|
+
en: ['B', 'KB', 'MB', 'GB', 'TB'],
|
|
207
|
+
fr: ['o', 'ko', 'Mo', 'Go', 'To'],
|
|
208
|
+
}
|
|
209
|
+
|
|
204
210
|
/**
|
|
205
|
-
*
|
|
211
|
+
* The size units of a locale: B, KB, MB, GB, TB, or o, ko, Mo, Go, To in French
|
|
212
|
+
*
|
|
213
|
+
* @param locale - Explicit locale override (default: browser locale)
|
|
206
214
|
*/
|
|
207
|
-
export function
|
|
208
|
-
|
|
209
|
-
|
|
215
|
+
export function byteUnits(locale?: string): string[] {
|
|
216
|
+
const lang = new Intl.NumberFormat(locale).resolvedOptions().locale.split('-')[0] ?? 'en'
|
|
217
|
+
return BYTE_UNITS[lang] ?? BYTE_UNITS.en!
|
|
218
|
+
}
|
|
210
219
|
|
|
211
|
-
|
|
220
|
+
/**
|
|
221
|
+
* Format bytes to human-readable size, base 1024 ("1 Mo", "1,4 Mo", "512 o")
|
|
222
|
+
*
|
|
223
|
+
* @param locale - Explicit locale override (default: browser locale)
|
|
224
|
+
* @param units - The five unit labels, B to TB (default: the locale's, see byteUnits)
|
|
225
|
+
*/
|
|
226
|
+
export function formatBytes(bytes: number | null | undefined, locale?: string, units?: string[]): string {
|
|
227
|
+
if (bytes === null || bytes === undefined) return emptyPlaceholder
|
|
228
|
+
const labels = units ?? byteUnits(locale)
|
|
212
229
|
const k = 1024
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
230
|
+
let i = bytes === 0 ? 0 : Math.min(Math.max(Math.floor(Math.log(Math.abs(bytes)) / Math.log(k)), 0), labels.length - 1)
|
|
231
|
+
// 1023.96 KB shows as 1 MB, not 1 024 KB
|
|
232
|
+
if (i < labels.length - 1 && Math.round((Math.abs(bytes) / Math.pow(k, i)) * 10) / 10 >= k) i++
|
|
233
|
+
const value = new Intl.NumberFormat(locale, { maximumFractionDigits: i === 0 ? 0 : 1 }).format(bytes / Math.pow(k, i))
|
|
234
|
+
return `${value} ${labels[i]}`
|
|
216
235
|
}
|
|
217
236
|
|
|
218
237
|
/**
|