@things-factory/worklist 6.1.68 → 6.1.71

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 (81) hide show
  1. package/client/components/activity-approval-ribon.ts +5 -5
  2. package/client/components/activity-instance-ribon.ts +7 -7
  3. package/client/components/activity-thread-ribon.ts +4 -5
  4. package/client/pages/activity/activity-list-page.ts +1 -1
  5. package/client/pages/activity/starter-list-page.ts +4 -25
  6. package/client/pages/activity-approval/activity-approval-list-page.ts +7 -23
  7. package/client/pages/activity-approval/activity-approval-page.ts +18 -2
  8. package/client/pages/activity-instance/activity-instance-list-page.ts +1 -1
  9. package/client/pages/activity-instance/activity-instance-search-page.ts +27 -3
  10. package/client/pages/activity-instance/activity-instance-start-page.ts +17 -1
  11. package/client/pages/activity-stats/activity-stats-list-page.ts +5 -21
  12. package/client/pages/activity-store/activity-store-page.ts +1 -1
  13. package/client/pages/activity-supervisor/reporter-list-page.ts +1 -1
  14. package/client/pages/activity-template/activity-template-list-page.ts +1 -1
  15. package/client/pages/activity-thread/activity-thread-list-page.ts +3 -3
  16. package/client/pages/activity-thread/activity-thread-page.ts +18 -2
  17. package/client/pages/activity-thread/activity-thread-view-page.ts +16 -0
  18. package/client/pages/installable-activity/installable-activity-list-page.ts +1 -1
  19. package/client/pages/todo/approval-done-list-page.ts +1 -1
  20. package/client/pages/todo/approval-pending-list-page.ts +1 -1
  21. package/client/pages/todo/done-list-page.ts +1 -1
  22. package/client/pages/todo/draft-list-page.ts +1 -1
  23. package/client/pages/todo/pickable-list-page.ts +1 -1
  24. package/client/pages/todo/todo-list-page.ts +1 -1
  25. package/dist-client/components/activity-approval-ribon.js +5 -5
  26. package/dist-client/components/activity-approval-ribon.js.map +1 -1
  27. package/dist-client/components/activity-instance-ribon.js +7 -7
  28. package/dist-client/components/activity-instance-ribon.js.map +1 -1
  29. package/dist-client/components/activity-thread-ribon.js +4 -5
  30. package/dist-client/components/activity-thread-ribon.js.map +1 -1
  31. package/dist-client/pages/activity/activity-list-page.js +2 -1
  32. package/dist-client/pages/activity/activity-list-page.js.map +1 -1
  33. package/dist-client/pages/activity/starter-list-page.d.ts +1 -2
  34. package/dist-client/pages/activity/starter-list-page.js +3 -31
  35. package/dist-client/pages/activity/starter-list-page.js.map +1 -1
  36. package/dist-client/pages/activity-approval/activity-approval-list-page.js +6 -14
  37. package/dist-client/pages/activity-approval/activity-approval-list-page.js.map +1 -1
  38. package/dist-client/pages/activity-approval/activity-approval-page.js +14 -2
  39. package/dist-client/pages/activity-approval/activity-approval-page.js.map +1 -1
  40. package/dist-client/pages/activity-instance/activity-instance-list-page.js +2 -1
  41. package/dist-client/pages/activity-instance/activity-instance-list-page.js.map +1 -1
  42. package/dist-client/pages/activity-instance/activity-instance-search-page.js +28 -3
  43. package/dist-client/pages/activity-instance/activity-instance-search-page.js.map +1 -1
  44. package/dist-client/pages/activity-instance/activity-instance-start-page.js +13 -1
  45. package/dist-client/pages/activity-instance/activity-instance-start-page.js.map +1 -1
  46. package/dist-client/pages/activity-stats/activity-stats-list-page.js +4 -12
  47. package/dist-client/pages/activity-stats/activity-stats-list-page.js.map +1 -1
  48. package/dist-client/pages/activity-store/activity-store-page.js +2 -1
  49. package/dist-client/pages/activity-store/activity-store-page.js.map +1 -1
  50. package/dist-client/pages/activity-supervisor/reporter-list-page.js +2 -1
  51. package/dist-client/pages/activity-supervisor/reporter-list-page.js.map +1 -1
  52. package/dist-client/pages/activity-template/activity-template-list-page.js +2 -1
  53. package/dist-client/pages/activity-template/activity-template-list-page.js.map +1 -1
  54. package/dist-client/pages/activity-thread/activity-thread-list-page.js +4 -3
  55. package/dist-client/pages/activity-thread/activity-thread-list-page.js.map +1 -1
  56. package/dist-client/pages/activity-thread/activity-thread-page.js +15 -2
  57. package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
  58. package/dist-client/pages/activity-thread/activity-thread-view-page.js +12 -0
  59. package/dist-client/pages/activity-thread/activity-thread-view-page.js.map +1 -1
  60. package/dist-client/pages/installable-activity/installable-activity-list-page.js +2 -1
  61. package/dist-client/pages/installable-activity/installable-activity-list-page.js.map +1 -1
  62. package/dist-client/pages/todo/approval-done-list-page.js +2 -1
  63. package/dist-client/pages/todo/approval-done-list-page.js.map +1 -1
  64. package/dist-client/pages/todo/approval-pending-list-page.js +2 -1
  65. package/dist-client/pages/todo/approval-pending-list-page.js.map +1 -1
  66. package/dist-client/pages/todo/done-list-page.js +2 -1
  67. package/dist-client/pages/todo/done-list-page.js.map +1 -1
  68. package/dist-client/pages/todo/draft-list-page.js +2 -1
  69. package/dist-client/pages/todo/draft-list-page.js.map +1 -1
  70. package/dist-client/pages/todo/pickable-list-page.js +2 -1
  71. package/dist-client/pages/todo/pickable-list-page.js.map +1 -1
  72. package/dist-client/pages/todo/todo-list-page.js +2 -1
  73. package/dist-client/pages/todo/todo-list-page.js.map +1 -1
  74. package/dist-client/route.d.ts +1 -1
  75. package/dist-client/tsconfig.tsbuildinfo +1 -1
  76. package/package.json +4 -4
  77. package/translations/en.json +4 -0
  78. package/translations/ja.json +4 -0
  79. package/translations/ko.json +4 -0
  80. package/translations/ms.json +4 -0
  81. package/translations/zh.json +28 -24
