@quazardous/qdadm 2.47.0 → 2.48.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.
@@ -4,13 +4,14 @@
4
4
  *
5
5
  * Shown while there is a run to show. Each run reopens its dialog; finished
6
6
  * ones can be cleared. A row's content can be replaced (#4334): the `item`
7
- * slot, or `configureTasks({ tray: { item } })`, gets `{ run }`.
7
+ * slot, or `configureTasks({ tray: { item } })`, gets `{ run }`. A sequence
8
+ * (#4934) is one row, "Verify · 1/2", which opens its window.
8
9
  */
9
10
  import { computed, ref } from 'vue'
10
11
  import Popover from 'primevue/popover'
11
12
  import QdButton from '../base/QdButton.vue'
12
13
  import { useI18n } from '../../i18n/useI18n'
13
- import { getTaskStore } from '../../tasks/taskStore'
14
+ import { getTaskStore, type TaskRun, type TaskSequence } from '../../tasks/taskStore'
14
15
  import { getTaskUi } from '../../tasks/taskUi'
15
16
  import { useTaskTrayVisible } from '../../tasks/useTaskNotifications'
16
17
 
@@ -21,9 +22,20 @@ const visible = useTaskTrayVisible()
21
22
  const { t } = useI18n()
22
23
  const popover = ref<InstanceType<typeof Popover> | null>(null)
23
24
 
24
- const runs = computed(() => store.state.runs)
25
- const activeCount = computed(() => store.active.value.length)
26
- const hasFinished = computed(() => runs.value.some((r) => store.isFinal(r.status)))
25
+ // A sequence's steps show as the sequence's row
26
+ const runs = computed(() => store.state.runs.filter((r) => !r.sequenceId || !store.state.sequences.some((s) => s.id === r.sequenceId)))
27
+ const sequences = computed(() => store.state.sequences)
28
+ type Row = { id: string; startedAt: number; run: TaskRun | null; sequence: TaskSequence | null }
29
+ const rows = computed<Row[]>(() =>
30
+ [
31
+ ...runs.value.map((run) => ({ id: run.id, startedAt: run.startedAt, run, sequence: null })),
32
+ ...sequences.value.map((sequence) => ({ id: sequence.id, startedAt: sequence.startedAt, run: null, sequence })),
33
+ ].sort((a, b) => b.startedAt - a.startedAt)
34
+ )
35
+ const activeCount = computed(() => runs.value.filter((r) => store.isActive(r)).length + sequences.value.filter((s) => store.isActive(s)).length)
36
+ const hasFinished = computed(() => runs.value.some((r) => store.isFinal(r.status)) || sequences.value.some((s) => !store.isActive(s)))
37
+ const stepsDone = (sequence: TaskSequence) =>
38
+ sequence.steps.filter((st) => ['succeeded', 'failed', 'cancelled'].includes(store.stepStatus(st))).length
27
39
 
28
40
  function openRun(id: string): void {
29
41
  store.open(id)
@@ -35,7 +47,7 @@ const icon = (status: string) =>
35
47
  </script>
36
48
 
37
49
  <template>
38
- <div v-if="visible && runs.length" class="qd-task-tray">
50
+ <div v-if="visible && rows.length" class="qd-task-tray">
39
51
  <button type="button" class="qd-task-tray-button" :class="{ 'qd-task-tray-button--busy': activeCount > 0 }"
40
52
  :aria-label="t('core.task.tray', { count: activeCount })" @click="popover?.toggle($event)">
41
53
  <i :class="activeCount ? 'pi pi-spin pi-cog' : 'pi pi-check'" />
@@ -44,15 +56,23 @@ const icon = (status: string) =>
44
56
  </button>
45
57
  <Popover ref="popover" class="qd-task-popover">
46
58
  <ul class="qd-task-list">
47
- <li v-for="r in runs" :key="r.id">
48
- <button type="button" class="qd-task-item" :class="`qd-task-item--${r.status}`" @click="openRun(r.id)">
49
- <slot name="item" :run="r">
50
- <component :is="taskUi.tray.item" v-if="taskUi.tray?.item" :run="r" />
59
+ <li v-for="row in rows" :key="row.id">
60
+ <button v-if="row.sequence" type="button" class="qd-task-item qd-task-item--sequence"
61
+ :class="`qd-task-item--${row.sequence.status}`" @click="openRun(row.sequence.id)">
62
+ <i :class="icon(row.sequence.status)" />
63
+ <span class="qd-task-item-label">{{ row.sequence.label }}</span>
64
+ <span class="qd-task-item-state">
65
+ {{ t('core.task.sequence.progress', { done: stepsDone(row.sequence), total: row.sequence.steps.length }) }}
66
+ </span>
67
+ </button>
68
+ <button v-else-if="row.run" type="button" class="qd-task-item" :class="`qd-task-item--${row.run.status}`" @click="openRun(row.run.id)">
69
+ <slot name="item" :run="row.run">
70
+ <component :is="taskUi.tray.item" v-if="taskUi.tray?.item" :run="row.run" />
51
71
  <template v-else>
52
- <i :class="icon(r.status)" />
53
- <span class="qd-task-item-label">{{ r.label }}</span>
72
+ <i :class="icon(row.run.status)" />
73
+ <span class="qd-task-item-label">{{ row.run.label }}</span>
54
74
  <span class="qd-task-item-state">
55
- {{ r.progress !== null && !store.isFinal(r.status) ? `${Math.round(r.progress)} %` : t(`core.task.status.${r.status}`) }}
75
+ {{ row.run.progress !== null && !store.isFinal(row.run.status) ? `${Math.round(row.run.progress)} %` : t(`core.task.status.${row.run.status}`) }}
56
76
  </span>
57
77
  </template>
58
78
  </slot>
@@ -189,6 +189,19 @@ export default `core:
189
189
  subs: "{count} sub-phase | {count} sub-phases"
190
190
  filter: "Phase: {name}"
191
191
  showAll: Show the whole log
192
+ # Tasks chained in one window (#4934)
193
+ sequence:
194
+ progress: "{done}/{total}"
195
+ step: "Step {n}"
196
+ pending: Waiting
197
+ skipped: Not run
198
+ why:
199
+ error: An earlier step failed
200
+ cancelled: The sequence was stopped
201
+ reload: The page was reloaded
202
+ back: Back to the list
203
+ details: Show this step
204
+ cancel: Stop the sequence
192
205
  # Waiting states (#4665)
193
206
  pending:
194
207
  reading: Reading…
@@ -187,6 +187,19 @@ core:
187
187
  subs: "{count} sub-phase | {count} sub-phases"
188
188
  filter: "Phase: {name}"
189
189
  showAll: Show the whole log
190
+ # Tasks chained in one window (#4934)
191
+ sequence:
192
+ progress: "{done}/{total}"
193
+ step: "Step {n}"
194
+ pending: Waiting
195
+ skipped: Not run
196
+ why:
197
+ error: An earlier step failed
198
+ cancelled: The sequence was stopped
199
+ reload: The page was reloaded
200
+ back: Back to the list
201
+ details: Show this step
202
+ cancel: Stop the sequence
190
203
  # Waiting states (#4665)
191
204
  pending:
192
205
  reading: Reading…
@@ -189,6 +189,19 @@ export default `core:
189
189
  subs: "{count} sous-phase | {count} sous-phases"
190
190
  filter: "Phase : {name}"
191
191
  showAll: Voir tout le journal
192
+ # Tasks chained in one window (#4934)
193
+ sequence:
194
+ progress: "{done}/{total}"
195
+ step: "Étape {n}"
196
+ pending: En attente
197
+ skipped: Non lancée
198
+ why:
199
+ error: Une étape précédente a échoué
200
+ cancelled: La suite a été arrêtée
201
+ reload: La page a été rechargée
202
+ back: Retour à la liste
203
+ details: Voir cette étape
204
+ cancel: Arrêter la suite
192
205
  # Waiting states (#4665)
193
206
  pending:
194
207
  reading: Lecture…
@@ -187,6 +187,19 @@ core:
187
187
  subs: "{count} sous-phase | {count} sous-phases"
188
188
  filter: "Phase : {name}"
189
189
  showAll: Voir tout le journal
190
+ # Tasks chained in one window (#4934)
191
+ sequence:
192
+ progress: "{done}/{total}"
193
+ step: "Étape {n}"
194
+ pending: En attente
195
+ skipped: Non lancée
196
+ why:
197
+ error: Une étape précédente a échoué
198
+ cancelled: La suite a été arrêtée
199
+ reload: La page a été rechargée
200
+ back: Retour à la liste
201
+ details: Voir cette étape
202
+ cancel: Arrêter la suite
190
203
  # Waiting states (#4665)
191
204
  pending:
192
205
  reading: Lecture…
package/src/index.ts CHANGED
@@ -481,6 +481,11 @@ export {
481
481
  type TaskFollow,
482
482
  type TaskConfirm,
483
483
  type RunOptions,
484
+ type SequenceStep,
485
+ type SequenceOptions,
486
+ type SequenceStepStatus,
487
+ type TaskSequence,
488
+ type TaskSequenceStep,
484
489
  } from './tasks/taskStore'
485
490
  export {
486
491
  TASK_PHASE_STATE_ICONS,
@@ -72,6 +72,108 @@
72
72
  }
73
73
  }
74
74
 
75
+ // TaskRunView fills the window like the content did (#4934)
76
+ .qd-task-run-view {
77
+ display: flex;
78
+ flex-direction: column;
79
+ flex: 1 1 auto;
80
+ min-height: 0;
81
+ }
82
+
83
+ // The sequence window: the list of steps (#4934)
84
+ .qd-task-sequence-header {
85
+ display: flex;
86
+ align-items: center;
87
+ gap: 0.75rem;
88
+ }
89
+
90
+ .qd-task-sequence-list {
91
+ list-style: none;
92
+ margin: 0;
93
+ padding: 0;
94
+ display: flex;
95
+ flex-direction: column;
96
+ gap: 0.25rem;
97
+ }
98
+
99
+ .qd-task-sequence-step {
100
+ display: flex;
101
+ align-items: center;
102
+ gap: 0.75rem;
103
+ width: 100%;
104
+ padding: 0.5rem 0.75rem;
105
+ border: 1px solid var(--p-content-border-color);
106
+ border-radius: $radius-sm;
107
+ background: transparent;
108
+ color: inherit;
109
+ font: inherit;
110
+ text-align: left;
111
+ cursor: pointer;
112
+
113
+ &:hover:not(:disabled) { background: var(--p-content-hover-background); }
114
+ &:disabled { cursor: default; }
115
+ &:focus-visible { outline: 2px solid var(--p-primary-color); outline-offset: 1px; }
116
+
117
+ &--current {
118
+ border-color: var(--qd-task-running-color, var(--p-orange-500));
119
+ box-shadow: inset 3px 0 0 var(--qd-task-running-color, var(--p-orange-500));
120
+ }
121
+ &--pending,
122
+ &--skipped { color: var(--p-text-muted-color); }
123
+ &--succeeded .qd-task-sequence-icon { color: var(--qd-task-done-color, var(--p-green-600)); }
124
+ &--failed .qd-task-sequence-icon { color: var(--p-red-600); }
125
+ &--running .qd-task-sequence-icon,
126
+ &--queued .qd-task-sequence-icon,
127
+ &--starting .qd-task-sequence-icon { color: var(--qd-task-running-color, var(--p-orange-500)); }
128
+ }
129
+
130
+ .qd-task-sequence-main {
131
+ flex: 1;
132
+ min-width: 0;
133
+ display: flex;
134
+ flex-direction: column;
135
+ gap: 0.125rem;
136
+ }
137
+
138
+ .qd-task-sequence-label { font-weight: 600; }
139
+
140
+ .qd-task-sequence-recap {
141
+ font-size: $font-size-sm;
142
+ color: var(--p-text-muted-color);
143
+ overflow-wrap: anywhere;
144
+
145
+ .qd-task-sequence-step--failed & { color: var(--p-red-700); }
146
+ }
147
+
148
+ .qd-task-sequence-progress {
149
+ height: 0.375rem;
150
+ margin-top: 0.25rem;
151
+ }
152
+
153
+ .qd-task-sequence-state,
154
+ .qd-task-sequence-duration {
155
+ font-size: $font-size-sm;
156
+ color: var(--p-text-muted-color);
157
+ white-space: nowrap;
158
+ }
159
+
160
+ .qd-task-sequence-duration {
161
+ min-width: 4rem;
162
+ text-align: right;
163
+ font-variant-numeric: tabular-nums;
164
+ }
165
+
166
+ .qd-task-sequence-detail-title {
167
+ margin-bottom: 0.75rem;
168
+ font-weight: 600;
169
+ }
170
+
171
+ .qd-task-sequence-detail-index {
172
+ margin-right: 0.5rem;
173
+ color: var(--p-text-muted-color);
174
+ font-variant-numeric: tabular-nums;
175
+ }
176
+
75
177
  .qd-task-before-log,
76
178
  .qd-task-after-log {
77
179
  margin-top: 0.75rem;