@things-factory/worklist 6.1.58 → 6.1.59

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 (38) hide show
  1. package/client/pages/activity-instance/activity-instance-view.ts +116 -26
  2. package/client/types/activity-approval.ts +62 -0
  3. package/client/types/activity-thread.ts +3 -36
  4. package/dist-client/pages/activity-instance/activity-instance-view.d.ts +6 -2
  5. package/dist-client/pages/activity-instance/activity-instance-view.js +95 -24
  6. package/dist-client/pages/activity-instance/activity-instance-view.js.map +1 -1
  7. package/dist-client/tsconfig.tsbuildinfo +1 -1
  8. package/dist-client/types/activity-approval.d.ts +36 -0
  9. package/dist-client/types/activity-approval.js +17 -0
  10. package/dist-client/types/activity-approval.js.map +1 -0
  11. package/dist-client/types/activity-thread.d.ts +2 -0
  12. package/dist-client/types/activity-thread.js +0 -33
  13. package/dist-client/types/activity-thread.js.map +1 -1
  14. package/dist-server/controllers/activity-approval/abort.js +1 -1
  15. package/dist-server/controllers/activity-approval/abort.js.map +1 -1
  16. package/dist-server/controllers/activity-approval/approve.js +1 -1
  17. package/dist-server/controllers/activity-approval/approve.js.map +1 -1
  18. package/dist-server/controllers/activity-approval/delegate.js +1 -1
  19. package/dist-server/controllers/activity-approval/delegate.js.map +1 -1
  20. package/dist-server/controllers/activity-approval/reject.js +1 -1
  21. package/dist-server/controllers/activity-approval/reject.js.map +1 -1
  22. package/dist-server/service/activity-thread/activity-thread-query.js +14 -0
  23. package/dist-server/service/activity-thread/activity-thread-query.js.map +1 -1
  24. package/dist-server/service/activity-thread/activity-thread.js +6 -0
  25. package/dist-server/service/activity-thread/activity-thread.js.map +1 -1
  26. package/dist-server/tsconfig.tsbuildinfo +1 -1
  27. package/package.json +3 -3
  28. package/server/controllers/activity-approval/abort.ts +1 -1
  29. package/server/controllers/activity-approval/approve.ts +1 -1
  30. package/server/controllers/activity-approval/delegate.ts +1 -1
  31. package/server/controllers/activity-approval/reject.ts +1 -1
  32. package/server/service/activity-thread/activity-thread-query.ts +11 -0
  33. package/server/service/activity-thread/activity-thread.ts +5 -0
  34. package/translations/en.json +2 -0
  35. package/translations/ja.json +2 -0
  36. package/translations/ko.json +2 -0
  37. package/translations/ms.json +2 -0
  38. package/translations/zh.json +2 -0
@@ -7,6 +7,10 @@ import { i18next, localize } from '@operato/i18n'
7
7
  import { ScrollbarStyles } from '@operato/styles'
8
8
 
9
9
  import { ActivityInstance } from '../../types/activity-instance'
10
+ import { ActivityThread } from '../../types/activity-thread'
11
+ import { ActivityApproval } from '../../types/activity-approval'
12
+
13
+ const formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' })
10
14
 
11
15
  @customElement('activity-instance-view')
