@jumoo/processing 17.4.3-prerelease.6 → 17.4.3-prerelease.7

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.
@@ -89,6 +89,7 @@ export type PipelineRunStatus = {
89
89
  cancelRequested: boolean;
90
90
  progress: PipelineRunProgress;
91
91
  startedBy?: string | null;
92
+ startedByName?: string | null;
92
93
  created?: string | null;
93
94
  modified?: string | null;
94
95
  scheduledFor?: string | null;
@@ -16,10 +16,28 @@ declare const _default: {
16
16
  jumooProcConflict: {
17
17
  headline: string;
18
18
  message: string;
19
+ headlineRunning: string;
20
+ messageRunning: string;
21
+ headlineQueued: string;
22
+ messageQueued: string;
23
+ headlineWaiting: string;
24
+ messageWaiting: string;
25
+ headlineScheduled: string;
26
+ messageScheduled: string;
19
27
  status: string;
20
28
  startedBy: string;
21
- started: string;
29
+ queued: string;
30
+ lastActivity: string;
31
+ waitingSince: string;
32
+ scheduledFor: string;
22
33
  progress: string;
34
+ stateQueued: string;
35
+ stateRunning: string;
36
+ stateScheduled: string;
37
+ stateWaiting: string;
38
+ stateCompleted: string;
39
+ stateFailed: string;
40
+ stateCancelled: string;
23
41
  };
24
42
  jumooProcBackground: {
25
43
  completed: string;
@@ -14,12 +14,30 @@ export default {
14
14
  stack: 'Stack',
15
15
  },
16
16
  jumooProcConflict: {
17
- headline: 'Already running',
18
- message: 'Another process is already running for this target. Wait for it to finish, or cancel it, then try again.',
17
+ headline: 'Already in progress',
18
+ message: 'Another process is already in progress for this target. Wait for it to finish, or cancel it, then try again.',
19
+ headlineRunning: 'Already running',
20
+ messageRunning: 'Another process is already running for this target. Wait for it to finish, or cancel it, then try again.',
21
+ headlineQueued: 'Already queued',
22
+ messageQueued: 'Another process for this target is queued and will start shortly. Wait for it to finish, or cancel it, then try again.',
23
+ headlineWaiting: 'Waiting to continue',
24
+ messageWaiting: 'Another process for this target is paused and waiting to continue. Finish or cancel it, then try again.',
25
+ headlineScheduled: 'Already scheduled',
26
+ messageScheduled: 'Another process for this target is scheduled. Cancel it, or wait for it to run, then try again.',
19
27
  status: 'Status',
20
28
  startedBy: 'Started by',
21
- started: 'Started',
29
+ queued: 'Queued',
30
+ lastActivity: 'Last activity',
31
+ waitingSince: 'Waiting since',
32
+ scheduledFor: 'Scheduled for',
22
33
  progress: 'Progress',
34
+ stateQueued: 'Queued',
35
+ stateRunning: 'Running',
36
+ stateScheduled: 'Scheduled',
37
+ stateWaiting: 'Waiting',
38
+ stateCompleted: 'Completed',
39
+ stateFailed: 'Failed',
40
+ stateCancelled: 'Cancelled',
23
41
  },
24
42
  jumooProcBackground: {
25
43
  completed: 'This process has completed in the background',
@@ -61,6 +61,13 @@ export declare class JumooPipelineElement extends UmbLitElement {
61
61
  private onLastAction;
62
62
  render(): import("lit-html").TemplateResult<1>;
63
63
  private renderConflict;
64
+ /**
65
+ * @description the time worth showing for the holder: when it was queued, when it last
66
+ * moved, how long it has been paused, or when it is due.
67
+ * @param holder the holder's status.
68
+ * @returns the label key and the time, or undefined when there is nothing to show.
69
+ */
70
+ private conflictTime;
64
71
  private renderDebug;
65
72
  private renderStatus;
66
73
  private renderBackground;
@@ -7,6 +7,24 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { css, customElement, html, nothing, property, state, } from '@umbraco-cms/backoffice/external/lit';
8
8
  import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
9
9
  import { PipelineStatus, JUMOO_PROCESSING_CONTEXT, } from '@jumoo/processing';
10
+ import { PipelineRunState } from '../api/index.js';
11
+ /**
12
+ * @description the suffix on the conflict panel's headline and message keys for the holder's
13
+ * status. A holder that isn't moving or waiting gets the general wording.
14
+ * @param status the holder's status.
15
+ * @returns the key suffix.
16
+ */
17
+ function conflictSuffix(status) {
18
+ switch (status) {
19
+ case PipelineRunState.RUNNING:
20
+ case PipelineRunState.QUEUED:
21
+ case PipelineRunState.WAITING:
22
+ case PipelineRunState.SCHEDULED:
23
+ return status;
24
+ default:
25
+ return '';
26
+ }
27
+ }
10
28
  /**
11
29
  * @property {string} processor - the processor to use for the pipeline
12
30
  * @property {string} strategy - the strategy to use for the pipeline
@@ -156,49 +174,65 @@ let JumooPipelineElement = class JumooPipelineElement extends UmbLitElement {
156
174
  }
157
175
  renderConflict(conflict) {
158
176
  const holder = conflict.holder;
177
+ const suffix = holder ? conflictSuffix(holder.status) : '';
178
+ const time = holder ? this.conflictTime(holder) : undefined;
179
+ const dateFormat = {
180
+ dateStyle: 'medium',
181
+ timeStyle: 'short',
182
+ };
159
183
  return html `<div class="conflict">
160
184
  <div class="header">
161
185
  <uui-icon name="icon-alert"></uui-icon>
162
- <h3>
163
- <umb-localize key="jumooProcConflict_headline">Already running</umb-localize>
164
- </h3>
186
+ <h3>${this.localize.term(`jumooProcConflict_headline${suffix}`)}</h3>
165
187
  </div>
166
- <p>
167
- <umb-localize key="jumooProcConflict_message">
168
- Another process is already running for this target. Wait for it to finish, or
169
- cancel it, then try again.
170
- </umb-localize>
171
- </p>
188
+ <p>${this.localize.term(`jumooProcConflict_message${suffix}`)}</p>
172
189
  ${holder
173
190
  ? html `<dl>
174
191
  <dt><umb-localize key="jumooProcConflict_status">Status</umb-localize></dt>
175
- <dd>${holder.status}</dd>
176
- ${holder.startedBy
192
+ <dd>${this.localize.term(`jumooProcConflict_state${holder.status}`)}</dd>
193
+ ${holder.startedByName
177
194
  ? html `<dt>
178
195
  <umb-localize key="jumooProcConflict_startedBy"
179
196
  >Started by</umb-localize
180
197
  >
181
198
  </dt>
182
- <dd>${holder.startedBy}</dd>`
199
+ <dd>${holder.startedByName}</dd>`
183
200
  : nothing}
184
- ${holder.created
201
+ ${time
202
+ ? html `<dt>${this.localize.term(time.label)}</dt>
203
+ <dd>${this.localize.date(time.value, dateFormat)}</dd>`
204
+ : nothing}
205
+ ${holder.status === PipelineRunState.RUNNING
185
206
  ? html `<dt>
186
- <umb-localize key="jumooProcConflict_started"
187
- >Started</umb-localize
207
+ <umb-localize key="jumooProcConflict_progress"
208
+ >Progress</umb-localize
188
209
  >
189
210
  </dt>
190
- <dd>
191
- ${this.localize.date(holder.created, { dateStyle: 'medium', timeStyle: 'short' })}
192
- </dd>`
211
+ <dd>${Math.round(holder.progress.percentage)}%</dd>`
193
212
  : nothing}
194
- <dt>
195
- <umb-localize key="jumooProcConflict_progress">Progress</umb-localize>
196
- </dt>
197
- <dd>${Math.round(holder.progress.percentage)}%</dd>
198
213
  </dl>`
199
214
  : nothing}
200
215
  </div>`;
201
216
  }
217
+ /**
218
+ * @description the time worth showing for the holder: when it was queued, when it last
219
+ * moved, how long it has been paused, or when it is due.
220
+ * @param holder the holder's status.
221
+ * @returns the label key and the time, or undefined when there is nothing to show.
222
+ */
223
+ conflictTime(holder) {
224
+ const pick = (label, value) => value ? { label: `jumooProcConflict_${label}`, value } : undefined;
225
+ switch (holder.status) {
226
+ case PipelineRunState.QUEUED:
227
+ return pick('queued', holder.created);
228
+ case PipelineRunState.WAITING:
229
+ return pick('waitingSince', holder.modified);
230
+ case PipelineRunState.SCHEDULED:
231
+ return pick('scheduledFor', holder.scheduledFor);
232
+ default:
233
+ return pick('lastActivity', holder.modified ?? holder.created);
234
+ }
235
+ }
202
236
  renderDebug() {
203
237
  return this.debug
204
238
  ? html `<div><pre>${JSON.stringify(this.state, null, 1)}</pre></div>`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jumoo/processing",
3
3
  "licence": "custom",
4
- "version": "17.4.3-prerelease.6",
4
+ "version": "17.4.3-prerelease.7",
5
5
  "type": "module",
6
6
  "description": "Jumoo processing library",
7
7
  "exports": {