@@ -97,19 +97,19 @@ export class ActivityApprovalRibon extends localize(i18next)(LitElement) {
97
97
  }
98
98
 
99
99
  @media only screen and (max-width: 460px) {
100
- :host {
101
- flex-direction: column;
102
- }
103
100
  div {
104
101
  border-left: none;
105
- border-bottom: var(--border-dark-color);
106
102
  }
103
+
107
104
  [assignee] {
108
105
  display: none;
109
106
  }
110
107
  mwc-icon {
111
108
  padding: 0;
112
109
  }
110
+ approval-line-brief {
111
+ display: none;
112
+ }
113
113
  }
114
114
  `
115
115
  ]
@@ -156,7 +156,7 @@ export class ActivityApprovalRibon extends localize(i18next)(LitElement) {
156
156
  }
157
157
 
158
158
  updated(changes) {
159
- if (changes.has('activityApproval')) {
159
+ if (changes.has('activityApproval') && this.activityApproval) {
160
160
  const { state } = this.activityApproval.activityThread
161
161
 
162
162
  this.setAttribute('state', state)
@@ -94,16 +94,12 @@ export class ActivityInstanceRibon extends localize(i18next)(LitElement) {
94
94
  [state] {
95
95
  text-align: right;
96
96
  font-size: var(--fontsize-small);
97
- font-weight:bold;
97
+ font-weight: bold;
98
98
  }
99
99
 
100
100
  @media only screen and (max-width: 460px) {
101
- :host {
102
- flex-direction: column;
103
- }
104
101
  div {
105
102
  border-left: none;
106
- border-bottom: var(--border-dark-color);
107
103
  }
108
104
  [assignee] {
109
105
  display: none;
@@ -111,6 +107,9 @@ export class ActivityInstanceRibon extends localize(i18next)(LitElement) {
111
107
  mwc-icon {
112
108
  padding: 0;
113
109
  }
110
+ approval-line-brief {
111
+ display: none;
112
+ }
114
113
  }
115
114
  `
