@things-factory/worklist 10.1.26 → 10.1.28

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.
Files changed (74) hide show
  1. package/approval-walk/harness.mjs +255 -0
  2. package/dist-client/pages/activity/activity-list-page.d.ts +0 -2
  3. package/dist-client/pages/activity/activity-list-page.js +7 -15
  4. package/dist-client/pages/activity/activity-list-page.js.map +1 -1
  5. package/dist-client/pages/activity/activity-model-item-list.js +2 -1
  6. package/dist-client/pages/activity/activity-model-item-list.js.map +1 -1
  7. package/dist-client/pages/activity/activity-page.d.ts +6 -0
  8. package/dist-client/pages/activity/activity-page.js +171 -131
  9. package/dist-client/pages/activity/activity-page.js.map +1 -1
  10. package/dist-client/pages/activity/starter-list-page.js +6 -11
  11. package/dist-client/pages/activity/starter-list-page.js.map +1 -1
  12. package/dist-client/pages/activity-approval/activity-approval-list-page.js +8 -12
  13. package/dist-client/pages/activity-approval/activity-approval-list-page.js.map +1 -1
  14. package/dist-client/pages/activity-approval/activity-approval-page.d.ts +7 -2
  15. package/dist-client/pages/activity-approval/activity-approval-page.js +146 -138
  16. package/dist-client/pages/activity-approval/activity-approval-page.js.map +1 -1
  17. package/dist-client/pages/activity-catalog/activity-catalog-page.d.ts +10 -0
  18. package/dist-client/pages/activity-catalog/activity-catalog-page.js +56 -35
  19. package/dist-client/pages/activity-catalog/activity-catalog-page.js.map +1 -1
  20. package/dist-client/pages/activity-instance/activity-instance-list-page.d.ts +0 -1
  21. package/dist-client/pages/activity-instance/activity-instance-list-page.js +79 -107
  22. package/dist-client/pages/activity-instance/activity-instance-list-page.js.map +1 -1
  23. package/dist-client/pages/activity-instance/activity-instance-search-page.js +3 -6
  24. package/dist-client/pages/activity-instance/activity-instance-search-page.js.map +1 -1
  25. package/dist-client/pages/activity-instance/activity-instance-start-page.d.ts +6 -0
  26. package/dist-client/pages/activity-instance/activity-instance-start-page.js +216 -157
  27. package/dist-client/pages/activity-instance/activity-instance-start-page.js.map +1 -1
  28. package/dist-client/pages/activity-stats/activity-stats-list-page.js +8 -12
  29. package/dist-client/pages/activity-stats/activity-stats-list-page.js.map +1 -1
  30. package/dist-client/pages/activity-store/activity-store-page.js +4 -11
  31. package/dist-client/pages/activity-store/activity-store-page.js.map +1 -1
  32. package/dist-client/pages/activity-supervisor/reporter-list-page.js +6 -11
  33. package/dist-client/pages/activity-supervisor/reporter-list-page.js.map +1 -1
  34. package/dist-client/pages/activity-template/activity-template-list-page.js +8 -12
  35. package/dist-client/pages/activity-template/activity-template-list-page.js.map +1 -1
  36. package/dist-client/pages/activity-thread/activity-thread-list-page.js +8 -12
  37. package/dist-client/pages/activity-thread/activity-thread-list-page.js.map +1 -1
  38. package/dist-client/pages/activity-thread/activity-thread-page.d.ts +6 -2
  39. package/dist-client/pages/activity-thread/activity-thread-page.js +96 -82
  40. package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
  41. package/dist-client/pages/activity-thread/activity-thread-view-page.d.ts +6 -2
  42. package/dist-client/pages/activity-thread/activity-thread-view-page.js +53 -23
  43. package/dist-client/pages/activity-thread/activity-thread-view-page.js.map +1 -1
  44. package/dist-client/pages/installable-activity/installable-activity-list-page.d.ts +0 -1
  45. package/dist-client/pages/installable-activity/installable-activity-list-page.js +7 -16
  46. package/dist-client/pages/installable-activity/installable-activity-list-page.js.map +1 -1
  47. package/dist-client/pages/todo/approval-done-list-page.d.ts +0 -2
  48. package/dist-client/pages/todo/approval-done-list-page.js +7 -15
  49. package/dist-client/pages/todo/approval-done-list-page.js.map +1 -1
  50. package/dist-client/pages/todo/approval-pending-list-page.d.ts +0 -2
  51. package/dist-client/pages/todo/approval-pending-list-page.js +5 -16
  52. package/dist-client/pages/todo/approval-pending-list-page.js.map +1 -1
  53. package/dist-client/pages/todo/done-list-calendar-page.js +4 -5
  54. package/dist-client/pages/todo/done-list-calendar-page.js.map +1 -1
  55. package/dist-client/pages/todo/done-list-page.d.ts +0 -2
  56. package/dist-client/pages/todo/done-list-page.js +7 -15
  57. package/dist-client/pages/todo/done-list-page.js.map +1 -1
  58. package/dist-client/pages/todo/draft-list-page.js +6 -11
  59. package/dist-client/pages/todo/draft-list-page.js.map +1 -1
  60. package/dist-client/pages/todo/pickable-list-page.d.ts +0 -2
  61. package/dist-client/pages/todo/pickable-list-page.js +7 -15
  62. package/dist-client/pages/todo/pickable-list-page.js.map +1 -1
  63. package/dist-client/pages/todo/todo-list-page.d.ts +0 -2
  64. package/dist-client/pages/todo/todo-list-page.js +5 -15
  65. package/dist-client/pages/todo/todo-list-page.js.map +1 -1
  66. package/dist-client/tsconfig.tsbuildinfo +1 -1
  67. package/dist-server/service/activity/decision-key-declaration.d.ts +11 -2
  68. package/dist-server/service/activity/decision-key-declaration.js +22 -1
  69. package/dist-server/service/activity/decision-key-declaration.js.map +1 -1
  70. package/dist-server/service/installable-activity/installable-activity-query.d.ts +11 -0
  71. package/dist-server/service/installable-activity/installable-activity-query.js +31 -0
  72. package/dist-server/service/installable-activity/installable-activity-query.js.map +1 -1
  73. package/dist-server/tsconfig.tsbuildinfo +1 -1
  74. package/package.json +11 -11
