@things-factory/worklist 6.0.43 → 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 (190) 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-stats/activity-stats-importer.ts +97 -0
  10. package/client/pages/activity-stats/activity-stats-list-page.ts +348 -0
  11. package/client/pages/activity-thread/activity-thread-page.ts +1 -1
  12. package/client/pages/installable-activity/installable-activity-list-page.ts +7 -5
  13. package/client/pages/todo/approval-done-list-page.ts +340 -0
  14. package/client/pages/todo/approval-pending-list-page.ts +2 -2
  15. package/client/pages/todo/done-list-calendar-page.ts +115 -0
  16. package/client/pages/todo/done-list-page.ts +2 -3
  17. package/client/pages/todo/draft-list-page.ts +26 -102
  18. package/client/pages/todo/pickable-list-page.ts +2 -1
  19. package/client/pages/todo/todo-list-page.ts +1 -1
  20. package/client/route.ts +14 -2
  21. package/client/templates/activity-approval-context-template.ts +4 -0
  22. package/client/templates/activity-instance-context-template.ts +171 -0
  23. package/client/templates/activity-thread-context-template.ts +4 -0
  24. package/client/themes/calendar-theme.css +54 -0
  25. package/client/types/activity-instance-type.ts +4 -2
  26. package/client/types/activity-instance.ts +2 -2
  27. package/client/types/activity.ts +7 -0
  28. package/client/types/types.ts +8 -0
  29. package/dist-client/bootstrap.d.ts +1 -0
  30. package/dist-client/bootstrap.js +5 -0
  31. package/dist-client/bootstrap.js.map +1 -1
  32. package/dist-client/components/activity-starter-form.d.ts +2 -5
  33. package/dist-client/components/activity-starter-form.js +54 -247
  34. package/dist-client/components/activity-starter-form.js.map +1 -1
  35. package/dist-client/pages/activity/activity-list-page.d.ts +1 -1
  36. package/dist-client/pages/activity/activity-list-page.js +45 -30
  37. package/dist-client/pages/activity/activity-list-page.js.map +1 -1
  38. package/dist-client/pages/activity/activity-page.d.ts +1 -1
  39. package/dist-client/pages/activity/activity-page.js +3 -3
  40. package/dist-client/pages/activity/activity-page.js.map +1 -1
  41. package/dist-client/pages/activity/activity-partial-view.js +2 -2
  42. package/dist-client/pages/activity/activity-partial-view.js.map +1 -1
  43. package/dist-client/pages/activity/starter-list-page.d.ts +1 -0
  44. package/dist-client/pages/activity/starter-list-page.js +14 -11
  45. package/dist-client/pages/activity/starter-list-page.js.map +1 -1
  46. package/dist-client/pages/activity-instance/activity-instance-page.d.ts +2 -2
  47. package/dist-client/pages/activity-instance/activity-instance-page.js +19 -10
  48. package/dist-client/pages/activity-instance/activity-instance-page.js.map +1 -1
  49. package/dist-client/pages/activity-instance/activity-instance-search-page.js +1 -8
  50. package/dist-client/pages/activity-instance/activity-instance-search-page.js.map +1 -1
  51. package/dist-client/pages/activity-instance/activity-instance-start-page.d.ts +49 -0
  52. package/dist-client/pages/activity-instance/activity-instance-start-page.js +450 -0
  53. package/dist-client/pages/activity-instance/activity-instance-start-page.js.map +1 -0
  54. package/dist-client/pages/activity-stats/activity-stats-importer.d.ts +22 -0
  55. package/dist-client/pages/activity-stats/activity-stats-importer.js +100 -0
  56. package/dist-client/pages/activity-stats/activity-stats-importer.js.map +1 -0
  57. package/dist-client/pages/activity-stats/activity-stats-list-page.d.ts +62 -0
  58. package/dist-client/pages/activity-stats/activity-stats-list-page.js +326 -0
  59. package/dist-client/pages/activity-stats/activity-stats-list-page.js.map +1 -0
  60. package/dist-client/pages/activity-thread/activity-thread-page.js +1 -1
  61. package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
  62. package/dist-client/pages/installable-activity/installable-activity-list-page.js +7 -5
  63. package/dist-client/pages/installable-activity/installable-activity-list-page.js.map +1 -1
  64. package/dist-client/pages/todo/approval-done-list-page.d.ts +39 -0
  65. package/dist-client/pages/todo/approval-done-list-page.js +338 -0
  66. package/dist-client/pages/todo/approval-done-list-page.js.map +1 -0
  67. package/dist-client/pages/todo/approval-pending-list-page.js +2 -2
  68. package/dist-client/pages/todo/approval-pending-list-page.js.map +1 -1
  69. package/dist-client/pages/todo/done-list-calendar-page.d.ts +24 -0
  70. package/dist-client/pages/todo/done-list-calendar-page.js +107 -0
  71. package/dist-client/pages/todo/done-list-calendar-page.js.map +1 -0
  72. package/dist-client/pages/todo/done-list-page.js +2 -3
  73. package/dist-client/pages/todo/done-list-page.js.map +1 -1
  74. package/dist-client/pages/todo/draft-list-page.d.ts +1 -0
  75. package/dist-client/pages/todo/draft-list-page.js +25 -99
  76. package/dist-client/pages/todo/draft-list-page.js.map +1 -1
  77. package/dist-client/pages/todo/pickable-list-page.d.ts +1 -0
  78. package/dist-client/pages/todo/pickable-list-page.js +2 -1
  79. package/dist-client/pages/todo/pickable-list-page.js.map +1 -1
  80. package/dist-client/pages/todo/todo-list-page.js +1 -1
  81. package/dist-client/pages/todo/todo-list-page.js.map +1 -1
  82. package/dist-client/route.d.ts +1 -1
  83. package/dist-client/route.js +11 -2
  84. package/dist-client/route.js.map +1 -1
  85. package/dist-client/templates/activity-approval-context-template.js +4 -0
  86. package/dist-client/templates/activity-approval-context-template.js.map +1 -1
  87. package/dist-client/templates/activity-instance-context-template.d.ts +2 -0
  88. package/dist-client/templates/activity-instance-context-template.js +145 -0
  89. package/dist-client/templates/activity-instance-context-template.js.map +1 -0
  90. package/dist-client/templates/activity-thread-context-template.js +4 -0
  91. package/dist-client/templates/activity-thread-context-template.js.map +1 -1
  92. package/dist-client/tsconfig.tsbuildinfo +1 -1
  93. package/dist-client/types/activity-instance-type.d.ts +3 -2
  94. package/dist-client/types/activity-instance-type.js +2 -2
  95. package/dist-client/types/activity-instance-type.js.map +1 -1
  96. package/dist-client/types/activity-instance.d.ts +1 -1
  97. package/dist-client/types/activity-instance.js +2 -2
  98. package/dist-client/types/activity-instance.js.map +1 -1
  99. package/dist-client/types/activity.d.ts +5 -0
  100. package/dist-client/types/activity.js +5 -0
  101. package/dist-client/types/activity.js.map +1 -1
  102. package/dist-client/types/types.d.ts +4 -0
  103. package/dist-client/types/types.js +6 -0
  104. package/dist-client/types/types.js.map +1 -1
  105. package/dist-server/controllers/activity-instance/assign.js +1 -1
  106. package/dist-server/controllers/activity-instance/assign.js.map +1 -1
  107. package/dist-server/controllers/activity-instance/draft.js +24 -6
  108. package/dist-server/controllers/activity-instance/draft.js.map +1 -1
  109. package/dist-server/controllers/activity-instance/index.js +1 -1
  110. package/dist-server/controllers/activity-instance/index.js.map +1 -1
  111. package/dist-server/controllers/activity-instance/issue.js +105 -0
  112. package/dist-server/controllers/activity-instance/issue.js.map +1 -0
  113. package/dist-server/controllers/activity-instance/pick.js +1 -1
  114. package/dist-server/controllers/activity-instance/pick.js.map +1 -1
  115. package/dist-server/controllers/activity-instance/post.js +7 -7
  116. package/dist-server/controllers/activity-instance/post.js.map +1 -1
  117. package/dist-server/controllers/common.js +33 -9
  118. package/dist-server/controllers/common.js.map +1 -1
  119. package/dist-server/routes.js +2 -2
  120. package/dist-server/routes.js.map +1 -1
  121. package/dist-server/service/activity/activity-history.js +6 -2
  122. package/dist-server/service/activity/activity-history.js.map +1 -1
  123. package/dist-server/service/activity/activity-query.js +84 -1
  124. package/dist-server/service/activity/activity-query.js.map +1 -1
  125. package/dist-server/service/activity/activity-type.js +8 -0
  126. package/dist-server/service/activity/activity-type.js.map +1 -1
  127. package/dist-server/service/activity/activity.js +36 -3
  128. package/dist-server/service/activity/activity.js.map +1 -1
  129. package/dist-server/service/activity-approval/activity-approval-query.js +48 -0
  130. package/dist-server/service/activity-approval/activity-approval-query.js.map +1 -1
  131. package/dist-server/service/activity-instance/activity-instance-history.js +1 -1
  132. package/dist-server/service/activity-instance/activity-instance-history.js.map +1 -1
  133. package/dist-server/service/activity-instance/activity-instance-mutation.js +6 -6
  134. package/dist-server/service/activity-instance/activity-instance-mutation.js.map +1 -1
  135. package/dist-server/service/activity-instance/activity-instance-query.js +2 -2
  136. package/dist-server/service/activity-instance/activity-instance-query.js.map +1 -1
  137. package/dist-server/service/activity-instance/activity-instance-type.js +62 -50
  138. package/dist-server/service/activity-instance/activity-instance-type.js.map +1 -1
  139. package/dist-server/service/activity-instance/activity-instance.js +4 -23
  140. package/dist-server/service/activity-instance/activity-instance.js.map +1 -1
  141. package/dist-server/service/activity-stats/activity-stats-query.js +93 -0
  142. package/dist-server/service/activity-stats/activity-stats-query.js.map +1 -0
  143. package/dist-server/service/activity-stats/activity-stats-type.js +47 -0
  144. package/dist-server/service/activity-stats/activity-stats-type.js.map +1 -0
  145. package/dist-server/service/activity-stats/index.js +6 -0
  146. package/dist-server/service/activity-stats/index.js.map +1 -0
  147. package/dist-server/service/activity-summary/activity-summary-query.js +5 -23
  148. package/dist-server/service/activity-summary/activity-summary-query.js.map +1 -1
  149. package/dist-server/service/index.js +2 -0
  150. package/dist-server/service/index.js.map +1 -1
  151. package/dist-server/service/installable-activity/installable-activity.js +4 -0
  152. package/dist-server/service/installable-activity/installable-activity.js.map +1 -1
  153. package/dist-server/tsconfig.tsbuildinfo +1 -1
  154. package/helps/worklist/activity-bank.md +22 -0
  155. package/helps/worklist/{activity-approval.md → activity-stats.md} +1 -1
  156. package/helps/worklist/activity.md +91 -0
  157. package/helps/worklist/draft-list.md +19 -0
  158. package/helps/worklist/starter-list.md +34 -0
  159. package/helps/worklist/worklist-concept.md +11 -8
  160. package/package.json +3 -2
  161. package/server/controllers/activity-instance/assign.ts +1 -1
  162. package/server/controllers/activity-instance/draft.ts +33 -6
  163. package/server/controllers/activity-instance/index.ts +1 -1
  164. package/server/controllers/activity-instance/issue.ts +175 -0
  165. package/server/controllers/activity-instance/pick.ts +1 -1
  166. package/server/controllers/common.ts +43 -9
  167. package/server/routes.ts +2 -2
  168. package/server/service/activity/activity-history.ts +5 -2
  169. package/server/service/activity/activity-query.ts +85 -2
  170. package/server/service/activity/activity-type.ts +15 -2
  171. package/server/service/activity/activity.ts +28 -2
  172. package/server/service/activity-approval/activity-approval-query.ts +45 -1
  173. package/server/service/activity-instance/activity-instance-history.ts +1 -1
  174. package/server/service/activity-instance/activity-instance-mutation.ts +7 -7
  175. package/server/service/activity-instance/activity-instance-query.ts +3 -3
  176. package/server/service/activity-instance/activity-instance-type.ts +13 -4
  177. package/server/service/activity-instance/activity-instance.ts +4 -16
  178. package/server/service/activity-stats/activity-stats-query.ts +94 -0
  179. package/server/service/activity-stats/activity-stats-type.ts +34 -0
  180. package/server/service/activity-stats/index.ts +3 -0
  181. package/server/service/activity-summary/activity-summary-query.ts +5 -23
  182. package/server/service/index.ts +2 -0
  183. package/server/service/installable-activity/installable-activity.ts +4 -1
  184. package/things-factory.config.js +5 -2
  185. package/translations/en.json +23 -0
  186. package/translations/ko.json +29 -6
  187. package/translations/ms.json +23 -0
  188. package/translations/zh.json +23 -0
  189. package/client/pages/activity-instance/activity-instance-page.ts +0 -445
  190. package/server/controllers/activity-instance/post.ts +0 -140