116
115
  ]
@@ -132,7 +131,8 @@ export class ActivityInstanceRibon extends localize(i18next)(LitElement) {
132
131
  ></activity-instance-context-template>`
133
132
  })
134
133
  }}
135
- >description</mwc-icon>
134
+ >description</mwc-icon
135
+ >
136
136
  ${description}
137
137
  </div>
138
138
  ${startingType == 'issue' && assignee
@@ -150,7 +150,7 @@ export class ActivityInstanceRibon extends localize(i18next)(LitElement) {
150
150
  }
151
151
 
152
152
  updated(changes) {
153
- if (changes.has('activityInstance')) {
153
+ if (changes.has('activityInstance') && this.activityInstance) {
154
154
  const { state } = this.activityInstance
155
155
 
156
156
  this.setAttribute('state', state)
@@ -97,12 +97,8 @@ export class ActivityThreadRibon extends localize(i18next)(LitElement) {
97
97
  }
98
98
 
99
99
  @media only screen and (max-width: 460px) {
100
- :host {
101
- flex-direction: column;
102
- }
103
100
  div {
104
101
  border-left: none;
105
- border-bottom: var(--border-dark-color);
106
102
  }
107
103
  [assignee] {
108
104
  display: none;
@@ -110,6 +106,9 @@ export class ActivityThreadRibon extends localize(i18next)(LitElement) {
110
106
  mwc-icon {
111
107
  padding: 0;
112
108
  }
109
+ approval-line-brief {
110
+ display: none;
111
+ }
113
112
  }
114
113
  `
115
114
  ]
@@ -151,7 +150,7 @@ export class ActivityThreadRibon extends localize(i18next)(LitElement) {
151
150
  }
152
151
 
