@things-factory/worklist 6.0.25 → 6.0.27

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 (85) hide show
  1. package/client/bootstrap.ts +38 -0
  2. package/client/components/activity-starter-form.ts +6 -0
  3. package/client/pages/activity-approval/activity-approval-page.ts +58 -56
  4. package/client/pages/activity-instance/activity-instance-page.ts +18 -0
  5. package/client/pages/activity-thread/activity-thread-page.ts +29 -47
  6. package/client/pages/installable-activity/installable-activity-list-page.ts +3 -13
  7. package/client/pages/todo/draft-list-page.ts +6 -3
  8. package/client/templates/activity-approval-context-template.ts +67 -0
  9. package/client/templates/activity-thread-context-template.ts +62 -0
  10. package/client/types.js +1 -0
  11. package/dist-client/bootstrap.d.ts +3 -0
  12. package/dist-client/bootstrap.js +36 -0
  13. package/dist-client/bootstrap.js.map +1 -1
  14. package/dist-client/components/activity-starter-form.js +6 -0
  15. package/dist-client/components/activity-starter-form.js.map +1 -1
  16. package/dist-client/pages/activity-approval/activity-approval-page.d.ts +3 -2
  17. package/dist-client/pages/activity-approval/activity-approval-page.js +55 -54
  18. package/dist-client/pages/activity-approval/activity-approval-page.js.map +1 -1
  19. package/dist-client/pages/activity-instance/activity-instance-page.d.ts +2 -1
  20. package/dist-client/pages/activity-instance/activity-instance-page.js +15 -0
  21. package/dist-client/pages/activity-instance/activity-instance-page.js.map +1 -1
  22. package/dist-client/pages/activity-thread/activity-thread-page.d.ts +3 -2
  23. package/dist-client/pages/activity-thread/activity-thread-page.js +25 -45
  24. package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
  25. package/dist-client/pages/installable-activity/installable-activity-list-page.js +3 -13
  26. package/dist-client/pages/installable-activity/installable-activity-list-page.js.map +1 -1
  27. package/dist-client/pages/todo/draft-list-page.d.ts +4 -8
  28. package/dist-client/pages/todo/draft-list-page.js +4 -1
  29. package/dist-client/pages/todo/draft-list-page.js.map +1 -1
  30. package/dist-client/route.d.ts +1 -1
  31. package/dist-client/templates/activity-approval-context-template.d.ts +2 -0
  32. package/dist-client/templates/activity-approval-context-template.js +62 -0
  33. package/dist-client/templates/activity-approval-context-template.js.map +1 -0
  34. package/dist-client/templates/activity-thread-context-template.d.ts +2 -0
  35. package/dist-client/templates/activity-thread-context-template.js +57 -0
  36. package/dist-client/templates/activity-thread-context-template.js.map +1 -0
  37. package/dist-client/tsconfig.tsbuildinfo +1 -1
  38. package/dist-client/types.js +1 -0
  39. package/dist-client/types.js.map +1 -1
  40. package/dist-server/controllers/activity-approval/approve.js +1 -1
  41. package/dist-server/controllers/activity-approval/approve.js.map +1 -1
  42. package/dist-server/controllers/activity-instance/draft.js +16 -0
  43. package/dist-server/controllers/activity-instance/draft.js.map +1 -1
  44. package/dist-server/controllers/activity-instance/post.js +2 -2
  45. package/dist-server/controllers/activity-instance/post.js.map +1 -1
  46. package/dist-server/controllers/activity-thread/submit.js +1 -1
  47. package/dist-server/controllers/activity-thread/submit.js.map +1 -1
  48. package/dist-server/controllers/common.js +45 -36
  49. package/dist-server/controllers/common.js.map +1 -1
  50. package/dist-server/service/activity/activity.js +2 -1
  51. package/dist-server/service/activity/activity.js.map +1 -1
  52. package/dist-server/service/activity-instance/activity-instance-query.js +41 -0
  53. package/dist-server/service/activity-instance/activity-instance-query.js.map +1 -1
  54. package/dist-server/tsconfig.tsbuildinfo +1 -1
  55. package/package.json +8 -7
  56. package/server/controllers/activity-approval/approve.ts +2 -2
  57. package/server/controllers/activity-instance/draft.ts +18 -0
  58. package/server/controllers/activity-instance/post.ts +3 -3
  59. package/server/controllers/activity-thread/submit.ts +2 -2
  60. package/server/controllers/common.ts +52 -32
  61. package/server/service/activity/activity.ts +2 -1
  62. package/server/service/activity-instance/activity-instance-query.ts +44 -0
  63. package/things-factory.config.js +1 -4
  64. package/translations/en.json +2 -0
  65. package/translations/ko.json +2 -0
  66. package/translations/ms.json +2 -0
  67. package/translations/zh.json +2 -0
  68. package/dist-client/pages/installed-activity/installed-activity-list-page.d.ts +0 -45
  69. package/dist-client/pages/installed-activity/installed-activity-list-page.js +0 -412
  70. package/dist-client/pages/installed-activity/installed-activity-list-page.js.map +0 -1
  71. package/dist-client/pages/installed-activity/installed-activity-model-item-list.d.ts +0 -1
  72. package/dist-client/pages/installed-activity/installed-activity-model-item-list.js +0 -20
  73. package/dist-client/pages/installed-activity/installed-activity-model-item-list.js.map +0 -1
  74. package/dist-server/controllers/activity-extension-controller.js +0 -11
  75. package/dist-server/controllers/activity-extension-controller.js.map +0 -1
  76. package/dist-server/service/installed-activity/index.js +0 -10
  77. package/dist-server/service/installed-activity/index.js.map +0 -1
  78. package/dist-server/service/installed-activity/installed-activity-mutation.js +0 -60
  79. package/dist-server/service/installed-activity/installed-activity-mutation.js.map +0 -1
  80. package/dist-server/service/installed-activity/installed-activity-query.js +0 -48
  81. package/dist-server/service/installed-activity/installed-activity-query.js.map +0 -1
  82. package/dist-server/service/installed-activity/installed-activity-type.js +0 -21
  83. package/dist-server/service/installed-activity/installed-activity-type.js.map +0 -1
  84. package/dist-server/service/installed-activity/installed-activity.js +0 -70
  85. package/dist-server/service/installed-activity/installed-activity.js.map +0 -1
