@things-factory/worklist 10.1.27 → 10.1.29

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 (69) hide show
  1. package/approval-walk/harness.mjs +255 -0
  2. package/dist-client/pages/activity/activity-list-page.js +6 -11
  3. package/dist-client/pages/activity/activity-list-page.js.map +1 -1
  4. package/dist-client/pages/activity/activity-page.d.ts +6 -0
  5. package/dist-client/pages/activity/activity-page.js +173 -142
  6. package/dist-client/pages/activity/activity-page.js.map +1 -1
  7. package/dist-client/pages/activity/starter-list-page.js +6 -11
  8. package/dist-client/pages/activity/starter-list-page.js.map +1 -1
  9. package/dist-client/pages/activity-approval/activity-approval-list-page.js +6 -11
  10. package/dist-client/pages/activity-approval/activity-approval-list-page.js.map +1 -1
  11. package/dist-client/pages/activity-approval/activity-approval-page.d.ts +21 -4
  12. package/dist-client/pages/activity-approval/activity-approval-page.js +256 -173
  13. package/dist-client/pages/activity-approval/activity-approval-page.js.map +1 -1
  14. package/dist-client/pages/activity-catalog/activity-catalog-page.d.ts +6 -0
  15. package/dist-client/pages/activity-catalog/activity-catalog-page.js +43 -32
  16. package/dist-client/pages/activity-catalog/activity-catalog-page.js.map +1 -1
  17. package/dist-client/pages/activity-instance/activity-instance-list-page.js +79 -105
  18. package/dist-client/pages/activity-instance/activity-instance-list-page.js.map +1 -1
  19. package/dist-client/pages/activity-instance/activity-instance-search-page.js +3 -6
  20. package/dist-client/pages/activity-instance/activity-instance-search-page.js.map +1 -1
  21. package/dist-client/pages/activity-instance/activity-instance-start-page.d.ts +6 -0
  22. package/dist-client/pages/activity-instance/activity-instance-start-page.js +220 -161
  23. package/dist-client/pages/activity-instance/activity-instance-start-page.js.map +1 -1
  24. package/dist-client/pages/activity-stats/activity-stats-list-page.js +6 -11
  25. package/dist-client/pages/activity-stats/activity-stats-list-page.js.map +1 -1
  26. package/dist-client/pages/activity-store/activity-store-page.js +4 -11
  27. package/dist-client/pages/activity-store/activity-store-page.js.map +1 -1
  28. package/dist-client/pages/activity-supervisor/reporter-list-page.js +6 -11
  29. package/dist-client/pages/activity-supervisor/reporter-list-page.js.map +1 -1
  30. package/dist-client/pages/activity-template/activity-template-list-page.js +6 -11
  31. package/dist-client/pages/activity-template/activity-template-list-page.js.map +1 -1
  32. package/dist-client/pages/activity-thread/activity-thread-list-page.js +6 -11
  33. package/dist-client/pages/activity-thread/activity-thread-list-page.js.map +1 -1
  34. package/dist-client/pages/activity-thread/activity-thread-page.d.ts +7 -2
  35. package/dist-client/pages/activity-thread/activity-thread-page.js +101 -82
  36. package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
  37. package/dist-client/pages/activity-thread/activity-thread-view-page.d.ts +7 -2
  38. package/dist-client/pages/activity-thread/activity-thread-view-page.js +58 -23
  39. package/dist-client/pages/activity-thread/activity-thread-view-page.js.map +1 -1
  40. package/dist-client/pages/installable-activity/installable-activity-list-page.js +6 -11
  41. package/dist-client/pages/installable-activity/installable-activity-list-page.js.map +1 -1
  42. package/dist-client/pages/todo/approval-done-list-page.js +6 -11
  43. package/dist-client/pages/todo/approval-done-list-page.js.map +1 -1
  44. package/dist-client/pages/todo/approval-pending-list-page.js +4 -12
  45. package/dist-client/pages/todo/approval-pending-list-page.js.map +1 -1
  46. package/dist-client/pages/todo/done-list-calendar-page.js +4 -5
  47. package/dist-client/pages/todo/done-list-calendar-page.js.map +1 -1
  48. package/dist-client/pages/todo/done-list-page.js +6 -11
  49. package/dist-client/pages/todo/done-list-page.js.map +1 -1
  50. package/dist-client/pages/todo/draft-list-page.js +6 -11
  51. package/dist-client/pages/todo/draft-list-page.js.map +1 -1
  52. package/dist-client/pages/todo/pickable-list-page.js +6 -11
  53. package/dist-client/pages/todo/pickable-list-page.js.map +1 -1
  54. package/dist-client/pages/todo/todo-list-page.js +4 -11
  55. package/dist-client/pages/todo/todo-list-page.js.map +1 -1
  56. package/dist-client/tsconfig.tsbuildinfo +1 -1
  57. package/dist-server/service/activity/decision-key-declaration.d.ts +11 -2
  58. package/dist-server/service/activity/decision-key-declaration.js +22 -1
  59. package/dist-server/service/activity/decision-key-declaration.js.map +1 -1
  60. package/dist-server/service/installable-activity/installable-activity-query.d.ts +11 -0
  61. package/dist-server/service/installable-activity/installable-activity-query.js +31 -0
  62. package/dist-server/service/installable-activity/installable-activity-query.js.map +1 -1
  63. package/dist-server/tsconfig.tsbuildinfo +1 -1
  64. package/package.json +10 -11
  65. package/translations/en.json +27 -14
  66. package/translations/ja.json +27 -14
  67. package/translations/ko.json +27 -14
  68. package/translations/ms.json +27 -14
  69. package/translations/zh.json +27 -14
