@things-factory/worklist 6.0.27 → 6.0.32

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 (195) hide show
  1. package/client/bootstrap.ts +9 -1
  2. package/client/components/activity-starter-form.ts +35 -10
  3. package/client/grist-editor/grist-editor-activity-search-key.ts +79 -0
  4. package/client/grist-editor/popup-activity-search-keys-input.ts +167 -0
  5. package/client/pages/activity/activity-list-page.ts +122 -11
  6. package/client/pages/activity/activity-partial-view.ts +85 -0
  7. package/client/pages/activity/starter-list-page.ts +1 -0
  8. package/client/pages/activity-approval/activity-approval-page.ts +6 -6
  9. package/client/pages/activity-instance/activity-instance-search-page.ts +377 -0
  10. package/client/pages/activity-instance/activity-instance-view.ts +135 -0
  11. package/client/pages/activity-store/activity-store-page.ts +1 -1
  12. package/client/pages/activity-template/activity-template-list-page.ts +29 -1
  13. package/client/pages/activity-thread/activity-thread-page.ts +8 -3
  14. package/client/pages/activity-thread/activity-thread-view.ts +102 -0
  15. package/client/pages/installable-activity/installable-activity-list-page.ts +29 -1
  16. package/client/pages/todo/approval-waiting-list-page.ts +19 -9
  17. package/client/pages/todo/done-list-page.ts +344 -0
  18. package/client/pages/todo/draft-list-page.ts +13 -2
  19. package/client/pages/todo/todo-list-page.ts +14 -3
  20. package/client/route.ts +8 -0
  21. package/client/types/activity-instance-type.ts +123 -0
  22. package/client/types/activity-instance.ts +124 -0
  23. package/client/types/activity-model-type.ts +40 -0
  24. package/client/types/activity-search-key-item-type.ts +9 -0
  25. package/client/types/activity-thread-type.ts +19 -0
  26. package/client/types/activity-thread.ts +88 -0
  27. package/client/types/activity.ts +103 -0
  28. package/client/{types.js → types/types.ts} +0 -9
  29. package/dist-client/bootstrap.js +4 -1
  30. package/dist-client/bootstrap.js.map +1 -1
  31. package/dist-client/components/activity-starter-form.d.ts +1 -1
  32. package/dist-client/components/activity-starter-form.js +34 -9
  33. package/dist-client/components/activity-starter-form.js.map +1 -1
  34. package/dist-client/grist-editor/grist-editor-activity-search-key.d.ts +12 -0
  35. package/dist-client/grist-editor/grist-editor-activity-search-key.js +70 -0
  36. package/dist-client/grist-editor/grist-editor-activity-search-key.js.map +1 -0
  37. package/dist-client/grist-editor/popup-activity-search-keys-input.d.ts +17 -0
  38. package/dist-client/grist-editor/popup-activity-search-keys-input.js +177 -0
  39. package/dist-client/grist-editor/popup-activity-search-keys-input.js.map +1 -0
  40. package/dist-client/pages/activity/activity-list-page.d.ts +4 -0
  41. package/dist-client/pages/activity/activity-list-page.js +121 -11
  42. package/dist-client/pages/activity/activity-list-page.js.map +1 -1
  43. package/dist-client/pages/activity/activity-partial-view.d.ts +13 -0
  44. package/dist-client/pages/activity/activity-partial-view.js +56 -0
  45. package/dist-client/pages/activity/activity-partial-view.js.map +1 -0
  46. package/dist-client/pages/activity/starter-list-page.js.map +1 -1
  47. package/dist-client/pages/activity-approval/activity-approval-page.js +6 -6
  48. package/dist-client/pages/activity-approval/activity-approval-page.js.map +1 -1
  49. package/dist-client/pages/activity-instance/activity-instance-search-page.d.ts +76 -0
  50. package/dist-client/pages/activity-instance/activity-instance-search-page.js +371 -0
  51. package/dist-client/pages/activity-instance/activity-instance-search-page.js.map +1 -0
  52. package/dist-client/pages/activity-instance/activity-instance-view.d.ts +14 -0
  53. package/dist-client/pages/activity-instance/activity-instance-view.js +130 -0
  54. package/dist-client/pages/activity-instance/activity-instance-view.js.map +1 -0
  55. package/dist-client/pages/activity-store/activity-store-page.js +1 -1
  56. package/dist-client/pages/activity-store/activity-store-page.js.map +1 -1
  57. package/dist-client/pages/activity-template/activity-template-list-page.js +29 -1
  58. package/dist-client/pages/activity-template/activity-template-list-page.js.map +1 -1
  59. package/dist-client/pages/activity-thread/activity-thread-page.js +8 -3
  60. package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
  61. package/dist-client/pages/activity-thread/activity-thread-view.d.ts +11 -0
  62. package/dist-client/pages/activity-thread/activity-thread-view.js +103 -0
  63. package/dist-client/pages/activity-thread/activity-thread-view.js.map +1 -0
  64. package/dist-client/pages/installable-activity/installable-activity-list-page.js +29 -1
  65. package/dist-client/pages/installable-activity/installable-activity-list-page.js.map +1 -1
  66. package/dist-client/pages/todo/approval-waiting-list-page.js +19 -9
  67. package/dist-client/pages/todo/approval-waiting-list-page.js.map +1 -1
  68. package/dist-client/pages/todo/done-list-page.d.ts +44 -0
  69. package/dist-client/pages/todo/done-list-page.js +342 -0
  70. package/dist-client/pages/todo/done-list-page.js.map +1 -0
  71. package/dist-client/pages/todo/draft-list-page.js +12 -2
  72. package/dist-client/pages/todo/draft-list-page.js.map +1 -1
  73. package/dist-client/pages/todo/todo-list-page.js +13 -3
  74. package/dist-client/pages/todo/todo-list-page.js.map +1 -1
  75. package/dist-client/route.d.ts +1 -1
  76. package/dist-client/route.js +6 -0
  77. package/dist-client/route.js.map +1 -1
  78. package/dist-client/tsconfig.tsbuildinfo +1 -1
  79. package/dist-client/types/activity-instance-type.d.ts +76 -0
  80. package/dist-client/types/activity-instance-type.js +11 -0
  81. package/dist-client/types/activity-instance-type.js.map +1 -0
  82. package/dist-client/types/activity-instance.d.ts +70 -0
  83. package/dist-client/types/activity-instance.js +36 -0
  84. package/dist-client/types/activity-instance.js.map +1 -0
  85. package/dist-client/types/activity-model-type.d.ts +31 -0
  86. package/dist-client/types/activity-model-type.js +18 -0
  87. package/dist-client/types/activity-model-type.js.map +1 -0
  88. package/dist-client/types/activity-search-key-item-type.d.ts +6 -0
  89. package/dist-client/types/activity-search-key-item-type.js +3 -0
  90. package/dist-client/types/activity-search-key-item-type.js.map +1 -0
  91. package/dist-client/types/activity-thread-type.d.ts +15 -0
  92. package/dist-client/types/activity-thread-type.js +7 -0
  93. package/dist-client/types/activity-thread-type.js.map +1 -0
  94. package/dist-client/types/activity-thread.d.ts +37 -0
  95. package/dist-client/types/activity-thread.js +51 -0
  96. package/dist-client/types/activity-thread.js.map +1 -0
  97. package/dist-client/types/activity.d.ts +65 -0
  98. package/dist-client/types/activity.js +35 -0
  99. package/dist-client/types/activity.js.map +1 -0
  100. package/dist-client/{types.d.ts → types/types.d.ts} +3 -7
  101. package/dist-client/{types.js → types/types.js} +0 -8
  102. package/dist-client/types/types.js.map +1 -0
  103. package/dist-server/controllers/activity-approval/approve.js +2 -0
  104. package/dist-server/controllers/activity-approval/approve.js.map +1 -1
  105. package/dist-server/controllers/activity-approval/reject.js +2 -0
  106. package/dist-server/controllers/activity-approval/reject.js.map +1 -1
  107. package/dist-server/controllers/{activity-installation-controller.js → activity-installation/activity-installation-controller.js} +8 -0
  108. package/dist-server/controllers/activity-installation/activity-installation-controller.js.map +1 -0
  109. package/dist-server/controllers/activity-installation/call-webhook.js.map +1 -0
  110. package/dist-server/controllers/activity-instance/abort.js +1 -1
  111. package/dist-server/controllers/activity-instance/abort.js.map +1 -1
  112. package/dist-server/controllers/activity-instance/adjust.js +1 -1
  113. package/dist-server/controllers/activity-instance/adjust.js.map +1 -1
  114. package/dist-server/controllers/activity-instance/delegate.js +5 -0
  115. package/dist-server/controllers/activity-instance/delegate.js.map +1 -1
  116. package/dist-server/controllers/activity-instance/draft.js +16 -1
  117. package/dist-server/controllers/activity-instance/draft.js.map +1 -1
  118. package/dist-server/controllers/activity-instance/post.js +38 -3
  119. package/dist-server/controllers/activity-instance/post.js.map +1 -1
  120. package/dist-server/controllers/activity-instance/start.js +1 -1
  121. package/dist-server/controllers/activity-instance/start.js.map +1 -1
  122. package/dist-server/controllers/activity-thread/submit.js +1 -1
  123. package/dist-server/controllers/activity-thread/submit.js.map +1 -1
  124. package/dist-server/controllers/common.js +72 -25
  125. package/dist-server/controllers/common.js.map +1 -1
  126. package/dist-server/controllers/index.js +1 -1
  127. package/dist-server/controllers/index.js.map +1 -1
  128. package/dist-server/service/activity/activity-history.js +38 -1
  129. package/dist-server/service/activity/activity-history.js.map +1 -1
  130. package/dist-server/service/activity/activity-search-key-item-type.js +28 -0
  131. package/dist-server/service/activity/activity-search-key-item-type.js.map +1 -0
  132. package/dist-server/service/activity/activity-type.js +56 -0
  133. package/dist-server/service/activity/activity-type.js.map +1 -1
  134. package/dist-server/service/activity/activity.js +40 -4
  135. package/dist-server/service/activity/activity.js.map +1 -1
  136. package/dist-server/service/activity-approval/event-subscriber.js +1 -1
  137. package/dist-server/service/activity-approval/event-subscriber.js.map +1 -1
  138. package/dist-server/service/activity-instance/activity-instance-history.js +53 -0
  139. package/dist-server/service/activity-instance/activity-instance-history.js.map +1 -1
  140. package/dist-server/service/activity-instance/activity-instance-query.js +29 -0
  141. package/dist-server/service/activity-instance/activity-instance-query.js.map +1 -1
  142. package/dist-server/service/activity-instance/activity-instance-type.js +16 -0
  143. package/dist-server/service/activity-instance/activity-instance-type.js.map +1 -1
  144. package/dist-server/service/activity-instance/activity-instance.js +63 -0
  145. package/dist-server/service/activity-instance/activity-instance.js.map +1 -1
  146. package/dist-server/service/activity-instance/event-subscriber.js +4 -4
  147. package/dist-server/service/activity-instance/event-subscriber.js.map +1 -1
  148. package/dist-server/service/activity-thread/activity-thread-query.js +27 -0
  149. package/dist-server/service/activity-thread/activity-thread-query.js.map +1 -1
  150. package/dist-server/service/activity-thread/activity-thread.js +4 -1
  151. package/dist-server/service/activity-thread/activity-thread.js.map +1 -1
  152. package/dist-server/service/installable-activity/installable-activity-mutation.js +1 -1
  153. package/dist-server/service/installable-activity/installable-activity-mutation.js.map +1 -1
  154. package/dist-server/service/installable-activity/installable-activity-query.js +1 -1
  155. package/dist-server/service/installable-activity/installable-activity-query.js.map +1 -1
  156. package/dist-server/service/installable-activity/installable-activity.js.map +1 -1
  157. package/dist-server/tsconfig.tsbuildinfo +1 -1
  158. package/package.json +9 -8
  159. package/server/controllers/activity-approval/approve.ts +3 -0
  160. package/server/controllers/activity-approval/reject.ts +3 -0
  161. package/server/controllers/{activity-installation-controller.ts → activity-installation/activity-installation-controller.ts} +12 -1
  162. package/server/controllers/activity-instance/abort.ts +1 -1
  163. package/server/controllers/activity-instance/adjust.ts +1 -1
  164. package/server/controllers/activity-instance/delegate.ts +9 -1
  165. package/server/controllers/activity-instance/draft.ts +16 -5
  166. package/server/controllers/activity-instance/post.ts +54 -6
  167. package/server/controllers/activity-instance/start.ts +1 -1
  168. package/server/controllers/activity-thread/submit.ts +1 -0
  169. package/server/controllers/common.ts +85 -28
  170. package/server/controllers/index.ts +1 -1
  171. package/server/service/activity/activity-history.ts +32 -1
  172. package/server/service/activity/activity-search-key-item-type.ts +16 -0
  173. package/server/service/activity/activity-type.ts +46 -1
  174. package/server/service/activity/activity.ts +34 -4
  175. package/server/service/activity-approval/event-subscriber.ts +1 -1
  176. package/server/service/activity-instance/activity-instance-history.ts +41 -0
  177. package/server/service/activity-instance/activity-instance-query.ts +30 -1
  178. package/server/service/activity-instance/activity-instance-type.ts +12 -0
  179. package/server/service/activity-instance/activity-instance.ts +49 -0
  180. package/server/service/activity-instance/event-subscriber.ts +4 -4
  181. package/server/service/activity-thread/activity-thread-query.ts +24 -0
  182. package/server/service/activity-thread/activity-thread.ts +6 -3
  183. package/server/service/installable-activity/installable-activity-mutation.ts +1 -1
  184. package/server/service/installable-activity/installable-activity-query.ts +1 -1
  185. package/server/service/installable-activity/installable-activity.ts +3 -1
  186. package/things-factory.config.js +5 -1
  187. package/translations/en.json +7 -0
  188. package/translations/ko.json +7 -0
  189. package/translations/ms.json +7 -0
  190. package/translations/zh.json +7 -0
  191. package/dist-client/types.js.map +0 -1
  192. package/dist-server/controllers/activity-installation-controller.js.map +0 -1
  193. package/dist-server/controllers/call-webhook.js.map +0 -1
  194. /package/dist-server/controllers/{call-webhook.js → activity-installation/call-webhook.js} +0 -0
  195. /package/server/controllers/{call-webhook.ts → activity-installation/call-webhook.ts} +0 -0
