@things-factory/worklist 6.0.32 → 6.0.34

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 (111) hide show
  1. package/client/pages/activity/activity-list-page.ts +78 -3
  2. package/client/pages/activity-template/activity-template-list-page.ts +2 -0
  3. package/client/pages/activity-thread/activity-thread-view-page.ts +293 -0
  4. package/client/pages/installable-activity/installable-activity-list-page.ts +2 -0
  5. package/client/pages/todo/done-list-page.ts +3 -3
  6. package/client/pages/todo/todo-list-page.ts +3 -4
  7. package/client/route.ts +4 -0
  8. package/dist-client/components/activity-search-keys-input.d.ts +17 -0
  9. package/dist-client/components/activity-search-keys-input.js +173 -0
  10. package/dist-client/components/activity-search-keys-input.js.map +1 -0
  11. package/dist-client/components/grist-editor-activity-search-key.d.ts +12 -0
  12. package/dist-client/components/grist-editor-activity-search-key.js +70 -0
  13. package/dist-client/components/grist-editor-activity-search-key.js.map +1 -0
  14. package/dist-client/components/popup-activity-search-keys-input.d.ts +17 -0
  15. package/dist-client/components/popup-activity-search-keys-input.js +177 -0
  16. package/dist-client/components/popup-activity-search-keys-input.js.map +1 -0
  17. package/dist-client/pages/activity/activity-list-page.d.ts +3 -1
  18. package/dist-client/pages/activity/activity-list-page.js +73 -3
  19. package/dist-client/pages/activity/activity-list-page.js.map +1 -1
  20. package/dist-client/pages/activity-template/activity-template-list-page.js +2 -0
  21. package/dist-client/pages/activity-template/activity-template-list-page.js.map +1 -1
  22. package/dist-client/pages/activity-thread/activity-thread-view-page.d.ts +43 -0
  23. package/dist-client/pages/activity-thread/activity-thread-view-page.js +268 -0
  24. package/dist-client/pages/activity-thread/activity-thread-view-page.js.map +1 -0
  25. package/dist-client/pages/installable-activity/installable-activity-list-page.js +2 -0
  26. package/dist-client/pages/installable-activity/installable-activity-list-page.js.map +1 -1
  27. package/dist-client/pages/todo/done-list-page.d.ts +1 -1
  28. package/dist-client/pages/todo/done-list-page.js +3 -3
  29. package/dist-client/pages/todo/done-list-page.js.map +1 -1
  30. package/dist-client/pages/todo/todo-list-page.js +3 -4
  31. package/dist-client/pages/todo/todo-list-page.js.map +1 -1
  32. package/dist-client/route.d.ts +1 -1
  33. package/dist-client/route.js +3 -0
  34. package/dist-client/route.js.map +1 -1
  35. package/dist-client/tsconfig.tsbuildinfo +1 -1
  36. package/dist-client/types/domain.d.ts +16 -0
  37. package/dist-client/types/domain.js +3 -0
  38. package/dist-client/types/domain.js.map +1 -0
  39. package/dist-client/types/privilege.d.ts +16 -0
  40. package/dist-client/types/privilege.js +3 -0
  41. package/dist-client/types/privilege.js.map +1 -0
  42. package/dist-client/types/role.d.ts +19 -0
  43. package/dist-client/types/role.js +3 -0
  44. package/dist-client/types/role.js.map +1 -0
  45. package/dist-client/types/user.d.ts +18 -0
  46. package/dist-client/types/user.js +12 -0
  47. package/dist-client/types/user.js.map +1 -0
  48. package/dist-client/types.d.ts +25 -0
  49. package/dist-client/types.js +38 -0
  50. package/dist-client/types.js.map +1 -0
  51. package/dist-server/controllers/activity-installation/callback-registry.js +21 -0
  52. package/dist-server/controllers/activity-installation/callback-registry.js.map +1 -0
  53. package/dist-server/controllers/activity-installation-controller.js +17 -0
  54. package/dist-server/controllers/activity-installation-controller.js.map +1 -0
  55. package/dist-server/controllers/activity-instance/draft.js +1 -6
  56. package/dist-server/controllers/activity-instance/draft.js.map +1 -1
  57. package/dist-server/controllers/activity-instance/post.js +11 -7
  58. package/dist-server/controllers/activity-instance/post.js.map +1 -1
  59. package/dist-server/controllers/call-webhook.js +41 -0
  60. package/dist-server/controllers/call-webhook.js.map +1 -0
  61. package/dist-server/controllers/common.js +3 -0
  62. package/dist-server/controllers/common.js.map +1 -1
  63. package/dist-server/routes.js +30 -0
  64. package/dist-server/routes.js.map +1 -1
  65. package/dist-server/service/activity/activity-history.js +5 -0
  66. package/dist-server/service/activity/activity-history.js.map +1 -1
  67. package/dist-server/service/activity/activity-mutation.js +92 -0
  68. package/dist-server/service/activity/activity-mutation.js.map +1 -1
  69. package/dist-server/service/activity/activity-type.js +8 -0
  70. package/dist-server/service/activity/activity-type.js.map +1 -1
  71. package/dist-server/service/activity/activity.js +6 -3
  72. package/dist-server/service/activity/activity.js.map +1 -1
  73. package/dist-server/service/activity-approval/event-subscriber.js.map +1 -1
  74. package/dist-server/service/activity-key-set/activity-key-item-type.js +50 -0
  75. package/dist-server/service/activity-key-set/activity-key-item-type.js.map +1 -0
  76. package/dist-server/service/activity-key-set/activity-key-set-mutation.js +127 -0
  77. package/dist-server/service/activity-key-set/activity-key-set-mutation.js.map +1 -0
  78. package/dist-server/service/activity-key-set/activity-key-set-query.js +97 -0
  79. package/dist-server/service/activity-key-set/activity-key-set-query.js.map +1 -0
  80. package/dist-server/service/activity-key-set/activity-key-set-type.js +74 -0
  81. package/dist-server/service/activity-key-set/activity-key-set-type.js.map +1 -0
  82. package/dist-server/service/activity-key-set/activity-key-set.js +86 -0
  83. package/dist-server/service/activity-key-set/activity-key-set.js.map +1 -0
  84. package/dist-server/service/activity-key-set/index.js +9 -0
  85. package/dist-server/service/activity-key-set/index.js.map +1 -0
  86. package/dist-server/service/activity-template/activity-template-type.js +16 -0
  87. package/dist-server/service/activity-template/activity-template-type.js.map +1 -1
  88. package/dist-server/service/activity-template/activity-template.js +10 -0
  89. package/dist-server/service/activity-template/activity-template.js.map +1 -1
  90. package/dist-server/service/installable-activity/installable-activity.js +8 -0
  91. package/dist-server/service/installable-activity/installable-activity.js.map +1 -1
  92. package/dist-server/tsconfig.tsbuildinfo +1 -1
  93. package/package.json +9 -8
  94. package/server/controllers/activity-instance/draft.ts +4 -4
  95. package/server/controllers/activity-instance/post.ts +13 -7
  96. package/server/controllers/common.ts +4 -0
  97. package/server/routes.ts +47 -0
  98. package/server/service/activity/activity-history.ts +4 -0
  99. package/server/service/activity/activity-mutation.ts +102 -0
  100. package/server/service/activity/activity-type.ts +6 -0
  101. package/server/service/activity/activity.ts +5 -3
  102. package/server/service/activity-approval/event-subscriber.ts +1 -1
  103. package/server/service/activity-template/activity-template-type.ts +12 -0
  104. package/server/service/activity-template/activity-template.ts +8 -0
  105. package/server/service/installable-activity/installable-activity.ts +6 -0
  106. package/things-factory.config.js +1 -0
  107. package/translations/en.json +2 -0
  108. package/translations/ko.json +2 -0
  109. package/translations/ms.json +2 -0
  110. package/translations/zh.json +2 -0
  111. package/client/pages/activity-thread/activity-thread-view.ts +0 -102
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/worklist",
3
- "version": "6.0.32",
3
+ "version": "6.0.34",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -27,13 +27,14 @@
27
27
  "dependencies": {
28
28
  "@operato/graphql": "^1.0.0",
29
29
  "@operato/grist-editor": "^1.0.0",
30
- "@things-factory/attachment-base": "^6.0.32",
31
- "@things-factory/auth-base": "^6.0.32",
32
- "@things-factory/board-service": "^6.0.32",
33
- "@things-factory/context-ui": "^6.0.32",
34
- "@things-factory/organization": "^6.0.32",
35
- "@things-factory/shell": "^6.0.32",
30
+ "@things-factory/attachment-base": "^6.0.34",
31
+ "@things-factory/auth-base": "^6.0.34",
32
+ "@things-factory/board-service": "^6.0.34",
33
+ "@things-factory/context-ui": "^6.0.34",
34
+ "@things-factory/organization": "^6.0.34",
35
+ "@things-factory/scheduler-client": "^6.0.34",
36
+ "@things-factory/shell": "^6.0.34",
36
37
  "moment-timezone": "^0.5.40"
37
38
  },