12
16
  export class ActivityInstanceView extends localize(i18next)(LitElement) {
@@ -14,16 +18,8 @@ export class ActivityInstanceView extends localize(i18next)(LitElement) {
14
18
  ScrollbarStyles,
15
19
  css`
16
20
  :host {
17
- display: flex;
18
- flex-direction: column;
19
-
21
+ display: block;
20
22
  background-color: #fff;
21
- }
22
-
23
- div[content] {
24
- flex: 1;
25
-
26
- display: flex;
27
23
  overflow: auto;
28
24
  }
29
25
  `
@@ -41,13 +37,64 @@ export class ActivityInstanceView extends localize(i18next)(LitElement) {
41
37
  if (!this.activityInstance) {
42
38
  return html`<div>no activity instance info.</div>`
43
39
  }
44
- const { id, name, description, activity } = this.activityInstance
40
+ const { id, name, description, input, output, assignedAt, startedAt, activityThreads, terminatedAt, updatedAt } =
41
+ this.activityInstance
45
42
  const instance = this.activityInstance
46
43
 
47
44
  return html`
48
- <div>name: ${name}</div>
49
- <div>description: ${description}</div>
50
- ${this.renderSearchKeys()} ${this.renderInOut()}
45
+ <div>${i18next.t('field.name')}: ${name}</div>
46
+ <div>${i18next.t('field.description')}: ${description}</div>
47
+ <div>${i18next.t('field.search-keys')}: ${this.renderSearchKeys()}</div>
48
+ <div>${i18next.t('field.assigned-at')}: ${assignedAt && formatter.format(new Date(assignedAt))}</div>
49
+ <div>${i18next.t('field.started-at')}: ${startedAt && formatter.format(new Date(startedAt))}</div>
50
+ <div>${i18next.t('field.terminated-at')}: ${terminatedAt && formatter.format(new Date(terminatedAt))}</div>
51
+ <div>${i18next.t('field.updated-at')}: ${updatedAt && formatter.format(new Date(updatedAt))}</div>
52
+
53
+ ${this.renderInOut({ ...input, ...output })}
54
+ <div>실행 이력</div>
55
+ ${activityThreads?.map(activityThread => this.renderActivityThread(activityThread))}
56
+ `
57
+ }
58
+
59
+ renderActivityThread(activityThread: ActivityThread) {
60
+ const {
61
+ state,
62
+ assignee,
63
+ output,
64
+ round,
65
+ activityApprovals = [],
66
+ assignedAt,
67
+ startedAt,
68
+ terminatedAt
69
+ } = activityThread
70
+ const { name, email } = assignee || {}
71
+
72
+ return html`
73
+ <div>${i18next.t('field.assignee')}: ${name}</div>
74
+ <div>${i18next.t('field.round')}: ${round}</div>
75
+ <div>${i18next.t('field.output')}: ${this.renderInOut(output)}</div>
76
+ <div>${i18next.t('field.assigned-at')}: ${assignedAt && formatter.format(new Date(assignedAt))}</div>
77
+ <div>${i18next.t('field.started-at')}: ${startedAt && formatter.format(new Date(startedAt))}</div>
78
+ <div>${i18next.t('field.terminated-at')}: ${terminatedAt && formatter.format(new Date(terminatedAt))}</div>
79
+
80
+ ${activityApprovals
81
+ .sort((a, b) => (a.round > b.round ? 1 : a.round < b.round ? -1 : a.order! > b.order! ? 1 : -1))
82
+ .map(approval => this.renderActivityApproval(approval))}
83
+ `
84
+ }
85
+
86
+ renderActivityApproval(activityApproval: ActivityApproval) {
87
+ const { judgment, approver, comment, round, order, createdAt, terminatedAt } = activityApproval
88
+ const { name, email } = approver || {}
89
+
90
+ return html`
91
+ <div>${i18next.t('field.approver')}: ${name}</div>
92
+ <div>${i18next.t('field.judgment')}: ${judgment}</div>
93
+ <div>${i18next.t('field.comment')}: ${comment}</div>
94
+ <div>${i18next.t('field.round')}: ${round}</div>
95
+ <div>${i18next.t('field.order')}: ${order}</div>
96
+ <div>${i18next.t('field.started-at')}: ${createdAt && formatter.format(new Date(createdAt))}</div>
97
+ <div>${i18next.t('field.terminated-at')}: ${terminatedAt && formatter.format(new Date(terminatedAt))}</div>
51
98
  `
52
99
  }
53
100
 
@@ -55,23 +102,44 @@ export class ActivityInstanceView extends localize(i18next)(LitElement) {
55
102
  const { activity } = this.activityInstance!
56
103
  const { searchKeys = [] } = activity! || {}
57
104
 
58
- return searchKeys?.map(
59
- (item, index) => html` <div>${i18next.t(String(item.tKey))}: ${this.activityInstance![`key0${index + 1}`]}</div> `
60
- )
105
+ return html`
106
+ <table>
107
+ <tr>
108
+ <th>${i18next.t('label.name')}</th>
109
+ <th>${i18next.t('label.value')}</th>
110
+ </tr>
111
+
112
+ ${searchKeys?.map(
113
+ (item, index) => html`
114
+ <tr>
115
+ <td>${item.tKey ? i18next.t(item.tKey) : item.name}</td>
116
+ <td>${this.activityInstance![`key0${index + 1}`]}</td>
117
+ </tr>
118
+ `
119
+ )}
120
+ </table>
121
+ `
61
122
  }
62
123
 
63
- renderInOut() {
64
- const { input, output } = this.activityInstance!
124
+ renderInOut(data) {
125
+ const { input, output, activity } = this.activityInstance!
126
+ const { model } = activity || {}
65
127
 
66
128
  return html`
67
- <div>
68
- input:
69
- <pre>${JSON.stringify(input, null, 2)}</pre>
70
- </div>
71
- <div>
72
- output:
73
- <pre>${JSON.stringify(output, null, 2)}</pre>
74
- </div>
129
+ <table>
130
+ <tr>
131
+ <th>${i18next.t('label.name')}</th>
132
+ <th>${i18next.t('label.value')}</th>
133
+ </tr>
134
+ ${model?.map(
135
+ item => html`
136
+ <tr>
137
+ <td>${item.name}</td>
138
+ <td>${item.tag ? data[item.tag] : ''}</td>
139
+ </tr>
140
+ `
141
+ )}
142
+ </table>
75
143
  `
76
144
  }
77
145
 
@@ -108,6 +176,18 @@ export class ActivityInstanceView extends localize(i18next)(LitElement) {
108
176
  inputKey
109
177
  tKey
110
178
  }
179
+ model {
180
+ name
181
+ description
182
+ active
183
+ tag
184
+ inout
185
+ type
186
+ unit
187
+ options
188
+ quantifier
189
+ spec
190
+ }
111
191
  }
112
192
  activityThreads {
113
193
  state
@@ -119,6 +199,16 @@ export class ActivityInstanceView extends localize(i18next)(LitElement) {
119
199
  email
120
200
  }
121
201
  round
202
+ activityApprovals {
203
+ round
204
+ order
205
+ approver {
206
+ name
207
+ email
208
+ }
209
+ judgment
210
+ comment
211
+ }
122
212
  assignedAt
123
213
  startedAt
124
214
  terminatedAt
@@ -0,0 +1,62 @@
1
+ import { Domain, User } from '@operato/shell'
2
+
3
+ import { ActivityThread } from './activity-thread'
4
+
5
+ export enum ActivityApprovalJudgment {
6
+ Pending = '',
7
+ Rejected = 'rejected',
8
+ Escalated = 'escalated',
9
+ Delegated = 'delegated',
10
+ Approved = 'approved',
11
+ Aborted = 'aborted'
12
+ }
13
+
14
+ export class ActivityApproval {
15
+ id?: string
16
+
17
+ domain?: Domain
18
+
19
+ domainId?: string
20
+
21
+ originalApproval?: ActivityApproval
22
+
23
+ originalApprovalId?: string
24
+
25
+ derivedApprovals?: ActivityApproval
26
+
27
+ activityThread?: ActivityThread
28
+
29
+ activityThreadId?: string
30
+
31
+ round: number = 1
32
+
33
+ order?: number = 0
34
+
35
+ approver?: User
36
+
37
+ approverId?: string
38
+
39
+ judgment?: ActivityApprovalJudgment = ActivityApprovalJudgment.Pending
40
+
41
+ comment?: string
42
+
43
+ transaction?: string
44
+
45
+ createdAt?: Date
46
+
47
+ updatedAt?: Date
48
+
49
+ terminatedAt?: Date
50
+
51
+ creator?: User
52
+
53
+ creatorId?: string
54
+
55
+ updater?: User
56
+
57
+ updaterId?: string
58
+
59
+ terminator?: User
60
+
61
+ terminatorId?: string
62
+ }
@@ -1,6 +1,7 @@
1
1
  import { Domain, User } from '@operato/shell'
2
2
 
3
3
  import { ActivityInstance } from './activity-instance'
4
+ import { ActivityApproval } from './activity-approval'
4
5
 
5
6
  export enum ActivityThreadStatus {
6
7
  Assigned = 'assigned',
@@ -22,6 +23,8 @@ export class ActivityThread {
22
23
 
23
24
  activityInstance?: ActivityInstance
24
25
 
26
+ activityApprovals?: ActivityApproval[]
27
+
25
28
  state?: ActivityThreadStatus
26
29
 
27
30
  output?: { [key: string]: any }
@@ -49,40 +52,4 @@ export class ActivityThread {
49
52
  updater?: User
50
53
 
51
54
  terminator?: User
52
-
53
- // isPendingStarted(): boolean {
54
- // switch (this.state) {
55
- // case ActivityThreadStatus.Assigned:
56
- // return true
57
- // default:
58
- // return false
59
- // }
60
- // }
61
-
62
- // isPendingEnded(): boolean {
63
- // switch (this.state) {
64
- // case ActivityThreadStatus.Started:
65
- // case ActivityThreadStatus.Rejected:
66
- // case ActivityThreadStatus.Submitted:
67
- // case ActivityThreadStatus.Escalated:
68
- // return true
69
- // default:
70
- // return false
71
- // }
72
- // }
73
-
74
- // isValid(): boolean {
75
- // switch (this.state) {
76
- // case ActivityThreadStatus.Assigned:
77
- // case ActivityThreadStatus.Started:
78
- // case ActivityThreadStatus.Ended:
79
- // case ActivityThreadStatus.Rejected:
80
- // case ActivityThreadStatus.Escalated:
81
- // case ActivityThreadStatus.Aborted:
82
- // case ActivityThreadStatus.Submitted:
83
- // return true
84
- // default:
85
- // return false
86
- // }
87
- // }
88
55
  }
@@ -1,13 +1,17 @@
1
1
  import { LitElement } from 'lit';
2
2
  import { ActivityInstance } from '../../types/activity-instance';
3
+ import { ActivityThread } from '../../types/activity-thread';
4
+ import { ActivityApproval } from '../../types/activity-approval';
3
5
  declare const ActivityInstanceView_base: (new (...args: any[]) => LitElement) & typeof LitElement;
4
6
  export declare class ActivityInstanceView extends ActivityInstanceView_base {
5
7
  static styles: import("lit").CSSResult[];
6
8
  activityInstanceId?: string;
7
9
  activityInstance?: ActivityInstance;
8
10
  render(): import("lit-html").TemplateResult<1>;
9
- renderSearchKeys(): import("lit-html").TemplateResult<1>[];
10
- renderInOut(): import("lit-html").TemplateResult<1>;
11
+ renderActivityThread(activityThread: ActivityThread): import("lit-html").TemplateResult<1>;
12
+ renderActivityApproval(activityApproval: ActivityApproval): import("lit-html").TemplateResult<1>;
13
+ renderSearchKeys(): import("lit-html").TemplateResult<1>;
14
+ renderInOut(data: any): import("lit-html").TemplateResult<1>;
11
15
  updated(changes: any): void;
12
16
  fetchActivityInstance(): Promise<void>;
13
17
  }
@@ -6,35 +6,92 @@ import { client } from '@operato/graphql';
6
6
  import { i18next, localize } from '@operato/i18n';
7
7
  import { ScrollbarStyles } from '@operato/styles';
8
8
  import { ActivityInstance } from '../../types/activity-instance';
9
+ const formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' });
9
10
  let ActivityInstanceView = class ActivityInstanceView extends localize(i18next)(LitElement) {
10
11
  render() {
11
12
  if (!this.activityInstance) {
12
13
  return html `<div>no activity instance info.</div>`;
13
14
  }
14
- const { id, name, description, activity } = this.activityInstance;
15
+ const { id, name, description, input, output, assignedAt, startedAt, activityThreads, terminatedAt, updatedAt } = this.activityInstance;
15
16
  const instance = this.activityInstance;
16
17
  return html `
17
- <div>name: ${name}</div>
18
- <div>description: ${description}</div>
19
- ${this.renderSearchKeys()} ${this.renderInOut()}
18
+ <div>${i18next.t('field.name')}: ${name}</div>
19
+ <div>${i18next.t('field.description')}: ${description}</div>
20
+ <div>${i18next.t('field.search-keys')}: ${this.renderSearchKeys()}</div>
21
+ <div>${i18next.t('field.assigned-at')}: ${assignedAt && formatter.format(new Date(assignedAt))}</div>
22
+ <div>${i18next.t('field.started-at')}: ${startedAt && formatter.format(new Date(startedAt))}</div>
23
+ <div>${i18next.t('field.terminated-at')}: ${terminatedAt && formatter.format(new Date(terminatedAt))}</div>
24
+ <div>${i18next.t('field.updated-at')}: ${updatedAt && formatter.format(new Date(updatedAt))}</div>
25
+
26
+ ${this.renderInOut(Object.assign(Object.assign({}, input), output))}
27
+ <div>실행 이력</div>
28
+ ${activityThreads === null || activityThreads === void 0 ? void 0 : activityThreads.map(activityThread => this.renderActivityThread(activityThread))}
29
+ `;
30
+ }
31
+ renderActivityThread(activityThread) {
32
+ const { state, assignee, output, round, activityApprovals = [], assignedAt, startedAt, terminatedAt } = activityThread;
33
+ const { name, email } = assignee || {};
34
+ return html `
35
+ <div>${i18next.t('field.assignee')}: ${name}</div>
36
+ <div>${i18next.t('field.round')}: ${round}</div>
37
+ <div>${i18next.t('field.output')}: ${this.renderInOut(output)}</div>
38
+ <div>${i18next.t('field.assigned-at')}: ${assignedAt && formatter.format(new Date(assignedAt))}</div>
39
+ <div>${i18next.t('field.started-at')}: ${startedAt && formatter.format(new Date(startedAt))}</div>
40
+ <div>${i18next.t('field.terminated-at')}: ${terminatedAt && formatter.format(new Date(terminatedAt))}</div>
41
+
42
+ ${activityApprovals
43
+ .sort((a, b) => (a.round > b.round ? 1 : a.round < b.round ? -1 : a.order > b.order ? 1 : -1))
44
+ .map(approval => this.renderActivityApproval(approval))}
45
+ `;
46
+ }
47
+ renderActivityApproval(activityApproval) {
48
+ const { judgment, approver, comment, round, order, createdAt, terminatedAt } = activityApproval;
49
+ const { name, email } = approver || {};
50
+ return html `
51
+ <div>${i18next.t('field.approver')}: ${name}</div>
52
+ <div>${i18next.t('field.judgment')}: ${judgment}</div>
53
+ <div>${i18next.t('field.comment')}: ${comment}</div>
54
+ <div>${i18next.t('field.round')}: ${round}</div>
55
+ <div>${i18next.t('field.order')}: ${order}</div>
56
+ <div>${i18next.t('field.started-at')}: ${createdAt && formatter.format(new Date(createdAt))}</div>
57
+ <div>${i18next.t('field.terminated-at')}: ${terminatedAt && formatter.format(new Date(terminatedAt))}</div>
20
58
  `;
21
59
  }
22
60
  renderSearchKeys() {
23
61
  const { activity } = this.activityInstance;
24
62
  const { searchKeys = [] } = activity || {};
25
- return searchKeys === null || searchKeys === void 0 ? void 0 : searchKeys.map((item, index) => html ` <div>${i18next.t(String(item.tKey))}: ${this.activityInstance[`key0${index + 1}`]}</div> `);
63
+ return html `
64
+ <table>
65
+ <tr>
66
+ <th>${i18next.t('label.name')}</th>
67
+ <th>${i18next.t('label.value')}</th>
68
+ </tr>
69
+
70
+ ${searchKeys === null || searchKeys === void 0 ? void 0 : searchKeys.map((item, index) => html `
71
+ <tr>
72
+ <td>${item.tKey ? i18next.t(item.tKey) : item.name}</td>
73
+ <td>${this.activityInstance[`key0${index + 1}`]}</td>
74
+ </tr>
75
+ `)}
76
+ </table>
77
+ `;
26
78
  }
27
- renderInOut() {
28
- const { input, output } = this.activityInstance;
79
+ renderInOut(data) {
80
+ const { input, output, activity } = this.activityInstance;
81
+ const { model } = activity || {};
29
82
  return html `
30
- <div>
31
- input:
32
- <pre>${JSON.stringify(input, null, 2)}</pre>
33
- </div>
34
- <div>
35
- output:
36
- <pre>${JSON.stringify(output, null, 2)}</pre>
37
- </div>
83
+ <table>
84
+ <tr>
85
+ <th>${i18next.t('label.name')}</th>
86
+ <th>${i18next.t('label.value')}</th>
87
+ </tr>
88
+ ${model === null || model === void 0 ? void 0 : model.map(item => html `
89
+ <tr>
90
+ <td>${item.name}</td>
91
+ <td>${item.tag ? data[item.tag] : ''}</td>
92
+ </tr>
93
+ `)}
94
+ </table>
38
95
  `;
39
96
  }
40
97
  updated(changes) {
@@ -68,6 +125,18 @@ let ActivityInstanceView = class ActivityInstanceView extends localize(i18next)(
68
125
  inputKey
69
126
  tKey
70
127
  }
128
+ model {
129
+ name
130
+ description
131
+ active
132
+ tag
133
+ inout
134
+ type
135
+ unit
136
+ options
137
+ quantifier
138
+ spec
139
+ }
71
140
  }
72
141
  activityThreads {
73
142
  state
@@ -79,6 +148,16 @@ let ActivityInstanceView = class ActivityInstanceView extends localize(i18next)(
79
148
  email
80
149
  }
81
150
  round
151
+ activityApprovals {
152
+ round
153
+ order
154
+ approver {
155
+ name
156
+ email
157
+ }
158
+ judgment
159
+ comment
160
+ }
82
161
  assignedAt
83
162
  startedAt
84
163
  terminatedAt
@@ -105,16 +184,8 @@ ActivityInstanceView.styles = [
105
184
  ScrollbarStyles,
106
185
  css `
107
186
  :host {
108
- display: flex;
109
- flex-direction: column;
110
-
187
+ display: block;
111
188
  background-color: #fff;
112
- }
113
-
114
- div[content] {
115
- flex: 1;
116
-
117
- display: flex;
118
189
  overflow: auto;
119
190
  }
120
191
  `
@@ -1 +1 @@
1
- {"version":3,"file":"activity-instance-view.js","sourceRoot":"","sources":["../../../client/pages/activity-instance/activity-instance-view.ts"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAS,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAGzD,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IA4BrE,MAAM;QACJ,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;YAC1B,OAAO,IAAI,CAAA,uCAAuC,CAAA;SACnD;QACD,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAA;QACjE,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAA;QAEtC,OAAO,IAAI,CAAA;mBACI,IAAI;0BACG,WAAW;QAC7B,IAAI,CAAC,gBAAgB,EAAE,IAAI,IAAI,CAAC,WAAW,EAAE;KAChD,CAAA;IACH,CAAC;IAED,gBAAgB;QACd,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,gBAAiB,CAAA;QAC3C,MAAM,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,QAAS,IAAI,EAAE,C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yB;AAE3B;IAAC,KAAK,EAAE;8BAAoB,gBAAgB;8DAAA;AA1BjC,oBAAoB;IADhC,aAAa,CAAC,wBAAwB,CAAC;GAC3B,oBAAoB,CAoIhC;SApIY,oBAAoB","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { ScrollbarStyles } from '@operato/styles'\n\nimport { ActivityInstance } from '../../types/activity-instance'\n\n@customElement('activity-instance-view')\nexport class ActivityInstanceView extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n }\n\n div[content] {\n flex: 1;\n\n display: flex;\n overflow: auto;\n }\n `\n ]\n\n @property({\n type: String,\n attribute: 'activity-instance-id'\n })\n activityInstanceId?: string\n\n @state() activityInstance?: ActivityInstance\n\n render() {\n if (!this.activityInstance) {\n return html`<div>no activity instance info.</div>`\n }\n const { id, name, description, activity } = this.activityInstance\n const instance = this.activityInstance\n\n return html`\n <div>name: ${name}</div>\n <div>description: ${description}</div>\n ${this.renderSearchKeys()} ${this.renderInOut()}\n `\n }\n\n renderSearchKeys() {\n const { activity } = this.activityInstance!\n const { searchKeys = [] } = activity! || {}\n\n return searchKeys?.map(\n (item, index) => html` <div>${i18next.t(String(item.tKey))}: ${this.activityInstance![`key0${index + 1}`]}</div> `\n )\n }\n\n renderInOut() {\n const { input, output } = this.activityInstance!\n\n return html`\n <div>\n input:\n <pre>${JSON.stringify(input, null, 2)}</pre>\n </div>\n <div>\n output:\n <pre>${JSON.stringify(output, null, 2)}</pre>\n </div>\n `\n }\n\n updated(changes) {\n if (changes.has('activityInstanceId')) {\n this.fetchActivityInstance()\n }\n }\n\n async fetchActivityInstance() {\n const id = this.activityInstanceId\n\n const response = await client.query({\n query: gql`\n query ($id: String!) {\n activityInstance(id: $id) {\n id\n name\n description\n key01\n key02\n key03\n key04\n key05\n input\n output\n activity {\n id\n name\n description\n searchKeys {\n name\n description\n inputKey\n tKey\n }\n }\n activityThreads {\n state\n transaction\n output\n assignee {\n id\n name\n email\n }\n round\n assignedAt\n startedAt\n terminatedAt\n }\n updater {\n id\n name\n }\n assignedAt\n startedAt\n terminatedAt\n updatedAt\n }\n }\n `,\n variables: {\n id\n }\n })\n\n this.activityInstance = response.data.activityInstance\n }\n}\n"]}
1
+ {"version":3,"file":"activity-instance-view.js","sourceRoot":"","sources":["../../../client/pages/activity-instance/activity-instance-view.ts"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAS,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAIhE,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAA;AAGjG,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAoBrE,MAAM;QACJ,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;YAC1B,OAAO,IAAI,CAAA,uCAAuC,CAAA;SACnD;QACD,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,Y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SAAS,EAAE,sBAAsB;KAClC,CAAC;;gEACyB;AAE3B;IAAC,KAAK,EAAE;8BAAoB,gBAAgB;8DAAA;AAlBjC,oBAAoB;IADhC,aAAa,CAAC,wBAAwB,CAAC;GAC3B,oBAAoB,CA0NhC;SA1NY,oBAAoB","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { ScrollbarStyles } from '@operato/styles'\n\nimport { ActivityInstance } from '../../types/activity-instance'\nimport { ActivityThread } from '../../types/activity-thread'\nimport { ActivityApproval } from '../../types/activity-approval'\n\nconst formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' })\n\n@customElement('activity-instance-view')\nexport class ActivityInstanceView extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: block;\n background-color: #fff;\n overflow: auto;\n }\n `\n ]\n\n @property({\n type: String,\n attribute: 'activity-instance-id'\n })\n activityInstanceId?: string\n\n @state() activityInstance?: ActivityInstance\n\n render() {\n if (!this.activityInstance) {\n return html`<div>no activity instance info.</div>`\n }\n const { id, name, description, input, output, assignedAt, startedAt, activityThreads, terminatedAt, updatedAt } =\n this.activityInstance\n const instance = this.activityInstance\n\n return html`\n <div>${i18next.t('field.name')}: ${name}</div>\n <div>${i18next.t('field.description')}: ${description}</div>\n <div>${i18next.t('field.search-keys')}: ${this.renderSearchKeys()}</div>\n <div>${i18next.t('field.assigned-at')}: ${assignedAt && formatter.format(new Date(assignedAt))}</div>\n <div>${i18next.t('field.started-at')}: ${startedAt && formatter.format(new Date(startedAt))}</div>\n <div>${i18next.t('field.terminated-at')}: ${terminatedAt && formatter.format(new Date(terminatedAt))}</div>\n <div>${i18next.t('field.updated-at')}: ${updatedAt && formatter.format(new Date(updatedAt))}</div>\n\n ${this.renderInOut({ ...input, ...output })}\n <div>실행 이력</div>\n ${activityThreads?.map(activityThread => this.renderActivityThread(activityThread))}\n `\n }\n\n renderActivityThread(activityThread: ActivityThread) {\n const {\n state,\n assignee,\n output,\n round,\n activityApprovals = [],\n assignedAt,\n startedAt,\n terminatedAt\n } = activityThread\n const { name, email } = assignee || {}\n\n return html`\n <div>${i18next.t('field.assignee')}: ${name}</div>\n <div>${i18next.t('field.round')}: ${round}</div>\n <div>${i18next.t('field.output')}: ${this.renderInOut(output)}</div>\n <div>${i18next.t('field.assigned-at')}: ${assignedAt && formatter.format(new Date(assignedAt))}</div>\n <div>${i18next.t('field.started-at')}: ${startedAt && formatter.format(new Date(startedAt))}</div>\n <div>${i18next.t('field.terminated-at')}: ${terminatedAt && formatter.format(new Date(terminatedAt))}</div>\n\n ${activityApprovals\n .sort((a, b) => (a.round > b.round ? 1 : a.round < b.round ? -1 : a.order! > b.order! ? 1 : -1))\n .map(approval => this.renderActivityApproval(approval))}\n `\n }\n\n renderActivityApproval(activityApproval: ActivityApproval) {\n const { judgment, approver, comment, round, order, createdAt, terminatedAt } = activityApproval\n const { name, email } = approver || {}\n\n return html`\n <div>${i18next.t('field.approver')}: ${name}</div>\n <div>${i18next.t('field.judgment')}: ${judgment}</div>\n <div>${i18next.t('field.comment')}: ${comment}</div>\n <div>${i18next.t('field.round')}: ${round}</div>\n <div>${i18next.t('field.order')}: ${order}</div>\n <div>${i18next.t('field.started-at')}: ${createdAt && formatter.format(new Date(createdAt))}</div>\n <div>${i18next.t('field.terminated-at')}: ${terminatedAt && formatter.format(new Date(terminatedAt))}</div>\n `\n }\n\n renderSearchKeys() {\n const { activity } = this.activityInstance!\n const { searchKeys = [] } = activity! || {}\n\n return html`\n <table>\n <tr>\n <th>${i18next.t('label.name')}</th>\n <th>${i18next.t('label.value')}</th>\n </tr>\n\n ${searchKeys?.map(\n (item, index) => html`\n <tr>\n <td>${item.tKey ? i18next.t(item.tKey) : item.name}</td>\n <td>${this.activityInstance![`key0${index + 1}`]}</td>\n </tr>\n `\n )}\n </table>\n `\n }\n\n renderInOut(data) {\n const { input, output, activity } = this.activityInstance!\n const { model } = activity || {}\n\n return html`\n <table>\n <tr>\n <th>${i18next.t('label.name')}</th>\n <th>${i18next.t('label.value')}</th>\n </tr>\n ${model?.map(\n item => html`\n <tr>\n <td>${item.name}</td>\n <td>${item.tag ? data[item.tag] : ''}</td>\n </tr>\n `\n )}\n </table>\n `\n }\n\n updated(changes) {\n if (changes.has('activityInstanceId')) {\n this.fetchActivityInstance()\n }\n }\n\n async fetchActivityInstance() {\n const id = this.activityInstanceId\n\n const response = await client.query({\n query: gql`\n query ($id: String!) {\n activityInstance(id: $id) {\n id\n name\n description\n key01\n key02\n key03\n key04\n key05\n input\n output\n activity {\n id\n name\n description\n searchKeys {\n name\n description\n inputKey\n tKey\n }\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 activityThreads {\n state\n transaction\n output\n assignee {\n id\n name\n email\n }\n round\n activityApprovals {\n round\n order\n approver {\n name\n email\n }\n judgment\n comment\n }\n assignedAt\n startedAt\n terminatedAt\n }\n updater {\n id\n name\n }\n assignedAt\n startedAt\n terminatedAt\n updatedAt\n }\n }\n `,\n variables: {\n id\n }\n })\n\n this.activityInstance = response.data.activityInstance\n }\n}\n"]}