@things-factory/worklist 6.0.36 → 6.0.39

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 (96) hide show
  1. package/client/bootstrap.ts +3 -6
  2. package/client/grist-editor/grist-editor-activity-search-key.ts +3 -2
  3. package/client/grist-editor/grist-renderer-activity-search-key.ts +25 -0
  4. package/client/grist-editor/popup-activity-search-keys-input.ts +1 -1
  5. package/client/pages/activity/activity-list-page.ts +27 -54
  6. package/client/pages/activity/activity-partial-view.ts +0 -3
  7. package/client/pages/activity/starter-list-page.ts +2 -2
  8. package/client/pages/activity-instance/activity-instance-list-page.ts +10 -5
  9. package/client/pages/activity-store/activity-store-page.ts +2 -2
  10. package/client/pages/activity-supervisor/reporter-list-page.ts +2 -2
  11. package/client/pages/activity-template/activity-template-list-page.ts +2 -2
  12. package/client/pages/activity-thread/activity-thread-list-page.ts +2 -2
  13. package/client/pages/activity-thread/activity-thread-page.ts +4 -11
  14. package/client/pages/installable-activity/installable-activity-list-page.ts +6 -28
  15. package/client/pages/todo/approval-waiting-list-page.ts +42 -59
  16. package/client/pages/todo/assigned-list-page.ts +2 -2
  17. package/client/pages/todo/done-list-page.ts +52 -36
  18. package/client/pages/todo/draft-list-page.ts +16 -14
  19. package/client/pages/todo/pickable-list-page.ts +2 -2
  20. package/client/pages/todo/todo-list-page.ts +57 -59
  21. package/client/types/activity.ts +0 -6
  22. package/dist-client/bootstrap.js +3 -2
  23. package/dist-client/bootstrap.js.map +1 -1
  24. package/dist-client/grist-editor/grist-editor-activity-search-key.js +3 -2
  25. package/dist-client/grist-editor/grist-editor-activity-search-key.js.map +1 -1
  26. package/dist-client/grist-editor/grist-renderer-activity-search-key.d.ts +3 -0
  27. package/dist-client/grist-editor/grist-renderer-activity-search-key.js +22 -0
  28. package/dist-client/grist-editor/grist-renderer-activity-search-key.js.map +1 -0
  29. package/dist-client/grist-editor/popup-activity-search-keys-input.d.ts +1 -1
  30. package/dist-client/grist-editor/popup-activity-search-keys-input.js +1 -1
  31. package/dist-client/grist-editor/popup-activity-search-keys-input.js.map +1 -1
  32. package/dist-client/pages/activity/activity-list-page.d.ts +2 -7
  33. package/dist-client/pages/activity/activity-list-page.js +25 -52
  34. package/dist-client/pages/activity/activity-list-page.js.map +1 -1
  35. package/dist-client/pages/activity/activity-partial-view.js +1 -1
  36. package/dist-client/pages/activity/activity-partial-view.js.map +1 -1
  37. package/dist-client/pages/activity/starter-list-page.d.ts +2 -7
  38. package/dist-client/pages/activity/starter-list-page.js.map +1 -1
  39. package/dist-client/pages/activity-instance/activity-instance-list-page.d.ts +2 -7
  40. package/dist-client/pages/activity-instance/activity-instance-list-page.js +8 -3
  41. package/dist-client/pages/activity-instance/activity-instance-list-page.js.map +1 -1
  42. package/dist-client/pages/activity-store/activity-store-page.d.ts +2 -7
  43. package/dist-client/pages/activity-store/activity-store-page.js.map +1 -1
  44. package/dist-client/pages/activity-supervisor/reporter-list-page.d.ts +2 -7
  45. package/dist-client/pages/activity-supervisor/reporter-list-page.js.map +1 -1
  46. package/dist-client/pages/activity-template/activity-template-list-page.d.ts +2 -7
  47. package/dist-client/pages/activity-template/activity-template-list-page.js.map +1 -1
  48. package/dist-client/pages/activity-thread/activity-thread-list-page.d.ts +2 -7
  49. package/dist-client/pages/activity-thread/activity-thread-list-page.js.map +1 -1
  50. package/dist-client/pages/activity-thread/activity-thread-page.js +4 -6
  51. package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
  52. package/dist-client/pages/installable-activity/installable-activity-list-page.d.ts +2 -8
  53. package/dist-client/pages/installable-activity/installable-activity-list-page.js +2 -24
  54. package/dist-client/pages/installable-activity/installable-activity-list-page.js.map +1 -1
  55. package/dist-client/pages/todo/approval-waiting-list-page.d.ts +2 -7
  56. package/dist-client/pages/todo/approval-waiting-list-page.js +37 -57
  57. package/dist-client/pages/todo/approval-waiting-list-page.js.map +1 -1
  58. package/dist-client/pages/todo/assigned-list-page.d.ts +2 -7
  59. package/dist-client/pages/todo/assigned-list-page.js.map +1 -1
  60. package/dist-client/pages/todo/done-list-page.d.ts +2 -7
  61. package/dist-client/pages/todo/done-list-page.js +48 -33
  62. package/dist-client/pages/todo/done-list-page.js.map +1 -1
  63. package/dist-client/pages/todo/draft-list-page.js +16 -15
  64. package/dist-client/pages/todo/draft-list-page.js.map +1 -1
  65. package/dist-client/pages/todo/pickable-list-page.d.ts +2 -7
  66. package/dist-client/pages/todo/pickable-list-page.js.map +1 -1
  67. package/dist-client/pages/todo/todo-list-page.d.ts +2 -7
  68. package/dist-client/pages/todo/todo-list-page.js +52 -55
  69. package/dist-client/pages/todo/todo-list-page.js.map +1 -1
  70. package/dist-client/tsconfig.tsbuildinfo +1 -1
  71. package/dist-client/types/activity.d.ts +0 -3
  72. package/dist-client/types/activity.js.map +1 -1
  73. package/dist-server/controllers/activity-thread/save.js +2 -2
  74. package/dist-server/controllers/activity-thread/save.js.map +1 -1
  75. package/dist-server/service/activity/activity-history.js +0 -15
  76. package/dist-server/service/activity/activity-history.js.map +1 -1
  77. package/dist-server/service/activity/activity-type.js +0 -24
  78. package/dist-server/service/activity/activity-type.js.map +1 -1
  79. package/dist-server/service/activity/activity.js +7 -22
  80. package/dist-server/service/activity/activity.js.map +1 -1
  81. package/dist-server/service/activity-approval/activity-approval-query.js +8 -0
  82. package/dist-server/service/activity-approval/activity-approval-query.js.map +1 -1
  83. package/dist-server/service/activity-thread/activity-thread-query.js +4 -2
  84. package/dist-server/service/activity-thread/activity-thread-query.js.map +1 -1
  85. package/dist-server/tsconfig.tsbuildinfo +1 -1
  86. package/package.json +3 -3
  87. package/server/controllers/activity-thread/save.ts +2 -1
  88. package/server/service/activity/activity-history.ts +0 -12
  89. package/server/service/activity/activity-type.ts +0 -18
  90. package/server/service/activity/activity.ts +7 -19
  91. package/server/service/activity-approval/activity-approval-query.ts +8 -0
  92. package/server/service/activity-thread/activity-thread-query.ts +4 -2
  93. package/translations/en.json +27 -1
  94. package/translations/ko.json +27 -1
  95. package/translations/ms.json +70 -44
  96. package/translations/zh.json +69 -43