153
152
  updated(changes) {
154
- if (changes.has('activityThread')) {
153
+ if (changes.has('activityThread') && this.activityThread) {
155
154
  const { state } = this.activityThread
156
155
 
157
156
  this.setAttribute('state', state)
@@ -57,7 +57,7 @@ export class ActivityListPage extends connect(store)(localize(i18next)(PageView)
57
57
  this.grist.searchText = search
58
58
  },
59
59
  placeholder: i18next.t('title.activity list'),
60
- value: this.grist.searchText
60
+ value: this.grist?.searchText || ''
61
61
  },
62
62
  filter: {
63
63
  handler: () => {
@@ -52,9 +52,6 @@ export class StarterListPage extends connect(store)(localize(i18next)(PageView))
52
52
  `
53
53
  ]
54
54
 
55
- @property({ type: Object }) gristConfig?: any
56
- @property({ type: String }) mode: 'GRID' | 'LIST' | 'CARD' = isMobileDevice() ? 'CARD' : 'GRID'
57
-
58
55
  get context() {
59
56
  return {
60
57
  search: {
@@ -62,7 +59,7 @@ export class StarterListPage extends connect(store)(localize(i18next)(PageView))
62
59
  this.grist.searchText = search
63
60
  },
64
61
  placeholder: i18next.t('title.activity starter list'),
65
- value: this.grist.searchText
62
+ value: this.grist?.searchText || ''
66
63
  },
67
64
  filter: {
68
65
  handler: () => {
@@ -73,34 +70,16 @@ export class StarterListPage extends connect(store)(localize(i18next)(PageView))
73
70
  }
74
71
  }
75
72
 
73
+ @property({ type: Object }) gristConfig?: any
74
+
76
75
  @query('#sorter-control') sorterControl?: any
77
76
  @query('ox-grist') grist!: DataGrist
78
77
 
79
78
  @state() filters?: string[]
80
79
 
81
80
  render() {
82
- const mode = this.mode
83
-
84
81
  return html`
85
- <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
86
- <div slot="headroom">
87
- <div id="filters">
88
- <!-- <ox-input-select-buttons
89
- .value=${this.filters}
90
- .options=${FILTERS}
91
- @change=${(e: CustomEvent) => {
92
- this.filters = (e.currentTarget as any)?.value
93
- }}
94
- ></ox-input-select-buttons> -->
95
- </div>
96
-
97
- <div id="modes">
98
- <mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>
99
- <mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>
100
- <mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>
101
- </div>
102
- </div>
103
- </ox-grist>
82
+ <ox-grist .mode=${'CARD'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}> </ox-grist>
104
83
  `
105
84
  }
106
85
 
@@ -5,12 +5,7 @@ import { PageView, store } from '@operato/shell'
5
5
  import { css, html } from 'lit'
6
6
  import { customElement, property, query } from 'lit/decorators.js'
7
7
  import { ScopedElementsMixin } from '@open-wc/scoped-elements'
8
- import {
9
- ColumnConfig,
10
- DataGrist,
11
- FetchOption,
12
- SortersControl
13
- } from '@operato/data-grist'
8
+ import { ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'
14
9
  import { client } from '@operato/graphql'
15
10
  import { i18next, localize } from '@operato/i18n'
16
11
  import { notify, openPopup } from '@operato/layout'
@@ -24,7 +19,6 @@ import { ActivityApprovalImporter } from './activity-approval-importer'
24
19
 
25
20
  @customElement('activity-approval-list-page')
26
21
  export class ActivityApprovalListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
27
-
28
22
  static styles = [
29
23
  ScrollbarStyles,
30
24
  CommonGristStyles,
@@ -58,8 +52,8 @@ export class ActivityApprovalListPage extends connect(store)(localize(i18next)(S
58
52
  handler: (search: string) => {
59
53
  this.grist.searchText = search
60
54
  },
61
- placeholder: i18next.t('title.activity-approval list'),
62
- value: this.grist.searchText
55
+ placeholder: i18next.t('title.activity approval list'),
56
+ value: this.grist?.searchText || ''
63
57
  },
64
58
  filter: {
65
59
  handler: () => {
@@ -80,7 +74,7 @@ export class ActivityApprovalListPage extends connect(store)(localize(i18next)(S
80
74
  }
81
75
  ],
82
76
  exportable: {
83
- name: i18next.t('title.activity-approval list'),
77
+ name: i18next.t('title.activity approval list'),
84
78
  data: this.exportHandler.bind(this)
85
79
  },
86
80
  importable: {
@@ -93,11 +87,7 @@ export class ActivityApprovalListPage extends connect(store)(localize(i18next)(S
93
87
  const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
94
88
 
95
89
  return html`
96
- <ox-grist
97
- .mode=${mode}
98
- .config=${this.gristConfig}
99
- .fetchHandler=${this.fetchHandler.bind(this)}
100
- >
90
+ <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
101
91
  <div slot="headroom">
102
92
  <div id="filters">
103
93
  <ox-filters-form autofocus></ox-filters-form>
@@ -305,12 +295,7 @@ export class ActivityApprovalListPage extends connect(store)(localize(i18next)(S
305
295
 
306
296
  async exportHandler() {
307
297
  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
- ])
298
+ const targetFieldSet = new Set(['id', 'name', 'description', 'active'])
314
299
 
315
300
  return exportTargets.map(activityApproval => {
316
301
  let tempObj = {}
@@ -339,10 +324,9 @@ export class ActivityApprovalListPage extends connect(store)(localize(i18next)(S
339
324
  title: i18next.t('title.import activity-approval')
340
325
  }
341
326
  )
342
-
327
+
343
328
  popup.onclosed = () => {
344
329
  this.grist.fetch()
345
330
  }
346
331
  }
347
332
  }
348
-
@@ -142,7 +142,7 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
142
142
  const judgment = this.activityApproval?.judgment
143
143
 
144
144
  return {
145
- title: this.lifecycle?.params?.['title'] || i18next.t('title.activity-approval'),
145
+ title: this.lifecycle?.params?.['title'] || i18next.t('title.activity approval'),
146
146
  help: 'worklist/activity-approval',
147
147
  actions: judgment
148
148
  ? []
@@ -204,6 +204,10 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
204
204
  }
205
205
 
206
206
  templateContent() {
207
+ if (!this.activityApproval) {
208
+ return html``
209
+ }
210
+
207
211
  const { viewSource: template } = this.activityThread?.activityInstance
208
212
  return unsafeHTML(template)
209
213
  }
@@ -239,6 +243,10 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
239
243
  }
240
244
 
241
245
  generatedContent() {
246
+ if (!this.activityApproval) {
247
+ return html``
248
+ }
249
+
242
250
  var { output, activityInstance } = this.activityThread || {}
243
251
  var { input } = activityInstance || {}
244
252
 
@@ -280,6 +288,10 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
280
288
  }
281
289
 
282
290
  boardContent() {
291
+ if (!this.activityApproval) {
292
+ return html``
293
+ }
294
+
283
295
  const { output, activityInstance } = this.activityThread
284
296
  const { viewSource: boardId, input } = activityInstance || {}
285
297
 
@@ -305,6 +317,10 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
305
317
  }
306
318
 
307
319
  customElementContent() {
320
+ if (!this.activityApproval) {
321
+ return html``
322
+ }
323
+
308
324
  const { output, activityInstance } = this.activityThread
309
325
  const { viewSource: tagName, input } = activityInstance || {}
310
326
 
@@ -336,7 +352,7 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
336
352
  }
337
353
 
338
354
  async pageUpdated(changes, lifecycle, changedBefore) {
339
- if (this.active) {
355
+ if (this.active && lifecycle.resourceId) {
340
356
  this.fetchActivityApproval(lifecycle.resourceId)
341
357
  }
342
358
  }
@@ -39,7 +39,7 @@ export class ActivityInstanceListPage extends connect(store)(localize(i18next)(P
39
39
  this.grist.searchText = search
40
40
  },
41
41
  placeholder: i18next.t('title.activity instance list'),
42
- value: this.grist.searchText
42
+ value: this.grist?.searchText || ''
43
43
  },
44
44
  filter: {
45
45
  handler: () => {
@@ -53,7 +53,7 @@ export class ActivityInstanceSearchPage extends connect(store)(localize(i18next)
53
53
  this.grist.searchText = search
54
54
  },
55
55
  placeholder: i18next.t('title.activity instance search'),
56
- value: this.grist.searchText
56
+ value: this.grist?.searchText || ''
57
57
  },
58
58
  filter: {
59
59
  handler: () => {
@@ -165,7 +165,7 @@ export class ActivityInstanceSearchPage extends connect(store)(localize(i18next)
165
165
  this.gristConfig = {
166
166
  list: {
167
167
  fields: ['name', 'description'],
168
- details: ['input', 'updatedAt']
168
+ details: ['updatedAt', 'updater', 'createdAt', 'creator']
169
169
  },
170
170
  columns: [
171
171
  { type: 'gutter', gutterName: 'sequence' },
@@ -208,7 +208,6 @@ export class ActivityInstanceSearchPage extends connect(store)(localize(i18next)
208
208
  {
209
209
  type: 'string',
210
210
  name: 'description',
211
- label: true,
212
211
  header: i18next.t('field.description'),
213
212
  record: {
214
213
  editable: false
@@ -238,11 +237,30 @@ export class ActivityInstanceSearchPage extends connect(store)(localize(i18next)
238
237
  hidden: true,
239
238
  imex: true
240
239
  },
240
+ {
241
+ type: 'resource-object',
242
+ name: 'creator',
243
+ header: i18next.t('field.creator'),
244
+ sortable: true,
245
+ label: true,
246
+ width: 100,
247
+ imex: true
248
+ },
249
+ {
250
+ type: 'datetime',
251
+ name: 'createdAt',
252
+ header: i18next.t('field.created_at'),
253
+ sortable: true,
254
+ label: true,
255
+ width: 180,
256
+ imex: true
257
+ },
241
258
  {
242
259
  type: 'resource-object',
243
260
  name: 'updater',
244
261
  header: i18next.t('field.updater'),
245
262
  sortable: true,
263
+ label: true,
246
264
  width: 100,
247
265
  imex: true
248
266
  },
@@ -251,6 +269,7 @@ export class ActivityInstanceSearchPage extends connect(store)(localize(i18next)
251
269
  name: 'updatedAt',
252
270
  header: i18next.t('field.updated_at'),
253
271
  sortable: true,
272
+ label: true,
254
273
  width: 180,
255
274
  imex: true
256
275
  }
@@ -300,6 +319,11 @@ export class ActivityInstanceSearchPage extends connect(store)(localize(i18next)
300
319
  name
301
320
  }
302
321
  updatedAt
322
+ creator {
323
+ id
324
+ name
325
+ }
326
+ createdAt
303
327
  }
304
328
  total
305
329
  }
@@ -97,6 +97,10 @@ export class ActivityInstanceStartPage extends connect(store)(localize(i18next)(
97
97
  }
98
98
 
99
99
  templateContent() {
100
+ if (!this.activityInstance) {
101
+ return html``
102
+ }
103
+
100
104
  const { uiSource: template } = this.activityInstance
101
105
  return unsafeHTML(template)
102
106
  }
@@ -132,6 +136,10 @@ export class ActivityInstanceStartPage extends connect(store)(localize(i18next)(
132
136
  }
133
137
 
134
138
  generatedContent() {
139
+ if (!this.activityInstance) {
140
+ return html``
141
+ }
142
+
135
143
  var { input, output } = this.activityInstance || {}
136
144
 
137
145
  const inputSpec = this.getInputSpec()
@@ -173,6 +181,10 @@ export class ActivityInstanceStartPage extends connect(store)(localize(i18next)(
173
181
  }
174
182
 
175
183
  boardContent() {
184
+ if (!this.activityInstance) {
185
+ return html``
186
+ }
187
+
176
188
  const { uiSource: boardId, input, output } = this.activityInstance
177
189
 
178
190
  if (!this.board || this.board.id !== boardId) {
@@ -202,6 +214,10 @@ export class ActivityInstanceStartPage extends connect(store)(localize(i18next)(
202
214
  }
203
215
 
204
216
  customElementContent() {
217
+ if (!this.activityInstance) {
218
+ return html``
219
+ }
220
+
205
221
  const { uiSource: tagName, input, output } = this.activityInstance
206
222
 
207
223
  if (!this.customHtmlElement) {
@@ -254,7 +270,7 @@ export class ActivityInstanceStartPage extends connect(store)(localize(i18next)(
254
270
  }
255
271
 
256
272
  async pageUpdated(changes, lifecycle, changedBefore) {
257
- if (this.active) {
273
+ if (this.active && lifecycle.resourceId) {
258
274
  this.fetchActivityInstance(lifecycle.resourceId)
259
275
  } else {
260
276
  this.customHtmlElement = undefined
@@ -5,12 +5,7 @@ import { PageView, store } from '@operato/shell'
5
5
  import { css, html } from 'lit'
6
6
  import { customElement, property, query } from 'lit/decorators.js'
7
7
  import { ScopedElementsMixin } from '@open-wc/scoped-elements'
8
- import {
9
- ColumnConfig,
10
- DataGrist,
11
- FetchOption,
12
- SortersControl
13
- } from '@operato/data-grist'
8
+ import { ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'
14
9
  import { client } from '@operato/graphql'
15
10
  import { i18next, localize } from '@operato/i18n'
16
11
  import { notify, openPopup } from '@operato/layout'
@@ -24,7 +19,6 @@ import { ActivityStatsImporter } from './activity-stats-importer'
24
19
 
25
20
  @customElement('activity-stats-list-page')
26
21
  export class ActivityStatsListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
27
-
28
22
  static styles = [
29
23
  ScrollbarStyles,
30
24
  CommonGristStyles,
@@ -59,7 +53,7 @@ export class ActivityStatsListPage extends connect(store)(localize(i18next)(Scop
59
53
  this.grist.searchText = search
60
54
  },
61
55
  placeholder: i18next.t('title.activity-stats list'),
62
- value: this.grist.searchText
56
+ value: this.grist?.searchText || ''
63
57
  },
64
58
  filter: {
65
59
  handler: () => {
@@ -93,11 +87,7 @@ export class ActivityStatsListPage extends connect(store)(localize(i18next)(Scop
93
87
  const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
94
88
 
95
89
  return html`
96
- <ox-grist
97
- .mode=${mode}
98
- .config=${this.gristConfig}
99
- .fetchHandler=${this.fetchHandler.bind(this)}
100
- >
90
+ <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
101
91
  <div slot="headroom">
102
92
  <div id="filters">
103
93
  <ox-filters-form autofocus></ox-filters-form>
@@ -305,12 +295,7 @@ export class ActivityStatsListPage extends connect(store)(localize(i18next)(Scop
305
295
 
306
296
  async exportHandler() {
307
297
  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
- ])
298
+ const targetFieldSet = new Set(['id', 'name', 'description', 'active'])
314
299
 
315
300
  return exportTargets.map(activityStats => {
316
301
  let tempObj = {}
@@ -339,10 +324,9 @@ export class ActivityStatsListPage extends connect(store)(localize(i18next)(Scop
339
324
  title: i18next.t('title.import activity-stats')
340
325
  }
341
326
  )
342
-
327
+
343
328
  popup.onclosed = () => {
344
329
  this.grist.fetch()
345
330
  }
346
331
  }
347
332
  }
348
-
@@ -41,7 +41,7 @@ export class ActivityStorePage extends connect(store)(localize(i18next)(PageView
41
41
  this.grist.searchText = search
42
42
  },
43
43
  placeholder: i18next.t('title.activity store'),
44
- value: this.grist.searchText
44
+ value: this.grist?.searchText || ''
45
45
  },
46
46
  filter: {
47
47
  handler: () => {
@@ -41,7 +41,7 @@ export class ReporterListPage extends connect(store)(localize(i18next)(PageView)
41
41
  this.grist.searchText = search
42
42
  },
43
43
  placeholder: i18next.t('title.activity reporter list'),
44
- value: this.grist.searchText
44
+ value: this.grist?.searchText || ''
45
45
  },
46
46
  filter: {
47
47
  handler: () => {
@@ -44,7 +44,7 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
44
44
  this.grist.searchText = search
45
45
  },
46
46
  placeholder: i18next.t('title.activity template list'),
47
- value: this.grist.searchText
47
+ value: this.grist?.searchText || ''
48
48
  },
49
49
  filter: {
50
50
  handler: () => {
@@ -40,8 +40,8 @@ export class ActivityThreadListPage extends connect(store)(localize(i18next)(Pag
40
40
  handler: (search: string) => {
41
41
  this.grist.searchText = search
42
42
  },
43
- placeholder: i18next.t('title.activity-thread list'),
44
- value: this.grist.searchText
43
+ placeholder: i18next.t('title.activity thread list'),
44
+ value: this.grist?.searchText || ''
45
45
  },
46
46
  filter: {
47
47
  handler: () => {
@@ -62,7 +62,7 @@ export class ActivityThreadListPage extends connect(store)(localize(i18next)(Pag
62
62
  }
63
63
  ],
64
64
  exportable: {
65
- name: i18next.t('title.activity-thread list'),
65
+ name: i18next.t('title.activity thread list'),
66
66
  data: this.exportHandler.bind(this)
67
67
  },
68
68
  importable: {
@@ -179,6 +179,10 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
179
179
  }
180
180
 
181
181
  templateContent() {
182
+ if (!this.activityThread) {
183
+ return html``
184
+ }
185
+
182
186
  const { uiSource: template } = this.activityThread?.activityInstance
183
187
  return unsafeHTML(template)
184
188
  }
@@ -214,6 +218,10 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
214
218
  }
215
219
 
216
220
  generatedContent() {
221
+ if (!this.activityThread) {
222
+ return html``
223
+ }
224
+
217
225
  var { output, activityInstance } = this.activityThread || {}
218
226
  var { input } = activityInstance || {}
219
227
 
@@ -230,7 +238,7 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
230
238
  }
231
239
 
232
240
  return keyed(
233
- this.activityThread.id,
241
+ this.activityThread?.id,
234
242
  html`
235
243
  <fieldset>
236
244
  <legend>Input</legend>
@@ -255,6 +263,10 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
255
263
  }
256
264
 
257
265
  boardContent() {
266
+ if (!this.activityThread) {
267
+ return html``
268
+ }
269
+
258
270
  const { output, activityInstance } = this.activityThread
259
271
  const { uiSource: boardId, input } = activityInstance || {}
260
272
 
@@ -285,6 +297,10 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
285
297
  }
286
298
 
287
299
  customElementContent() {
300
+ if (!this.activityThread) {
301
+ return html``
302
+ }
303
+
288
304
  const { output, activityInstance } = this.activityThread
289
305
  const { uiSource: tagName, input } = activityInstance || {}
290
306
 
@@ -319,7 +335,7 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
319
335
  }
320
336
 
321
337
  async pageUpdated(changes, lifecycle, changedBefore) {
322
- if (this.active) {
338
+ if (this.active && lifecycle.resourceId) {
323
339
  this.fetchActivityThread(lifecycle.resourceId)
324
340
  }
325
341
  }
@@ -145,6 +145,10 @@ export class ActivityThreadViewPage extends connect(store)(localize(i18next)(Pag
145
145
  }
146
146
 
147
147
  templateContent() {
148
+ if (!this.activityThread) {
149
+ return html``
150
+ }
151
+
148
152
  const { viewSource: template } = this.activityThread?.activityInstance
149
153
  return unsafeHTML(template)
150
154
  }
@@ -180,6 +184,10 @@ export class ActivityThreadViewPage extends connect(store)(localize(i18next)(Pag
180
184
  }
181
185
 
182
186
  generatedContent() {
187
+ if (!this.activityThread) {
188
+ return html``
189
+ }
190
+
183
191
  return keyed(
184
192
  this.activityThread.id,
185
193
  html` <activity-thread-view .activityThreadId=${this.activityThread.id}></activity-thread-view> `
@@ -187,6 +195,10 @@ export class ActivityThreadViewPage extends connect(store)(localize(i18next)(Pag
187
195
  }
188
196
 
189
197
  boardContent() {
198
+ if (!this.activityThread) {
199
+ return html``
200
+ }
201
+
190
202
  const { output, activityInstance } = this.activityThread
191
203
  const { viewSource: boardId, input } = activityInstance || {}
192
204
 
@@ -217,6 +229,10 @@ export class ActivityThreadViewPage extends connect(store)(localize(i18next)(Pag
217
229
  }
218
230
 
219
231
  customElementContent() {
232
+ if (!this.activityThread) {
233
+ return html``
234
+ }
235
+
220
236
  const { output, activityInstance } = this.activityThread
221
237
  const { viewSource: tagName, input } = activityInstance || {}
222
238