@things-factory/worklist 6.0.12 → 6.0.16
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.
- package/client/pages/activity-approval/activity-approval-page.ts +17 -3
- package/client/pages/activity-thread/activity-thread-page.ts +93 -3
- package/dist-client/pages/activity-approval/activity-approval-page.js +19 -5
- package/dist-client/pages/activity-approval/activity-approval-page.js.map +1 -1
- package/dist-client/pages/activity-thread/activity-thread-page.d.ts +4 -0
- package/dist-client/pages/activity-thread/activity-thread-page.js +67 -6
- package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/controllers/activity-approval/approve.js +3 -4
- package/dist-server/controllers/activity-approval/approve.js.map +1 -1
- package/dist-server/controllers/activity-approval/delegate.js +10 -4
- package/dist-server/controllers/activity-approval/delegate.js.map +1 -1
- package/dist-server/controllers/activity-approval/reject.js +5 -3
- package/dist-server/controllers/activity-approval/reject.js.map +1 -1
- package/dist-server/controllers/activity-thread/delegate.js +2 -3
- package/dist-server/controllers/activity-thread/delegate.js.map +1 -1
- package/dist-server/controllers/activity-thread/end.js +1 -2
- package/dist-server/controllers/activity-thread/end.js.map +1 -1
- package/dist-server/controllers/activity-thread/index.js +1 -0
- package/dist-server/controllers/activity-thread/index.js.map +1 -1
- package/dist-server/controllers/activity-thread/restart.js +25 -0
- package/dist-server/controllers/activity-thread/restart.js.map +1 -0
- package/dist-server/controllers/activity-thread/save.js +6 -2
- package/dist-server/controllers/activity-thread/save.js.map +1 -1
- package/dist-server/controllers/activity-thread/start.js +3 -4
- package/dist-server/controllers/activity-thread/start.js.map +1 -1
- package/dist-server/controllers/activity-thread/submit.js +2 -1
- package/dist-server/controllers/activity-thread/submit.js.map +1 -1
- package/dist-server/controllers/activity-thread/terminate.js +2 -3
- package/dist-server/controllers/activity-thread/terminate.js.map +1 -1
- package/dist-server/service/activity-approval/activity-approval-mutation.js +10 -8
- package/dist-server/service/activity-approval/activity-approval-mutation.js.map +1 -1
- package/dist-server/service/activity-approval/activity-approval-query.js +21 -1
- package/dist-server/service/activity-approval/activity-approval-query.js.map +1 -1
- package/dist-server/service/activity-approval/activity-approval-subscription.js +48 -0
- package/dist-server/service/activity-approval/activity-approval-subscription.js.map +1 -0
- package/dist-server/service/activity-approval/activity-approval.js +23 -2
- package/dist-server/service/activity-approval/activity-approval.js.map +1 -1
- package/dist-server/service/activity-approval/index.js +2 -1
- package/dist-server/service/activity-approval/index.js.map +1 -1
- package/dist-server/service/activity-instance/activity-instance-subscription.js +2 -2
- package/dist-server/service/activity-instance/activity-instance-subscription.js.map +1 -1
- package/dist-server/service/activity-summary/activity-summary-query.js +154 -0
- package/dist-server/service/activity-summary/activity-summary-query.js.map +1 -0
- package/dist-server/service/activity-summary/activity-summary.js +28 -0
- package/dist-server/service/activity-summary/activity-summary.js.map +1 -0
- package/dist-server/service/activity-summary/index.js +8 -0
- package/dist-server/service/activity-summary/index.js.map +1 -0
- package/dist-server/service/activity-thread/activity-thread-history.js +194 -0
- package/dist-server/service/activity-thread/activity-thread-history.js.map +1 -0
- package/dist-server/service/activity-thread/activity-thread-mutation.js +15 -1
- package/dist-server/service/activity-thread/activity-thread-mutation.js.map +1 -1
- package/dist-server/service/activity-thread/activity-thread-query.js +18 -5
- package/dist-server/service/activity-thread/activity-thread-query.js.map +1 -1
- package/dist-server/service/activity-thread/activity-thread-subscription.js +2 -2
- package/dist-server/service/activity-thread/activity-thread-subscription.js.map +1 -1
- package/dist-server/service/activity-thread/activity-thread.js +21 -22
- package/dist-server/service/activity-thread/activity-thread.js.map +1 -1
- package/dist-server/service/activity-thread/event-subscriber.js +15 -1
- package/dist-server/service/activity-thread/event-subscriber.js.map +1 -1
- package/dist-server/service/activity-thread/index.js +3 -2
- package/dist-server/service/activity-thread/index.js.map +1 -1
- package/dist-server/service/index.js +6 -2
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/server/controllers/activity-approval/approve.ts +5 -4
- package/server/controllers/activity-approval/delegate.ts +21 -6
- package/server/controllers/activity-approval/reject.ts +12 -4
- package/server/controllers/activity-thread/delegate.ts +2 -3
- package/server/controllers/activity-thread/end.ts +1 -2
- package/server/controllers/activity-thread/index.ts +1 -0
- package/server/controllers/activity-thread/restart.ts +42 -0
- package/server/controllers/activity-thread/save.ts +9 -2
- package/server/controllers/activity-thread/start.ts +3 -4
- package/server/controllers/activity-thread/submit.ts +2 -1
- package/server/controllers/activity-thread/terminate.ts +2 -3
- package/server/service/activity-approval/activity-approval-mutation.ts +6 -4
- package/server/service/activity-approval/activity-approval-query.ts +11 -1
- package/server/service/activity-approval/activity-approval-subscription.ts +46 -0
- package/server/service/activity-approval/activity-approval.ts +16 -0
- package/server/service/activity-approval/index.ts +2 -1
- package/server/service/activity-instance/activity-instance-subscription.ts +2 -2
- package/server/service/activity-summary/activity-summary-query.ts +132 -0
- package/server/service/activity-summary/activity-summary.ts +16 -0
- package/server/service/activity-summary/index.ts +5 -0
- package/server/service/activity-thread/activity-thread-history.ts +177 -0
- package/server/service/activity-thread/activity-thread-mutation.ts +21 -2
- package/server/service/activity-thread/activity-thread-query.ts +13 -5
- package/server/service/activity-thread/activity-thread-subscription.ts +2 -2
- package/server/service/activity-thread/activity-thread.ts +13 -15
- package/server/service/activity-thread/event-subscriber.ts +17 -1
- package/server/service/activity-thread/index.ts +4 -3
- package/server/service/index.ts +14 -6
- package/translations/en.json +3 -0
- package/translations/ko.json +3 -0
- package/translations/ms.json +3 -0
- package/translations/zh.json +3 -0
- package/server/controllers/activity-approval/abort.ts +0 -33
- package/server/controllers/activity-approval/escalate.ts +0 -33
|
@@ -22,6 +22,13 @@ const ActivityApprovalFetchResult = `\
|
|
|
22
22
|
id
|
|
23
23
|
judgment
|
|
24
24
|
comment
|
|
25
|
+
approver {
|
|
26
|
+
id
|
|
27
|
+
name
|
|
28
|
+
}
|
|
29
|
+
round
|
|
30
|
+
order
|
|
31
|
+
createdAt
|
|
25
32
|
activityThread {
|
|
26
33
|
state
|
|
27
34
|
dueAt
|
|
@@ -122,7 +129,7 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
|
|
|
122
129
|
@property({ type: Object }) board: any
|
|
123
130
|
|
|
124
131
|
get context() {
|
|
125
|
-
const judgment = this.activityApproval
|
|
132
|
+
const judgment = this.activityApproval?.judgment
|
|
126
133
|
|
|
127
134
|
return {
|
|
128
135
|
title: this.lifecycle?.params?.['title'] || i18next.t('title.activity-approval'),
|
|
@@ -152,6 +159,7 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
|
|
|
152
159
|
}
|
|
153
160
|
|
|
154
161
|
render() {
|
|
162
|
+
const { round, order, approver, createdAt } = this.activityApproval || {}
|
|
155
163
|
const { state, dueAt, assignedAt, assignee, activityInstance } = this.activityThread || {}
|
|
156
164
|
const { name, description, thumbnail, approvalLine } = activityInstance || {}
|
|
157
165
|
|
|
@@ -161,13 +169,19 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
|
|
|
161
169
|
<div>name: ${name}</div>
|
|
162
170
|
<div>description: ${description}</div>
|
|
163
171
|
<div>state: ${state}</div>
|
|
172
|
+
<div>round: ${round}</div>
|
|
173
|
+
<div>order: ${order}</div>
|
|
164
174
|
<div>assigned at: ${assignedAt && formatter.format(new Date(assignedAt))}</div>
|
|
165
175
|
<div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>
|
|
166
176
|
<div>assignee: ${assignee?.name}</div>
|
|
177
|
+
<div>approver: ${approver?.name}</div>
|
|
178
|
+
<div>waited since: ${createdAt && formatter.format(new Date(createdAt))}</div>
|
|
167
179
|
</div>
|
|
168
180
|
<div>
|
|
169
181
|
<div approval-line>
|
|
170
|
-
${approvalLine
|
|
182
|
+
${approvalLine
|
|
183
|
+
? html` <approval-line-view .model=${approvalLine} .current=${order}></approval-line-view> `
|
|
184
|
+
: html``}
|
|
171
185
|
</div>
|
|
172
186
|
<img src=${thumbnail} />
|
|
173
187
|
</div>
|
|
@@ -346,7 +360,7 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
|
|
|
346
360
|
})
|
|
347
361
|
|
|
348
362
|
if (!response.errors) {
|
|
349
|
-
this.activityApproval = response.data.
|
|
363
|
+
this.activityApproval = response.data.rejectActivityApproval
|
|
350
364
|
|
|
351
365
|
document.dispatchEvent(
|
|
352
366
|
new CustomEvent('notify', {
|
|
@@ -28,6 +28,7 @@ const ActivityThreadFetchResult = `\
|
|
|
28
28
|
name
|
|
29
29
|
}
|
|
30
30
|
output
|
|
31
|
+
round
|
|
31
32
|
activityInstance {
|
|
32
33
|
id
|
|
33
34
|
name
|
|
@@ -70,6 +71,7 @@ export const ActivityThreadStatus = {
|
|
|
70
71
|
Assigned: 'assigned',
|
|
71
72
|
Started: 'started',
|
|
72
73
|
Delegated: 'delegated',
|
|
74
|
+
Rejected: 'rejected',
|
|
73
75
|
Ended: 'ended',
|
|
74
76
|
Aborted: 'aborted'
|
|
75
77
|
}
|
|
@@ -117,10 +119,14 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
|
|
|
117
119
|
@property({ type: Object }) board: any
|
|
118
120
|
|
|
119
121
|
get context() {
|
|
120
|
-
const
|
|
122
|
+
const state = this.activityThread?.state
|
|
121
123
|
|
|
122
|
-
const
|
|
124
|
+
const startable = [ActivityThreadStatus.Assigned].includes(state)
|
|
125
|
+
const endable = [ActivityThreadStatus.Started].includes(state)
|
|
123
126
|
const savable = endable
|
|
127
|
+
const restartable = [ActivityThreadStatus.Rejected].includes(state)
|
|
128
|
+
const delegatable = [ActivityThreadStatus.Assigned, ActivityThreadStatus.Started].includes(state)
|
|
129
|
+
const abortable = [ActivityThreadStatus.Assigned, ActivityThreadStatus.Started].includes(state)
|
|
124
130
|
|
|
125
131
|
return {
|
|
126
132
|
title: this.lifecycle?.params?.['title'] || i18next.t('title.activity'),
|
|
@@ -142,13 +148,31 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
|
|
|
142
148
|
title: i18next.t('button.submit'),
|
|
143
149
|
action: this._submitActivityThread.bind(this),
|
|
144
150
|
...CommonButtonStyles.save
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
delegatable && {
|
|
154
|
+
title: i18next.t('button.delegate'),
|
|
155
|
+
action: this._delegateActivityThread.bind(this),
|
|
156
|
+
...CommonButtonStyles.save
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
restartable && {
|
|
160
|
+
title: i18next.t('button.restart'),
|
|
161
|
+
action: this._restartActivityThread.bind(this),
|
|
162
|
+
...CommonButtonStyles.save
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
abortable && {
|
|
166
|
+
title: i18next.t('button.abort'),
|
|
167
|
+
action: this._abortActivityThread.bind(this),
|
|
168
|
+
...CommonButtonStyles.cancel
|
|
145
169
|
}
|
|
146
170
|
].filter(Boolean /* truthy only */)
|
|
147
171
|
}
|
|
148
172
|
}
|
|
149
173
|
|
|
150
174
|
render() {
|
|
151
|
-
const { state, dueAt, assignedAt, assignee, activityInstance } = this.activityThread || {}
|
|
175
|
+
const { state, round, dueAt, assignedAt, assignee, activityInstance } = this.activityThread || {}
|
|
152
176
|
const { name, description, thumbnail, approvalLine } = activityInstance || {}
|
|
153
177
|
|
|
154
178
|
return html`
|
|
@@ -157,6 +181,7 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
|
|
|
157
181
|
<div>name: ${name}</div>
|
|
158
182
|
<div>description: ${description}</div>
|
|
159
183
|
<div>state: ${state}</div>
|
|
184
|
+
<div>round: ${round}</div>
|
|
160
185
|
<div>assigned at: ${assignedAt && formatter.format(new Date(assignedAt))}</div>
|
|
161
186
|
<div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>
|
|
162
187
|
<div>assignee: ${assignee?.name}</div>
|
|
@@ -357,6 +382,43 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
|
|
|
357
382
|
}
|
|
358
383
|
}
|
|
359
384
|
|
|
385
|
+
async _restartActivityThread() {
|
|
386
|
+
var { id, output, activityInstance } = this.activityThread
|
|
387
|
+
var { uiType } = activityInstance
|
|
388
|
+
|
|
389
|
+
if (uiType === 'board') {
|
|
390
|
+
output = this.getOutputFromBoard()
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const response = await client.mutate({
|
|
394
|
+
mutation: gql`
|
|
395
|
+
mutation ($id: String!, $output: Object) {
|
|
396
|
+
restartActivityThread(id: $id, output: $output) ${ActivityThreadFetchResult}
|
|
397
|
+
}
|
|
398
|
+
`,
|
|
399
|
+
variables: {
|
|
400
|
+
id,
|
|
401
|
+
output
|
|
402
|
+
}
|
|
403
|
+
})
|
|
404
|
+
|
|
405
|
+
if (!response.errors) {
|
|
406
|
+
this.activityThread = response.data.restartActivityThread
|
|
407
|
+
|
|
408
|
+
document.dispatchEvent(
|
|
409
|
+
new CustomEvent('notify', {
|
|
410
|
+
detail: {
|
|
411
|
+
message: i18next.t('text.task_is_restarted_successfully')
|
|
412
|
+
}
|
|
413
|
+
})
|
|
414
|
+
)
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
async _delegateActivityThread() {
|
|
419
|
+
throw 'not implemented yet'
|
|
420
|
+
}
|
|
421
|
+
|
|
360
422
|
async _saveActivityThread() {
|
|
361
423
|
var { id, output, reason, activityInstance } = this.activityThread
|
|
362
424
|
var { uiType } = activityInstance || {}
|
|
@@ -425,4 +487,32 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
|
|
|
425
487
|
)
|
|
426
488
|
}
|
|
427
489
|
}
|
|
490
|
+
|
|
491
|
+
async _abortActivityThread() {
|
|
492
|
+
var { id, reason } = this.activityThread
|
|
493
|
+
|
|
494
|
+
const response = await client.mutate({
|
|
495
|
+
mutation: gql`
|
|
496
|
+
mutation ($id: String!, $reason: String) {
|
|
497
|
+
abortActivityThread(id: $id, reason: $reason) ${ActivityThreadFetchResult}
|
|
498
|
+
}
|
|
499
|
+
`,
|
|
500
|
+
variables: {
|
|
501
|
+
id,
|
|
502
|
+
reason
|
|
503
|
+
}
|
|
504
|
+
})
|
|
505
|
+
|
|
506
|
+
if (!response.errors) {
|
|
507
|
+
this.activityThread = response.data.abortActivityThread
|
|
508
|
+
|
|
509
|
+
document.dispatchEvent(
|
|
510
|
+
new CustomEvent('notify', {
|
|
511
|
+
detail: {
|
|
512
|
+
message: i18next.t('text.task_is_aborted_successfully')
|
|
513
|
+
}
|
|
514
|
+
})
|
|
515
|
+
)
|
|
516
|
+
}
|
|
517
|
+
}
|
|
428
518
|
}
|
|
@@ -19,6 +19,13 @@ const ActivityApprovalFetchResult = `\
|
|
|
19
19
|
id
|
|
20
20
|
judgment
|
|
21
21
|
comment
|
|
22
|
+
approver {
|
|
23
|
+
id
|
|
24
|
+
name
|
|
25
|
+
}
|
|
26
|
+
round
|
|
27
|
+
order
|
|
28
|
+
createdAt
|
|
22
29
|
activityThread {
|
|
23
30
|
state
|
|
24
31
|
dueAt
|
|
@@ -75,10 +82,10 @@ export const ActivityThreadStatus = {
|
|
|
75
82
|
};
|
|
76
83
|
let ActivityApprovalPage = class ActivityApprovalPage extends connect(store)(localize(i18next)(PageView)) {
|
|
77
84
|
get context() {
|
|
78
|
-
var _a, _b;
|
|
79
|
-
const judgment = this.activityApproval.judgment;
|
|
85
|
+
var _a, _b, _c;
|
|
86
|
+
const judgment = (_a = this.activityApproval) === null || _a === void 0 ? void 0 : _a.judgment;
|
|
80
87
|
return {
|
|
81
|
-
title: ((
|
|
88
|
+
title: ((_c = (_b = this.lifecycle) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c['title']) || i18next.t('title.activity-approval'),
|
|
82
89
|
help: 'worklist/activity-approval',
|
|
83
90
|
actions: judgment
|
|
84
91
|
? []
|
|
@@ -90,6 +97,7 @@ let ActivityApprovalPage = class ActivityApprovalPage extends connect(store)(loc
|
|
|
90
97
|
};
|
|
91
98
|
}
|
|
92
99
|
render() {
|
|
100
|
+
const { round, order, approver, createdAt } = this.activityApproval || {};
|
|
93
101
|
const { state, dueAt, assignedAt, assignee, activityInstance } = this.activityThread || {};
|
|
94
102
|
const { name, description, thumbnail, approvalLine } = activityInstance || {};
|
|
95
103
|
return html `
|
|
@@ -98,13 +106,19 @@ let ActivityApprovalPage = class ActivityApprovalPage extends connect(store)(loc
|
|
|
98
106
|
<div>name: ${name}</div>
|
|
99
107
|
<div>description: ${description}</div>
|
|
100
108
|
<div>state: ${state}</div>
|
|
109
|
+
<div>round: ${round}</div>
|
|
110
|
+
<div>order: ${order}</div>
|
|
101
111
|
<div>assigned at: ${assignedAt && formatter.format(new Date(assignedAt))}</div>
|
|
102
112
|
<div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>
|
|
103
113
|
<div>assignee: ${assignee === null || assignee === void 0 ? void 0 : assignee.name}</div>
|
|
114
|
+
<div>approver: ${approver === null || approver === void 0 ? void 0 : approver.name}</div>
|
|
115
|
+
<div>waited since: ${createdAt && formatter.format(new Date(createdAt))}</div>
|
|
104
116
|
</div>
|
|
105
117
|
<div>
|
|
106
118
|
<div approval-line>
|
|
107
|
-
${approvalLine
|
|
119
|
+
${approvalLine
|
|
120
|
+
? html ` <approval-line-view .model=${approvalLine} .current=${order}></approval-line-view> `
|
|
121
|
+
: html ``}
|
|
108
122
|
</div>
|
|
109
123
|
<img src=${thumbnail} />
|
|
110
124
|
</div>
|
|
@@ -251,7 +265,7 @@ let ActivityApprovalPage = class ActivityApprovalPage extends connect(store)(loc
|
|
|
251
265
|
}
|
|
252
266
|
});
|
|
253
267
|
if (!response.errors) {
|
|
254
|
-
this.activityApproval = response.data.
|
|
268
|
+
this.activityApproval = response.data.rejectActivityApproval;
|
|
255
269
|
document.dispatchEvent(new CustomEvent('notify', {
|
|
256
270
|
detail: {
|
|
257
271
|
message: i18next.t('text.task_is_rejected_successfully')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"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AAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4DAAoB;AAC/C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAAW;AA0KtC;IAAC,KAAK,CAAC,iBAAiB,CAAC;;2DAAmB;AAlNjC,oBAAoB;IADhC,aAAa,CAAC,wBAAwB,CAAC;GAC3B,oBAAoB,CAgVhC;SAhVY,oBAAoB","sourcesContent":["import '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@operato/board/ox-board-viewer.js'\nimport '@things-factory/organization'\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 { keyed } from 'lit/directives/keyed.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { PageView, store } from '@operato/shell'\nimport { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { provider } from '@things-factory/board-ui'\n\nconst formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' })\n\nconst ActivityApprovalFetchResult = `\\\n{\n id\n judgment\n comment\n activityThread {\n state\n dueAt\n assignedAt\n assignee {\n id\n name\n }\n output\n activityInstance {\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 approvalLine {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n } \n }\n}`\n\nexport const ActivityThreadStatus = {\n Assigned: 'assigned',\n Started: 'started',\n Delegated: 'delegated',\n Ended: 'ended',\n Aborted: 'aborted'\n}\n\n@customElement('activity-approval-page')\nexport class ActivityApprovalPage extends connect(store)(localize(i18next)(PageView)) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\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: flex;\n padding: 5px;\n }\n\n [header] > div {\n flex: 1;\n }\n\n [content] {\n clear: left;\n\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 }) activityApproval: any\n @property({ type: Object }) activityThread: any\n @property({ type: Object }) board: any\n\n get context() {\n const judgment = this.activityApproval.judgment\n\n return {\n title: this.lifecycle?.params?.['title'] || i18next.t('title.activity-approval'),\n help: 'worklist/activity-approval',\n actions: judgment\n ? []\n : [\n {\n title: i18next.t('button.reject'),\n action: this._rejectActivityApproval.bind(this),\n ...CommonButtonStyles.play\n },\n\n {\n title: i18next.t('button.approve'),\n action: this._approveActivityApproval.bind(this),\n ...CommonButtonStyles.save\n },\n\n {\n title: i18next.t('button.save'),\n action: this._saveActivityApproval.bind(this),\n ...CommonButtonStyles.save\n }\n ]\n }\n }\n\n render() {\n const { state, dueAt, assignedAt, assignee, activityInstance } = this.activityThread || {}\n const { name, description, thumbnail, approvalLine } = activityInstance || {}\n\n return html`\n <div header>\n <div>\n <div>name: ${name}</div>\n <div>description: ${description}</div>\n <div>state: ${state}</div>\n <div>assigned at: ${assignedAt && formatter.format(new Date(assignedAt))}</div>\n <div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>\n <div>assignee: ${assignee?.name}</div>\n </div>\n <div>\n <div approval-line>\n ${approvalLine ? html` <approval-line-view .model=${approvalLine}></approval-line-view> ` : html``}\n </div>\n <img src=${thumbnail} />\n </div>\n </div>\n\n <div content>${this.activityContent()}</div>\n `\n }\n\n activityContent() {\n switch (this.activityThread?.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.activityThread?.activityInstance\n return unsafeHTML(template)\n }\n\n getInputSpec() {\n const model = this.activityThread?.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'in' || item.inout === 'inout')\n .map(item => {\n return {\n ...item,\n label: item.name\n }\n })\n }\n\n getOutputSpec() {\n const model = this.activityThread?.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'inout' || item.inout === 'out')\n .map(item => {\n return {\n ...item,\n label: item.name\n }\n })\n }\n\n generatedContent() {\n var { output, activityInstance } = this.activityThread || {}\n var { input } = 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 keyed(\n activityInstance.id,\n html`\n <fieldset>\n <legend>Input</legend>\n <ox-properties-dynamic-view\n data-name=\"input\"\n .props=${inputSpec}\n .value=${input}\n ></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.activityApproval.output = e.currentTarget.value)}\n ></ox-properties-dynamic-view>\n </fieldset>\n `\n )\n }\n\n boardContent() {\n const { output, activityInstance } = this.activityThread\n const { uiSource: boardId, input } = activityInstance || {}\n\n if (!this.board || this.board.id !== boardId) {\n this.board = {\n id: boardId\n }\n }\n\n return keyed(\n activityInstance.id,\n 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\n @query('ox-board-viewer') oxBoardViewer: any\n\n getOutputFromBoard() {\n const outputSpec = this.getOutputSpec()\n const data = this.oxBoardViewer.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('activityApproval')) {\n this.updateContext()\n }\n }\n\n async pageUpdated(changes, lifecycle, changedBefore) {\n if (this.active) {\n this.fetchActivityApproval(lifecycle.resourceId)\n }\n }\n\n async fetchActivityApproval(id) {\n const response = await client.query({\n query: gql`\n query activityApproval($id: String!) {\n activityApproval(id: $id) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id\n }\n })\n\n this.activityApproval = response.data.activityApproval\n this.activityThread = this.activityApproval.activityThread\n }\n\n async _rejectActivityApproval() {\n var { id } = this.activityApproval\n var comment = 'xxxxxxxxxxxxxxxxxxx'\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $comment: String!) {\n rejectActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id,\n comment\n }\n })\n\n if (!response.errors) {\n this.activityApproval = response.data.startActivityApproval\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_rejected_successfully')\n }\n })\n )\n }\n }\n\n async _approveActivityApproval() {\n var { id } = this.activityApproval\n var comment = 'xxxxxxxxxxxxxxxxxxx'\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $comment: String!) {\n approveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id,\n comment\n }\n })\n\n if (!response.errors) {\n this.activityApproval = response.data.approveActivityApproval\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_approved_successfully')\n }\n })\n )\n }\n }\n\n async _saveActivityApproval() {\n var { id } = this.activityApproval\n var comment = 'yyyyyyyyyyyyyyyyyyy'\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $comment: String) {\n saveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id,\n comment\n }\n })\n\n if (!response.errors) {\n this.activityApproval = response.data.saveActivityApproval\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_saved_successfully')\n }\n })\n )\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"activity-approval-page.js","sourceRoot":"","sources":["../../../client/pages/activity-approval/activity-approval-page.ts"],"names":[],"mappings":";AAAA,OAAO,wDAAwD,CAAA;AAC/D,OAAO,mCAAmC,CAAA;AAC1C,OAAO,8BAA8B,CAAA;AAErC,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,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAEnD,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAA;AAExG,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0DlC,CAAA;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;I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CAAC,aAAa,CACpB,IAAI,WAAW,CAAC,QAAQ,EAAE;gBACxB,MAAM,EAAE;oBACN,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,iCAAiC,CAAC;iBACtD;aACF,CAAC,CACH,CAAA;SACF;IACH,CAAC;;AArVM,2BAAM,GAAG;IACd,eAAe;IACf,iBAAiB;IACjB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8DAAsB;AACjD;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4DAAoB;AAC/C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAAW;AAiLtC;IAAC,KAAK,CAAC,iBAAiB,CAAC;;2DAAmB;AAzNjC,oBAAoB;IADhC,aAAa,CAAC,wBAAwB,CAAC;GAC3B,oBAAoB,CAuVhC;SAvVY,oBAAoB","sourcesContent":["import '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@operato/board/ox-board-viewer.js'\nimport '@things-factory/organization'\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 { keyed } from 'lit/directives/keyed.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { PageView, store } from '@operato/shell'\nimport { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { provider } from '@things-factory/board-ui'\n\nconst formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' })\n\nconst ActivityApprovalFetchResult = `\\\n{\n id\n judgment\n comment\n approver {\n id\n name\n }\n round\n order\n createdAt\n activityThread {\n state\n dueAt\n assignedAt\n assignee {\n id\n name\n }\n output\n activityInstance {\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 approvalLine {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n } \n }\n}`\n\nexport const ActivityThreadStatus = {\n Assigned: 'assigned',\n Started: 'started',\n Delegated: 'delegated',\n Ended: 'ended',\n Aborted: 'aborted'\n}\n\n@customElement('activity-approval-page')\nexport class ActivityApprovalPage extends connect(store)(localize(i18next)(PageView)) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\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: flex;\n padding: 5px;\n }\n\n [header] > div {\n flex: 1;\n }\n\n [content] {\n clear: left;\n\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 }) activityApproval: any\n @property({ type: Object }) activityThread: any\n @property({ type: Object }) board: any\n\n get context() {\n const judgment = this.activityApproval?.judgment\n\n return {\n title: this.lifecycle?.params?.['title'] || i18next.t('title.activity-approval'),\n help: 'worklist/activity-approval',\n actions: judgment\n ? []\n : [\n {\n title: i18next.t('button.reject'),\n action: this._rejectActivityApproval.bind(this),\n ...CommonButtonStyles.play\n },\n\n {\n title: i18next.t('button.approve'),\n action: this._approveActivityApproval.bind(this),\n ...CommonButtonStyles.save\n },\n\n {\n title: i18next.t('button.save'),\n action: this._saveActivityApproval.bind(this),\n ...CommonButtonStyles.save\n }\n ]\n }\n }\n\n render() {\n const { round, order, approver, createdAt } = this.activityApproval || {}\n const { state, dueAt, assignedAt, assignee, activityInstance } = this.activityThread || {}\n const { name, description, thumbnail, approvalLine } = activityInstance || {}\n\n return html`\n <div header>\n <div>\n <div>name: ${name}</div>\n <div>description: ${description}</div>\n <div>state: ${state}</div>\n <div>round: ${round}</div>\n <div>order: ${order}</div>\n <div>assigned at: ${assignedAt && formatter.format(new Date(assignedAt))}</div>\n <div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>\n <div>assignee: ${assignee?.name}</div>\n <div>approver: ${approver?.name}</div>\n <div>waited since: ${createdAt && formatter.format(new Date(createdAt))}</div>\n </div>\n <div>\n <div approval-line>\n ${approvalLine\n ? html` <approval-line-view .model=${approvalLine} .current=${order}></approval-line-view> `\n : html``}\n </div>\n <img src=${thumbnail} />\n </div>\n </div>\n\n <div content>${this.activityContent()}</div>\n `\n }\n\n activityContent() {\n switch (this.activityThread?.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.activityThread?.activityInstance\n return unsafeHTML(template)\n }\n\n getInputSpec() {\n const model = this.activityThread?.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'in' || item.inout === 'inout')\n .map(item => {\n return {\n ...item,\n label: item.name\n }\n })\n }\n\n getOutputSpec() {\n const model = this.activityThread?.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'inout' || item.inout === 'out')\n .map(item => {\n return {\n ...item,\n label: item.name\n }\n })\n }\n\n generatedContent() {\n var { output, activityInstance } = this.activityThread || {}\n var { input } = 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 keyed(\n activityInstance.id,\n html`\n <fieldset>\n <legend>Input</legend>\n <ox-properties-dynamic-view\n data-name=\"input\"\n .props=${inputSpec}\n .value=${input}\n ></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.activityApproval.output = e.currentTarget.value)}\n ></ox-properties-dynamic-view>\n </fieldset>\n `\n )\n }\n\n boardContent() {\n const { output, activityInstance } = this.activityThread\n const { uiSource: boardId, input } = activityInstance || {}\n\n if (!this.board || this.board.id !== boardId) {\n this.board = {\n id: boardId\n }\n }\n\n return keyed(\n activityInstance.id,\n 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\n @query('ox-board-viewer') oxBoardViewer: any\n\n getOutputFromBoard() {\n const outputSpec = this.getOutputSpec()\n const data = this.oxBoardViewer.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('activityApproval')) {\n this.updateContext()\n }\n }\n\n async pageUpdated(changes, lifecycle, changedBefore) {\n if (this.active) {\n this.fetchActivityApproval(lifecycle.resourceId)\n }\n }\n\n async fetchActivityApproval(id) {\n const response = await client.query({\n query: gql`\n query activityApproval($id: String!) {\n activityApproval(id: $id) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id\n }\n })\n\n this.activityApproval = response.data.activityApproval\n this.activityThread = this.activityApproval.activityThread\n }\n\n async _rejectActivityApproval() {\n var { id } = this.activityApproval\n var comment = 'xxxxxxxxxxxxxxxxxxx'\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $comment: String!) {\n rejectActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id,\n comment\n }\n })\n\n if (!response.errors) {\n this.activityApproval = response.data.rejectActivityApproval\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_rejected_successfully')\n }\n })\n )\n }\n }\n\n async _approveActivityApproval() {\n var { id } = this.activityApproval\n var comment = 'xxxxxxxxxxxxxxxxxxx'\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $comment: String!) {\n approveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id,\n comment\n }\n })\n\n if (!response.errors) {\n this.activityApproval = response.data.approveActivityApproval\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_approved_successfully')\n }\n })\n )\n }\n }\n\n async _saveActivityApproval() {\n var { id } = this.activityApproval\n var comment = 'yyyyyyyyyyyyyyyyyyy'\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $comment: String) {\n saveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id,\n comment\n }\n })\n\n if (!response.errors) {\n this.activityApproval = response.data.saveActivityApproval\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_saved_successfully')\n }\n })\n )\n }\n }\n}\n"]}
|
|
@@ -6,6 +6,7 @@ export declare const ActivityThreadStatus: {
|
|
|
6
6
|
Assigned: string;
|
|
7
7
|
Started: string;
|
|
8
8
|
Delegated: string;
|
|
9
|
+
Rejected: string;
|
|
9
10
|
Ended: string;
|
|
10
11
|
Aborted: string;
|
|
11
12
|
};
|
|
@@ -48,7 +49,10 @@ export declare class ActivityThreadPage extends ActivityThreadPage_base {
|
|
|
48
49
|
pageUpdated(changes: any, lifecycle: any, changedBefore: any): Promise<void>;
|
|
49
50
|
fetchActivityThread(id: any): Promise<void>;
|
|
50
51
|
_startActivityThread(): Promise<void>;
|
|
52
|
+
_restartActivityThread(): Promise<void>;
|
|
53
|
+
_delegateActivityThread(): Promise<void>;
|
|
51
54
|
_saveActivityThread(): Promise<void>;
|
|
52
55
|
_submitActivityThread(): Promise<void>;
|
|
56
|
+
_abortActivityThread(): Promise<void>;
|
|
53
57
|
}
|
|
54
58
|
export {};
|
|
@@ -25,6 +25,7 @@ const ActivityThreadFetchResult = `\
|
|
|
25
25
|
name
|
|
26
26
|
}
|
|
27
27
|
output
|
|
28
|
+
round
|
|
28
29
|
activityInstance {
|
|
29
30
|
id
|
|
30
31
|
name
|
|
@@ -66,27 +67,35 @@ export const ActivityThreadStatus = {
|
|
|
66
67
|
Assigned: 'assigned',
|
|
67
68
|
Started: 'started',
|
|
68
69
|
Delegated: 'delegated',
|
|
70
|
+
Rejected: 'rejected',
|
|
69
71
|
Ended: 'ended',
|
|
70
72
|
Aborted: 'aborted'
|
|
71
73
|
};
|
|
72
74
|
let ActivityThreadPage = class ActivityThreadPage extends connect(store)(localize(i18next)(PageView)) {
|
|
73
75
|
get context() {
|
|
74
|
-
var _a, _b, _c
|
|
75
|
-
const
|
|
76
|
-
const
|
|
76
|
+
var _a, _b, _c;
|
|
77
|
+
const state = (_a = this.activityThread) === null || _a === void 0 ? void 0 : _a.state;
|
|
78
|
+
const startable = [ActivityThreadStatus.Assigned].includes(state);
|
|
79
|
+
const endable = [ActivityThreadStatus.Started].includes(state);
|
|
77
80
|
const savable = endable;
|
|
81
|
+
const restartable = [ActivityThreadStatus.Rejected].includes(state);
|
|
82
|
+
const delegatable = [ActivityThreadStatus.Assigned, ActivityThreadStatus.Started].includes(state);
|
|
83
|
+
const abortable = [ActivityThreadStatus.Assigned, ActivityThreadStatus.Started].includes(state);
|
|
78
84
|
return {
|
|
79
|
-
title: ((
|
|
85
|
+
title: ((_c = (_b = this.lifecycle) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c['title']) || i18next.t('title.activity'),
|
|
80
86
|
help: 'worklist/activity',
|
|
81
87
|
actions: [
|
|
82
88
|
startable && Object.assign({ title: i18next.t('button.start'), action: this._startActivityThread.bind(this) }, CommonButtonStyles.play),
|
|
83
89
|
savable && Object.assign({ title: i18next.t('button.save'), action: this._saveActivityThread.bind(this) }, CommonButtonStyles.save),
|
|
84
|
-
endable && Object.assign({ title: i18next.t('button.submit'), action: this._submitActivityThread.bind(this) }, CommonButtonStyles.save)
|
|
90
|
+
endable && Object.assign({ title: i18next.t('button.submit'), action: this._submitActivityThread.bind(this) }, CommonButtonStyles.save),
|
|
91
|
+
delegatable && Object.assign({ title: i18next.t('button.delegate'), action: this._delegateActivityThread.bind(this) }, CommonButtonStyles.save),
|
|
92
|
+
restartable && Object.assign({ title: i18next.t('button.restart'), action: this._restartActivityThread.bind(this) }, CommonButtonStyles.save),
|
|
93
|
+
abortable && Object.assign({ title: i18next.t('button.abort'), action: this._abortActivityThread.bind(this) }, CommonButtonStyles.cancel)
|
|
85
94
|
].filter(Boolean /* truthy only */)
|
|
86
95
|
};
|
|
87
96
|
}
|
|
88
97
|
render() {
|
|
89
|
-
const { state, dueAt, assignedAt, assignee, activityInstance } = this.activityThread || {};
|
|
98
|
+
const { state, round, dueAt, assignedAt, assignee, activityInstance } = this.activityThread || {};
|
|
90
99
|
const { name, description, thumbnail, approvalLine } = activityInstance || {};
|
|
91
100
|
return html `
|
|
92
101
|
<div header>
|
|
@@ -94,6 +103,7 @@ let ActivityThreadPage = class ActivityThreadPage extends connect(store)(localiz
|
|
|
94
103
|
<div>name: ${name}</div>
|
|
95
104
|
<div>description: ${description}</div>
|
|
96
105
|
<div>state: ${state}</div>
|
|
106
|
+
<div>round: ${round}</div>
|
|
97
107
|
<div>assigned at: ${assignedAt && formatter.format(new Date(assignedAt))}</div>
|
|
98
108
|
<div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>
|
|
99
109
|
<div>assignee: ${assignee === null || assignee === void 0 ? void 0 : assignee.name}</div>
|
|
@@ -257,6 +267,35 @@ let ActivityThreadPage = class ActivityThreadPage extends connect(store)(localiz
|
|
|
257
267
|
}));
|
|
258
268
|
}
|
|
259
269
|
}
|
|
270
|
+
async _restartActivityThread() {
|
|
271
|
+
var { id, output, activityInstance } = this.activityThread;
|
|
272
|
+
var { uiType } = activityInstance;
|
|
273
|
+
if (uiType === 'board') {
|
|
274
|
+
output = this.getOutputFromBoard();
|
|
275
|
+
}
|
|
276
|
+
const response = await client.mutate({
|
|
277
|
+
mutation: gql `
|
|
278
|
+
mutation ($id: String!, $output: Object) {
|
|
279
|
+
restartActivityThread(id: $id, output: $output) ${ActivityThreadFetchResult}
|
|
280
|
+
}
|
|
281
|
+
`,
|
|
282
|
+
variables: {
|
|
283
|
+
id,
|
|
284
|
+
output
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
if (!response.errors) {
|
|
288
|
+
this.activityThread = response.data.restartActivityThread;
|
|
289
|
+
document.dispatchEvent(new CustomEvent('notify', {
|
|
290
|
+
detail: {
|
|
291
|
+
message: i18next.t('text.task_is_restarted_successfully')
|
|
292
|
+
}
|
|
293
|
+
}));
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
async _delegateActivityThread() {
|
|
297
|
+
throw 'not implemented yet';
|
|
298
|
+
}
|
|
260
299
|
async _saveActivityThread() {
|
|
261
300
|
var { id, output, reason, activityInstance } = this.activityThread;
|
|
262
301
|
var { uiType } = activityInstance || {};
|
|
@@ -312,6 +351,28 @@ let ActivityThreadPage = class ActivityThreadPage extends connect(store)(localiz
|
|
|
312
351
|
}));
|
|
313
352
|
}
|
|
314
353
|
}
|
|
354
|
+
async _abortActivityThread() {
|
|
355
|
+
var { id, reason } = this.activityThread;
|
|
356
|
+
const response = await client.mutate({
|
|
357
|
+
mutation: gql `
|
|
358
|
+
mutation ($id: String!, $reason: String) {
|
|
359
|
+
abortActivityThread(id: $id, reason: $reason) ${ActivityThreadFetchResult}
|
|
360
|
+
}
|
|
361
|
+
`,
|
|
362
|
+
variables: {
|
|
363
|
+
id,
|
|
364
|
+
reason
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
if (!response.errors) {
|
|
368
|
+
this.activityThread = response.data.abortActivityThread;
|
|
369
|
+
document.dispatchEvent(new CustomEvent('notify', {
|
|
370
|
+
detail: {
|
|
371
|
+
message: i18next.t('text.task_is_aborted_successfully')
|
|
372
|
+
}
|
|
373
|
+
}));
|
|
374
|
+
}
|
|
375
|
+
}
|
|
315
376
|
};
|
|
316
377
|
ActivityThreadPage.styles = [
|
|
317
378
|
ScrollbarStyles,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity-thread-page.js","sourceRoot":"","sources":["../../../client/pages/activity-thread/activity-thread-page.ts"],"names":[],"mappings":";AAAA,OAAO,wDAAwD,CAAA;AAC/D,OAAO,mCAAmC,CAAA;AAC1C,OAAO,8BAA8B,CAAA;AAErC,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,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAEnD,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAA;AAExG,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+ChC,CAAA;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,S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AM,KAAK,OAAO,EAAE;YACtB,MAAM,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAA;SACnC;QAED,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;4EAEyD,yBAAyB;;OAE9F;YACD,SAAS,EAAE;gBACT,EAAE;gBACF,MAAM;gBACN,MAAM;aACP;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;YACpB,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC,IAAI,CAAC,oBAAoB,CAAA;YAExD,QAAQ,CAAC,aAAa,CACpB,IAAI,WAAW,CAAC,QAAQ,EAAE;gBACxB,MAAM,EAAE;oBACN,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,oCAAoC,CAAC;iBACzD;aACF,CAAC,CACH,CAAA;SACF;IACH,CAAC;;AA5VM,yBAAM,GAAG;IACd,eAAe;IACf,iBAAiB;IACjB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0DAAoB;AAC/C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAW;AA2KtC;IAAC,KAAK,CAAC,iBAAiB,CAAC;;yDAAmB;AAlNjC,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CA8V9B;SA9VY,kBAAkB","sourcesContent":["import '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@operato/board/ox-board-viewer.js'\nimport '@things-factory/organization'\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 { keyed } from 'lit/directives/keyed.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { PageView, store } from '@operato/shell'\nimport { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { provider } from '@things-factory/board-ui'\n\nconst formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' })\n\nconst ActivityThreadFetchResult = `\\\n{\n id\n state\n dueAt\n assignedAt\n assignee {\n id\n name\n }\n output\n activityInstance {\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 approvalLine {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n }\n}`\n\nexport const ActivityThreadStatus = {\n Assigned: 'assigned',\n Started: 'started',\n Delegated: 'delegated',\n Ended: 'ended',\n Aborted: 'aborted'\n}\n\n@customElement('activity-thread-page')\nexport class ActivityThreadPage extends connect(store)(localize(i18next)(PageView)) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\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: flex;\n padding: 5px;\n }\n\n [header] > div {\n flex: 1;\n }\n\n [content] {\n clear: left;\n\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 }) activityThread: any\n @property({ type: Object }) board: any\n\n get context() {\n const startable = [ActivityThreadStatus.Assigned].includes(this.activityThread?.state)\n\n const endable = [ActivityThreadStatus.Started].includes(this.activityThread?.state)\n const savable = endable\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.start'),\n action: this._startActivityThread.bind(this),\n ...CommonButtonStyles.play\n },\n\n savable && {\n title: i18next.t('button.save'),\n action: this._saveActivityThread.bind(this),\n ...CommonButtonStyles.save\n },\n\n endable && {\n title: i18next.t('button.submit'),\n action: this._submitActivityThread.bind(this),\n ...CommonButtonStyles.save\n }\n ].filter(Boolean /* truthy only */)\n }\n }\n\n render() {\n const { state, dueAt, assignedAt, assignee, activityInstance } = this.activityThread || {}\n const { name, description, thumbnail, approvalLine } = activityInstance || {}\n\n return html`\n <div header>\n <div>\n <div>name: ${name}</div>\n <div>description: ${description}</div>\n <div>state: ${state}</div>\n <div>assigned at: ${assignedAt && formatter.format(new Date(assignedAt))}</div>\n <div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>\n <div>assignee: ${assignee?.name}</div>\n </div>\n <div>\n <div approval-line>\n ${approvalLine ? html` <approval-line-view .model=${approvalLine}></approval-line-view> ` : html``}\n </div>\n <img src=${thumbnail} />\n </div>\n </div>\n\n <div content>${this.activityContent()}</div>\n `\n }\n\n activityContent() {\n switch (this.activityThread?.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.activityThread?.activityInstance\n return unsafeHTML(template)\n }\n\n getInputSpec() {\n const model = this.activityThread?.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'in' || item.inout === 'inout')\n .map(item => {\n return {\n ...item,\n label: item.name\n }\n })\n }\n\n getOutputSpec() {\n const model = this.activityThread?.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'inout' || item.inout === 'out')\n .map(item => {\n return {\n ...item,\n label: item.name\n }\n })\n }\n\n generatedContent() {\n var { output, activityInstance } = this.activityThread || {}\n var { input } = 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 keyed(\n activityInstance.id,\n html`\n <fieldset>\n <legend>Input</legend>\n <ox-properties-dynamic-view\n data-name=\"input\"\n .props=${inputSpec}\n .value=${input}\n ></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.activityThread.output = e.currentTarget.value)}\n ></ox-properties-dynamic-view>\n </fieldset>\n `\n )\n }\n\n boardContent() {\n const { output, activityInstance } = this.activityThread\n const { uiSource: boardId, input } = activityInstance || {}\n\n if (!this.board || this.board.id !== boardId) {\n this.board = {\n id: boardId\n }\n }\n\n return keyed(\n activityInstance.id,\n 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\n @query('ox-board-viewer') oxBoardViewer: any\n\n getOutputFromBoard() {\n const outputSpec = this.getOutputSpec()\n const data = this.oxBoardViewer.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('activityThread')) {\n this.updateContext()\n }\n }\n\n async pageUpdated(changes, lifecycle, changedBefore) {\n if (this.active) {\n this.fetchActivityThread(lifecycle.resourceId)\n }\n }\n\n async fetchActivityThread(id) {\n const response = await client.query({\n query: gql`\n query activityThread($id: String!) {\n activityThread(id: $id) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id\n }\n })\n\n this.activityThread = response.data.activityThread\n }\n\n async _startActivityThread() {\n var { id, output, reason, activityInstance } = this.activityThread\n var { uiType } = activityInstance\n\n if (uiType === 'board') {\n output = this.getOutputFromBoard()\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $output: Object) {\n startActivityThread(id: $id, output: $output) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id,\n output\n }\n })\n\n if (!response.errors) {\n this.activityThread = response.data.startActivityThread\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_started_successfully')\n }\n })\n )\n }\n }\n\n async _saveActivityThread() {\n var { id, output, reason, activityInstance } = this.activityThread\n var { uiType } = activityInstance || {}\n\n if (uiType === 'board') {\n output = this.getOutputFromBoard()\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $save: ActivityThreadSave!) {\n saveActivityThread(id: $id, save: $save) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id,\n save: {\n output\n }\n }\n })\n\n if (!response.errors) {\n this.activityThread = response.data.saveActivityThread\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_saved_successfully')\n }\n })\n )\n }\n }\n\n async _submitActivityThread() {\n var { id, output, reason, activityInstance } = this.activityThread\n var { uiType } = activityInstance || {}\n\n if (uiType === 'board') {\n output = this.getOutputFromBoard()\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $output: Object, $reason: String) {\n submitActivityThread(id: $id, output: $output, reason: $reason) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id,\n output,\n reason\n }\n })\n\n if (!response.errors) {\n this.activityThread = response.data.submitActivityThread\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_finished_successfully')\n }\n })\n )\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"activity-thread-page.js","sourceRoot":"","sources":["../../../client/pages/activity-thread/activity-thread-page.ts"],"names":[],"mappings":";AAAA,OAAO,wDAAwD,CAAA;AAC/D,OAAO,mCAAmC,CAAA;AAC1C,OAAO,8BAA8B,CAAA;AAErC,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,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A+BF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0DAAoB;AAC/C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAW;AAkMtC;IAAC,KAAK,CAAC,iBAAiB,CAAC;;yDAAmB;AAzOjC,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAsb9B;SAtbY,kBAAkB","sourcesContent":["import '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@operato/board/ox-board-viewer.js'\nimport '@things-factory/organization'\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 { keyed } from 'lit/directives/keyed.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { PageView, store } from '@operato/shell'\nimport { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { provider } from '@things-factory/board-ui'\n\nconst formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' })\n\nconst ActivityThreadFetchResult = `\\\n{\n id\n state\n dueAt\n assignedAt\n assignee {\n id\n name\n }\n output\n round\n activityInstance {\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 approvalLine {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n }\n}`\n\nexport const ActivityThreadStatus = {\n Assigned: 'assigned',\n Started: 'started',\n Delegated: 'delegated',\n Rejected: 'rejected',\n Ended: 'ended',\n Aborted: 'aborted'\n}\n\n@customElement('activity-thread-page')\nexport class ActivityThreadPage extends connect(store)(localize(i18next)(PageView)) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\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: flex;\n padding: 5px;\n }\n\n [header] > div {\n flex: 1;\n }\n\n [content] {\n clear: left;\n\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 }) activityThread: any\n @property({ type: Object }) board: any\n\n get context() {\n const state = this.activityThread?.state\n\n const startable = [ActivityThreadStatus.Assigned].includes(state)\n const endable = [ActivityThreadStatus.Started].includes(state)\n const savable = endable\n const restartable = [ActivityThreadStatus.Rejected].includes(state)\n const delegatable = [ActivityThreadStatus.Assigned, ActivityThreadStatus.Started].includes(state)\n const abortable = [ActivityThreadStatus.Assigned, ActivityThreadStatus.Started].includes(state)\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.start'),\n action: this._startActivityThread.bind(this),\n ...CommonButtonStyles.play\n },\n\n savable && {\n title: i18next.t('button.save'),\n action: this._saveActivityThread.bind(this),\n ...CommonButtonStyles.save\n },\n\n endable && {\n title: i18next.t('button.submit'),\n action: this._submitActivityThread.bind(this),\n ...CommonButtonStyles.save\n },\n\n delegatable && {\n title: i18next.t('button.delegate'),\n action: this._delegateActivityThread.bind(this),\n ...CommonButtonStyles.save\n },\n\n restartable && {\n title: i18next.t('button.restart'),\n action: this._restartActivityThread.bind(this),\n ...CommonButtonStyles.save\n },\n\n abortable && {\n title: i18next.t('button.abort'),\n action: this._abortActivityThread.bind(this),\n ...CommonButtonStyles.cancel\n }\n ].filter(Boolean /* truthy only */)\n }\n }\n\n render() {\n const { state, round, dueAt, assignedAt, assignee, activityInstance } = this.activityThread || {}\n const { name, description, thumbnail, approvalLine } = activityInstance || {}\n\n return html`\n <div header>\n <div>\n <div>name: ${name}</div>\n <div>description: ${description}</div>\n <div>state: ${state}</div>\n <div>round: ${round}</div>\n <div>assigned at: ${assignedAt && formatter.format(new Date(assignedAt))}</div>\n <div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>\n <div>assignee: ${assignee?.name}</div>\n </div>\n <div>\n <div approval-line>\n ${approvalLine ? html` <approval-line-view .model=${approvalLine}></approval-line-view> ` : html``}\n </div>\n <img src=${thumbnail} />\n </div>\n </div>\n\n <div content>${this.activityContent()}</div>\n `\n }\n\n activityContent() {\n switch (this.activityThread?.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.activityThread?.activityInstance\n return unsafeHTML(template)\n }\n\n getInputSpec() {\n const model = this.activityThread?.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'in' || item.inout === 'inout')\n .map(item => {\n return {\n ...item,\n label: item.name\n }\n })\n }\n\n getOutputSpec() {\n const model = this.activityThread?.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'inout' || item.inout === 'out')\n .map(item => {\n return {\n ...item,\n label: item.name\n }\n })\n }\n\n generatedContent() {\n var { output, activityInstance } = this.activityThread || {}\n var { input } = 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 keyed(\n activityInstance.id,\n html`\n <fieldset>\n <legend>Input</legend>\n <ox-properties-dynamic-view\n data-name=\"input\"\n .props=${inputSpec}\n .value=${input}\n ></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.activityThread.output = e.currentTarget.value)}\n ></ox-properties-dynamic-view>\n </fieldset>\n `\n )\n }\n\n boardContent() {\n const { output, activityInstance } = this.activityThread\n const { uiSource: boardId, input } = activityInstance || {}\n\n if (!this.board || this.board.id !== boardId) {\n this.board = {\n id: boardId\n }\n }\n\n return keyed(\n activityInstance.id,\n 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\n @query('ox-board-viewer') oxBoardViewer: any\n\n getOutputFromBoard() {\n const outputSpec = this.getOutputSpec()\n const data = this.oxBoardViewer.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('activityThread')) {\n this.updateContext()\n }\n }\n\n async pageUpdated(changes, lifecycle, changedBefore) {\n if (this.active) {\n this.fetchActivityThread(lifecycle.resourceId)\n }\n }\n\n async fetchActivityThread(id) {\n const response = await client.query({\n query: gql`\n query activityThread($id: String!) {\n activityThread(id: $id) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id\n }\n })\n\n this.activityThread = response.data.activityThread\n }\n\n async _startActivityThread() {\n var { id, output, reason, activityInstance } = this.activityThread\n var { uiType } = activityInstance\n\n if (uiType === 'board') {\n output = this.getOutputFromBoard()\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $output: Object) {\n startActivityThread(id: $id, output: $output) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id,\n output\n }\n })\n\n if (!response.errors) {\n this.activityThread = response.data.startActivityThread\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_started_successfully')\n }\n })\n )\n }\n }\n\n async _restartActivityThread() {\n var { id, output, activityInstance } = this.activityThread\n var { uiType } = activityInstance\n\n if (uiType === 'board') {\n output = this.getOutputFromBoard()\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $output: Object) {\n restartActivityThread(id: $id, output: $output) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id,\n output\n }\n })\n\n if (!response.errors) {\n this.activityThread = response.data.restartActivityThread\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_restarted_successfully')\n }\n })\n )\n }\n }\n\n async _delegateActivityThread() {\n throw 'not implemented yet'\n }\n\n async _saveActivityThread() {\n var { id, output, reason, activityInstance } = this.activityThread\n var { uiType } = activityInstance || {}\n\n if (uiType === 'board') {\n output = this.getOutputFromBoard()\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $save: ActivityThreadSave!) {\n saveActivityThread(id: $id, save: $save) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id,\n save: {\n output\n }\n }\n })\n\n if (!response.errors) {\n this.activityThread = response.data.saveActivityThread\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_saved_successfully')\n }\n })\n )\n }\n }\n\n async _submitActivityThread() {\n var { id, output, reason, activityInstance } = this.activityThread\n var { uiType } = activityInstance || {}\n\n if (uiType === 'board') {\n output = this.getOutputFromBoard()\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $output: Object, $reason: String) {\n submitActivityThread(id: $id, output: $output, reason: $reason) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id,\n output,\n reason\n }\n })\n\n if (!response.errors) {\n this.activityThread = response.data.submitActivityThread\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_finished_successfully')\n }\n })\n )\n }\n }\n\n async _abortActivityThread() {\n var { id, reason } = this.activityThread\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $reason: String) {\n abortActivityThread(id: $id, reason: $reason) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id,\n reason\n }\n })\n\n if (!response.errors) {\n this.activityThread = response.data.abortActivityThread\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_aborted_successfully')\n }\n })\n )\n }\n }\n}\n"]}
|