@things-factory/worklist 6.0.45 → 6.0.46

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 (151) hide show
  1. package/client/bootstrap.ts +5 -0
  2. package/client/components/activity-starter-form.ts +52 -303
  3. package/client/pages/activity/activity-list-page.ts +44 -28
  4. package/client/pages/activity/activity-page.ts +3 -3
  5. package/client/pages/activity/activity-partial-view.ts +2 -1
  6. package/client/pages/activity/starter-list-page.ts +16 -11
  7. package/client/pages/activity-instance/activity-instance-search-page.ts +2 -19
  8. package/client/pages/activity-instance/activity-instance-start-page.ts +514 -0
  9. package/client/pages/activity-thread/activity-thread-page.ts +1 -1
  10. package/client/pages/installable-activity/installable-activity-list-page.ts +7 -5
  11. package/client/pages/todo/approval-pending-list-page.ts +1 -1
  12. package/client/pages/todo/done-list-page.ts +1 -1
  13. package/client/pages/todo/draft-list-page.ts +26 -102
  14. package/client/pages/todo/todo-list-page.ts +1 -1
  15. package/client/route.ts +2 -2
  16. package/client/templates/activity-approval-context-template.ts +4 -0
  17. package/client/templates/activity-instance-context-template.ts +171 -0
  18. package/client/templates/activity-thread-context-template.ts +4 -0
  19. package/client/types/activity-instance-type.ts +4 -2
  20. package/client/types/activity-instance.ts +2 -2
  21. package/client/types/activity.ts +7 -0
  22. package/client/types/types.ts +8 -0
  23. package/dist-client/bootstrap.d.ts +1 -0
  24. package/dist-client/bootstrap.js +5 -0
  25. package/dist-client/bootstrap.js.map +1 -1
  26. package/dist-client/components/activity-starter-form.d.ts +2 -5
  27. package/dist-client/components/activity-starter-form.js +54 -247
  28. package/dist-client/components/activity-starter-form.js.map +1 -1
  29. package/dist-client/pages/activity/activity-list-page.d.ts +1 -1
  30. package/dist-client/pages/activity/activity-list-page.js +45 -30
  31. package/dist-client/pages/activity/activity-list-page.js.map +1 -1
  32. package/dist-client/pages/activity/activity-page.d.ts +1 -1
  33. package/dist-client/pages/activity/activity-page.js +3 -3
  34. package/dist-client/pages/activity/activity-page.js.map +1 -1
  35. package/dist-client/pages/activity/activity-partial-view.js +2 -2
  36. package/dist-client/pages/activity/activity-partial-view.js.map +1 -1
  37. package/dist-client/pages/activity/starter-list-page.d.ts +1 -0
  38. package/dist-client/pages/activity/starter-list-page.js +14 -11
  39. package/dist-client/pages/activity/starter-list-page.js.map +1 -1
  40. package/dist-client/pages/activity-instance/activity-instance-page.d.ts +2 -2
  41. package/dist-client/pages/activity-instance/activity-instance-page.js +19 -10
  42. package/dist-client/pages/activity-instance/activity-instance-page.js.map +1 -1
  43. package/dist-client/pages/activity-instance/activity-instance-search-page.js +1 -8
  44. package/dist-client/pages/activity-instance/activity-instance-search-page.js.map +1 -1
  45. package/dist-client/pages/activity-instance/activity-instance-start-page.d.ts +49 -0
  46. package/dist-client/pages/activity-instance/activity-instance-start-page.js +450 -0
  47. package/dist-client/pages/activity-instance/activity-instance-start-page.js.map +1 -0
  48. package/dist-client/pages/activity-thread/activity-thread-page.js +1 -1
  49. package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
  50. package/dist-client/pages/installable-activity/installable-activity-list-page.js +7 -5
  51. package/dist-client/pages/installable-activity/installable-activity-list-page.js.map +1 -1
  52. package/dist-client/pages/todo/approval-pending-list-page.js +1 -1
  53. package/dist-client/pages/todo/approval-pending-list-page.js.map +1 -1
  54. package/dist-client/pages/todo/done-list-page.js +1 -1
  55. package/dist-client/pages/todo/done-list-page.js.map +1 -1
  56. package/dist-client/pages/todo/draft-list-page.d.ts +1 -0
  57. package/dist-client/pages/todo/draft-list-page.js +25 -99
  58. package/dist-client/pages/todo/draft-list-page.js.map +1 -1
  59. package/dist-client/pages/todo/todo-list-page.js +1 -1
  60. package/dist-client/pages/todo/todo-list-page.js.map +1 -1
  61. package/dist-client/route.d.ts +1 -1
  62. package/dist-client/route.js +2 -2
  63. package/dist-client/route.js.map +1 -1
  64. package/dist-client/templates/activity-approval-context-template.js +4 -0
  65. package/dist-client/templates/activity-approval-context-template.js.map +1 -1
  66. package/dist-client/templates/activity-instance-context-template.d.ts +2 -0
  67. package/dist-client/templates/activity-instance-context-template.js +145 -0
  68. package/dist-client/templates/activity-instance-context-template.js.map +1 -0
  69. package/dist-client/templates/activity-thread-context-template.js +4 -0
  70. package/dist-client/templates/activity-thread-context-template.js.map +1 -1
  71. package/dist-client/tsconfig.tsbuildinfo +1 -1
  72. package/dist-client/types/activity-instance-type.d.ts +3 -2
  73. package/dist-client/types/activity-instance-type.js +2 -2
  74. package/dist-client/types/activity-instance-type.js.map +1 -1
  75. package/dist-client/types/activity-instance.d.ts +1 -1
  76. package/dist-client/types/activity-instance.js +2 -2
  77. package/dist-client/types/activity-instance.js.map +1 -1
  78. package/dist-client/types/activity.d.ts +5 -0
  79. package/dist-client/types/activity.js +5 -0
  80. package/dist-client/types/activity.js.map +1 -1
  81. package/dist-client/types/types.d.ts +4 -0
  82. package/dist-client/types/types.js +6 -0
  83. package/dist-client/types/types.js.map +1 -1
  84. package/dist-server/controllers/activity-instance/assign.js +1 -1
  85. package/dist-server/controllers/activity-instance/assign.js.map +1 -1
  86. package/dist-server/controllers/activity-instance/draft.js +24 -6
  87. package/dist-server/controllers/activity-instance/draft.js.map +1 -1
  88. package/dist-server/controllers/activity-instance/index.js +1 -1
  89. package/dist-server/controllers/activity-instance/index.js.map +1 -1
  90. package/dist-server/controllers/activity-instance/issue.js +105 -0
  91. package/dist-server/controllers/activity-instance/issue.js.map +1 -0
  92. package/dist-server/controllers/activity-instance/pick.js +1 -1
  93. package/dist-server/controllers/activity-instance/pick.js.map +1 -1
  94. package/dist-server/controllers/activity-instance/post.js +7 -7
  95. package/dist-server/controllers/activity-instance/post.js.map +1 -1
  96. package/dist-server/controllers/common.js +33 -9
  97. package/dist-server/controllers/common.js.map +1 -1
  98. package/dist-server/routes.js +2 -2
  99. package/dist-server/routes.js.map +1 -1
  100. package/dist-server/service/activity/activity-history.js +6 -2
  101. package/dist-server/service/activity/activity-history.js.map +1 -1
  102. package/dist-server/service/activity/activity-query.js +84 -1
  103. package/dist-server/service/activity/activity-query.js.map +1 -1
  104. package/dist-server/service/activity/activity-type.js +8 -0
  105. package/dist-server/service/activity/activity-type.js.map +1 -1
  106. package/dist-server/service/activity/activity.js +36 -3
  107. package/dist-server/service/activity/activity.js.map +1 -1
  108. package/dist-server/service/activity-instance/activity-instance-history.js +1 -1
  109. package/dist-server/service/activity-instance/activity-instance-history.js.map +1 -1
  110. package/dist-server/service/activity-instance/activity-instance-mutation.js +6 -6
  111. package/dist-server/service/activity-instance/activity-instance-mutation.js.map +1 -1
  112. package/dist-server/service/activity-instance/activity-instance-query.js +2 -2
  113. package/dist-server/service/activity-instance/activity-instance-query.js.map +1 -1
  114. package/dist-server/service/activity-instance/activity-instance-type.js +62 -50
  115. package/dist-server/service/activity-instance/activity-instance-type.js.map +1 -1
  116. package/dist-server/service/activity-instance/activity-instance.js +4 -23
  117. package/dist-server/service/activity-instance/activity-instance.js.map +1 -1
  118. package/dist-server/service/activity-summary/activity-summary-query.js +1 -1
  119. package/dist-server/service/activity-summary/activity-summary-query.js.map +1 -1
  120. package/dist-server/service/installable-activity/installable-activity.js +4 -0
  121. package/dist-server/service/installable-activity/installable-activity.js.map +1 -1
  122. package/dist-server/tsconfig.tsbuildinfo +1 -1
  123. package/helps/worklist/activity.md +91 -0
  124. package/helps/worklist/draft-list.md +5 -1
  125. package/helps/worklist/starter-list.md +34 -0
  126. package/package.json +2 -2
  127. package/server/controllers/activity-instance/assign.ts +1 -1
  128. package/server/controllers/activity-instance/draft.ts +33 -6
  129. package/server/controllers/activity-instance/index.ts +1 -1
  130. package/server/controllers/activity-instance/issue.ts +175 -0
  131. package/server/controllers/activity-instance/pick.ts +1 -1
  132. package/server/controllers/common.ts +43 -9
  133. package/server/routes.ts +2 -2
  134. package/server/service/activity/activity-history.ts +5 -2
  135. package/server/service/activity/activity-query.ts +85 -2
  136. package/server/service/activity/activity-type.ts +15 -2
  137. package/server/service/activity/activity.ts +28 -2
  138. package/server/service/activity-instance/activity-instance-history.ts +1 -1
  139. package/server/service/activity-instance/activity-instance-mutation.ts +7 -7
  140. package/server/service/activity-instance/activity-instance-query.ts +3 -3
  141. package/server/service/activity-instance/activity-instance-type.ts +13 -4
  142. package/server/service/activity-instance/activity-instance.ts +4 -16
  143. package/server/service/activity-summary/activity-summary-query.ts +1 -1
  144. package/server/service/installable-activity/installable-activity.ts +4 -1
  145. package/things-factory.config.js +1 -1
  146. package/translations/en.json +13 -0
  147. package/translations/ko.json +17 -4
  148. package/translations/ms.json +13 -0
  149. package/translations/zh.json +13 -0
  150. package/client/pages/activity-instance/activity-instance-page.ts +0 -445
  151. package/server/controllers/activity-instance/post.ts +0 -140