@@ -0,0 +1,97 @@
1
+ import '@operato/data-grist'
2
+
3
+ import gql from 'graphql-tag'
4
+ import { css, html, LitElement } from 'lit'
5
+ import { property } from 'lit/decorators.js'
6
+
7
+ import { client } from '@operato/graphql'
8
+ import { i18next } from '@operato/i18n'
9
+ import { isMobileDevice } from '@operato/utils'
10
+
11
+ export class ActivityStatsImporter extends LitElement {
12
+ static styles = [
13
+ css`
14
+ :host {
15
+ display: flex;
16
+ flex-direction: column;
17
+
18
+ background-color: #fff;
19
+ }
20
+
21
+ ox-grist {
22
+ flex: 1;
23
+ }
24
+
25
+ .button-container {
26
+ display: flex;
27
+ margin-left: auto;
28
+ padding: var(--padding-default);
29
+ }
30
+
31
+ mwc-button {
32
+ margin-left: var(--margin-default);
33
+ }
34
+ `
35
+ ]
36
+
37
+ @property({ type: Array }) activityStats: any[] = []
38
+ @property({ type: Object }) columns = {
39
+ list: { fields: ['name', 'description'] },
40
+ pagination: { infinite: true },
41
+ columns: [
42
+ {
43
+ type: 'string',
44
+ name: 'name',
45
+ header: i18next.t('field.name'),
46
+ width: 150
47
+ },
48
+ {
49
+ type: 'string',
50
+ name: 'description',
51
+ header: i18next.t('field.description'),
52
+ width: 200
53
+ },
54
+ {
55
+ type: 'checkbox',
56
+ name: 'active',
57
+ header: i18next.t('field.active'),
58
+ width: 60
59
+ }
60
+ ]
61
+ }
62
+
63
+
64
+ render() {
65
+ return html`
66
+ <ox-grist
67
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
68
+ .config=${this.columns}
69
+ .data=${
70
+ {
71
+ records: this.activityStats
72
+ }
73
+ }
74
+ ></ox-grist>
75
+
76
+ <div class="button-container">
77
+ <mwc-button raised @click="${this.save.bind(this)}">${i18next.t('button.save')}</mwc-button>
78
+ </div>
79
+ `
80
+ }
81
+
82
+ async save() {
83
+ const response = await client.mutate({
84
+ mutation: gql`
85
+ mutation importActivityStats($activityStats: [ActivityStatsPatch!]!) {
86
+ importActivityStats(activityStats: $activityStats)
87
+ }
88
+ `,
89
+ variables: { activityStats: this.activityStats }
90
+ })
91
+
92
+ if (response.errors?.length) return
93
+
94
+ this.dispatchEvent(new CustomEvent('imported'))
95
+ }
96
+ }
97
+
@@ -0,0 +1,348 @@
1
+ import '@operato/data-grist'
2
+
3
+ import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
4
+ import { PageView, store } from '@operato/shell'
5
+ import { css, html } from 'lit'
6
+ import { customElement, property, query } from 'lit/decorators.js'
7
+ import { ScopedElementsMixin } from '@open-wc/scoped-elements'
8
+ import {
9
+ ColumnConfig,
10
+ DataGrist,
11
+ FetchOption,
12
+ SortersControl
13
+ } from '@operato/data-grist'
14
+ import { client } from '@operato/graphql'
15
+ import { i18next, localize } from '@operato/i18n'
16
+ import { notify, openPopup } from '@operato/layout'
17
+ import { OxPopup } from '@operato/popup'
18
+ import { isMobileDevice } from '@operato/utils'
19
+
20
+ import { connect } from 'pwa-helpers/connect-mixin'
21
+ import gql from 'graphql-tag'
22
+
23
+ import { ActivityStatsImporter } from './activity-stats-importer'
24
+
25
+ @customElement('activity-stats-list-page')
26
+ export class ActivityStatsListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
27
+
28
+ static styles = [
29
+ ScrollbarStyles,
30
+ CommonGristStyles,
31
+ css`
32
+ :host {
33
+ display: flex;
34
+
35
+ width: 100%;
36
+
37
+ --grid-record-emphasized-background-color: red;
38
+ --grid-record-emphasized-color: yellow;
39
+ }
40
+ `
41
+ ]
42
+
43
+ static get scopedElements() {
44
+ return {
45
+ 'activity-stats-importer': ActivityStatsImporter
46
+ }
47
+ }
48
+
49
+ @property({ type: Object }) gristConfig: any
50
+ @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
51
+
52
+ @query('ox-grist') private grist!: DataGrist
53
+ @query('#sorter-control') private sortersControl!: OxPopup
54
+
55
+ get context() {
56
+ return {
57
+ search: {
58
+ handler: (search: string) => {
59
+ this.grist.searchText = search
60
+ },
61
+ placeholder: i18next.t('title.activity-stats list'),
62
+ value: this.grist.searchText
63
+ },
64
+ filter: {
65
+ handler: () => {
66
+ this.grist.toggleHeadroom()
67
+ }
68
+ },
69
+ help: 'worklist/activity-stats',
70
+ actions: [
71
+ {
72
+ title: i18next.t('button.save'),
73
+ action: this._updateActivityStats.bind(this),
74
+ ...CommonButtonStyles.save
75
+ },
76
+ {
77
+ title: i18next.t('button.delete'),
78
+ action: this._deleteActivityStats.bind(this),
79
+ ...CommonButtonStyles.delete
80
+ }
81
+ ],
82
+ exportable: {
83
+ name: i18next.t('title.activity-stats list'),
84
+ data: this.exportHandler.bind(this)
85
+ },
86
+ importable: {
87
+ handler: this.importHandler.bind(this)
88
+ }
89
+ }
90
+ }
91
+
92
+ render() {
93
+ const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
94
+
95
+ return html`
96
+ <ox-grist
97
+ .mode=${mode}
98
+ .config=${this.gristConfig}
99
+ .fetchHandler=${this.fetchHandler.bind(this)}
100
+ >
101
+ <div slot="headroom">
102
+ <div id="filters">
103
+ <ox-filters-form autofocus></ox-filters-form>
104
+ </div>
105
+
106
+ <div id="sorters">
107
+ Sort
108
+ <mwc-icon
109
+ @click=${e => {
110
+ const target = e.currentTarget
111
+ this.sortersControl.open({
112
+ right: 0,
113
+ top: target.offsetTop + target.offsetHeight
114
+ })
115
+ }}
116
+ >expand_more</mwc-icon
117
+ >
118
+ <ox-popup id="sorter-control">
119
+ <ox-sorters-control> </ox-sorters-control>
120
+ </ox-popup>
121
+ </div>
122
+
123
+ <div id="modes">
124
+ <mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>
125
+ <mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>
126
+ <mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>
127
+ </div>
128
+ </div>
129
+ </ox-grist>
130
+ `
131
+ }
132
+
133
+ async pageInitialized(lifecycle: any) {
134
+ this.gristConfig = {
135
+ list: {
136
+ fields: ['name', 'description'],
137
+ details: ['active', 'updatedAt']
138
+ },
139
+ columns: [
140
+ { type: 'gutter', gutterName: 'sequence' },
141
+ { type: 'gutter', gutterName: 'row-selector', multiple: true },
142
+ {
143
+ type: 'string',
144
+ name: 'name',
145
+ header: i18next.t('field.name'),
146
+ record: {
147
+ editable: true
148
+ },
149
+ filter: 'search',
150
+ sortable: true,
151
+ width: 150
152
+ },
153
+ {
154
+ type: 'string',
155
+ name: 'description',
156
+ header: i18next.t('field.description'),
157
+ record: {
158
+ editable: true
159
+ },
160
+ filter: 'search',
161
+ width: 200
162
+ },
163
+ {
164
+ type: 'checkbox',
165
+ name: 'active',
166
+ label: true,
167
+ header: i18next.t('field.active'),
168
+ record: {
169
+ editable: true
170
+ },
171
+ filter: true,
172
+ sortable: true,
173
+ width: 60
174
+ },
175
+ {
176
+ type: 'resource-object',
177
+ name: 'updater',
178
+ header: i18next.t('field.updater'),
179
+ record: {
180
+ editable: false
181
+ },
182
+ sortable: true,
183
+ width: 120
184
+ },
185
+ {
186
+ type: 'datetime',
187
+ name: 'updatedAt',
188
+ header: i18next.t('field.updated_at'),
189
+ record: {
190
+ editable: false
191
+ },
192
+ sortable: true,
193
+ width: 180
194
+ }
195
+ ],
196
+ rows: {
197
+ selectable: {
198
+ multiple: true
199
+ }
200
+ },
201
+ sorters: [
202
+ {
203
+ name: 'name'
204
+ }
205
+ ]
206
+ }
207
+ }
208
+
209
+ async pageUpdated(changes: any, lifecycle: any) {
210
+ if (this.active) {
211
+ // do something here when this page just became as active
212
+ }
213
+ }
214
+
215
+ async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {
216
+ const response = await client.query({
217
+ query: gql`
218
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
219
+ responses: activityStats(filters: $filters, pagination: $pagination, sortings: $sortings) {
220
+ items {
221
+ id
222
+ name
223
+ description
224
+ active
225
+ updater {
226
+ id
227
+ name
228
+ }
229
+ updatedAt
230
+ }
231
+ total
232
+ }
233
+ }
234
+ `,
235
+ variables: {
236
+ filters,
237
+ pagination: { page, limit },
238
+ sortings
239
+ }
240
+ })
241
+
242
+ return {
243
+ total: response.data.responses.total || 0,
244
+ records: response.data.responses.items || []
245
+ }
246
+ }
247
+
248
+ async _deleteActivityStats() {
249
+ if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
250
+ const ids = this.grist.selected.map(record => record.id)
251
+ if (ids && ids.length > 0) {
252
+ const response = await client.mutate({
253
+ mutation: gql`
254
+ mutation ($ids: [String!]!) {
255
+ deleteActivityStats(ids: $ids)
256
+ }
257
+ `,
258
+ variables: {
259
+ ids
260
+ }
261
+ })
262
+
263
+ if (!response.errors) {
264
+ this.grist.fetch()
265
+ notify({
266
+ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
267
+ })
268
+ }
269
+ }
270
+ }
271
+ }
272
+
273
+ async _updateActivityStats() {
274
+ let patches = this.grist.dirtyRecords
275
+ if (patches && patches.length) {
276
+ patches = patches.map(patch => {
277
+ let patchField: any = patch.id ? { id: patch.id } : {}
278
+ const dirtyFields = patch.__dirtyfields__
279
+ for (let key in dirtyFields) {
280
+ patchField[key] = dirtyFields[key].after
281
+ }
282
+ patchField.cuFlag = patch.__dirty__
283
+
284
+ return patchField
285
+ })
286
+
287
+ const response = await client.mutate({
288
+ mutation: gql`
289
+ mutation ($patches: [ActivityStatsPatch!]!) {
290
+ updateMultipleActivityStats(patches: $patches) {
291
+ name
292
+ }
293
+ }
294
+ `,
295
+ variables: {
296
+ patches
297
+ }
298
+ })
299
+
300
+ if (!response.errors) {
301
+ this.grist.fetch()
302
+ }
303
+ }
304
+ }
305
+
306
+ async exportHandler() {
307
+ const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
308
+ const targetFieldSet = new Set([
309
+ 'id',
310
+ 'name',
311
+ 'description',
312
+ 'active'
313
+ ])
314
+
315
+ return exportTargets.map(activityStats => {
316
+ let tempObj = {}
317
+ for (const field of targetFieldSet) {
318
+ tempObj[field] = activityStats[field]
319
+ }
320
+
321
+ return tempObj
322
+ })
323
+ }
324
+
325
+ async importHandler(records) {
326
+ const popup = openPopup(
327
+ html`
328
+ <activity-stats-importer
329
+ .activityStats=${records}
330
+ @imported=${() => {
331
+ history.back()
332
+ this.grist.fetch()
333
+ }}
334
+ ></activity-stats-importer>
335
+ `,
336
+ {
337
+ backdrop: true,
338
+ size: 'large',
339
+ title: i18next.t('title.import activity-stats')
340
+ }
341
+ )
342
+
343
+ popup.onclosed = () => {
344
+ this.grist.fetch()
345
+ }
346
+ }
347
+ }
348
+
@@ -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