@@ -1,10 +1,11 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
+ import '@operato/list-state/ox-page-state.js';
2
3
  import '@operato/property-editor/ox-properties-dynamic-view.js';
3
4
  import '@operato/board/ox-board-viewer.js';
4
5
  import gql from 'graphql-tag';
5
6
  import { css, html } from 'lit';
6
7
  import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
7
- import { customElement, property, query } from 'lit/decorators.js';
8
+ import { customElement, property, query, state } from 'lit/decorators.js';
8
9
  import { client } from '@operato/graphql';
9
10
  import { i18next, localize } from '@operato/i18n';
10
11
  import { ranMutation } from '../../components/say-outcome.js';
@@ -22,7 +23,8 @@ function getSafeFormatter(locale, options) {
22
23
  }
23
24
  }
24
25
  const formatter = getSafeFormatter(navigator.language, { dateStyle: 'full', timeStyle: 'short' });
25
- export const ActivityInstanceStatus = { Draft: 'draft',
26
+ export const ActivityInstanceStatus = {
27
+ Draft: 'draft',
26
28
  Issued: 'issued',
27
29
  Unassigned: 'unassigned',
28
30
  Assigned: 'assigned',
@@ -32,47 +34,60 @@ export const ActivityInstanceStatus = { Draft: 'draft',
32
34
  Aborted: 'aborted'
33
35
  };
34
36
  let ActivityPage = class ActivityPage extends localize(i18next)(PageView) {
37
+ constructor() {
38
+ super(...arguments);
39
+ this.loaded = false;
40
+ this.loadError = null;
41
+ }
35
42
  static { this.styles = [
36
43
  ScrollbarStyles,
37
44
  css `
38
- :host { display: flex;
45
+ :host {
46
+ display: flex;
39
47
  flex-direction: column;
40
48
 
41
49
  width: 100%;
42
50
  padding: 5px;
43
51
  overflow: auto;
44
- }
52
+ }
45
53
 
46
- [header] { display: block;
54
+ [header] {
55
+ display: block;
47
56
  padding: 5px;
48
- }
57
+ }
49
58
 
50
- [content] { flex: 1;
59
+ [content] {
60
+ flex: 1;
51
61
  display: block;
52
62
  padding: 5px;
53
- }
63
+ }
54
64
 
55
- ox-board-viewer { width: 100%;
65
+ ox-board-viewer {
66
+ width: 100%;
56
67
  height: 100%;
57
- }
68
+ }
58
69
  `
59
70
  ]; }
60
71
  get context() {
61
72
  const startable = [ActivityInstanceStatus.Assigned, ActivityInstanceStatus.Issued].includes(this.activityInstance?.state);
62
73
  const finishable = [ActivityInstanceStatus.Started].includes(this.activityInstance?.state);
63
74
  const savable = finishable;
64
- return { title: this.lifecycle?.params?.['title'] || i18next.t('title.activity'),
75
+ return {
76
+ title: this.lifecycle?.params?.['title'] || i18next.t('title.activity'),
65
77
  help: 'worklist/activity',
66
78
  actions: [
67
- startable && { title: i18next.t('button.play'),
79
+ startable && {
80
+ title: i18next.t('button.play'),
68
81
  action: this._startActivityInstance.bind(this),
69
82
  ...CommonButtonStyles.play
70
83
  },
71
- savable && { title: i18next.t('button.save'),
84
+ savable && {
85
+ title: i18next.t('button.save'),
72
86
  action: this._saveActivityInstance.bind(this),
73
87
  ...CommonButtonStyles.save
74
88
  },
75
- finishable && { title: i18next.t('button.finish'),
89
+ finishable && {
90
+ title: i18next.t('button.finish'),
76
91
  action: this._endActivityInstance.bind(this),
77
92
  ...CommonButtonStyles.save
78
93
  }
@@ -80,6 +95,18 @@ let ActivityPage = class ActivityPage extends localize(i18next)(PageView) {
80
95
  };
81
96
  }
82
97
  render() {
98
+ /*
99
+ * Reading and failing both drew the same empty header, so a task that could not be read looked
100
+ * like a task with nothing in it (ADR-0060 decision 8).
101
+ */
102
+ return html `<ox-page-state
103
+ .loading=${!this.loaded && !this.loadError}
104
+ .error=${this.loadError}
105
+ @retry=${() => this.lastId && this.fetchActivityInstance(this.lastId)}
106
+ >${this.renderActivity()}</ox-page-state
107
+ >`;
108
+ }
109
+ renderActivity() {
83
110
  const { name, description, state, thumbnail, dueAt, createdAt } = this.activityInstance || {};
84
111
  return html `
85
112
  <div header>
@@ -117,11 +144,7 @@ let ActivityPage = class ActivityPage extends localize(i18next)(PageView) {
117
144
  return (model || [])
118
145
  .filter(item => item.inout === 'in' || item.inout === 'inout')
119
146
  .map(item => {
120
- return { ...item,
121
- name: item.tag,
122
- label: item.tKey || item.name,
123
- property: item.options
124
- };
147
+ return { ...item, name: item.tag, label: item.tKey || item.name, property: item.options };
125
148
  });
126
149
  }
127
150
  getOutputSpec() {
@@ -129,11 +152,7 @@ let ActivityPage = class ActivityPage extends localize(i18next)(PageView) {
129
152
  return (model || [])
130
153
  .filter(item => item.inout === 'inout' || item.inout === 'out')
131
154
  .map(item => {
132
- return { ...item,
133
- name: item.tag,
134
- label: item.tKey || item.name,
135
- property: item.options
136
- };
155
+ return { ...item, name: item.tag, label: item.tKey || item.name, property: item.options };
137
156
  });
138
157
  }
139
158
  generatedContent() {
@@ -168,8 +187,7 @@ let ActivityPage = class ActivityPage extends localize(i18next)(PageView) {
168
187
  boardContent() {
169
188
  const { uiSource: boardId, input, output } = this.activityInstance;
170
189
  if (!this.board || this.board.id !== boardId) {
171
- this.board = { id: boardId
172
- };
190
+ this.board = { id: boardId };
173
191
  }
174
192
  return html `
175
193
  <ox-board-viewer
@@ -201,149 +219,163 @@ let ActivityPage = class ActivityPage extends localize(i18next)(PageView) {
201
219
  }
202
220
  }
203
221
  async fetchActivityInstance(id) {
204
- const response = await client.query({ query: gql `
205
- query activityInstance($id: String!) { activityInstance(id: $id) { id
206
- name
207
- description
208
- state
209
- activity { model { name
210
- description
211
- active
212
- tag
213
- inout
214
- type
215
- unit
216
- options
217
- quantifier
218
- spec
219
- }
220
- }
221
- thumbnail
222
- input
223
- output
224
- uiType
225
- uiSource
226
- dueAt
227
- createdAt
228
- }
229
- }
230
- `,
231
- variables: { id
222
+ this.lastId = id;
223
+ this.loadError = null;
224
+ try {
225
+ const response = await client.query({
226
+ query: gql `
227
+ query activityInstance($id: String!) {
228
+ activityInstance(id: $id) {
229
+ id
230
+ name
231
+ description
232
+ state
233
+ activity {
234
+ model {
235
+ name
236
+ description
237
+ active
238
+ tag
239
+ inout
240
+ type
241
+ unit
242
+ options
243
+ quantifier
244
+ spec
245
+ }
246
+ }
247
+ thumbnail
248
+ input
249
+ output
250
+ uiType
251
+ uiSource
252
+ dueAt
253
+ createdAt
232
254
  }
233
- });
234
- this.activityInstance = response.data.activityInstance;
255
+ }
256
+ `,
257
+ variables: { id }
258
+ });
259
+ if (response.errors?.length || !response.data?.activityInstance) {
260
+ throw (response.errors?.[0] || new Error(i18next.t('error.activity-instance not found', { activityInstance: id })));
261
+ }
262
+ this.activityInstance = response.data.activityInstance;
263
+ this.loaded = true;
264
+ }
265
+ catch (error) {
266
+ this.loadError = error;
267
+ }
235
268
  }
236
269
  async _startActivityInstance() {
237
270
  var { id, output, reason, uiType } = this.activityInstance;
238
271
  if (uiType === 'board') {
239
272
  output = this.getOutputFromBoard();
240
273
  }
241
- const outcome = await ranMutation(() => client.mutate({ mutation: gql `
242
- mutation ($id: String!, $output: Object) { startActivityInstance(id: $id, output: $output) { name
243
- }
244
- }
245
- `,
246
- variables: { id,
247
- output
274
+ const outcome = await ranMutation(() => client.mutate({
275
+ mutation: gql `
276
+ mutation ($id: String!, $output: Object) {
277
+ startActivityInstance(id: $id, output: $output) {
278
+ name
248
279
  }
280
+ }
281
+ `,
282
+ variables: { id, output }
249
283
  }));
250
284
  if (!outcome.ok) {
251
285
  return;
252
286
  }
253
287
  await this.fetchActivityInstance(this.activityInstance.id);
254
- document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_started_successfully')
255
- }
256
- }));
288
+ document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_started_successfully') } }));
257
289
  }
258
290
  async _saveActivityInstance() {
259
291
  var { id, output, reason, uiType } = this.activityInstance;
260
292
  if (uiType === 'board') {
261
293
  output = this.getOutputFromBoard();
262
294
  }
263
- const outcome = await ranMutation(() => client.mutate({ mutation: gql `
264
- mutation ($id: String!, $save: ActivityInstanceSave!) { draftActivityInstance(id: $id, save: $save) { id
265
- name
266
- description
267
- state
268
- activity { model { name
269
- description
270
- active
271
- tag
272
- inout
273
- type
274
- unit
275
- options
276
- quantifier
277
- spec
278
- }
279
- }
280
- thumbnail
281
- input
282
- output
283
- uiType
284
- uiSource
285
- dueAt
286
- createdAt
287
- }
288
- }
289
- `,
290
- variables: { id,
291
- save: { output
295
+ const outcome = await ranMutation(() => client.mutate({
296
+ mutation: gql `
297
+ mutation ($id: String!, $save: ActivityInstanceSave!) {
298
+ draftActivityInstance(id: $id, save: $save) {
299
+ id
300
+ name
301
+ description
302
+ state
303
+ activity {
304
+ model {
305
+ name
306
+ description
307
+ active
308
+ tag
309
+ inout
310
+ type
311
+ unit
312
+ options
313
+ quantifier
314
+ spec
292
315
  }
316
+ }
317
+ thumbnail
318
+ input
319
+ output
320
+ uiType
321
+ uiSource
322
+ dueAt
323
+ createdAt
293
324
  }
325
+ }
326
+ `,
327
+ variables: { id, save: { output } }
294
328
  }));
295
329
  if (!outcome.ok) {
296
330
  return;
297
331
  }
298
332
  this.activityInstance = outcome.data.saveActivityInstance;
299
- document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_saved_successfully')
300
- }
301
- }));
333
+ document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_saved_successfully') } }));
302
334
  }
303
335
  async _endActivityInstance() {
304
336
  var { id, output, reason, uiType } = this.activityInstance;
305
337
  if (uiType === 'board') {
306
338
  output = this.getOutputFromBoard();
307
339
  }
308
- const outcome = await ranMutation(() => client.mutate({ mutation: gql `
309
- mutation ($id: String!, $output: Object, $reason: String) { endActivityInstance(id: $id, output: $output, reason: $reason) { id
310
- name
311
- description
312
- state
313
- activity { model { name
314
- description
315
- active
316
- tag
317
- inout
318
- type
319
- unit
320
- options
321
- quantifier
322
- spec
323
- }
324
- }
325
- thumbnail
326
- input
327
- output
328
- uiType
329
- uiSource
330
- dueAt
331
- createdAt
332
- }
333
- }
334
- `,
335
- variables: { id,
336
- output,
337
- reason
340
+ const outcome = await ranMutation(() => client.mutate({
341
+ mutation: gql `
342
+ mutation ($id: String!, $output: Object, $reason: String) {
343
+ endActivityInstance(id: $id, output: $output, reason: $reason) {
344
+ id
345
+ name
346
+ description
347
+ state
348
+ activity {
349
+ model {
350
+ name
351
+ description
352
+ active
353
+ tag
354
+ inout
355
+ type
356
+ unit
357
+ options
358
+ quantifier
359
+ spec
360
+ }
361
+ }
362
+ thumbnail
363
+ input
364
+ output
365
+ uiType
366
+ uiSource
367
+ dueAt
368
+ createdAt
338
369
  }
370
+ }
371
+ `,
372
+ variables: { id, output, reason }
339
373
  }));
340
374
  if (!outcome.ok) {
341
375
  return;
342
376
  }
343
377
  this.activityInstance = outcome.data.endActivityInstance;
344
- document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_finished_successfully')
345
- }
346
- }));
378
+ document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_finished_successfully') } }));
347
379
  }
348
380
  };
349
381
  __decorate([
@@ -354,6 +386,14 @@ __decorate([
354
386
  property({ type: Object }),
355
387
  __metadata("design:type", Object)
356
388
  ], ActivityPage.prototype, "board", void 0);
389
+ __decorate([
390
+ state(),
391
+ __metadata("design:type", Object)
392
+ ], ActivityPage.prototype, "loaded", void 0);
393
+ __decorate([
394
+ state(),
395
+ __metadata("design:type", Object)
396
+ ], ActivityPage.prototype, "loadError", void 0);
357
397
  __decorate([
358
398
  query('ox-board-viewer'),
359
399
  __metadata("design:type", Object)
@@ -1 +1 @@
1
- {"version":3,"file":"activity-page.js","sourceRoot":"","sources":["../../../client/pages/activity/activity-page.ts"],"names":[],"mappings":";AAAA,OAAO,wDAAwD,CAAA;AAC/D,OAAO,mCAAmC,CAAA;AAE1C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAA;AAE3D,SAAS,gBAAgB,CAAC,MAAc,EAAE,OAAmC;IAA2B,IAAI,CAAC;QAAK,MAAM,UAAU,GAAG,MAAM,IAAI,OAAO,CAAA;QAClJ,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IACtD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QAAK,OAAO,CAAC,IAAI,CAAC,uCAAuC,MAAM,kC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":["import '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@operato/board/ox-board-viewer.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { ranMutation } from '../../components/say-outcome.js'\nimport { PageView } from '@operato/shell'\nimport { CommonButtonStyles, ScrollbarStyles } from '@operato/styles'\nimport { provider } from '@operato/board/board-provider.js'\n\nfunction getSafeFormatter(locale: string, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat { try { const safeLocale = locale || 'en-US'\n return new Intl.DateTimeFormat(safeLocale, options)\n } catch (e) { console.warn(`Invalid locale or options provided: ${locale}, falling back to default en-US.`, e)\n return new Intl.DateTimeFormat('en-US', options)\n }\n}\n\nconst formatter = getSafeFormatter(navigator.language, { dateStyle: 'full', timeStyle: 'short' })\n\nexport const ActivityInstanceStatus = { Draft: 'draft',\n Issued: 'issued',\n Unassigned: 'unassigned',\n Assigned: 'assigned',\n Started: 'started',\n Pending: 'pending',\n Ended: 'ended',\n Aborted: 'aborted'\n}\n\n@customElement('activity-page')\nexport class ActivityPage extends localize(i18next)(PageView) { static styles = [\n ScrollbarStyles,\n css`\n :host { display: flex;\n flex-direction: column;\n\n width: 100%;\n padding: 5px;\n overflow: auto;\n }\n\n [header] { display: block;\n padding: 5px;\n }\n\n [content] { flex: 1;\n display: block;\n padding: 5px;\n }\n\n ox-board-viewer { width: 100%;\n height: 100%;\n }\n `\n ]\n\n @property({ type: Object }) activityInstance: any\n @property({ type: Object }) board: any\n\n get context() { const startable = [ActivityInstanceStatus.Assigned, ActivityInstanceStatus.Issued].includes(\n this.activityInstance?.state\n )\n\n const finishable = [ActivityInstanceStatus.Started].includes(this.activityInstance?.state)\n const savable = finishable\n\n return { title: this.lifecycle?.params?.['title'] || i18next.t('title.activity'),\n help: 'worklist/activity',\n actions: [\n startable && { title: i18next.t('button.play'),\n action: this._startActivityInstance.bind(this),\n ...CommonButtonStyles.play\n },\n\n savable && { title: i18next.t('button.save'),\n action: this._saveActivityInstance.bind(this),\n ...CommonButtonStyles.save\n },\n\n finishable && { title: i18next.t('button.finish'),\n action: this._endActivityInstance.bind(this),\n ...CommonButtonStyles.save\n }\n ].filter(Boolean /* truthy only */)\n }\n }\n\n render() { const { name, description, state, thumbnail, dueAt, createdAt } = this.activityInstance || {}\n return html`\n <div header>\n <div>name: ${name}</div>\n <div>description: ${description}</div>\n <div>state: ${state}</div>\n <div>posted at: ${createdAt && formatter.format(new Date(createdAt))}</div>\n <div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>\n <img src=${thumbnail} />\n </div>\n\n <div content>${this.activityContent()}</div>\n `\n }\n\n activityContent() { switch (this.activityInstance?.uiType) { case 'template':\n return this.templateContent()\n case 'generated':\n return this.generatedContent()\n case 'board':\n return this.boardContent()\n case 'page':\n case 'external':\n default:\n return html``\n }\n }\n\n templateContent() { const { uiSource: template } = this.activityInstance\n return unsafeHTML(template)\n }\n\n getInputSpec() { const model = this.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'in' || item.inout === 'inout')\n .map(item => { return { ...item,\n name: item.tag,\n label: item.tKey || item.name,\n property: item.options\n }\n })\n }\n\n getOutputSpec() { const model = this.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'inout' || item.inout === 'out')\n .map(item => { return { ...item,\n name: item.tag,\n label: item.tKey || item.name,\n property: item.options\n }\n })\n }\n\n generatedContent() { var { input, output } = this.activityInstance || {}\n\n const inputSpec = this.getInputSpec()\n const outputSpec = this.getOutputSpec()\n\n if (!output) { output = inputSpec\n .filter(item => item.inout === 'inout')\n .reduce((inout, item) => { inout[item.name] = input[item.name]\n return inout\n }, {})\n }\n\n return html`\n <fieldset>\n <legend>Input</legend>\n <ox-properties-dynamic-view data-name=\"input\" .props=${inputSpec} .value=${input}></ox-properties-dynamic-view>\n </fieldset>\n\n <fieldset>\n <legend>Output</legend>\n <ox-properties-dynamic-view\n data-name=\"output\"\n .props=${outputSpec}\n .value=${output}\n @property-change=${e => (this.activityInstance.output = e.currentTarget.value)}\n ></ox-properties-dynamic-view>\n </fieldset>\n `\n }\n\n boardContent() { const { uiSource: boardId, input, output } = this.activityInstance\n\n if (!this.board || this.board.id !== boardId) { this.board = { id: boardId\n }\n }\n\n return html`\n <ox-board-viewer\n style=\"background-color: white;\"\n .board=${this.board}\n .provider=${provider}\n .values=${{ ...input, ...output }}\n hide-fullscreen\n hide-navigation\n ></ox-board-viewer>\n `\n }\n\n @query('ox-board-viewer') boardViewer: any\n\n getOutputFromBoard() { const outputSpec = this.getOutputSpec()\n const data = this.boardViewer.getSceneValues()\n\n return outputSpec.reduce((output, spec) => { output[spec.name] = data[spec.name]\n return output\n }, {})\n }\n\n updated(changes) { if (changes.has('activityInstance')) { this.updateContext()\n }\n }\n\n async pageUpdated(changes, lifecycle, changedBefore) { if (this.active) { this.fetchActivityInstance(lifecycle.resourceId)\n }\n }\n\n async fetchActivityInstance(id) { const response = await client.query({ query: gql`\n query activityInstance($id: String!) { activityInstance(id: $id) { id\n name\n description\n state\n activity { model { name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n }\n }\n `,\n variables: { id\n }\n })\n\n this.activityInstance = response.data.activityInstance\n }\n\n async _startActivityInstance() { var { id, output, reason, uiType } = this.activityInstance\n if (uiType === 'board') { output = this.getOutputFromBoard()\n }\n\n const outcome = await ranMutation(() => client.mutate({ mutation: gql`\n mutation ($id: String!, $output: Object) { startActivityInstance(id: $id, output: $output) { name\n }\n }\n `,\n variables: { id,\n output\n }\n }))\n\n if (!outcome.ok) { return\n }\n\n await this.fetchActivityInstance(this.activityInstance.id)\n\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_started_successfully')\n }\n })\n )\n }\n\n async _saveActivityInstance() { var { id, output, reason, uiType } = this.activityInstance\n if (uiType === 'board') { output = this.getOutputFromBoard()\n }\n\n const outcome = await ranMutation(() => client.mutate({ mutation: gql`\n mutation ($id: String!, $save: ActivityInstanceSave!) { draftActivityInstance(id: $id, save: $save) { id\n name\n description\n state\n activity { model { name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n }\n }\n `,\n variables: { id,\n save: { output\n }\n }\n }))\n\n if (!outcome.ok) { return\n }\n\n this.activityInstance = outcome.data.saveActivityInstance\n\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_saved_successfully')\n }\n })\n )\n }\n\n async _endActivityInstance() { var { id, output, reason, uiType } = this.activityInstance\n if (uiType === 'board') { output = this.getOutputFromBoard()\n }\n\n const outcome = await ranMutation(() => client.mutate({ mutation: gql`\n mutation ($id: String!, $output: Object, $reason: String) { endActivityInstance(id: $id, output: $output, reason: $reason) { id\n name\n description\n state\n activity { model { name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n }\n }\n `,\n variables: { id,\n output,\n reason\n }\n }))\n\n if (!outcome.ok) { return\n }\n\n this.activityInstance = outcome.data.endActivityInstance\n\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_finished_successfully')\n }\n })\n )\n }\n}\n"]}
1
+ {"version":3,"file":"activity-page.js","sourceRoot":"","sources":["../../../client/pages/activity/activity-page.ts"],"names":[],"mappings":";AAAA,OAAO,sCAAsC,CAAA;AAC7C,OAAO,wDAAwD,CAAA;AAC/D,OAAO,mCAAmC,CAAA;AAE1C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC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oCAAoC,CAAC,EAAE,EAAE,CAAC,CACpG,CAAA;IACH,CAAC;;AAxX2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDAAsB;AACrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CAAW;AAE7B;IAAR,KAAK,EAAE;;4CAAe;AACd;IAAR,KAAK,EAAE;;+CAA0B;AA+JR;IAAzB,KAAK,CAAC,iBAAiB,CAAC;;iDAAiB;AAlM/B,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAwZxB","sourcesContent":["import '@operato/list-state/ox-page-state.js'\nimport '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@operato/board/ox-board-viewer.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { ranMutation } from '../../components/say-outcome.js'\nimport { PageView } from '@operato/shell'\nimport { CommonButtonStyles, ScrollbarStyles } from '@operato/styles'\nimport { provider } from '@operato/board/board-provider.js'\n\nfunction getSafeFormatter(locale: string, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat {\n try {\n const safeLocale = locale || 'en-US'\n return new Intl.DateTimeFormat(safeLocale, options)\n } catch (e) {\n console.warn(`Invalid locale or options provided: ${locale}, falling back to default en-US.`, e)\n return new Intl.DateTimeFormat('en-US', options)\n }\n}\n\nconst formatter = getSafeFormatter(navigator.language, { dateStyle: 'full', timeStyle: 'short' })\n\nexport const ActivityInstanceStatus = {\n Draft: 'draft',\n Issued: 'issued',\n Unassigned: 'unassigned',\n Assigned: 'assigned',\n Started: 'started',\n Pending: 'pending',\n Ended: 'ended',\n Aborted: 'aborted'\n}\n\n@customElement('activity-page')\nexport class ActivityPage extends localize(i18next)(PageView) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n width: 100%;\n padding: 5px;\n overflow: auto;\n }\n\n [header] {\n display: block;\n padding: 5px;\n }\n\n [content] {\n flex: 1;\n display: block;\n padding: 5px;\n }\n\n ox-board-viewer {\n width: 100%;\n height: 100%;\n }\n `\n ]\n\n @property({ type: Object }) activityInstance: any\n @property({ type: Object }) board: any\n\n @state() loaded = false\n @state() loadError: unknown = null\n\n /** The id this screen last read, so retry asks for the same task. */\n private lastId?: string\n\n get context() {\n const startable = [ActivityInstanceStatus.Assigned, ActivityInstanceStatus.Issued].includes(\n this.activityInstance?.state\n )\n\n const finishable = [ActivityInstanceStatus.Started].includes(this.activityInstance?.state)\n const savable = finishable\n\n return {\n title: this.lifecycle?.params?.['title'] || i18next.t('title.activity'),\n help: 'worklist/activity',\n actions: [\n startable && {\n title: i18next.t('button.play'),\n action: this._startActivityInstance.bind(this),\n ...CommonButtonStyles.play\n },\n\n savable && {\n title: i18next.t('button.save'),\n action: this._saveActivityInstance.bind(this),\n ...CommonButtonStyles.save\n },\n\n finishable && {\n title: i18next.t('button.finish'),\n action: this._endActivityInstance.bind(this),\n ...CommonButtonStyles.save\n }\n ].filter(Boolean /* truthy only */)\n }\n }\n\n render() {\n /*\n * Reading and failing both drew the same empty header, so a task that could not be read looked\n * like a task with nothing in it (ADR-0060 decision 8).\n */\n return html`<ox-page-state\n .loading=${!this.loaded && !this.loadError}\n .error=${this.loadError}\n @retry=${() => this.lastId && this.fetchActivityInstance(this.lastId)}\n >${this.renderActivity()}</ox-page-state\n >`\n }\n\n renderActivity() {\n const { name, description, state, thumbnail, dueAt, createdAt } = this.activityInstance || {}\n return html`\n <div header>\n <div>name: ${name}</div>\n <div>description: ${description}</div>\n <div>state: ${state}</div>\n <div>posted at: ${createdAt && formatter.format(new Date(createdAt))}</div>\n <div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>\n <img src=${thumbnail} />\n </div>\n\n <div content>${this.activityContent()}</div>\n `\n }\n\n activityContent() {\n switch (this.activityInstance?.uiType) {\n case 'template':\n return this.templateContent()\n case 'generated':\n return this.generatedContent()\n case 'board':\n return this.boardContent()\n case 'page':\n case 'external':\n default:\n return html``\n }\n }\n\n templateContent() {\n const { uiSource: template } = this.activityInstance\n return unsafeHTML(template)\n }\n\n getInputSpec() {\n const model = this.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'in' || item.inout === 'inout')\n .map(item => {\n return { ...item, name: item.tag, label: item.tKey || item.name, property: item.options }\n })\n }\n\n getOutputSpec() {\n const model = this.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'inout' || item.inout === 'out')\n .map(item => {\n return { ...item, name: item.tag, label: item.tKey || item.name, property: item.options }\n })\n }\n\n generatedContent() {\n var { input, output } = this.activityInstance || {}\n\n const inputSpec = this.getInputSpec()\n const outputSpec = this.getOutputSpec()\n\n if (!output) {\n output = inputSpec\n .filter(item => item.inout === 'inout')\n .reduce((inout, item) => {\n inout[item.name] = input[item.name]\n return inout\n }, {})\n }\n\n return html`\n <fieldset>\n <legend>Input</legend>\n <ox-properties-dynamic-view data-name=\"input\" .props=${inputSpec} .value=${input}></ox-properties-dynamic-view>\n </fieldset>\n\n <fieldset>\n <legend>Output</legend>\n <ox-properties-dynamic-view\n data-name=\"output\"\n .props=${outputSpec}\n .value=${output}\n @property-change=${e => (this.activityInstance.output = e.currentTarget.value)}\n ></ox-properties-dynamic-view>\n </fieldset>\n `\n }\n\n boardContent() {\n const { uiSource: boardId, input, output } = this.activityInstance\n\n if (!this.board || this.board.id !== boardId) {\n this.board = { id: boardId }\n }\n\n return html`\n <ox-board-viewer\n style=\"background-color: white;\"\n .board=${this.board}\n .provider=${provider}\n .values=${{ ...input, ...output }}\n hide-fullscreen\n hide-navigation\n ></ox-board-viewer>\n `\n }\n\n @query('ox-board-viewer') boardViewer: any\n\n getOutputFromBoard() {\n const outputSpec = this.getOutputSpec()\n const data = this.boardViewer.getSceneValues()\n\n return outputSpec.reduce((output, spec) => {\n output[spec.name] = data[spec.name]\n return output\n }, {})\n }\n\n updated(changes) {\n if (changes.has('activityInstance')) {\n this.updateContext()\n }\n }\n\n async pageUpdated(changes, lifecycle, changedBefore) {\n if (this.active) {\n this.fetchActivityInstance(lifecycle.resourceId)\n }\n }\n\n async fetchActivityInstance(id) {\n this.lastId = id\n this.loadError = null\n\n try {\n const response = await client.query({\n query: gql`\n query activityInstance($id: String!) {\n activityInstance(id: $id) {\n id\n name\n description\n state\n activity {\n model {\n name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n }\n }\n `,\n variables: { id }\n })\n\n if (response.errors?.length || !response.data?.activityInstance) {\n throw (\n response.errors?.[0] || new Error(i18next.t('error.activity-instance not found', { activityInstance: id }))\n )\n }\n\n this.activityInstance = response.data.activityInstance\n this.loaded = true\n } catch (error) {\n this.loadError = error\n }\n }\n\n async _startActivityInstance() {\n var { id, output, reason, uiType } = this.activityInstance\n if (uiType === 'board') {\n output = this.getOutputFromBoard()\n }\n\n const outcome = await ranMutation(() =>\n client.mutate({\n mutation: gql`\n mutation ($id: String!, $output: Object) {\n startActivityInstance(id: $id, output: $output) {\n name\n }\n }\n `,\n variables: { id, output }\n })\n )\n\n if (!outcome.ok) {\n return\n }\n\n await this.fetchActivityInstance(this.activityInstance.id)\n\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_started_successfully') } })\n )\n }\n\n async _saveActivityInstance() {\n var { id, output, reason, uiType } = this.activityInstance\n if (uiType === 'board') {\n output = this.getOutputFromBoard()\n }\n\n const outcome = await ranMutation(() =>\n client.mutate({\n mutation: gql`\n mutation ($id: String!, $save: ActivityInstanceSave!) {\n draftActivityInstance(id: $id, save: $save) {\n id\n name\n description\n state\n activity {\n model {\n name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n }\n }\n `,\n variables: { id, save: { output } }\n })\n )\n\n if (!outcome.ok) {\n return\n }\n\n this.activityInstance = outcome.data.saveActivityInstance\n\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_saved_successfully') } })\n )\n }\n\n async _endActivityInstance() {\n var { id, output, reason, uiType } = this.activityInstance\n if (uiType === 'board') {\n output = this.getOutputFromBoard()\n }\n\n const outcome = await ranMutation(() =>\n client.mutate({\n mutation: gql`\n mutation ($id: String!, $output: Object, $reason: String) {\n endActivityInstance(id: $id, output: $output, reason: $reason) {\n id\n name\n description\n state\n activity {\n model {\n name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n }\n }\n `,\n variables: { id, output, reason }\n })\n )\n\n if (!outcome.ok) {\n return\n }\n\n this.activityInstance = outcome.data.endActivityInstance\n\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_finished_successfully') } })\n )\n }\n}\n"]}
@@ -10,24 +10,19 @@ import { client } from '@operato/graphql';
10
10
  import { i18next, localize } from '@operato/i18n';
11
11
  import { openPopup } from '@operato/layout';
12
12
  import { DataGrist } from '@operato/data-grist';
13
- import { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles';
13
+ import { CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
14
14
  import { ActivityStartingTypes } from '../../types/types.js';
15
15
  let StarterListPage = class StarterListPage extends localize(i18next)(PageView) {
16
16
  static { this.styles = [
17
+ /* The work surface frame for a list screen (ADR-0060 decision 8). */
18
+ WorkSurfacePageStyles,
17
19
  ScrollbarStyles,
18
20
  CommonHeaderStyles,
19
21
  css `
20
- :host { display: flex;
21
-
22
- width: 100%;
23
-
22
+ :host {
24
23
  --grid-record-emphasized-background-color: #8b0000;
25
24
  --grid-record-emphasized-color: #ff6b6b;
26
- }
27
-
28
- ox-grist { flex: 1;
29
- overflow-y: auto;
30
- }
25
+ }
31
26
  `
32
27
  ]; }
33
28
  get context() {
@@ -44,7 +39,7 @@ let StarterListPage = class StarterListPage extends localize(i18next)(PageView)
44
39
  }
45
40
  render() {
46
41
  return html `
47
- <ox-grist mode="CARD" .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}> </ox-grist>
42
+ <ox-grist class="page-fill" mode="CARD" .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}> </ox-grist>
48
43
  `;
49
44
  }
50
45
  async pageInitialized(lifecycle) {
@@ -1 +1 @@
1
- {"version":3,"file":"starter-list-page.js","sourceRoot":"","sources":["../../../client/pages/activity/starter-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,2CAA2C,CAAA;AAClD,OAAO,2CAA2C,CAAA;AAElD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAe,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAErE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAGrD,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;aAAY,WAAM,GAAG;QACjF,eAAe;QACf,kBAAk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D,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;SAChD,CAAA;IACD,CAAC;;AArH4B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAkB;AAE1B;IAAlB,KAAK,CAAC,UAAU,CAAC;8BAAS,SAAS;8CAAA;AAE3B;IAAR,KAAK,EAAE;;gDAAmB;AAlChB,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAoJ3B","sourcesContent":["import '@operato/data-grist'\nimport '@operato/input/ox-input-select-buttons.js'\nimport '../../components/activity-starter-form.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { PageView } from '@operato/shell'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { openPopup } from '@operato/layout'\nimport { FetchOption, DataGrist } from '@operato/data-grist'\nimport { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\n\nimport { ActivityStartingTypes } from '../../types/types.js'\n\n@customElement('starter-list-page')\nexport class StarterListPage extends localize(i18next)(PageView) { static styles = [\n ScrollbarStyles,\n CommonHeaderStyles,\n css`\n :host { display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n\n ox-grist { flex: 1;\n overflow-y: auto;\n }\n `\n ]\n\n get context() { return { title: i18next.t('title.activity starter list'),\n search: { handler: (search: string) => { this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: { handler: () => { this.grist.toggleHeadroom()\n }\n },\n help: 'worklist/starter-list'\n }\n }\n\n @property({ type: Object }) gristConfig?: any\n\n @query('ox-grist') grist!: DataGrist\n\n @state() filters?: string[]\n\n render() { return html`\n <ox-grist mode=\"CARD\" .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}> </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle) { this.gristConfig = { list: { thumbnail: 'thumbnail',\n fields: ['name', 'description'],\n details: ['updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter',\n gutterName: 'button',\n icon: 'rocket_launch',\n iconOnly: false,\n title: i18next.t('button.start'),\n width: 72\n },\n { type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n filter: 'search',\n sortable: true,\n width: 375\n },\n { type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n filter: 'search',\n width: 400\n },\n { type: 'select',\n name: 'startingType',\n label: true,\n header: i18next.t('field.starting-type'),\n record: { editable: false,\n options: ActivityStartingTypes\n },\n sortable: true,\n width: 90\n },\n { type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n sortable: true,\n width: 90\n },\n { type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n sortable: true,\n width: 180\n },\n { type: 'image',\n name: 'thumbnail',\n header: i18next.t('field.thumbnail'),\n record: { editable: false },\n hidden: true\n }\n ],\n rows: { appendable: false,\n handlers: { click: (columns, data, column, record, rowIndex) => { if (!record.id) { return\n }\n\n const popup = openPopup(html` <activity-starter-form .activityId=${record.id}></activity-starter-form> `, { backdrop: true,\n help: 'worklist/activity-starter-form',\n size: 'large',\n title: i18next.t(record.startingType == 'issue' ? 'title.activity starter' : 'title.activity application')\n })\n popup.onclosed = () => { this.grist?.fetch()\n }\n }\n }\n },\n sorters: [\n { name: 'name'\n }\n ]\n }\n }\n\n async pageUpdated(changes, lifecycle, changedBefore) { if (this.active) { this.grist?.fetch()\n }\n }\n\n async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) { const response = await client.query({ query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: startableActivities(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id\n name\n description\n activityType\n priority\n thumbnail\n startingType\n updater { id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: { filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return { total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n}\n"]}
1
+ {"version":3,"file":"starter-list-page.js","sourceRoot":"","sources":["../../../client/pages/activity/starter-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,2CAA2C,CAAA;AAClD,OAAO,2CAA2C,CAAA;AAElD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAe,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAE5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAGrD,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;aAAY,WAAM,GAAG;QACjF,qEAAqE;QACrE,qBAAqB;QACrB,eAAe;QACf,kBAAkB;QAClB,GAAG,CAAA;;;;;KAKF;KACF,AAX+E,CAW/E;IAED,IAAI,OAAO;QAAS,OAAO,EAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,6BAA6B,CAAC;YAC9E,MAAM,EAAE,EAAU,OAAO,EAAE,CAAC,MAAc,EAAE,EAAE;oBAAa,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,M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gDAAmB;AA7BhB,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CA+I3B","sourcesContent":["import '@operato/data-grist'\nimport '@operato/input/ox-input-select-buttons.js'\nimport '../../components/activity-starter-form.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { PageView } from '@operato/shell'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { openPopup } from '@operato/layout'\nimport { FetchOption, DataGrist } from '@operato/data-grist'\nimport { CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\n\nimport { ActivityStartingTypes } from '../../types/types.js'\n\n@customElement('starter-list-page')\nexport class StarterListPage extends localize(i18next)(PageView) { static styles = [\n /* The work surface frame for a list screen (ADR-0060 decision 8). */\n WorkSurfacePageStyles,\n ScrollbarStyles,\n CommonHeaderStyles,\n css`\n :host {\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n `\n ]\n\n get context() { return { title: i18next.t('title.activity starter list'),\n search: { handler: (search: string) => { this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: { handler: () => { this.grist.toggleHeadroom()\n }\n },\n help: 'worklist/starter-list'\n }\n }\n\n @property({ type: Object }) gristConfig?: any\n\n @query('ox-grist') grist!: DataGrist\n\n @state() filters?: string[]\n\n render() { return html`\n <ox-grist class=\"page-fill\" mode=\"CARD\" .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}> </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle) { this.gristConfig = { list: { thumbnail: 'thumbnail',\n fields: ['name', 'description'],\n details: ['updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter',\n gutterName: 'button',\n icon: 'rocket_launch',\n iconOnly: false,\n title: i18next.t('button.start'),\n width: 72\n },\n { type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n filter: 'search',\n sortable: true,\n width: 375\n },\n { type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n filter: 'search',\n width: 400\n },\n { type: 'select',\n name: 'startingType',\n label: true,\n header: i18next.t('field.starting-type'),\n record: { editable: false,\n options: ActivityStartingTypes\n },\n sortable: true,\n width: 90\n },\n { type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n sortable: true,\n width: 90\n },\n { type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n sortable: true,\n width: 180\n },\n { type: 'image',\n name: 'thumbnail',\n header: i18next.t('field.thumbnail'),\n record: { editable: false },\n hidden: true\n }\n ],\n rows: { appendable: false,\n handlers: { click: (columns, data, column, record, rowIndex) => { if (!record.id) { return\n }\n\n const popup = openPopup(html` <activity-starter-form .activityId=${record.id}></activity-starter-form> `, { backdrop: true,\n help: 'worklist/activity-starter-form',\n size: 'large',\n title: i18next.t(record.startingType == 'issue' ? 'title.activity starter' : 'title.activity application')\n })\n popup.onclosed = () => { this.grist?.fetch()\n }\n }\n }\n },\n sorters: [\n { name: 'name'\n }\n ]\n }\n }\n\n async pageUpdated(changes, lifecycle, changedBefore) { if (this.active) { this.grist?.fetch()\n }\n }\n\n async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) { const response = await client.query({ query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: startableActivities(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id\n name\n description\n activityType\n priority\n thumbnail\n startingType\n updater { id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: { filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return { total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n}\n"]}