@@ -14,6 +14,7 @@ import { openPopup } from '@operato/layout'
14
14
  import { PageView, store } from '@operato/shell'
15
15
  import { CommonGristStyles, ScrollbarStyles } from '@operato/styles'
16
16
  import { isMobileDevice } from '@operato/utils'
17
+ import { ActivityStartingTypes, ActivityTypes } from '../../types/types.js'
17
18
 
18
19
  const FILTERS = [
19
20
  {
@@ -67,7 +68,8 @@ export class StarterListPage extends connect(store)(localize(i18next)(PageView))
67
68
  handler: () => {
68
69
  this.grist.toggleHeadroom()
69
70
  }
70
- }
71
+ },
72
+ help: 'worklist/starter-list'
71
73
  }
72
74
  }
73
75
 
@@ -115,7 +117,7 @@ export class StarterListPage extends connect(store)(localize(i18next)(PageView))
115
117
  type: 'gutter',
116
118
  gutterName: 'button',
117
119
  name: 'start',
118
- icon: 'add_task',
120
+ icon: 'rocket_launch',
119
121
  handlers: {
120
122
  click: (columns, data, column, record, rowIndex) => {
121
123
  if (!record.id) {
@@ -128,7 +130,9 @@ export class StarterListPage extends connect(store)(localize(i18next)(PageView))
128
130
  backdrop: true,
129
131
  help: 'worklist/activity-starter-form',
130
132
  size: 'large',
131
- title: i18next.t('title.activity starter')
133
+ title: i18next.t(
134
+ record.startingType == 'issue' ? 'title.activity starter' : 'title.activity application'
135
+ )
132
136
  }
133
137
  )
134
138
  popup.onclosed = () => {
@@ -153,16 +157,16 @@ export class StarterListPage extends connect(store)(localize(i18next)(PageView))
153
157
  width: 240
154
158
  },
155
159
  {
156
- type: 'string',
157
- name: 'activityType',
160
+ type: 'select',
161
+ name: 'startingType',
158
162
  label: true,
159
- header: i18next.t('field.activity-type'),
163
+ header: i18next.t('field.starting-type'),
164
+ record: {
165
+ editable: false,
166
+ options: ActivityStartingTypes
167
+ },
160
168
  sortable: true,
161
- // filter: {
162
- // type: 'select',
163
- // options: ActivityTypes
164
- // },
165
- width: 100
169
+ width: 80
166
170
  },
167
171
  {
168
172
  type: 'resource-object',
@@ -215,6 +219,7 @@ export class StarterListPage extends connect(store)(localize(i18next)(PageView))
215
219
  activityType
216
220
  priority
217
221
  thumbnail
222
+ startingType
218
223
  updater {
219
224
  id
220
225
  name
@@ -6,15 +6,7 @@ import { css, html } from 'lit'
6
6
  import { customElement, property, query, state } from 'lit/decorators.js'
7
7
  import { connect } from 'pwa-helpers/connect-mixin'
8
8
 
9
- import {
10
- getEditor,
11
- getRenderer,
12
- ColumnConfig,
13
- DataGrist,
14
- FetchOption,
15
- SortersControl,
16
- GristRecord
17
- } from '@operato/data-grist'
9
+ import { DataGrist, FetchOption, GristRecord } from '@operato/data-grist'
18
10
  import { client } from '@operato/graphql'
19
11
  import { i18next, localize } from '@operato/i18n'
20
12
  import { openPopup } from '@operato/layout'
@@ -81,12 +73,7 @@ export class ActivityInstanceSearchPage extends connect(store)(localize(i18next)
81
73
  const mode = this.mode || (isMobileDevice() ? 'LIST' : 'GRID')
82
74
 
83
75
  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
- >
76
+ <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
90
77
  <div slot="headroom">
91
78
  <div id="filters">
92
79
  <ox-filters-form autofocus without-search></ox-filters-form>
@@ -152,8 +139,6 @@ export class ActivityInstanceSearchPage extends connect(store)(localize(i18next)
152
139
  this.activity = response.data.activity
153
140
  this.searchKeys = this.activity?.searchKeys
154
141
  this.refreshGristConfig()
155
-
156
- this.grist.fetch()
157
142
  }
158
143
  }
159
144
 
@@ -177,8 +162,6 @@ export class ActivityInstanceSearchPage extends connect(store)(localize(i18next)
177
162
  }
178
163
 
179
164
  refreshGristConfig() {
180
- const today = new Date().toISOString().split('T')[0]
181
-
182
165
  this.gristConfig = {
183
166
  list: {
184
167
  fields: ['name', 'description'],
@@ -0,0 +1,514 @@
1
+ import '@operato/property-editor/ox-properties-dynamic-view.js'
2
+ import '@operato/board/ox-board-viewer.js'
3
+ import '@things-factory/organization'
4
+
5
+ import gql from 'graphql-tag'
6
+ import { css, html } from 'lit'
7
+ import { unsafeHTML } from 'lit-html/directives/unsafe-html.js'
8
+ import { customElement, property, query, state } from 'lit/decorators.js'
9
+ import { keyed } from 'lit/directives/keyed.js'
10
+ import { connect } from 'pwa-helpers/connect-mixin.js'
11
+ import { client } from '@operato/graphql'
12
+ import { i18next, localize } from '@operato/i18n'
13
+ import { PageView, store } from '@operato/shell'
14
+ import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
15
+ import { provider } from '@things-factory/board-ui'
16
+ import { notify } from '@operato/layout'
17
+
18
+ @customElement('activity-instance-start-page')
19
+ export class ActivityInstanceStartPage extends connect(store)(localize(i18next)(PageView)) {
20
+ static styles = [
21
+ ScrollbarStyles,
22
+ CommonGristStyles,
23
+ css`
24
+ :host {
25
+ display: flex;
26
+ flex-direction: column;
27
+
28
+ width: 100%;
29
+ padding: 5px;
30
+ overflow: auto;
31
+ }
32
+
33
+ ox-board-viewer {
34
+ width: 100%;
35
+ height: 100%;
36
+ }
37
+
38
+ #custom-content {
39
+ flex: 1;
40
+ }
41
+ `
42
+ ]
43
+
44
+ @state() activity: any = {}
45
+ @state() activityInstance: any = {}
46
+ @state() board: any
47
+
48
+ @query('ox-board-viewer') viewer: any
49
+
50
+ get context() {
51
+ const { startingType } = this.activity
52
+ const { state } = this.activityInstance
53
+
54
+ const issuable = state === 'draft'
55
+
56
+ return {
57
+ title: this.lifecycle?.params?.['title'] || i18next.t('title.activity'),
58
+ help: 'worklist/activity-instance-single-post',
59
+ actions: [
60
+ issuable && {
61
+ title: i18next.t('button.draft'),
62
+ action: this.draftActivityInstance.bind(this),
63
+ ...CommonButtonStyles.save
64
+ },
65
+ issuable && {
66
+ title: i18next.t(startingType == 'issue' ? 'button.issue' : 'button.post'),
67
+ action: this.issueActivityInstance.bind(this),
68
+ ...CommonButtonStyles.submit
69
+ }
70
+ ].filter(Boolean /* truthy only */),
71
+ activityInstance: this.activityInstance
72
+ }
73
+ }
74
+
75
+ render() {
76
+ return html` ${this.activityContent()}`
77
+ }
78
+
79
+ activityContent() {
80
+ switch (this.activityInstance?.uiType) {
81
+ case 'template':
82
+ return this.templateContent()
83
+ case 'generated':
84
+ return this.generatedContent()
85
+ case 'board':
86
+ return this.boardContent()
87
+ case 'custom-element':
88
+ return this.customElementContent()
89
+ case 'page':
90
+ case 'external':
91
+ default:
92
+ return html``
93
+ }
94
+ }
95
+
96
+ templateContent() {
97
+ const { uiSource: template } = this.activityInstance
98
+ return unsafeHTML(template)
99
+ }
100
+
101
+ getInputSpec() {
102
+ const model = this.activity?.model
103
+
104
+ return (model || [])
105
+ .filter(item => item.inout === 'in' || item.inout === 'inout')
106
+ .map(item => {
107
+ return {
108
+ ...item,
109
+ label: item.name
110
+ }
111
+ })
112
+ }
113
+
114
+ getOutputSpec() {
115
+ const model = this.activity?.model
116
+
117
+ return (model || [])
118
+ .filter(item => item.inout === 'inout' || item.inout === 'out')
119
+ .map(item => {
120
+ return {
121
+ ...item,
122
+ label: item.name
123
+ }
124
+ })
125
+ }
126
+
127
+ generatedContent() {
128
+ var { input, output } = this.activityInstance || {}
129
+
130
+ const inputSpec = this.getInputSpec()
131
+ const outputSpec = this.getOutputSpec()
132
+
133
+ if (!output) {
134
+ output = inputSpec
135
+ .filter(item => item.inout === 'inout')
136
+ .reduce((inout, item) => {
137
+ inout[item.name] = input[item.name]
138
+ return inout
139
+ }, {})
140
+ }
141
+
142
+ return keyed(
143
+ this.activityInstance.id,
144
+ html`
145
+ <fieldset>
146
+ <legend>Input</legend>
147
+ <ox-properties-dynamic-view
148
+ data-name="input"
149
+ .props=${inputSpec}
150
+ .value=${input}
151
+ @property-change=${e => (this.activityInstance.input = e.currentTarget.value)}
152
+ ></ox-properties-dynamic-view>
153
+ </fieldset>
154
+
155
+ <fieldset>
156
+ <legend>Output</legend>
157
+ <ox-properties-dynamic-view
158
+ data-name="output"
159
+ .props=${outputSpec}
160
+ .value=${output}
161
+ @property-change=${e => (this.activityInstance.output = e.currentTarget.value)}
162
+ ></ox-properties-dynamic-view>
163
+ </fieldset>
164
+ `
165
+ )
166
+ }
167
+
168
+ boardContent() {
169
+ const { uiSource: boardId, input, output } = this.activityInstance
170
+
171
+ if (!this.board || this.board.id !== boardId) {
172
+ this.board = {
173
+ id: boardId
174
+ }
175
+ }
176
+
177
+ /*
178
+ ox-board-viewer에서 provider에 의해 공급되는 board가 각 id별로 instance를 하나씩 밖에 가지지 않으므로,
179
+ 동일한 id의 보드를 다른 page에 뺏기는 경우가 있다.
180
+ 따라서, Page가 active될 때마다 타임스탬프를 refresh key로 설정하였다.
181
+ */
182
+ return keyed(
183
+ this.activityInstance.id,
184
+ html`
185
+ <ox-board-viewer
186
+ style="background-color: white;"
187
+ .board=${this.board}
188
+ .provider=${provider}
189
+ .values=${{ ...input, ...output }}
190
+ hide-fullscreen
191
+ hide-navigation
192
+ ></ox-board-viewer>
193
+ `
194
+ )
195
+ }
196
+
197
+ customElementContent() {
198
+ const { uiSource: tagName, input, output } = this.activityInstance
199
+
200
+ const element = document.createElement(tagName)
201
+ element.id = 'custom-content'
202
+ element.input = input
203
+ element.output = output
204
+
205
+ element.addEventListener('change-input', (e: CustomEvent) => {
206
+ this.activityInstance.input = e.detail
207
+ })
208
+ element.addEventListener('change-output', (e: CustomEvent) => {
209
+ this.activityInstance.output = e.detail
210
+ })
211
+
212
+ /* DEPRECATED 일반적으로 output만 수정될 가능성이 높기때문에, change 이벤트는 output을 수정하는 것으로 한다. */
213
+ element.addEventListener('change', (e: CustomEvent) => {
214
+ this.activityInstance.output = e.detail
215
+ })
216
+
217
+ return element
218
+ }
219
+
220
+ getInOutFromBoard() {
221
+ const inputSpec = this.getInputSpec()
222
+ const outputSpec = this.getOutputSpec()
223
+ const data = this.viewer?.getSceneValues() || {}
224
+
225
+ const input = inputSpec.reduce((input, spec) => {
226
+ input[spec.name] = data[spec.name]
227
+ return input
228
+ }, {})
229
+
230
+ const output = outputSpec.reduce((output, spec) => {
231
+ output[spec.name] = data[spec.name]
232
+ return output
233
+ }, {})
234
+
235
+ return [input, output]
236
+ }
237
+
238
+ updated(changes) {
239
+ if (changes.has('activityInstance')) {
240
+ this.updateContext()
241
+ }
242
+ }
243
+
244
+ async pageUpdated(changes, lifecycle, changedBefore) {
245
+ if (this.active) {
246
+ this.fetchActivityInstance(lifecycle.resourceId)
247
+ }
248
+ }
249
+
250
+ async fetchActivityInstance(id) {
251
+ const response = await client.query({
252
+ query: gql`
253
+ query activityInstance($id: String!) {
254
+ activityInstance(id: $id) {
255
+ id
256
+ name
257
+ description
258
+ state
259
+ activity {
260
+ startingType
261
+ model {
262
+ name
263
+ description
264
+ active
265
+ tag
266
+ inout
267
+ type
268
+ unit
269
+ options
270
+ quantifier
271
+ spec
272
+ }
273
+ }
274
+ thumbnail
275
+ input
276
+ output
277
+ uiType
278
+ uiSource
279
+ approvalLine {
280
+ type
281
+ value
282
+ approver {
283
+ id
284
+ name
285
+ description
286
+ controlNo
287
+ }
288
+ }
289
+ dueAt
290
+ createdAt
291
+ }
292
+ }
293
+ `,
294
+ variables: {
295
+ id
296
+ }
297
+ })
298
+
299
+ this.activityInstance = response.data.activityInstance
300
+ this.activity = this.activityInstance.activity
301
+ }
302
+
303
+ async draftActivityInstance() {
304
+ var { id: activityId } = this.activity
305
+ var {
306
+ id,
307
+ name,
308
+ description,
309
+ priority,
310
+ threadsMin,
311
+ threadsMax,
312
+ dueAt,
313
+ input,
314
+ output,
315
+ reason,
316
+ uiType,
317
+ assignees,
318
+ approvalLine
319
+ } = this.activityInstance
320
+
321
+ if (uiType === 'board') {
322
+ ;[input, output] = this.getInOutFromBoard()
323
+ }
324
+
325
+ name ||= this.activity.name
326
+ description ||= this.activity.description
327
+ assignees ||= this.activity.assignees
328
+ approvalLine ||= this.activity.approvalLine
329
+
330
+ var activityInstance = {
331
+ id,
332
+ activityId,
333
+ name,
334
+ description,
335
+ priority,
336
+ threadsMax,
337
+ threadsMin,
338
+ dueAt,
339
+ input,
340
+ output,
341
+ reason,
342
+ assignees,
343
+ approvalLine
344
+ }
345
+
346
+ const response = await client.mutate({
347
+ mutation: gql`
348
+ mutation ($activityInstance: ActivityInstanceDraft!) {
349
+ draftActivityInstance(activityInstance: $activityInstance) {
350
+ id
351
+ name
352
+ description
353
+ input
354
+ state
355
+ activity {
356
+ startingType
357
+ model {
358
+ name
359
+ description
360
+ active
361
+ tag
362
+ inout
363
+ type
364
+ unit
365
+ options
366
+ quantifier
367
+ spec
368
+ }
369
+ }
370
+ assignees {
371
+ type
372
+ value
373
+ assignee {
374
+ id
375
+ name
376
+ description
377
+ controlNo
378
+ }
379
+ }
380
+ approvalLine {
381
+ type
382
+ value
383
+ approver {
384
+ id
385
+ name
386
+ description
387
+ controlNo
388
+ }
389
+ }
390
+ uiType
391
+ uiSource
392
+ threadsMin
393
+ threadsMax
394
+ }
395
+ }
396
+ `,
397
+ variables: {
398
+ activityInstance
399
+ }
400
+ })
401
+
402
+ if (!response.errors) {
403
+ this.activityInstance = response.data.draftActivityInstance
404
+ this.activity = this.activityInstance.activity
405
+
406
+ notify({
407
+ message: i18next.t('text.info_x_successfully', {
408
+ x: `${i18next.t('label.activity-instance')} ${i18next.t('text.draft')}`
409
+ })
410
+ })
411
+ }
412
+ }
413
+
414
+ async issueActivityInstance() {
415
+ var {
416
+ id,
417
+ name,
418
+ description,
419
+ input,
420
+ output,
421
+ reason,
422
+ uiType,
423
+ threadsMin = 0,
424
+ threadsMax = 0,
425
+ assignees,
426
+ approvalLine
427
+ } = this.activityInstance
428
+
429
+ if (uiType === 'board') {
430
+ ;[input, output] = this.getInOutFromBoard()
431
+ }
432
+
433
+ const activityInstance = {
434
+ id,
435
+ name: name || this.activity.name,
436
+ description: description || this.activity.description,
437
+ threadsMin,
438
+ threadsMax,
439
+ input,
440
+ output,
441
+ reason,
442
+ assignees,
443
+ approvalLine
444
+ }
445
+
446
+ const response = await client.mutate({
447
+ mutation: gql`
448
+ mutation ($activityInstance: ActivityInstanceIssue!) {
449
+ issueActivityInstance(activityInstance: $activityInstance) {
450
+ id
451
+ name
452
+ description
453
+ input
454
+ output
455
+ state
456
+ activity {
457
+ startingType
458
+ model {
459
+ name
460
+ description
461
+ active
462
+ tag
463
+ inout
464
+ type
465
+ unit
466
+ options
467
+ quantifier
468
+ spec
469
+ }
470
+ }
471
+ assignees {
472
+ type
473
+ value
474
+ assignee {
475
+ id
476
+ name
477
+ description
478
+ controlNo
479
+ }
480
+ }
481
+ approvalLine {
482
+ type
483
+ value
484
+ approver {
485
+ id
486
+ name
487
+ description
488
+ controlNo
489
+ }
490
+ }
491
+ uiType
492
+ uiSource
493
+ threadsMin
494
+ threadsMax
495
+ }
496
+ }
497
+ `,
498
+ variables: {
499
+ activityInstance
500
+ }
501
+ })
502
+
503
+ if (!response.errors) {
504
+ this.activityInstance = response.data.issueActivityInstance
505
+ this.activity = this.activityInstance.activity
506
+
507
+ notify({
508
+ message: i18next.t('text.info_x_successfully', {
509
+ x: `${i18next.t('label.activity-instance')} ${i18next.t('text.assign')}`
510
+ })
511
+ })
512
+ }
513
+ }
514
+ }
@@ -125,7 +125,7 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
125
125
  submittable && {
126
126
  title: i18next.t('button.submit'),
127
127
  action: this._submitActivityThread.bind(this),
128
- ...CommonButtonStyles.save
128
+ ...CommonButtonStyles.submit
129
129
  },
130
130
 
131
131
  delegatable && {
@@ -14,7 +14,7 @@ import { PageView, store } from '@operato/shell'
14
14
  import { CommonGristStyles, ScrollbarStyles } from '@operato/styles'
15
15
  import { isMobileDevice } from '@operato/utils'
16
16
 
17
- import { ActivityTypes, ActivityUITypes } from '../../types/types.js'
17
+ import { ActivityStartingTypes, ActivityTypes, ActivityUITypes } from '../../types/types.js'
18
18
 
19
19
  @customElement('installable-activity-list-page')
20
20
  export class ActivityTemplateListPage extends connect(store)(localize(i18next)(PageView)) {
@@ -300,12 +300,13 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
300
300
  width: 140
301
301
  },
302
302
  {
303
- type: 'checkbox',
304
- name: 'startable',
303
+ type: 'select',
304
+ name: 'startingType',
305
305
  label: true,
306
- header: i18next.t('field.startable'),
306
+ header: i18next.t('field.starting-type'),
307
307
  record: {
308
- editable: false
308
+ editable: false,
309
+ options: ActivityStartingTypes
309
310
  },
310
311
  sortable: true,
311
312
  width: 60
@@ -340,6 +341,7 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
340
341
  activityType
341
342
  priority
342
343
  startable
344
+ startingType
343
345
  model {
344
346
  name
345
347
  description
@@ -229,7 +229,7 @@ export class ApprovalPendingListPage extends connect(store)(localize(i18next)(Pa
229
229
  {
230
230
  type: 'datetime',
231
231
  name: 'createdAt',
232
- header: i18next.t('field.posted-at'),
232
+ header: i18next.t('field.issued-at'),
233
233
  record: {
234
234
  editable: false
235
235
  },
@@ -241,7 +241,7 @@ export class DoneListPage extends connect(store)(localize(i18next)(PageView)) {
241
241
  {
242
242
  type: 'datetime',
243
243
  name: 'createdAt',
244
- header: i18next.t('field.posted-at'),
244
+ header: i18next.t('field.issued-at'),
245
245
  record: {
246
246
  editable: false
247
247
  },