@@ -1,15 +1,16 @@
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';
11
12
  import { PageView } from '@operato/shell';
12
- import { CommonButtonStyles, ScrollbarStyles } from '@operato/styles';
13
+ import { CommonButtonStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
13
14
  import { provider } from '@operato/board/board-provider.js';
14
15
  function getSafeFormatter(locale, options) {
15
16
  try {
@@ -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,51 @@ 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 = [
43
+ /*
44
+ * The frame owns the page shell; the task's content is what it sizes (ADR-0060 decision 8).
45
+ * `ox-board-viewer` asks for `height: 100%`, which only means something inside a box whose own
46
+ * height is settled - the frame settles it.
47
+ */
48
+ WorkSurfacePageStyles,
36
49
  ScrollbarStyles,
37
50
  css `
38
- :host { display: flex;
39
- flex-direction: column;
40
-
41
- width: 100%;
42
- padding: 5px;
43
- overflow: auto;
44
- }
45
-
46
- [header] { display: block;
47
- padding: 5px;
48
- }
49
-
50
- [content] { flex: 1;
51
+ [content] {
51
52
  display: block;
52
53
  padding: 5px;
53
- }
54
+ }
54
55
 
55
- ox-board-viewer { width: 100%;
56
+ ox-board-viewer {
57
+ width: 100%;
56
58
  height: 100%;
57
- }
59
+ }
58
60
  `
59
61
  ]; }
60
62
  get context() {
61
63
  const startable = [ActivityInstanceStatus.Assigned, ActivityInstanceStatus.Issued].includes(this.activityInstance?.state);
62
64
  const finishable = [ActivityInstanceStatus.Started].includes(this.activityInstance?.state);
63
65
  const savable = finishable;
64
- return { title: this.lifecycle?.params?.['title'] || i18next.t('title.activity'),
66
+ return {
67
+ title: this.lifecycle?.params?.['title'] || i18next.t('title.activity'),
65
68
  help: 'worklist/activity',
66
69
  actions: [
67
- startable && { title: i18next.t('button.play'),
70
+ startable && {
71
+ title: i18next.t('button.play'),
68
72
  action: this._startActivityInstance.bind(this),
69
73
  ...CommonButtonStyles.play
70
74
  },
71
- savable && { title: i18next.t('button.save'),
75
+ savable && {
76
+ title: i18next.t('button.save'),
72
77
  action: this._saveActivityInstance.bind(this),
73
78
  ...CommonButtonStyles.save
74
79
  },
75
- finishable && { title: i18next.t('button.finish'),
80
+ finishable && {
81
+ title: i18next.t('button.finish'),
76
82
  action: this._endActivityInstance.bind(this),
77
83
  ...CommonButtonStyles.save
78
84
  }
@@ -80,9 +86,21 @@ let ActivityPage = class ActivityPage extends localize(i18next)(PageView) {
80
86
  };
81
87
  }
82
88
  render() {
89
+ /*
90
+ * Reading and failing both drew the same empty header, so a task that could not be read looked
91
+ * like a task with nothing in it (ADR-0060 decision 8).
92
+ */
93
+ return html `<ox-page-state
94
+ .loading=${!this.loaded && !this.loadError}
95
+ .error=${this.loadError}
96
+ @retry=${() => this.lastId && this.fetchActivityInstance(this.lastId)}
97
+ >${this.renderActivity()}</ox-page-state
98
+ >`;
99
+ }
100
+ renderActivity() {
83
101
  const { name, description, state, thumbnail, dueAt, createdAt } = this.activityInstance || {};
84
102
  return html `
85
- <div header>
103
+ <div header class="page-headroom">
86
104
  <div>name: ${name}</div>
87
105
  <div>description: ${description}</div>
88
106
  <div>state: ${state}</div>
@@ -91,7 +109,7 @@ let ActivityPage = class ActivityPage extends localize(i18next)(PageView) {
91
109
  <img src=${thumbnail} />
92
110
  </div>
93
111
 
94
- <div content>${this.activityContent()}</div>
112
+ <div content class="page-fill">${this.activityContent()}</div>
95
113
  `;
96
114
  }
97
115
  activityContent() {
@@ -117,11 +135,7 @@ let ActivityPage = class ActivityPage extends localize(i18next)(PageView) {
117
135
  return (model || [])
118
136
  .filter(item => item.inout === 'in' || item.inout === 'inout')
119
137
  .map(item => {
120
- return { ...item,
121
- name: item.tag,
122
- label: item.tKey || item.name,
123
- property: item.options
124
- };
138
+ return { ...item, name: item.tag, label: item.tKey || item.name, property: item.options };
125
139
  });
126
140
  }
127
141
  getOutputSpec() {
@@ -129,11 +143,7 @@ let ActivityPage = class ActivityPage extends localize(i18next)(PageView) {
129
143
  return (model || [])
130
144
  .filter(item => item.inout === 'inout' || item.inout === 'out')
131
145
  .map(item => {
132
- return { ...item,
133
- name: item.tag,
134
- label: item.tKey || item.name,
135
- property: item.options
136
- };
146
+ return { ...item, name: item.tag, label: item.tKey || item.name, property: item.options };
137
147
  });
138
148
  }
139
149
  generatedContent() {
@@ -168,8 +178,7 @@ let ActivityPage = class ActivityPage extends localize(i18next)(PageView) {
168
178
  boardContent() {
169
179
  const { uiSource: boardId, input, output } = this.activityInstance;
170
180
  if (!this.board || this.board.id !== boardId) {
171
- this.board = { id: boardId
172
- };
181
+ this.board = { id: boardId };
173
182
  }
174
183
  return html `
175
184
  <ox-board-viewer
@@ -201,149 +210,163 @@ let ActivityPage = class ActivityPage extends localize(i18next)(PageView) {
201
210
  }
202
211
  }
203
212
  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
213
+ this.lastId = id;
214
+ this.loadError = null;
215
+ try {
216
+ const response = await client.query({
217
+ query: gql `
218
+ query activityInstance($id: String!) {
219
+ activityInstance(id: $id) {
220
+ id
221
+ name
222
+ description
223
+ state
224
+ activity {
225
+ model {
226
+ name
227
+ description
228
+ active
229
+ tag
230
+ inout
231
+ type
232
+ unit
233
+ options
234
+ quantifier
235
+ spec
236
+ }
237
+ }
238
+ thumbnail
239
+ input
240
+ output
241
+ uiType
242
+ uiSource
243
+ dueAt
244
+ createdAt
232
245
  }
233
- });
234
- this.activityInstance = response.data.activityInstance;
246
+ }
247
+ `,
248
+ variables: { id }
249
+ });
250
+ if (response.errors?.length || !response.data?.activityInstance) {
251
+ throw (response.errors?.[0] || new Error(i18next.t('error.activity-instance not found', { activityInstance: id })));
252
+ }
253
+ this.activityInstance = response.data.activityInstance;
254
+ this.loaded = true;
255
+ }
256
+ catch (error) {
257
+ this.loadError = error;
258
+ }
235
259
  }
236
260
  async _startActivityInstance() {
237
261
  var { id, output, reason, uiType } = this.activityInstance;
238
262
  if (uiType === 'board') {
239
263
  output = this.getOutputFromBoard();
240
264
  }
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
265
+ const outcome = await ranMutation(() => client.mutate({
266
+ mutation: gql `
267
+ mutation ($id: String!, $output: Object) {
268
+ startActivityInstance(id: $id, output: $output) {
269
+ name
248
270
  }
271
+ }
272
+ `,
273
+ variables: { id, output }
249
274
  }));
250
275
  if (!outcome.ok) {
251
276
  return;
252
277
  }
253
278
  await this.fetchActivityInstance(this.activityInstance.id);
254
- document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_started_successfully')
255
- }
256
- }));
279
+ document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_started_successfully') } }));
257
280
  }
258
281
  async _saveActivityInstance() {
259
282
  var { id, output, reason, uiType } = this.activityInstance;
260
283
  if (uiType === 'board') {
261
284
  output = this.getOutputFromBoard();
262
285
  }
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
286
+ const outcome = await ranMutation(() => client.mutate({
287
+ mutation: gql `
288
+ mutation ($id: String!, $save: ActivityInstanceSave!) {
289
+ draftActivityInstance(id: $id, save: $save) {
290
+ id
291
+ name
292
+ description
293
+ state
294
+ activity {
295
+ model {
296
+ name
297
+ description
298
+ active
299
+ tag
300
+ inout
301
+ type
302
+ unit
303
+ options
304
+ quantifier
305
+ spec
292
306
  }
307
+ }
308
+ thumbnail
309
+ input
310
+ output
311
+ uiType
312
+ uiSource
313
+ dueAt
314
+ createdAt
293
315
  }
316
+ }
317
+ `,
318
+ variables: { id, save: { output } }
294
319
  }));
295
320
  if (!outcome.ok) {
296
321
  return;
297
322
  }
298
323
  this.activityInstance = outcome.data.saveActivityInstance;
299
- document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_saved_successfully')
300
- }
301
- }));
324
+ document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_saved_successfully') } }));
302
325
  }
303
326
  async _endActivityInstance() {
304
327
  var { id, output, reason, uiType } = this.activityInstance;
305
328
  if (uiType === 'board') {
306
329
  output = this.getOutputFromBoard();
307
330
  }
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
331
+ const outcome = await ranMutation(() => client.mutate({
332
+ mutation: gql `
333
+ mutation ($id: String!, $output: Object, $reason: String) {
334
+ endActivityInstance(id: $id, output: $output, reason: $reason) {
335
+ id
336
+ name
337
+ description
338
+ state
339
+ activity {
340
+ model {
341
+ name
342
+ description
343
+ active
344
+ tag
345
+ inout
346
+ type
347
+ unit
348
+ options
349
+ quantifier
350
+ spec
351
+ }
352
+ }
353
+ thumbnail
354
+ input
355
+ output
356
+ uiType
357
+ uiSource
358
+ dueAt
359
+ createdAt
338
360
  }
361
+ }
362
+ `,
363
+ variables: { id, output, reason }
339
364
  }));
340
365
  if (!outcome.ok) {
341
366
  return;
342
367
  }
343
368
  this.activityInstance = outcome.data.endActivityInstance;
344
- document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_finished_successfully')
345
- }
346
- }));
369
+ document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_finished_successfully') } }));
347
370
  }
348
371
  };
349
372
  __decorate([
@@ -354,6 +377,14 @@ __decorate([
354
377
  property({ type: Object }),
355
378
  __metadata("design:type", Object)
356
379
  ], ActivityPage.prototype, "board", void 0);
380
+ __decorate([
381
+ state(),
382
+ __metadata("design:type", Object)
383
+ ], ActivityPage.prototype, "loaded", void 0);
384
+ __decorate([
385
+ state(),
386
+ __metadata("design:type", Object)
387
+ ], ActivityPage.prototype, "loadError", void 0);
357
388
  __decorate([
358
389
  query('ox-board-viewer'),
359
390
  __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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,CAAC;;sDAAsB;AACrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CAAW;AAsIZ;IAAzB,KAAK,CAAC,iBAAiB,CAAC;;iDAAiB;AAjK/B,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAgVxB","sourcesContent":["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,s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AC,EAAE,EAAE,CAAC;YAChB,OAAM;QACR,CAAC;QAED,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAA;QAExD,QAAQ,CAAC,aAAa,CACpB,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,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;AAzL/B,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CA+YxB","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, WorkSurfacePageStyles } 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 /*\n * The frame owns the page shell; the task's content is what it sizes (ADR-0060 decision 8).\n * `ox-board-viewer` asks for `height: 100%`, which only means something inside a box whose own\n * height is settled - the frame settles it.\n */\n WorkSurfacePageStyles,\n ScrollbarStyles,\n css`\n [content] {\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 class=\"page-headroom\">\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 class=\"page-fill\">${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;AAC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AG,MAAM,MAAM,CAAC,KAAK,CAAC,EAAQ,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;OAgBrI;YACD,SAAS,EAAE,EAAU,OAAO;gBAC1B,UAAU,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;gBAC3B,QAAQ;aACd;SACA,CAAC,CAAA;QAEC,OAAO,EAAQ,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;YACtD,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,GA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IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;YACtD,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;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"]}