@@ -7,16 +7,13 @@ import { store } from '@operato/shell'
7
7
  import { openOverlay, TOOL_POSITION } from '@operato/layout'
8
8
  import { APPEND_CONTEXT_TOOL } from '@things-factory/context-ui'
9
9
 
10
- import {
11
- OxGristRendererJson5,
12
- registerEditor as registerGristEditor,
13
- registerRenderer as registerGristRenderer
14
- } from '@operato/data-grist'
10
+ import { registerEditor as registerGristEditor, registerRenderer as registerGristRenderer } from '@operato/data-grist'
15
11
  import { OxGristEditorDuration } from '@operato/grist-editor/ox-grist-editor-duration.js'
16
12
  import { OxGristEditorQuantifier } from '@operato/grist-editor/ox-grist-editor-quantifier.js'
17
13
  import { OxGristRendererDuration } from '@operato/grist-editor/ox-grist-renderer-duration.js'
18
14
  import { OxGristRendererQuantifier } from '@operato/grist-editor/ox-grist-renderer-quantifier.js'
19
15
  import { GristEditorActivitySearchKeys } from './grist-editor/grist-editor-activity-search-key.js'
16
+ import { GristRendererActivitySearchKeys } from './grist-editor/grist-renderer-activity-search-key.js'
20
17
 