@@ -0,0 +1,377 @@
1
+ import '@operato/data-grist'
2
+ import './activity-instance-view.js'
3
+
4
+ import gql from 'graphql-tag'
5
+ import { css, html } from 'lit'
6
+ import { customElement, property, query, state } from 'lit/decorators.js'
7
+ import { connect } from 'pwa-helpers/connect-mixin'
8
+
9
+ import {
10
+ getEditor,
11
+ getRenderer,
12
+ ColumnConfig,
13
+ DataGrist,
14
+ FetchOption,
15
+ SortersControl,
16
+ GristRecord
17
+ } from '@operato/data-grist'
18
+ import { client } from '@operato/graphql'
19
+ import { i18next, localize } from '@operato/i18n'
20
+ import { openPopup } from '@operato/layout'
21
+ import { PageView, store } from '@operato/shell'
22
+ import { CommonGristStyles, ScrollbarStyles } from '@operato/styles'
23
+ import { isMobileDevice } from '@operato/utils'
24
+ import { OxPopup } from '@operato/popup'
25
+ import { ActivitySearchKeyItem } from '../../types/activity-search-key-item-type'
26
+
27
+ @customElement('activity-instance-search-page')
28
+ export class ActivityInstanceSearchPage extends connect(store)(localize(i18next)(PageView)) {
29
+ static styles = [
30
+ ScrollbarStyles,
31
+ CommonGristStyles,
32
+ css`
33
+ :host {
34
+ display: flex;
35
+ flex-direction: column;
36
+
37
+ overflow: hidden;
38
+ }
39
+
40
+ ox-grist {
41
+ overflow-y: auto;
42
+ flex: 1;
43
+ }
44
+ `
45
+ ]
46
+
47
+ @state() activityId?: string
48
+ @state() activity: any
49
+ @state() searchKeys: ActivitySearchKeyItem[] = []
50
+
51
+ @state() gristConfig: any
52
+ @state() mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
53
+
54
+ @query('ox-grist') private grist!: DataGrist
55
+ @query('#sorter-control') private sortersControl!: OxPopup
56
+
57
+ get context() {
58
+ return {
59
+ search: {
60
+ handler: (search: string) => {
61
+ this.grist.searchText = search
62
+ },
63
+ placeholder: i18next.t('title.activity instance search'),
64
+ value: this.grist.searchText
65
+ },
66
+ filter: {
67
+ handler: () => {
68
+ this.grist.toggleHeadroom()
69
+ }
70
+ },
71
+ help: 'dataset/activity-instance-search',
72
+ actions: [],
73
+ exportable: {
74
+ name: i18next.t('title.activity instance search'),
75
+ data: this._exportableData.bind(this)
76
+ }
77
+ }
78
+ }
79
+
80
+ render() {
81
+ const mode = this.mode || (isMobileDevice() ? 'LIST' : 'GRID')
82
+
83
+ return html`
84
+ <ox-grist
85
+ .mode=${mode}
86
+ .config=${this.gristConfig}
87
+ .fetchHandler=${this.fetchHandler.bind(this)}
88
+ ?url-params-sensitive=${this.active}
89
+ >
90
+ <div slot="headroom">
91
+ <div id="filters">
92
+ <ox-filters-form autofocus without-search></ox-filters-form>
93
+ </div>
94
+
95
+ <div id="sorters">
96
+ Sort
97
+ <mwc-icon
98
+ @click=${e => {
99
+ const target = e.currentTarget
100
+ this.sortersControl.open({
101
+ right: 0,
102
+ top: target.offsetTop + target.offsetHeight
103
+ })
104
+ }}
105
+ >expand_more</mwc-icon
106
+ >
107
+ <ox-popup id="sorter-control">
108
+ <ox-sorters-control> </ox-sorters-control>
109
+ </ox-popup>
110
+ </div>
111
+
112
+ <div id="modes">
113
+ <mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>
114
+ <mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>
115
+ <mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>
116
+ </div>
117
+ </div>
118
+ </ox-grist>
119
+ `
120
+ }
121
+
122
+ pageUpdated(changes, lifecycle) {
123
+ if (this.active) {
124
+ this.activityId = lifecycle.resourceId
125
+ return
126
+ }
127
+ }
128
+
129
+ async updated(changes) {
130
+ if (changes.has('activityId')) {
131
+ const response = await client.query({
132
+ query: gql`
133
+ query ($id: String!) {
134
+ activity(id: $id) {
135
+ id
136
+ name
137
+ description
138
+ searchKeys {
139
+ name
140
+ description
141
+ inputKey
142
+ tKey
143
+ }
144
+ }
145
+ }
146
+ `,
147
+ variables: {
148
+ id: this.activityId
149
+ }
150
+ })
151
+
152
+ this.activity = response.data.activity
153
+ this.searchKeys = this.activity?.searchKeys
154
+ this.refreshGristConfig()
155
+
156
+ this.grist.fetch()
157
+ }
158
+ }
159
+
160
+ getSearchKeyColumns() {
161
+ return (
162
+ this.searchKeys?.map((item, index) => {
163
+ return {
164
+ type: 'string',
165
+ name: `key0${index + 1}`,
166
+ header: item.tKey ? i18next.t(item.tKey) : `key0${index + 1}`,
167
+ record: {
168
+ editable: false
169
+ },
170
+ sortable: true,
171
+ filter: 'i_like',
172
+ width: 120,
173
+ imex: true
174
+ }
175
+ }) || []
176
+ )
177
+ }
178
+
179
+ refreshGristConfig() {
180
+ const today = new Date().toISOString().split('T')[0]
181
+
182
+ this.gristConfig = {
183
+ list: {
184
+ fields: ['name', 'description'],
185
+ details: ['input', 'updatedAt']
186
+ },
187
+ columns: [
188
+ { type: 'gutter', gutterName: 'sequence' },
189
+ { type: 'gutter', gutterName: 'row-selector', multiple: true },
190
+ {
191
+ type: 'gutter',
192
+ gutterName: 'button',
193
+ icon: 'assignment',
194
+ handlers: {
195
+ click: (columns, data, column, record, rowIndex) => {
196
+ openPopup(
197
+ html`
198
+ <activity-instance-view
199
+ activity-instance-id=${record.id}
200
+ style="background-color: white;"
201
+ ></activity-instance-view>
202
+ `,
203
+ {
204
+ backdrop: true,
205
+ size: 'large',
206
+ title: i18next.t('title.activity instance view')
207
+ }
208
+ )
209
+ }
210
+ }
211
+ },
212
+ {
213
+ type: 'string',
214
+ name: 'name',
215
+ label: true,
216
+ header: i18next.t('field.name'),
217
+ record: {
218
+ editable: false
219
+ },
220
+ filter: 'search',
221
+ sortable: true,
222
+ width: 120,
223
+ imex: true
224
+ },
225
+ {
226
+ type: 'string',
227
+ name: 'description',
228
+ label: true,
229
+ header: i18next.t('field.description'),
230
+ record: {
231
+ editable: false
232
+ },
233
+ filter: 'search',
234
+ width: 150,
235
+ imex: true
236
+ },
237
+ ...this.getSearchKeyColumns(),
238
+ {
239
+ type: 'json5',
240
+ name: 'input',
241
+ header: i18next.t('field.input'),
242
+ record: {
243
+ editable: false
244
+ },
245
+ hidden: true,
246
+ imex: true
247
+ },
248
+ {
249
+ type: 'json5',
250
+ name: 'output',
251
+ header: i18next.t('field.output'),
252
+ record: {
253
+ editable: false
254
+ },
255
+ hidden: true,
256
+ imex: true
257
+ },
258
+ {
259
+ type: 'resource-object',
260
+ name: 'updater',
261
+ header: i18next.t('field.updater'),
262
+ sortable: true,
263
+ width: 120,
264
+ imex: true
265
+ },
266
+ {
267
+ type: 'datetime',
268
+ name: 'updatedAt',
269
+ header: i18next.t('field.updated_at'),
270
+ sortable: true,
271
+ width: 180,
272
+ imex: true
273
+ }
274
+ ],
275
+ rows: {
276
+ appendable: false,
277
+ selectable: {
278
+ multiple: true
279
+ }
280
+ },
281
+ sorters: [
282
+ {
283
+ name: 'updatedAt',
284
+ desc: true
285
+ }
286
+ ]
287
+ }
288
+ }
289
+
290
+ async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
291
+ if (!this.activity) {
292
+ return { records: [], total: 0 }
293
+ }
294
+
295
+ const response = await client.query({
296
+ query: gql`
297
+ query ($activityId: String!, $filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
298
+ responses: activityInstancesByActivity(
299
+ activityId: $activityId
300
+ filters: $filters
301
+ pagination: $pagination
302
+ sortings: $sortings
303
+ ) {
304
+ items {
305
+ id
306
+ name
307
+ description
308
+ key01
309
+ key02
310
+ key03
311
+ key04
312
+ key05
313
+ input
314
+ output
315
+ updater {
316
+ id
317
+ name
318
+ }
319
+ updatedAt
320
+ }
321
+ total
322
+ }
323
+ }
324
+ `,
325
+ variables: {
326
+ activityId: this.activityId,
327
+ filters,
328
+ pagination: { page, limit },
329
+ sortings
330
+ }
331
+ })
332
+
333
+ return {
334
+ total: response.data.responses.total || 0,
335
+ records: response.data.responses.items || []
336
+ }
337
+ }
338
+
339
+ _exportableData() {
340
+ let records = [] as GristRecord[]
341
+ if (this.grist.selected && this.grist.selected.length > 0) {
342
+ records = this.grist.selected
343
+ } else {
344
+ records = this.grist.data.records
345
+ }
346
+
347
+ var headerSetting = this.grist.compiledConfig.columns
348
+ .filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
349
+ .map(column => {
350
+ return column.imex === true
351
+ ? {
352
+ header: column.header.renderer(column),
353
+ key: column.name,
354
+ width: column.width,
355
+ type: column.type
356
+ }
357
+ : column.imex
358
+ })
359
+
360
+ var data = records.map(item => {
361
+ return {
362
+ id: item.id,
363
+ ...this.gristConfig.columns
364
+ .filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
365
+ .reduce((record, column) => {
366
+ const key = column.imex === true ? column.name : column.imex.key
367
+ record[key] = key
368
+ .split('.')
369
+ .reduce((obj, key) => (obj && obj[key] !== 'undefined' ? obj[key] : undefined), item)
370
+ return record
371
+ }, {})
372
+ }
373
+ })
374
+
375
+ return { header: headerSetting, data: data }
376
+ }
377
+ }
@@ -0,0 +1,135 @@
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
+ import { ActivityInstance } from '../../types/activity-instance'
10
+
11
+ @customElement('activity-instance-view')
12
+ export class ActivityInstanceView extends localize(i18next)(LitElement) {
13
+ static styles = [
14
+ ScrollbarStyles,
15
+ css`
16
+ :host {
17
+ display: flex;
18
+ flex-direction: column;
19
+
20
+ background-color: #fff;
21
+ }
22
+
23
+ div[content] {
24
+ flex: 1;
25
+
26
+ display: flex;
27
+ overflow: auto;
28
+ }
29
+ `
30
+ ]
31
+
32
+ @property({
33
+ type: String,
34
+ attribute: 'activity-instance-id'
35
+ })
36
+ activityInstanceId?: string
37
+
38
+ @state() activityInstance?: ActivityInstance
39
+
40
+ render() {
41
+ if (!this.activityInstance) {
42
+ return html`<div>no activity instance info.</div>`
43
+ }
44
+ const { id, name, description, activity } = this.activityInstance
45
+ const instance = this.activityInstance
46
+
47
+ return html`
48
+ <div>name: ${name}</div>
49
+ <div>description: ${description}</div>
50
+ ${this.renderSearchKeys()} ${this.renderInOut()}
51
+ `
52
+ }
53
+
54
+ renderSearchKeys() {
55
+ const { key01, key02, key03, key04, key05 } = this.activityInstance!
56
+
57
+ return html`
58
+ <div>key01: ${key01}</div>
59
+ <div>key02: ${key02}</div>
60
+ <div>key03: ${key03}</div>
61
+ <div>key04: ${key04}</div>
62
+ <div>key05: ${key05}</div>
63
+ `
64
+ }
65
+
66
+ renderInOut() {
67
+ const { input, output } = this.activityInstance!
68
+
69
+ return html`
70
+ <div>input: ${input}</div>
71
+ <div>output: ${output}</div>
72
+ `
73
+ }
74
+
75
+ updated(changes) {
76
+ if (changes.has('activityInstanceId')) {
77
+ this.fetchActivityInstance()
78
+ }
79
+ }
80
+
81
+ async fetchActivityInstance() {
82
+ const id = this.activityInstanceId
83
+
84
+ const response = await client.query({
85
+ query: gql`
86
+ query ($id: String!) {
87
+ activityInstance(id: $id) {
88
+ id
89
+ name
90
+ description
91
+ key01
92
+ key02
93
+ key03
94
+ key04
95
+ key05
96
+ input
97
+ output
98
+ activity {
99
+ id
100
+ name
101
+ description
102
+ }
103
+ activityThreads {
104
+ state
105
+ transaction
106
+ output
107
+ assignee {
108
+ id
109
+ name
110
+ email
111
+ }
112
+ round
113
+ assignedAt
114
+ startedAt
115
+ terminatedAt
116
+ }
117
+ updater {
118
+ id
119
+ name
120
+ }
121
+ assignedAt
122
+ startedAt
123
+ terminatedAt
124
+ updatedAt
125
+ }
126
+ }
127
+ `,
128
+ variables: {
129
+ id
130
+ }
131
+ })
132
+
133
+ this.activityInstance = response.data.activityInstance
134
+ }
135
+ }
@@ -13,7 +13,7 @@ import { openPopup } from '@operato/layout'
13
13
  import { PageView, store } from '@operato/shell'