38
- "gitHead": "1b7b1eb2d2e1c0823ec69ee8160790c5da62072c"
39
+ "gitHead": "a460e5183f6e97e061be886d1efe9a114bd1316b"
39
40
  }
@@ -64,10 +64,10 @@ export async function draft(
64
64
 
65
65
  return await tx.getRepository(ActivityInstance).save({
66
66
  activityType: activity.activityType,
67
- // uiType: activity.uiType,
68
- // uiSource: activity.uiSource,
69
- // viewType: activity.viewType,
70
- // viewSource: activity.viewSource,
67
+ uiType: activity.uiType,
68
+ uiSource: activity.uiSource,
69
+ viewType: activity.viewType,
70
+ viewSource: activity.viewSource,
71
71
  assigneeRole: activity.assigneeRole,
72
72
  supervisoryRole: activity.supervisoryRole,
73
73
  ...activityInstance,
@@ -51,20 +51,24 @@ export async function post(
51
51
  }
52
52
  }
53
53
 
54
+ activityInstance.name = activity.name
55
+ activityInstance.description = activity.description
54
56
  activityInstance.activityType = activity.activityType
55
- // activityInstance.uiType = activity.uiType
56
- // activityInstance.uiSource = activity.uiSource
57
+ activityInstance.uiType = activity.uiType
58
+ activityInstance.uiSource = activity.uiSource
59
+ activityInstance.viewType = activity.viewType
60
+ activityInstance.viewSource = activity.viewSource
57
61
  activityInstance.assigneeRole = activity.assigneeRole
58
62
  activityInstance.supervisoryRole = activity.supervisoryRole
59
63
 
60
64
  if (!assignees || !approvalLine) {
61
65
  activityInstance.adhocType = 'standard'
62
66
  activityInstance.refBy = activityId
63
- if (!activityInstance.assignees) {
64
- activityInstance.assignees = activity.assignees
67
+ if (!assignees) {
68
+ assignees = activityInstance.assignees = activity.assignees
65
69
  }
66
- if (!activityInstance.approvalLine) {
67
- activityInstance.approvalLine = activity.approvalLine
70
+ if (!approvalLine) {
71
+ approvalLine = activityInstance.approvalLine = activity.approvalLine
68
72
  }
69
73
 
70
74
  if (!dueAt && activity.standardTime) {
@@ -89,7 +93,9 @@ export async function post(
89
93
  issuedAt
90
94
  })
91
95
 
92
- const assignedUsers = await Promise.all(assignees.map(assignee => getSystemUserFromOrgMemberItem(assignee, context)))
96
+ const assignedUsers = await Promise.all(
97
+ (assignees || []).map(assignee => getSystemUserFromOrgMemberItem(assignee, context))
98
+ )
93
99
 
94
100
  if (assignedUsers.length == 0 && posted.threadsMin === 0 && posted.assigneeRoleId) {
95
101
  await createActivityThreadsForAllRoleUsers('post', posted, context)
@@ -242,6 +242,10 @@ export async function getSystemUserFromOrgMemberItem(
242
242
  }
243
243
 
244
244
  export function fillActivitySearchKeys(searchKeys: ActivitySearchKeyItem[], input: { [key: string]: any }) {
245
+ if (!input || typeof input !== 'object') {
246
+ return
247
+ }
248
+
245
249
  return searchKeys?.reduce((sum, key, index) => {
246
250
  const value = input[key.inputKey]
247
251
  if (value != null) {
package/server/routes.ts CHANGED
@@ -1,3 +1,8 @@
1
+ import { logger } from '@things-factory/env'
2
+ import { Domain, getDataSource } from '@things-factory/shell'
3
+ import { ScheduleRegisterRequest } from '@things-factory/scheduler-client'
4
+ import { post } from './controllers/activity-instance/post'
5
+
1
6
  process.on('bootstrap-module-global-public-route' as any, (app, globalPublicRouter) => {
2
7
  /*
3
8
  * can add global public routes to application (auth not required, tenancy not required)
@@ -5,6 +10,48 @@ process.on('bootstrap-module-global-public-route' as any, (app, globalPublicRout
5
10
  * ex) routes.get('/path', async(context, next) => {})
6
11
  * ex) routes.post('/path', async(context, next) => {})
7
12
  */
13
+
14
+ /* When a callback occurs from the scheduler when a scheduled dataset is on schedule, data collection task for the dataset should be issued. */
15
+ globalPublicRouter.post('/callback-schedule-for-activity', async (context, next) => {
16
+ const { client } = context.request.body as ScheduleRegisterRequest
17
+
18
+ if (!client || typeof client !== 'object') {
19
+ throw new Error('client property should be a part of callback body.')
20
+ }
21
+
22
+ const { group: domainId, key: activityId } = client
23
+
24
+ if (!domainId || !activityId) {
25
+ throw new Error(`group(${domainId}) and key(${activityId}) properties should not be empty`)
26
+ }
27
+
28
+ if (!domainId || !activityId) {
29
+ throw new Error(`domainId(${domainId}) and activityId(${activityId}) properties should not be empty`)
30
+ }
31
+
32
+ await getDataSource().transaction(async tx => {
33
+ const domain = await tx.getRepository(Domain).findOneBy({ id: domainId })
34
+
35
+ if (!domain) {
36
+ throw new Error(`domain(${domainId}) not found`)
37
+ }
38
+
39
+ context.state = {
40
+ ...context.state,
41
+ domain,
42
+ tx
43
+ }
44
+
45
+ await post(
46
+ {
47
+ activityId
48
+ },
49
+ context
50
+ )
51
+ })
52
+
53
+ context.status = 200
54
+ })
8
55
  })
9
56
 
10
57
  process.on('bootstrap-module-global-private-route' as any, (app, globalPrivateRouter) => {
@@ -85,6 +85,10 @@ export class ActivityHistory implements HistoryEntityInterface<Activity> {
85
85
  @Field({ nullable: true })
86
86
  timezone?: string
87
87
 
88
+ @Column({ nullable: true })
89
+ @Field({ nullable: true })
90
+ scheduleId?: string
91
+
88
92
  @Column({ nullable: true })
89
93
  @Field({ nullable: true })
90
94
  standardTime?: number
@@ -2,6 +2,7 @@ import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
2
2
  import { In } from 'typeorm'
3
3
 
4
4
  import { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'
5
+ import { registerSchedule, unregisterSchedule } from '@things-factory/scheduler-client'
5
6
 
6
7
  import { Activity } from './activity'
7
8
  import { ActivityPatch, NewActivity } from './activity-type'
@@ -201,4 +202,105 @@ export class ActivityMutation {
201
202
 
202
203
  return true
203
204
  }
205
+
206
+ @Directive('@transaction')
207
+ @Mutation(returns => Activity, {
208
+ description: 'To start posting activity based on the schedule of the given activity'
209
+ })
210
+ async startActivitySchedule(
211
+ @Arg('activityId') activityId: string,
212
+ @Ctx() context: ResolverContext
213
+ ): Promise<Activity> {
214
+ const { domain, tx } = context.state
215
+
216
+ var repository = tx.getRepository(Activity)
217
+ var activity = await repository.findOne({
218
+ where: { domain: { id: domain.id }, id: activityId }
219
+ })
220
+
221
+ if (!activity) {
222
+ throw new Error(
223
+ context.t('error.activity not found', {
224
+ activity: activityId
225
+ })
226
+ )
227
+ }
228
+
229
+ try {
230
+ var handle = await registerSchedule({
231
+ name: activity.name,
232
+ client: {
233
+ application: 'operato-worklist',
234
+ group: `${domain.id}`,
235
+ type: 'activity',
236
+ key: activity.id,
237
+ operation: 'schedule'
238
+ },
239
+ type: 'cron',
240
+ schedule: activity.schedule,
241
+ timezone: activity.timezone,
242
+ task: {
243
+ type: 'rest',
244
+ connection: {
245
+ host: 'http://localhost:3000/callback-schedule-for-activity',
246
+ headers: {
247
+ 'Content-Type': 'application/json',
248
+ accept: '*/*'
249
+ }
250
+ },
251
+ data: {
252
+ domainId: domain.id,
253
+ activityId
254
+ },
255
+ history_check: true,
256
+ failed_policy: 'retry_dlq',
257
+ max_retry_count: 3,
258
+ retry_period: 60
259
+ }
260
+ })
261
+
262
+ return await repository.save({
263
+ ...activity,
264
+ scheduleId: handle
265
+ })
266
+ } catch (err) {
267
+ console.error('startActivitySchedule', err)
268
+ }
269
+ }
270
+
271
+ @Directive('@transaction')
272
+ @Mutation(returns => Activity, {
273
+ nullable: true,
274
+ description: 'To stop posting activity based on the schedule of the given activity'
275
+ })
276
+ async stopActivitySchedule(
277
+ @Arg('activityId') activityId: string,
278
+ @Ctx() context: ResolverContext
279
+ ): Promise<Activity | undefined> {
280
+ const { domain, tx } = context.state
281
+
282
+ var repository = tx.getRepository(Activity)
283
+ var activity = await repository.findOne({
284
+ where: { domain: { id: domain.id }, id: activityId }
285
+ })
286
+
287
+ if (!activity) {
288
+ throw new Error(
289
+ context.t('error.activity not found', {
290
+ activity: activityId
291
+ })
292
+ )
293
+ }
294
+
295
+ try {
296
+ await unregisterSchedule(activity.scheduleId)
297
+
298
+ return await repository.save({
299
+ ...activity,
300
+ scheduleId: null
301
+ })
302
+ } catch (err) {
303
+ console.error('stopActivitySchedule', err)
304
+ }
305
+ }
204
306
  }
@@ -42,6 +42,9 @@ export class NewActivity {
42
42
  @Field({ nullable: true })
43
43
  timezone?: string
44
44
 
45
+ @Field({ nullable: true })
46
+ scheduleId?: string
47
+
45
48
  @Field({ nullable: true })
46
49
  standardTime?: number
47
50
 
@@ -129,6 +132,9 @@ export class ActivityPatch {
129
132
  @Field({ nullable: true })
130
133
  timezone?: string
131
134
 
135
+ @Field({ nullable: true })
136
+ scheduleId?: string
137
+
132
138
  @Field({ nullable: true })
133
139
  standardTime?: number
134
140
 
@@ -114,12 +114,14 @@ export class Activity {
114
114
  @Field({ nullable: true, description: 'Whether the task can be started arbitrarily by a user with privileges.' })
115
115
  startable?: boolean
116
116
 
117
- @Column({
118
- nullable: true
119
- })
117
+ @Column({ nullable: true })
120
118
  @Field({ nullable: true })
121
119
  schedule?: string
122
120
 
121
+ @Column({ nullable: true })
122
+ @Field({ nullable: true })
123
+ scheduleId?: string
124
+
123
125
  @Column({ nullable: true })
124
126
  @Field({ nullable: true })
125
127
  timezone?: string
@@ -1,6 +1,6 @@
1
1
  import { EventSubscriber, EntitySubscriberInterface, InsertEvent, UpdateEvent } from 'typeorm'
2
2
 
3
- import { Domain, pubsub } from '@things-factory/shell'
3
+ import { pubsub } from '@things-factory/shell'
4
4
 
5
5
  import { ActivityApproval } from './activity-approval'
6
6
  import { callWebhook } from '../../controllers/activity-installation/call-webhook'
@@ -40,6 +40,12 @@ export class NewActivityTemplate {
40
40
  @Field({ nullable: true })
41
41
  uiSource?: string
42
42
 
43
+ @Field({ nullable: true })
44
+ viewType?: ActivityUIType
45
+
46
+ @Field({ nullable: true })
47
+ viewSource?: string
48
+
43
49
  @Field({ nullable: true })
44
50
  reportType?: ActivityUIType
45
51
 
@@ -85,6 +91,12 @@ export class ActivityTemplatePatch {
85
91
  @Field({ nullable: true })
86
92
  uiSource?: string
87
93
 
94
+ @Field({ nullable: true })
95
+ viewType?: ActivityUIType
96
+
97
+ @Field({ nullable: true })
98
+ viewSource?: string
99
+
88
100
  @Field({ nullable: true })
89
101
  reportType?: ActivityUIType
90
102
 
@@ -91,6 +91,14 @@ export class ActivityTemplate {
91
91
  @Field({ nullable: true })
92
92
  uiSource?: string
93
93
 
94
+ @Column({ nullable: true })
95
+ @Field({ nullable: true })
96
+ viewType?: ActivityUIType
97
+
98
+ @Column({ nullable: true })
99
+ @Field({ nullable: true })
100
+ viewSource?: string
101
+
94
102
  @Column({ nullable: true })
95
103
  @Field({ nullable: true })
96
104
  reportType?: ActivityUIType
@@ -35,6 +35,12 @@ export class InstallableActivity {
35
35
  @Field({ nullable: true })
36
36
  uiSource?: string
37
37
 
38
+ @Field({ nullable: true })
39
+ viewType?: ActivityUIType
40
+
41
+ @Field({ nullable: true })
42
+ viewSource?: string
43
+
38
44
  @Field({ nullable: true })
39
45
  reportType?: ActivityUIType
40
46
 
@@ -23,6 +23,7 @@ export default {
23
23
  { tagname: 'activity-instance-list-page', page: 'activity-instance-list' },
24
24
  { tagname: 'activity-instance-page', page: 'activity-instance' },
25
25
  { tagname: 'activity-thread-page', page: 'activity-thread' },
26
+ { tagname: 'activity-thread-view-page', page: 'activity-thread-view' },
26
27
  { tagname: 'activity-approval-page', page: 'activity-approval' },
27
28
  { tagname: 'worklist-home', page: 'worklist-home' },
28
29
  { tagname: 'activity-template-list-page', page: 'activity-template-list' },
@@ -46,6 +46,8 @@
46
46
  "field.ui-type": "UI type",
47
47
  "field.ui-source": "UI source",
48
48
  "field.unit": "unit",
49
+ "field.view-type": "view type",
50
+ "field.view-source": "view source",
49
51
  "label.activity-instance": "activity instance",
50
52
  "label.days": "days",
51
53
  "label.hours": "hours",
@@ -46,6 +46,8 @@
46
46
  "field.ui-type": "화면 타입",
47
47
  "field.ui-source": "화면 소스",
48
48
  "field.unit": "단위",
49
+ "field.view-type": "뷰 타입",
50
+ "field.view-source": "뷰 소스",
49
51
  "label.activity-instance": "업무 인스턴스",
50
52
  "label.days": "일",
51
53
  "label.hours": "시간",
@@ -46,6 +46,8 @@
46
46
  "field.ui-type": "UI type",
47
47
  "field.ui-source": "UI source",
48
48
  "field.unit": "[ms] unit",
49
+ "field.view-type": "[ms] view type",
50
+ "field.view-source": "[ms] view source",
49
51
  "label.activity-instance": "[ms] activity instance",
50
52
  "label.days": "[ms] days",
51
53
  "label.hours": "[ms] hours",
@@ -46,6 +46,8 @@
46
46
  "field.ui-type": "UI type",
47
47
  "field.ui-source": "UI source",
48
48
  "field.unit": "[zh] unit",
49
+ "field.view-type": "[zh] view type",
50
+ "field.view-source": "[zh] view source",
49
51
  "label.activity-instance": "[zh] activity instance",
50
52
  "label.days": "天",
51
53
  "label.hours": "小时",
@@ -1,102 +0,0 @@
1
- import gql from 'graphql-tag'
2
- import { css, html, LitElement } from 'lit'
3
- import { customElement, property, query, state } from 'lit/decorators.js'
4
-
5
- import { client } from '@operato/graphql'
6
- import { i18next, localize } from '@operato/i18n'
7
- import { ScrollbarStyles } from '@operato/styles'
8
-
9
- @customElement('activity-thread-view')
10
- export class ActivityThreadView extends localize(i18next)(LitElement) {
11
- static styles = [
12
- ScrollbarStyles,
13
- css`
14
- :host {
15
- display: flex;
16
- flex-direction: column;
17
-
18
- background-color: #fff;
19
- }
20
-
21
- div[content] {
22
- flex: 1;
23
-
24
- display: flex;
25
- overflow: auto;
26
- }
27
- `
28
- ]
29
-
30
- @property({
31
- type: String,
32
- attribute: 'activity-instance-id'
33
- })
34
- activityInstanceId?: string
35
- @state() activityInstance?: any //ActivityInstance
36
-
37
- render() {
38
- const { id, name, description, activity } = this.activityInstance
39
- const instance = this.activityInstance
40
-
41
- return html`<div content>XXX</div>`
42
- }
43
-
44
- updated(changes) {
45
- if (changes.has('activityInstanceId')) {
46
- this.fetchActivityInstance()
47
- }
48
- }
49
-
50
- async fetchActivityInstance() {
51
- const id = this.activityInstanceId
52
-
53
- const response = await client.query({
54
- query: gql`
55
- query ($id: String!) {
56
- activityInstance(id: $id) {
57
- id
58
- name
59
- description
60
- key01
61
- key02
62
- key03
63
- key04
64
- key05
65
- input
66
- output
67
- activity {
68
- id
69
- name
70
- description
71
- }
72
- activityThreads {
73
- state
74
- transaction
75
- output
76
- assignee {
77
- id
78
- name
79
- email
80
- }
81
- round
82
- assignedAt
83
- startedAt
84
- terminatedAt
85
- }
86
- updater {
87
- id
88
- name
89
- }
90
- updatedAt
91
- collectedAt
92
- }
93
- }
94
- `,
95
- variables: {
96
- id
97
- }
98
- })
99
-
100
- this.activityInstance = response.data.activityInstance
101
- }
102
- }