21
18
  export default function bootstrap() {
22
19
  ;[
@@ -54,5 +51,5 @@ export default function bootstrap() {
54
51
  registerGristRenderer('quantifier', OxGristRendererQuantifier)
55
52
 
56
53
  registerGristEditor('activity-search-keys', GristEditorActivitySearchKeys)
57
- registerGristRenderer('activity-search-keys', OxGristRendererJson5)
54
+ registerGristRenderer('activity-search-keys', GristRendererActivitySearchKeys)
58
55
  }
@@ -16,8 +16,9 @@ export class GristEditorActivitySearchKeys extends OxGristEditor {
16
16
  private popup?: PopupHandle
17
17
 
18
18
  get editorTemplate() {
19
- const value = typeof this.value === 'object' ? JSON.stringify(this.value) : this.value
20
- return html` <div tabindex="0">${value || ''}</div> `
19
+ return this.value && this.value instanceof Array && this.value.length > 0
20
+ ? html`<mwc-icon style="--mdc-icon-size:1.3em">key</mwc-icon>`
21
+ : html``
21
22
  }
22
23
 
23
24
  _onclick(e: Event): void {
@@ -0,0 +1,25 @@
1
+ import '@material/mwc-icon'
2
+ import { html } from 'lit'
3
+ import { FieldRenderer } from '@operato/data-grist'
4
+
5
+ function onmouseover(e: MouseEvent, value: any[]) {
6
+ const element = e.target as HTMLPreElement
7
+ const tooltip = value.map(key => key.name).join(',')
8
+ element.setAttribute('data-tooltip', tooltip)
9
+ }
10
+
11
+ function onmouseout(e: MouseEvent) {
12
+ const element = e.target as HTMLPreElement
13
+ element.removeAttribute('data-tooltip')
14
+ }
15
+
16
+ export const GristRendererActivitySearchKeys: FieldRenderer = (value, column, record, rowIndex, field) => {
17
+ return value && value instanceof Array && value.length > 0
18
+ ? html`<mwc-icon
19
+ style="--mdc-icon-size:1.3em"
20
+ @mouseover=${(e: MouseEvent) => onmouseover(e, value)}
21
+ @mouseout=${onmouseout}
22
+ >key</mwc-icon
23
+ >`
24
+ : html``
25
+ }
@@ -137,7 +137,7 @@ export class PopupActivitySearchKeysInput extends LitElement {
137
137
  `
138
138
  }
139
139
 
140
- async fetchHandler({ filters, page, limit, sortings = [] }: FetchOption) {
140
+ async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
141
141
  const records = this.value || []
142
142
  return {
143
143
  total: records.length,
@@ -7,7 +7,7 @@ import { customElement, property, query } from 'lit/decorators.js'
7
7
  import { connect } from 'pwa-helpers/connect-mixin.js'
8
8
  import moment from 'moment-timezone'
9
9
 
10
- import { DataGrist, getEditor, getRenderer } from '@operato/data-grist'
10
+ import { DataGrist, FetchOption, getEditor, getRenderer } from '@operato/data-grist'
11
11
  import { client } from '@operato/graphql'
12
12
  import { i18next, localize } from '@operato/i18n'
13
13
  import { notify, openPopup } from '@operato/layout'
@@ -19,9 +19,9 @@ import { ActivityTypes, ActivityUITypes } from '../../types/types.js'
19
19
 
20
20
  export const ActivityStatus = [
21
21
  { display: '', value: '' },
22
- { display: 'Draft', value: 'draft' },
23
- { display: 'Released', value: 'released' },
24
- { display: 'Deprecated', value: 'deprecated' }
22
+ { display: i18next.t('label.activity-state-draft'), value: 'draft' },
23
+ { display: i18next.t('label.activity-state-released'), value: 'released' },
24
+ { display: i18next.t('label.activity-state-deprecated'), value: 'deprecated' }
25
25
  ]
26
26
  const DEFAULT_TZ = Intl.DateTimeFormat().resolvedOptions().timeZone
27
27
  const TIMEZONE_OPTIONS = ['', DEFAULT_TZ, ...moment.tz.names().filter(tz => tz !== DEFAULT_TZ)]
@@ -123,6 +123,7 @@ export class ActivityListPage extends connect(store)(localize(i18next)(PageView)
123
123
  {
124
124
  type: 'gutter',
125
125
  gutterName: 'button',
126
+ title: i18next.t('title.activity schedule (un)register'),
126
127
  icon: record => (!record || !record.name ? '' : record.scheduleId ? 'pause' : 'play_arrow'),
127
128
  handlers: {
128
129
  click: (columns, data, column, record, rowIndex) => {
@@ -141,6 +142,7 @@ export class ActivityListPage extends connect(store)(localize(i18next)(PageView)
141
142
  {
142
143
  type: 'gutter',
143
144
  gutterName: 'button',
145
+ title: i18next.t('title.activity model item list'),
144
146
  icon: 'reorder',
145
147
  handlers: {
146
148
  click: (columns, data, column, record, rowIndex) => {
@@ -202,9 +204,18 @@ export class ActivityListPage extends connect(store)(localize(i18next)(PageView)
202
204
  options: ActivityTypes
203
205
  },
204
206
  sortable: true,
205
- // filter: true,
206
207
  width: 60
207
208
  },
209
+ {
210
+ type: 'boolean',
211
+ name: 'startable',
212
+ label: true,
213
+ header: i18next.t('field.startable'),
214
+ record: {
215
+ editable: true
216
+ },
217
+ width: 50
218
+ },
208
219
  {
209
220
  type: 'activity-search-keys',
210
221
  name: 'searchKeys',
@@ -213,26 +224,21 @@ export class ActivityListPage extends connect(store)(localize(i18next)(PageView)
213
224
  record: {
214
225
  editable: true
215
226
  },
216
- width: 120
227
+ width: 50
217
228
  },
218
229
  {
219
230
  type: 'number',
220
231
  name: 'priority',
221
232
  header: i18next.t('field.priority'),
222
233
  record: {
223
- editable: true
224
- },
225
- width: 30
226
- },
227
- {
228
- type: 'boolean',
229
- name: 'startable',
230
- label: true,
231
- header: i18next.t('field.startable'),
232
- record: {
233
- editable: true
234
+ editable: true,
235
+ renderer: function (value, column, record, rowIndex, field) {
236
+ const color = ['', 'gray', 'yellow', 'orange', 'red'][value || 0]
237
+ const count = new Array(value > 4 ? 4 : value || 0).fill('')
238
+ return html`${count.map(() => html`<mwc-icon style="color:${color};">star</mwc-icon>`)}`
239
+ }
234
240
  },
235
- width: 80
241
+ width: 60
236
242
  },
237
243
  {
238
244
  type: 'crontab',
@@ -319,7 +325,7 @@ export class ActivityListPage extends connect(store)(localize(i18next)(PageView)
319
325
  record: {
320
326
  editable: true
321
327
  },
322
- width: 120
328
+ width: 50
323
329
  },
324
330
  {
325
331
  type: 'approval-line',
@@ -328,7 +334,7 @@ export class ActivityListPage extends connect(store)(localize(i18next)(PageView)
328
334
  record: {
329
335
  editable: true
330
336
  },
331
- width: 120
337
+ width: 50
332
338
  },
333
339
  {
334
340
  type: 'select',
@@ -424,36 +430,6 @@ export class ActivityListPage extends connect(store)(localize(i18next)(PageView)
424
430
  sortable: true,
425
431
  width: 80
426
432
  },
427
- {
428
- type: 'duration',
429
- name: 'cycleTime',
430
- header: i18next.t('field.cycle-time'),
431
- record: {
432
- editable: true
433
- },
434
- sortable: true,
435
- width: 80
436
- },
437
- {
438
- type: 'duration',
439
- name: 'tactTime',
440
- header: i18next.t('field.tact-time'),
441
- record: {
442
- editable: true
443
- },
444
- sortable: true,
445
- width: 80
446
- },
447
- {
448
- type: 'duration',
449
- name: 'leadTime',
450
- header: i18next.t('field.lead-time'),
451
- record: {
452
- editable: true
453
- },
454
- sortable: true,
455
- width: 80
456
- },
457
433
  {
458
434
  type: 'resource-object',
459
435
  name: 'updater',
@@ -491,7 +467,7 @@ export class ActivityListPage extends connect(store)(localize(i18next)(PageView)
491
467
  }
492
468
  }
493
469
 
494
- async fetchHandler({ page, limit, sortings = [], filters = [] }) {
470
+ async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
495
471
  const response = await client.query({
496
472
  query: gql`
497
473
  query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
@@ -565,9 +541,6 @@ export class ActivityListPage extends connect(store)(localize(i18next)(PageView)
565
541
  timezone
566
542
  scheduleId
567
543
  standardTime
568
- leadTime
569
- cycleTime
570
- tactTime
571
544
  updater {
572
545
  id
573
546
  name
@@ -48,9 +48,6 @@ export class ActivityView extends localize(i18next)(LitElement) {
48
48
  schedule,
49
49
  timzeone,
50
50
  standardTime,
51
- cycleTime,
52
- tactTime,
53
- leadTime,
54
51
  issuerRole,
55
52
  assigneeRole,
56
53
  supervisoryRole,
@@ -7,7 +7,7 @@ import { css, html } from 'lit'
7
7
  import { customElement, property, query, state } from 'lit/decorators.js'
8
8
  import { connect } from 'pwa-helpers/connect-mixin.js'
9
9
 
10
- import { DataGrist } from '@operato/data-grist'
10
+ import { FetchOption, DataGrist } from '@operato/data-grist'
11
11
  import { client } from '@operato/graphql'
12
12
  import { i18next, localize } from '@operato/i18n'
13
13
  import { openPopup } from '@operato/layout'
@@ -204,7 +204,7 @@ export class StarterListPage extends connect(store)(localize(i18next)(PageView))
204
204
  }
205
205
  }
206
206
 
207
- async fetchHandler({ page, limit, sortings = [], filters = [] }) {
207
+ async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
208
208
  const response = await client.query({
209
209
  query: gql`
210
210
  query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
@@ -5,7 +5,7 @@ import { css, html } from 'lit'
5
5
  import { customElement, property, query } from 'lit/decorators.js'
6
6
  import { connect } from 'pwa-helpers/connect-mixin.js'
7
7
 
8
- import { DataGrist } from '@operato/data-grist'
8
+ import { FetchOption, DataGrist } from '@operato/data-grist'
9
9
  import { client } from '@operato/graphql'
10
10
  import { i18next, localize } from '@operato/i18n'
11
11
  import { PageView, store } from '@operato/shell'
@@ -127,9 +127,14 @@ export class ActivityInstanceListPage extends connect(store)(localize(i18next)(P
127
127
  name: 'priority',
128
128
  header: i18next.t('field.priority'),
129
129
  record: {
130
- editable: false
130
+ editable: false,
131
+ renderer: function (value, column, record, rowIndex, field) {
132
+ const color = ['', 'gray', 'yellow', 'orange', 'red'][value || 0]
133
+ const count = new Array(value > 4 ? 4 : value || 0).fill('')
134
+ return html`${count.map(() => html`<mwc-icon style="color:${color};">star</mwc-icon>`)}`
135
+ }
131
136
  },
132
- width: 30
137
+ width: 60
133
138
  },
134
139
  {
135
140
  type: 'string',
@@ -138,7 +143,7 @@ export class ActivityInstanceListPage extends connect(store)(localize(i18next)(P
138
143
  record: {
139
144
  editable: false
140
145
  },
141
- width: 60
146
+ width: 80
142
147
  },
143
148
  {
144
149
  type: 'resource-object',
@@ -181,7 +186,7 @@ export class ActivityInstanceListPage extends connect(store)(localize(i18next)(P
181
186
  }
182
187
  }
183
188
 
184
- async fetchHandler({ page, limit, sortings = [], filters = [] }) {
189
+ async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
185
190
  const response = await client.query({
186
191
  query: gql`
187
192
  query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
@@ -6,7 +6,7 @@ import { css, html } from 'lit'
6
6
  import { customElement, property, query } from 'lit/decorators.js'
7
7
  import { connect } from 'pwa-helpers/connect-mixin.js'
8
8
 
9
- import { DataGrist } from '@operato/data-grist'
9
+ import { FetchOption, DataGrist } from '@operato/data-grist'
10
10
  import { client } from '@operato/graphql'
11
11
  import { i18next, localize } from '@operato/i18n'
12
12
  import { openPopup } from '@operato/layout'
@@ -198,7 +198,7 @@ export class ActivityStorePage extends connect(store)(localize(i18next)(PageView
198
198
  }
199
199
  }
200
200
 
201
- async fetchHandler({ page, limit, sortings = [], filters = [] }) {
201
+ async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
202
202
  const response = await client.query({
203
203
  query: gql`
204
204
  query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
@@ -6,7 +6,7 @@ import { css, html } from 'lit'
6
6
  import { customElement, property, query } from 'lit/decorators.js'
7
7
  import { connect } from 'pwa-helpers/connect-mixin.js'
8
8
 
9
- import { DataGrist } from '@operato/data-grist'
9
+ import { FetchOption, DataGrist } from '@operato/data-grist'
10
10
  import { client } from '@operato/graphql'
11
11
  import { i18next, localize } from '@operato/i18n'
12
12
  import { openPopup } from '@operato/layout'
@@ -193,7 +193,7 @@ export class ReporterListPage extends connect(store)(localize(i18next)(PageView)
193
193
  }
194
194
  }
195
195
 
196
- async fetchHandler({ page, limit, sortings = [], filters = [] }) {
196
+ async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
197
197
  const response = await client.query({
198
198
  query: gql`
199
199
  query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
@@ -7,7 +7,7 @@ import { css, html } from 'lit'
7
7
  import { customElement, property, query } from 'lit/decorators.js'
8
8
  import { connect } from 'pwa-helpers/connect-mixin.js'
9
9
 
10
- import { DataGrist, getEditor, getRenderer } from '@operato/data-grist'
10
+ import { DataGrist, FetchOption, getEditor, getRenderer } from '@operato/data-grist'
11
11
  import { client } from '@operato/graphql'
12
12
  import { i18next, localize } from '@operato/i18n'
13
13
  import { notify, openPopup } from '@operato/layout'
@@ -322,7 +322,7 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
322
322
  }
323
323
  }
324
324
 
325
- async fetchHandler({ page, limit, sortings = [], filters = [] }) {
325
+ async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
326
326
  const response = await client.query({
327
327
  query: gql`
328
328
  query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
@@ -6,7 +6,7 @@ import { css, html } from 'lit'
6
6
  import { customElement, property, query } from 'lit/decorators.js'
7
7
  import { connect } from 'pwa-helpers/connect-mixin.js'
8
8
 
9
- import { DataGrist } from '@operato/data-grist'
9
+ import { DataGrist, FetchOption } from '@operato/data-grist'
10
10
  import { client } from '@operato/graphql'
11
11
  import { i18next, localize } from '@operato/i18n'
12
12
  import { notify, openPopup } from '@operato/layout'
@@ -193,7 +193,7 @@ export class ActivityThreadListPage extends connect(store)(localize(i18next)(Pag
193
193
  }
194
194
  }
195
195
 
196
- async fetchHandler({ page, limit, sortings = [], filters = [] }) {
196
+ async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
197
197
  const response = await client.query({
198
198
  query: gql`
199
199
  query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
@@ -106,23 +106,16 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
106
106
  get context() {
107
107
  const state = this.activityThread?.state
108
108
 
109
- const startable = [ActivityThreadStatus.Assigned].includes(state)
110
- const endable = [ActivityThreadStatus.Started].includes(state)
111
- const savable = endable
112
109
  const restartable = [ActivityThreadStatus.Rejected].includes(state)
113
- const delegatable = [ActivityThreadStatus.Assigned, ActivityThreadStatus.Started].includes(state)
114
- const abortable = [ActivityThreadStatus.Assigned, ActivityThreadStatus.Started].includes(state)
110
+ const savable = !restartable
111
+ const endable = !restartable
112
+ const delegatable = !restartable
113
+ const abortable = !restartable
115
114
 
116
115
  return {
117
116
  title: this.lifecycle?.params?.['title'] || i18next.t('title.activity'),
118
117
  help: 'worklist/activity',
119
118
  actions: [
120
- startable && {
121
- title: i18next.t('button.start'),
122
- action: this._startActivityThread.bind(this),
123
- ...CommonButtonStyles.play
124
- },
125
-
126
119
  savable && {
127
120
  title: i18next.t('button.save'),
128
121
  action: this._saveActivityThread.bind(this),
@@ -1,16 +1,17 @@
1
1
  import '@operato/data-grist'
2
2
  import './installable-activity-model-item-list.js'
3
+
3
4
  import gql from 'graphql-tag'
4
5
  import { css, html } from 'lit'
5
6
  import { customElement, property, query } from 'lit/decorators.js'
6
7
  import { connect } from 'pwa-helpers/connect-mixin.js'
7
8
 
8
- import { DataGrist, getEditor, getRenderer } from '@operato/data-grist'
9
+ import { DataGrist, FetchOption, getEditor, getRenderer } from '@operato/data-grist'
9
10
  import { client } from '@operato/graphql'
10
11
  import { i18next, localize } from '@operato/i18n'
11
12
  import { notify, openPopup } from '@operato/layout'
12
13
  import { PageView, store } from '@operato/shell'
13
- import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
14
+ import { CommonGristStyles, ScrollbarStyles } from '@operato/styles'
14
15
  import { isMobileDevice } from '@operato/utils'
15
16
 
16
17
  import { ActivityTypes, ActivityUITypes } from '../../types/types.js'
@@ -172,7 +173,7 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
172
173
  },
173
174
  filter: 'search',
174
175
  sortable: true,
175
- width: 150
176
+ width: 80
176
177
  },
177
178
  {
178
179
  type: 'string',
@@ -183,7 +184,7 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
183
184
  },
184
185
  filter: 'search',
185
186
  sortable: true,
186
- width: 150
187
+ width: 120
187
188
  },
188
189
  {
189
190
  type: 'select',
@@ -195,7 +196,6 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
195
196
  options: ActivityTypes
196
197
  },
197
198
  sortable: true,
198
- // filter: true,
199
199
  width: 60
200
200
  },
201
201
  {
@@ -293,23 +293,6 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
293
293
  record: {
294
294
  editable: false
295
295
  },
296
- // filter: true,
297
- sortable: true,
298
- width: 60
299
- },
300
- {
301
- type: 'checkbox',
302
- name: 'active',
303
- label: true,
304
- header: i18next.t('field.active'),
305
- record: {
306
- editable: false,
307
- renderer: function (value, column, record, rowIndex, field) {
308
- var type = record.reportType !== 'board' ? 'script' : 'board'
309
- return getRenderer(type)(value, column, record, rowIndex, field)
310
- }
311
- },
312
- // filter: true,
313
296
  sortable: true,
314
297
  width: 60
315
298
  }
@@ -326,12 +309,7 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
326
309
  }
327
310
  }
328
311
 
329
- async pageUpdated(changes, lifecycle) {
330
- if (this.active) {
331
- }
332
- }
333
-
334
- async fetchHandler({ page, limit, sortings = [], filters = [] }) {
312
+ async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
335
313
  const response = await client.query({
336
314
  query: gql`
337
315
  query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
@@ -7,34 +7,20 @@ import { customElement, property, query, state } from 'lit/decorators.js'
7
7
  import { asyncReplace } from 'lit/directives/async-replace.js'
8
8
  import { connect } from 'pwa-helpers/connect-mixin.js'
9
9
 
10
- import { DataGrist, getRenderer } from '@operato/data-grist'
10
+ import { DataGrist, FetchOption, getRenderer } from '@operato/data-grist'
11
11
  import { client } from '@operato/graphql'
12
12
  import { i18next, localize } from '@operato/i18n'
13
13
  import { navigate, PageView, store } from '@operato/shell'
14
14
  import { CommonGristStyles, ScrollbarStyles } from '@operato/styles'
15
- import { isMobileDevice, sleep } from '@operato/utils'
15
+ import { adjustFilters, isMobileDevice, sleep } from '@operato/utils'
16
16
 
17
+ import { ActivityThreadStatus } from '../../types/activity-thread'
17
18
  import { Priorities } from '../../types/types.js'
18
19
 
19
20
  const MIN = 60
20
21
  const HOUR = 60 * MIN
21
22
  const DAY = 24 * HOUR
22
23
 
23
- const FILTERS = [
24
- {
25
- display: 'Important',
26
- value: 'Important'
27
- },
28
- {
29
- display: 'Imminent',
30
- value: 'Imminent'
31
- },
32
- {
33
- display: 'Disapproved',
34
- value: 'Disapproved'
35
- }
36
- ]
37
-
38
24
  @customElement('approval-waiting-list-page')
39
25
  export class ApprovalWaitingListPage extends connect(store)(localize(i18next)(PageView)) {
40
26
  static styles = [
@@ -91,9 +77,23 @@ export class ApprovalWaitingListPage extends connect(store)(localize(i18next)(Pa
91
77
  <div id="filters">
92
78
  <ox-input-select-buttons
93
79
  .value=${this.filters}
94
- .options=${FILTERS}
80
+ .options=${[
81
+ {
82
+ display: i18next.t('label.filter-important'),
83
+ value: 'important'
84
+ },
85
+ {
86
+ display: i18next.t('label.filter-due'),
87
+ value: 'due'
88
+ },
89
+ {
90
+ display: i18next.t('label.filter-resubmitted'),
91
+ value: 'resubmitted'
92
+ }
93
+ ]}
95
94
  @change=${(e: CustomEvent) => {
96
95
  this.filters = (e.currentTarget as any)?.value
96
+ this.grist.fetch()
97
97
  }}
98
98
  multiple
99
99
  ></ox-input-select-buttons>
@@ -167,14 +167,17 @@ export class ApprovalWaitingListPage extends connect(store)(localize(i18next)(Pa
167
167
  hidden: true
168
168
  },
169
169
  {
170
- type: 'select',
170
+ type: 'number',
171
171
  name: 'priority',
172
172
  header: i18next.t('field.priority'),
173
173
  record: {
174
174
  editable: false,
175
- options: Priorities
175
+ renderer: function (value, column, record, rowIndex, field) {
176
+ const color = ['', 'gray', 'yellow', 'orange', 'red'][value || 0]
177
+ const count = new Array(value > 4 ? 4 : value || 0).fill('')
178
+ return html`${count.map(() => html`<mwc-icon style="color:${color};">star</mwc-icon>`)}`
179
+ }
176
180
  },
177
- // filter: true,
178
181
  width: 60
179
182
  },
180
183
  {
@@ -184,19 +187,11 @@ export class ApprovalWaitingListPage extends connect(store)(localize(i18next)(Pa
184
187
  record: {
185
188
  editable: false,
186
189
  options: [
187
- { display: 'Draft', value: 'draft' },
188
- { display: 'Posted', value: 'posted' },
189
- { display: 'WaitingAssignment', value: 'waiting-assignment' },
190
- { display: 'Assigned', value: 'assigned' },
191
- { display: 'Started', value: 'started' },
192
- { display: 'Pending', value: 'pending' },
193
- { display: 'Escalated', value: 'escalated' },
194
- { display: 'Ended', value: 'ended' },
195
- { display: 'Aborted', value: 'aborted' }
190
+ { display: i18next.t('label.activity-state-submitted'), value: 'submitted' },
191
+ { display: i18next.t('label.activity-state-escalated'), value: 'escalated' }
196
192
  ]
197
193
  },
198
- // filter: true,
199
- width: 60
194
+ width: 80
200
195
  },
201
196
  {
202
197
  type: 'datetime',
@@ -210,32 +205,6 @@ export class ApprovalWaitingListPage extends connect(store)(localize(i18next)(Pa
210
205
  day: 'numeric'
211
206
  }
212
207
  },
213
- // sortable: true,
214
- // filter: {
215
- // type: 'date',
216
- // operator: 'between'
217
- // },
218
- // filter: {
219
- // type: 'select',
220
- // operator: 'between',
221
- // options: (column, owner) => {
222
- // const now = Date.now()
223
- // return [
224
- // {
225
- // display: '1일 이내 처리',
226
- // value: [now, Date.now() + 60 * 60 * 3600 * 1000]
227
- // },
228
- // {
229
- // display: '2일 이내 처리',
230
- // value: [now, Date.now() + 2 * 60 * 60 * 3600 * 1000]
231
- // },
232
- // {
233
- // display: '3일 이내 처리',
234
- // value: [now, Date.now() + 3 * 60 * 60 * 3600 * 1000]
235
- // }
236
- // ]
237
- // }
238
- // },
239
208
  width: 100
240
209
  },
241
210
  {
@@ -298,13 +267,27 @@ export class ApprovalWaitingListPage extends connect(store)(localize(i18next)(Pa
298
267
  }
299
268
  }
300
269
 
301
- async fetchHandler({ page, limit, sortings = [], filters = [] }) {
270
+ async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
271
+ if (this.filters?.includes('important')) {
272
+ filters = adjustFilters(filters, [{ name: 'priority', operator: 'gte', value: 2 }])
273
+ }
274
+
275
+ if (this.filters?.includes('due')) {
276
+ let tomorrow = new Date(Date.now() + 24 * 3600 * 1000).toISOString().replace('T', ' ')
277
+ filters = adjustFilters(filters, [{ name: 'dueAt', operator: 'lte', value: tomorrow }])
278
+ }
279
+
280
+ if (this.filters?.includes('resubmitted')) {
281
+ filters = adjustFilters(filters, [{ name: 'round', operator: 'gte', value: 2 }])
282
+ }
283
+
302
284
  const response = await client.query({
303
285
  query: gql`
304
286
  query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
305
287
  responses: approvalWaitingList(filters: $filters, pagination: $pagination, sortings: $sortings) {
306
288
  items {
307
289
  id
290
+ round
308
291
  activityThread {
309
292
  activityInstance {
310
293
  activityId: id