14
14
  import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
15
15
 
16
- import { ActivityTypes } from '../../types.js'
16
+ import { ActivityTypes } from '../../types/types.js'
17
17
 
18
18
  @customElement('activity-store-page')
19
19
  export class ActivityStorePage extends connect(store)(localize(i18next)(PageView)) {
@@ -15,7 +15,7 @@ import { PageView, store } from '@operato/shell'
15
15
  import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
16
16
  import { isMobileDevice } from '@operato/utils'
17
17
 
18
- import { ActivityTypes, ActivityUITypes } from '../../types.js'
18
+ import { ActivityTypes, ActivityUITypes } from '../../types/types.js'
19
19
 
20
20
  @customElement('activity-template-list-page')
21
21
  export class ActivityTemplateListPage extends connect(store)(localize(i18next)(PageView)) {
@@ -215,6 +215,34 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
215
215
  },
216
216
  width: 140
217
217
  },
218
+ {
219
+ type: 'select',
220
+ name: 'viewType',
221
+ label: true,
222
+ header: i18next.t('field.view-type'),
223
+ record: {
224
+ editable: true,
225
+ options: ActivityUITypes
226
+ },
227
+ width: 80
228
+ },
229
+ {
230
+ type: 'string',
231
+ name: 'viewSource',
232
+ header: i18next.t('field.view-source'),
233
+ record: {
234
+ editable: true,
235
+ editor: function (value, column, record, rowIndex, field) {
236
+ var type = record.viewType !== 'board' ? 'script' : 'board'
237
+ return getEditor(type)(value, column, record, rowIndex, field)
238
+ },
239
+ renderer: function (value, column, record, rowIndex, field) {
240
+ var type = record.viewType !== 'board' ? 'script' : 'board'
241
+ return getRenderer(type)(value, column, record, rowIndex, field)
242
+ }
243
+ },
244
+ width: 140
245
+ },
218
246
  {
219
247
  type: 'select',
220
248
  name: 'reportType',
@@ -4,7 +4,7 @@ import '@operato/board/ox-board-viewer.js'
4
4
  import gql from 'graphql-tag'
5
5
  import { css, html } from 'lit'
6
6
  import { unsafeHTML } from 'lit-html/directives/unsafe-html.js'
7
- import { customElement, property, query } from 'lit/decorators.js'
7
+ import { customElement, property, query, state } from 'lit/decorators.js'
8
8
  import { keyed } from 'lit/directives/keyed.js'
9
9
  import { connect } from 'pwa-helpers/connect-mixin.js'
10
10
 
@@ -100,8 +100,8 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
100
100
  `
101
101
  ]
102
102
 
103
- @property({ type: Object }) activityThread: any
104
- @property({ type: Object }) board: any
103
+ @state() activityThread: any
104
+ @state() board: any
105
105
 
106
106
  get context() {
107
107
  const state = this.activityThread?.state
@@ -260,6 +260,11 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
260
260
  }
261
261
  }
262
262
 
263
+ /*
264
+ ox-board-viewer에서 provider에 의해 공급되는 board가 각 id별로 instance를 하나씩 밖에 가지지 않으므로,
265
+ 동일한 id의 보드를 다른 page에 뺏기는 경우가 있다.
266
+ 따라서, Page가 active될 때마다 타임스탬프를 refresh key로 설정하였다.
267
+ */
263
268
  return keyed(
264
269
  this.activityThread.id,
265
270
  html`
@@ -0,0 +1,102 @@
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
+ }