@quazardous/qdadm 2.44.1 → 2.46.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.
@@ -15,6 +15,7 @@
15
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
+ import type { TaskPhasesSource } from './taskPhases'
18
19
 
19
20
  export type TaskStatus = 'starting' | 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled'
20
21
 
@@ -60,6 +61,13 @@ export interface TaskKind {
60
61
  dialog?: TaskDialogOptions
61
62
  /** What the log flags as an error or a timestamp for this kind, over the app's (#4386). */
62
63
  logPatterns?: TaskLogPatterns
64
+ /**
65
+ * The task's phases, shown as a frieze above the log (#4655): fixed, or read
66
+ * from the backend at the log's pace while the run lasts, then once at its end.
67
+ */
68
+ phases?: TaskPhasesSource
69
+ /** An icon class per phase name, over the app's. */
70
+ phaseIcons?: Record<string, string>
63
71
  /** Slot components for this kind's dialog, over the app's. */
64
72
  slots?: TaskUiOptions['slots']
65
73
  /** A dialog of its own for this kind, instead of TaskDialog. */
@@ -8,6 +8,7 @@
8
8
  * configureTasks({ dialog: { width: '56rem', modal: false }, slots: { 'after-log': DeliverySummary } })
9
9
  * registerTaskKind('deploy', { task, log, dialog: { maximizable: false }, component: DeployDialog })
10
10
  * registerTaskKind('deliver', { task, log, logPatterns: { errorPattern: /\[error\]|^→ failed/ } })
11
+ * configureTasks({ phaseIcons: { deploy: 'pi pi-upload', 'backup-after': 'pi pi-database' } })
11
12
  */
12
13
  import { shallowReactive, type Component } from 'vue'
13
14
 
@@ -43,6 +44,8 @@ export interface TaskUiOptions {
43
44
  dialog?: TaskDialogOptions
44
45
  logPatterns?: TaskLogPatterns
45
46
  slots?: Partial<Record<TaskDialogSlotName, Component>>
47
+ /** An icon class per phase name, in the phases frieze (#4655); a phase without one shows its state's. */
48
+ phaseIcons?: Record<string, string>
46
49
  /**
47
50
  * Renders instead of TaskDialog, with props `{ runId, options }` and a
48
51
  * `close` event; it reads the run through getTaskStore().
@@ -78,6 +81,7 @@ export function configureTasks(options: TaskUiOptions): void {
78
81
  if (options.dialog) app.dialog = { ...app.dialog, ...options.dialog }
79
82
  if (options.slots) app.slots = { ...app.slots, ...options.slots }
80
83
  if (options.logPatterns) app.logPatterns = { ...app.logPatterns, ...options.logPatterns }
84
+ if (options.phaseIcons) app.phaseIcons = { ...app.phaseIcons, ...options.phaseIcons }
81
85
  if (options.component !== undefined) app.component = options.component
82
86
  if (options.tray) app.tray = { ...app.tray, ...options.tray }
83
87
  }
@@ -87,6 +91,7 @@ export function resetTaskUi(): void {
87
91
  delete app.dialog
88
92
  delete app.slots
89
93
  delete app.logPatterns
94
+ delete app.phaseIcons
90
95
  delete app.component
91
96
  delete app.tray
92
97
  }
@@ -104,6 +109,7 @@ export function resolveTaskUi(kind?: TaskUiOptions | null, page?: TaskDialogOpti
104
109
  // null is kept: it turns a pattern off
105
110
  logPatterns: { ...TASK_LOG_DEFAULTS, ...strip(app.logPatterns), ...strip(kind?.logPatterns) } as Required<TaskLogPatterns>,
106
111
  slots: { ...app.slots, ...kind?.slots } as Partial<Record<TaskDialogSlotName, Component>>,
112
+ phaseIcons: { ...app.phaseIcons, ...kind?.phaseIcons } as Record<string, string>,
107
113
  component: kind?.component ?? app.component ?? null,
108
114
  }
109
115
  }