@@ -1,3 +1,12 @@
1
+ import '@material/mwc-icon'
2
+ import './templates/activity-approval-context-template.js'
3
+ import './templates/activity-thread-context-template.js'
4
+
5
+ import { html } from 'lit-html'
6
+ import { store } from '@operato/shell'
7
+ import { openOverlay, TOOL_POSITION } from '@operato/layout'
8
+ import { APPEND_CONTEXT_TOOL } from '@things-factory/context-ui'
9
+
1
10
  import { registerEditor as registerGristEditor, registerRenderer as registerGristRenderer } from '@operato/data-grist'
2
11
  import { OxGristEditorDuration } from '@operato/grist-editor/ox-grist-editor-duration.js'
3
12
  import { OxGristEditorQuantifier } from '@operato/grist-editor/ox-grist-editor-quantifier.js'
@@ -5,6 +14,35 @@ import { OxGristRendererDuration } from '@operato/grist-editor/ox-grist-renderer
5
14
  import { OxGristRendererQuantifier } from '@operato/grist-editor/ox-grist-renderer-quantifier.js'
6
15
 
7
16
  export default function bootstrap() {
17
+ ;[
18
+ {
19
+ template: html` <activity-approval-context-template></activity-approval-context-template> `,
20
+ context: 'activityApproval'
21
+ },
22
+ {
23
+ template: html` <activity-thread-context-template></activity-thread-context-template> `,
24
+ context: 'activityThread'
25
+ }
26
+ ].forEach(({ template, context }) => {
27
+ store.dispatch({
28
+ type: APPEND_CONTEXT_TOOL,
29
+ tool: {
30
+ position: TOOL_POSITION.FRONT,
31
+ template: html`
32
+ <mwc-icon
33
+ @click=${async e => {
34
+ openOverlay('context-toolbar-overlay', {
35
+ template
36
+ })
37
+ }}
38
+ >info</mwc-icon
39
+ >
40
+ `,
41
+ context
42
+ }
43
+ })
44
+ })
45
+
8
46
  registerGristEditor('duration', OxGristEditorDuration)
9
47
  registerGristRenderer('duration', OxGristRendererDuration)
10
48
  registerGristEditor('quantifier', OxGristEditorQuantifier)
@@ -247,6 +247,7 @@ export class ActivityStarterForm extends localize(i18next)(LitElement) {
247
247
  state
248
248
  assignees {
249
249
  type
250
+ value
250
251
  assignee {
251
252
  id
252
253
  name
@@ -256,6 +257,7 @@ export class ActivityStarterForm extends localize(i18next)(LitElement) {
256
257
  }
257
258
  approvalLine {
258
259
  type
260
+ value
259
261
  approver {
260
262
  id
261
263
  name
@@ -316,6 +318,7 @@ export class ActivityStarterForm extends localize(i18next)(LitElement) {
316
318
  state
317
319
  assignees {
318
320
  type
321
+ value
319
322
  assignee {
320
323
  id
321
324
  name
@@ -325,6 +328,7 @@ export class ActivityStarterForm extends localize(i18next)(LitElement) {
325
328
  }
326
329
  approvalLine {
327
330
  type
331
+ value
328
332
  approver {
329
333
  id
330
334
  name
@@ -387,6 +391,7 @@ export class ActivityStarterForm extends localize(i18next)(LitElement) {
387
391
  state
388
392
  assignees {
389
393
  type
394
+ value
390
395
  assignee {
391
396
  id
392
397
  name
@@ -396,6 +401,7 @@ export class ActivityStarterForm extends localize(i18next)(LitElement) {
396
401
  }
397
402
  approvalLine {
398
403
  type
404
+ value
399
405
  approver {
400
406
  id
401
407
  name
@@ -1,11 +1,10 @@
1
1
  import '@operato/property-editor/ox-properties-dynamic-view.js'
2
2
  import '@operato/board/ox-board-viewer.js'
3
- import '@things-factory/organization'
4
3
 
5
4
  import gql from 'graphql-tag'
6
5
  import { css, html } from 'lit'
7
6
  import { unsafeHTML } from 'lit-html/directives/unsafe-html.js'
8
- import { customElement, property, query } from 'lit/decorators.js'
7
+ import { customElement, property, query, state } from 'lit/decorators.js'
9
8
  import { keyed } from 'lit/directives/keyed.js'
10
9
  import { connect } from 'pwa-helpers/connect-mixin.js'
11
10
 
@@ -15,8 +14,6 @@ import { PageView, store } from '@operato/shell'
15
14
  import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
16
15
  import { provider } from '@things-factory/board-ui'
17
16
 
18
- const formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' })
19
-
20
17
  const ActivityApprovalFetchResult = `\
21
18
  {
22
19
  id
@@ -59,6 +56,7 @@ const ActivityApprovalFetchResult = `\
59
56
  }
60
57
  approvalLine {
61
58
  type
59
+ value
62
60
  approver {
63
61
  id
64
62
  name
@@ -94,39 +92,47 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
94
92
  :host {
95
93
  display: flex;
96
94
  flex-direction: column;
95
+ position: relative;
97
96
 
98
97
  width: 100%;
99
98
  padding: 5px;
100
99
  overflow: auto;
101
100
  }
102
101
 
103
- [header] {
104
- display: flex;
105
- padding: 5px;
102
+ ox-board-viewer {
103
+ width: 100%;
104
+ height: 100%;
106
105
  }
107
106
 
108
- [header] > div {
107
+ #custom-content {
109
108
  flex: 1;
110
109
  }
111
110
 
112
- [content] {
113
- clear: left;
114
-
115
- flex: 1;
116
- display: block;
117
- padding: 5px;
111
+ div[comment] {
112
+ display: flex;
113
+ width: 100%;
114
+ height: 100px;
115
+ right: 0;
116
+ bottom: 0;
117
+ margin: 0;
118
+ padding: 0;
119
+ opacity: 0.8;
118
120
  }
119
121
 
120
- ox-board-viewer {
121
- width: 100%;
122
- height: 100%;
122
+ textarea {
123
+ flex: 1;
124
+ padding: 10px;
125
+ resize: none;
126
+ background-color: black;
127
+ color: yellow;
128
+ outline: none;
123
129
  }
124
130
  `
125
131
  ]
126
132
 
127
- @property({ type: Object }) activityApproval: any
128
- @property({ type: Object }) activityThread: any
129
- @property({ type: Object }) board: any
133
+ @state() activityApproval: any
134
+ @state() activityThread: any
135
+ @state() board: any
130
136
 
131
137
  get context() {
132
138
  const judgment = this.activityApproval?.judgment
@@ -154,40 +160,23 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
154
160
  action: this._saveActivityApproval.bind(this),
155
161
  ...CommonButtonStyles.save
156
162
  }
157
- ]
163
+ ],
164
+ activityApproval: this.activityApproval
158
165
  }
159
166
  }
160
167
 
161
168
  render() {
162
- const { round, order, approver, createdAt } = this.activityApproval || {}
163
- const { state, dueAt, assignedAt, assignee, activityInstance } = this.activityThread || {}
164
- const { name, description, thumbnail, approvalLine } = activityInstance || {}
165
-
166
169
  return html`
167
- <div header>
168
- <div>
169
- <div>name: ${name}</div>
170
- <div>description: ${description}</div>
171
- <div>state: ${state}</div>
172
- <div>round: ${round}</div>
173
- <div>order: ${order}</div>
174
- <div>assigned at: ${assignedAt && formatter.format(new Date(assignedAt))}</div>
175
- <div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>
176
- <div>assignee: ${assignee?.name}</div>
177
- <div>approver: ${approver?.name}</div>
178
- <div>waited since: ${createdAt && formatter.format(new Date(createdAt))}</div>
179
- </div>
180
- <div>
181
- <div approval-line>
182
- ${approvalLine
183
- ? html` <approval-line-view .model=${approvalLine} .current=${order}></approval-line-view> `
184
- : html``}
185
- </div>
186
- <img src=${thumbnail} />
187
- </div>
170
+ ${this.activityContent()}
171
+ <div comment>
172
+ <textarea
173
+ placeholder="Jot down your comment here."
174
+ .value=${this.activityApproval?.comment}
175
+ @change=${(e: Event) => {
176
+ this.activityApproval.comment = (e.target as HTMLTextAreaElement).value
177
+ }}
178
+ ></textarea>
188
179
  </div>
189
-
190
- <div content>${this.activityContent()}</div>
191
180
  `
192
181
  }
193
182
 
@@ -199,6 +188,8 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
199
188
  return this.generatedContent()
200
189
  case 'board':
201
190
  return this.boardContent()
191
+ case 'custom-element':
192
+ return this.customElementContent()
202
193
  case 'page':
203
194
  case 'external':
204
195
  default:
@@ -254,7 +245,7 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
254
245
  }
255
246
 
256
247
  return keyed(
257
- activityInstance.id,
248
+ this.activityApproval.id,
258
249
  html`
259
250
  <fieldset>
260
251
  <legend>Input</legend>
@@ -289,7 +280,7 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
289
280
  }
290
281
 
291
282
  return keyed(
292
- activityInstance.id,
283
+ this.activityApproval.id,
293
284
  html`
294
285
  <ox-board-viewer
295
286
  style="background-color: white;"
@@ -303,6 +294,18 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
303
294
  )
304
295
  }
305
296
 
297
+ customElementContent() {
298
+ const { output, activityInstance } = this.activityThread
299
+ const { uiSource: tagName, input } = activityInstance || {}
300
+
301
+ const element = document.createElement(tagName)
302
+ element.id = 'custom-content'
303
+ element.input = input
304
+ element.output = output
305
+
306
+ return element
307
+ }
308
+
306
309
  @query('ox-board-viewer') oxBoardViewer: any
307
310
 
308
311
  getOutputFromBoard() {
@@ -341,11 +344,12 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
341
344
 
342
345
  this.activityApproval = response.data.activityApproval
343
346
  this.activityThread = this.activityApproval.activityThread
347
+
348
+ this.updateContext()
344
349
  }
345
350
 
346
351
  async _rejectActivityApproval() {
347
- var { id } = this.activityApproval
348
- var comment = 'xxxxxxxxxxxxxxxxxxx'
352
+ var { id, comment } = this.activityApproval
349
353
 
350
354
  const response = await client.mutate({
351
355
  mutation: gql`
@@ -373,8 +377,7 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
373
377
  }
374
378
 
375
379
  async _approveActivityApproval() {
376
- var { id } = this.activityApproval
377
- var comment = 'xxxxxxxxxxxxxxxxxxx'
380
+ var { id, comment } = this.activityApproval
378
381
 
379
382
  const response = await client.mutate({
380
383
  mutation: gql`
@@ -402,8 +405,7 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
402
405
  }
403
406
 
404
407
  async _saveActivityApproval() {
405
- var { id } = this.activityApproval
406
- var comment = 'yyyyyyyyyyyyyyyyyyy'
408
+ var { id, comment } = this.activityApproval
407
409
 
408
410
  const response = await client.mutate({
409
411
  mutation: gql`
@@ -57,6 +57,10 @@ export class ActivityInstancePage extends connect(store)(localize(i18next)(PageV
57
57
  width: 100%;
58
58
  height: 100%;
59
59
  }
60
+
61
+ #custom-content {
62
+ flex: 1;
63
+ }
60
64
  `
61
65
  ]
62
66
 
@@ -111,6 +115,8 @@ export class ActivityInstancePage extends connect(store)(localize(i18next)(PageV
111
115
  return this.generatedContent()
112
116
  case 'board':
113
117
  return this.boardContent()
118
+ case 'custom-element':
119
+ return this.customElementContent()
114
120
  case 'page':
115
121
  case 'external':
116
122
  default:
@@ -203,6 +209,17 @@ export class ActivityInstancePage extends connect(store)(localize(i18next)(PageV
203
209
  `
204
210
  }
205
211
 
212
+ customElementContent() {
213
+ const { uiSource: tagName, input, output } = this.activityInstance
214
+
215
+ const element = document.createElement(tagName)
216
+ element.id = 'custom-content'
217
+ element.input = input
218
+ element.output = output
219
+
220
+ return element
221
+ }
222
+
206
223
  getOutputFromBoard() {
207
224
  const outputSpec = this.getOutputSpec()
208
225
  const data = this.viewer?.getSceneValues() || {}
@@ -255,6 +272,7 @@ export class ActivityInstancePage extends connect(store)(localize(i18next)(PageV
255
272
  uiSource
256
273
  approvalLine {
257
274
  type
275
+ value
258
276
  approver {
259
277
  id
260
278
  name
@@ -1,6 +1,5 @@
1
1
  import '@operato/property-editor/ox-properties-dynamic-view.js'
2
2
  import '@operato/board/ox-board-viewer.js'
3
- import '@things-factory/organization'
4
3
 
5
4
  import gql from 'graphql-tag'
6
5
  import { css, html } from 'lit'
@@ -15,8 +14,6 @@ import { PageView, store } from '@operato/shell'
15
14
  import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
16
15
  import { provider } from '@things-factory/board-ui'
17
16
 
18
- const formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' })
19
-
20
17
  const ActivityThreadFetchResult = `\
21
18
  {
22
19
  id
@@ -50,6 +47,7 @@ const ActivityThreadFetchResult = `\
50
47
  }
51
48
  approvalLine {
52
49
  type
50
+ value
53
51
  approver {
54
52
  id
55
53
  name
@@ -91,27 +89,14 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
91
89
  overflow: auto;
92
90
  }
93
91
 
94
- [header] {
95
- display: flex;
96
- padding: 5px;
97
- }
98
-
99
- [header] > div {
100
- flex: 1;
101
- }
102
-
103
- [content] {
104
- clear: left;
105
-
106
- flex: 1;
107
- display: block;
108
- padding: 5px;
109
- }
110
-
111
92
  ox-board-viewer {
112
93
  width: 100%;
113
94
  height: 100%;
114
95
  }
96
+
97
+ #custom-content {
98
+ flex: 1;
99
+ }
115
100
  `
116
101
  ]
117
102
 
@@ -167,35 +152,13 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
167
152
  action: this._abortActivityThread.bind(this),
168
153
  ...CommonButtonStyles.cancel
169
154
  }
170
- ].filter(Boolean /* truthy only */)
155
+ ].filter(Boolean /* truthy only */),
156
+ activityThread: this.activityThread
171
157
  }
172
158
  }
173
159
 
174
160
  render() {
175
- const { state, round, dueAt, assignedAt, assignee, activityInstance } = this.activityThread || {}
176
- const { name, description, thumbnail, approvalLine } = activityInstance || {}
177
-
178
- return html`
179
- <div header>
180
- <div>
181
- <div>name: ${name}</div>
182
- <div>description: ${description}</div>
183
- <div>state: ${state}</div>
184
- <div>round: ${round}</div>
185
- <div>assigned at: ${assignedAt && formatter.format(new Date(assignedAt))}</div>
186
- <div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>
187
- <div>assignee: ${assignee?.name}</div>
188
- </div>
189
- <div>
190
- <div approval-line>
191
- ${approvalLine ? html` <approval-line-view .model=${approvalLine}></approval-line-view> ` : html``}
192
- </div>
193
- <img src=${thumbnail} />
194
- </div>
195
- </div>
196
-
197
- <div content>${this.activityContent()}</div>
198
- `
161
+ return html` ${this.activityContent()}`
199
162
  }
200
163
 
201
164
  activityContent() {
@@ -206,6 +169,8 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
206
169
  return this.generatedContent()
207
170
  case 'board':
208
171
  return this.boardContent()
172
+ case 'custom-element':
173
+ return this.customElementContent()
209
174
  case 'page':
210
175
  case 'external':
211
176
  default:
@@ -261,7 +226,7 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
261
226
  }
262
227
 
263
228
  return keyed(
264
- activityInstance.id,
229
+ this.activityThread.id,
265
230
  html`
266
231
  <fieldset>
267
232
  <legend>Input</legend>
@@ -296,7 +261,7 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
296
261
  }
297
262
 
298
263
  return keyed(
299
- activityInstance.id,
264
+ this.activityThread.id,
300
265
  html`
301
266
  <ox-board-viewer
302
267
  style="background-color: white;"
@@ -310,6 +275,21 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
310
275
  )
311
276
  }
312
277
 
278
+ customElementContent() {
279
+ const { output, activityInstance } = this.activityThread
280
+ const { uiSource: tagName, input } = activityInstance || {}
281
+
282
+ const element = document.createElement(tagName)
283
+ element.id = 'custom-content'
284
+ element.input = input
285
+ element.output = output
286
+ element.addEventListener('change', (e: CustomEvent) => {
287
+ this.activityThread.output = e.detail
288
+ })
289
+
290
+ return element
291
+ }
292
+
313
293
  @query('ox-board-viewer') oxBoardViewer: any
314
294
 
315
295
  getOutputFromBoard() {
@@ -347,6 +327,8 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
347
327
  })
348
328
 
349
329
  this.activityThread = response.data.activityThread
330
+
331
+ this.updateContext()
350
332
  }
351
333
 
352
334
  async _startActivityThread() {
@@ -99,7 +99,7 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
99
99
  list: {
100
100
  thumbnail: 'thumbnail',
101
101
  fields: ['name', 'description'],
102
- details: ['visibility', 'updatedAt']
102
+ details: ['provider', 'release']
103
103
  },
104
104
  columns: [
105
105
  { type: 'gutter', gutterName: 'sequence' },
@@ -165,8 +165,8 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
165
165
  },
166
166
  {
167
167
  type: 'string',
168
- name: 'version',
169
- header: i18next.t('field.version'),
168
+ name: 'release',
169
+ header: i18next.t('field.release'),
170
170
  record: {
171
171
  editable: false
172
172
  },
@@ -284,16 +284,6 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
284
284
  // filter: true,
285
285
  sortable: true,
286
286
  width: 60
287
- },
288
- {
289
- type: 'resource-object',
290
- name: 'updater',
291
- header: i18next.t('field.updater'),
292
- record: {
293
- editable: false
294
- },
295
- sortable: true,
296
- width: 120
297
287
  }
298
288
  ],
299
289
  rows: {
@@ -6,13 +6,14 @@ import { css, html } from 'lit'
6
6
  import { customElement, property, query } from 'lit/decorators.js'
7
7
  import { connect } from 'pwa-helpers/connect-mixin.js'
8
8
 
9
- import { DataGrist, getRenderer } from '@operato/data-grist'
9
+ import { DataGrist, FetchOption, getRenderer } from '@operato/data-grist'
10
10
  import { client } from '@operato/graphql'
11
11
  import { i18next, localize } from '@operato/i18n'
12
12
  import { openPopup } from '@operato/layout'
13
13
  import { PageView, store } from '@operato/shell'
14
14
  import { CommonGristStyles, ScrollbarStyles } from '@operato/styles'
15
15
  import { isMobileDevice } from '@operato/utils'
16
+ import { OxPopup } from '@operato/popup'
16
17
 
17
18
  import { ActivityInstanceStatus, Priorities } from '../../types.js'
18
19
 
@@ -59,7 +60,7 @@ export class DraftListPage extends connect(store)(localize(i18next)(PageView)) {
59
60
  }
60
61
  }
61
62
 
62
- @query('#sorter-control') sorterControl?: any
63
+ @query('#sorter-control') sorterControl!: OxPopup
63
64
  @query('ox-grist') grist!: DataGrist
64
65
 
65
66
  render() {
@@ -283,7 +284,7 @@ export class DraftListPage extends connect(store)(localize(i18next)(PageView)) {
283
284
  }
284
285
  }
285
286
 
286
- async fetchHandler({ page, limit, sortings = [], filters = [] }) {
287
+ async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
287
288
  const response = await client.query({
288
289
  query: gql`
289
290
  query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
@@ -303,6 +304,7 @@ export class DraftListPage extends connect(store)(localize(i18next)(PageView)) {
303
304
  activityType
304
305
  assignees {
305
306
  type
307
+ value
306
308
  assignee {
307
309
  id
308
310
  name
@@ -312,6 +314,7 @@ export class DraftListPage extends connect(store)(localize(i18next)(PageView)) {
312
314
  }
313
315
  approvalLine {
314
316
  type
317
+ value
315
318
  approver {
316
319
  id
317
320
  name
@@ -0,0 +1,67 @@
1
+ import '@material/mwc-icon'
2
+
3
+ import { html, css, LitElement } from 'lit'
4
+ import { customElement, state } from 'lit/decorators.js'
5
+
6
+ import { connect } from 'pwa-helpers/connect-mixin'
7
+
8
+ import { ContextToolbarOverlayStyle } from '@operato/context/ox-context-toolbar-overlay-style.js'
9
+ import { store } from '@operato/shell'
10
+ import { i18next } from '@operato/i18n'
11
+
12
+ import '@things-factory/organization/dist-client/component/approval-line-view.js'
13
+
14
+ const formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' })
15
+
16
+ @customElement('activity-approval-context-template')
17
+ class ActivityApprovalContextTemplate extends connect(store)(LitElement) {
18
+ static styles = [
19
+ ContextToolbarOverlayStyle,
20
+ css`
21
+ :host {
22
+ background-color: white;
23
+
24
+ width: 100%;
25
+ padding: 5px;
26
+ overflow: auto;
27
+ }
28
+ `
29
+ ]
30
+
31
+ @state() private context
32
+
33
+ render() {
34
+ const activityApproval = this.context.activityApproval || {}
35
+
36
+ const { round, order, approver, createdAt, activityThread } = activityApproval || {}
37
+ const { state, dueAt, assignedAt, assignee, activityInstance } = activityThread || {}
38
+ const { name, description, thumbnail, approvalLine } = activityInstance || {}
39
+
40
+ return html`
41
+ <div>
42
+ <div>name: ${name}</div>
43
+ <div>description: ${description}</div>
44
+ <div>state: ${state}</div>
45
+ <div>round: ${round}</div>
46
+ <div>order: ${order}</div>
47
+ <div>assigned at: ${assignedAt && formatter.format(new Date(assignedAt))}</div>
48
+ <div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>
49
+ <div>assignee: ${assignee?.name}</div>
50
+ <div>approver: ${approver?.name}</div>
51
+ <div>waited since: ${createdAt && formatter.format(new Date(createdAt))}</div>
52
+ </div>
53
+ <div>
54
+ <div approval-line>
55
+ ${approvalLine
56
+ ? html` <approval-line-view .model=${approvalLine} .current=${order}></approval-line-view> `
57
+ : html``}
58
+ </div>
59
+ <img src=${thumbnail} />
60
+ </div>
61
+ `
62
+ }
63
+
64
+ stateChanged(state) {
65
+ this.context = state.route.context
66
+ }
67
+ }