@things-factory/worklist 7.0.1-alpha.54 → 7.0.1-alpha.56

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 (149) hide show
  1. package/package.json +9 -9
  2. package/client/activity-summary-generator.ts +0 -132
  3. package/client/bootstrap.ts +0 -70
  4. package/client/components/activity-/bowner-view.ts +0 -100
  5. package/client/components/activity-approval-ribon.ts +0 -155
  6. package/client/components/activity-instance-preview.ts +0 -184
  7. package/client/components/activity-instance-ribon.ts +0 -155
  8. package/client/components/activity-intro-view.ts +0 -95
  9. package/client/components/activity-reporter-view.ts +0 -95
  10. package/client/components/activity-starter-form.ts +0 -257
  11. package/client/components/activity-thread-ribon.ts +0 -145
  12. package/client/components/activity-thread-timeline.ts +0 -210
  13. package/client/grist-editor/grist-editor-activity-search-key.ts +0 -75
  14. package/client/grist-editor/grist-renderer-activity-search-key.ts +0 -20
  15. package/client/grist-editor/popup-activity-search-keys-input.ts +0 -158
  16. package/client/index.ts +0 -3
  17. package/client/pages/activity/activity-list-page.ts +0 -677
  18. package/client/pages/activity/activity-model-item-list.ts +0 -292
  19. package/client/pages/activity/activity-page.ts +0 -431
  20. package/client/pages/activity/activity-partial-view.ts +0 -82
  21. package/client/pages/activity/starter-list-page.ts +0 -216
  22. package/client/pages/activity-approval/activity-approval-importer.ts +0 -86
  23. package/client/pages/activity-approval/activity-approval-list-page.ts +0 -312
  24. package/client/pages/activity-approval/activity-approval-page.ts +0 -541
  25. package/client/pages/activity-instance/activity-instance-list-page.ts +0 -204
  26. package/client/pages/activity-instance/activity-instance-search-page.ts +0 -334
  27. package/client/pages/activity-instance/activity-instance-start-page.ts +0 -525
  28. package/client/pages/activity-instance/activity-instance-view.ts +0 -475
  29. package/client/pages/activity-stats/activity-stats-importer.ts +0 -86
  30. package/client/pages/activity-stats/activity-stats-list-page.ts +0 -312
  31. package/client/pages/activity-store/activity-store-page.ts +0 -221
  32. package/client/pages/activity-supervisor/reporter-list-page.ts +0 -214
  33. package/client/pages/activity-template/activity-template-importer.ts +0 -92
  34. package/client/pages/activity-template/activity-template-list-page.ts +0 -453
  35. package/client/pages/activity-template/activity-template-model-item-list.ts +0 -44
  36. package/client/pages/activity-thread/activity-thread-importer.ts +0 -90
  37. package/client/pages/activity-thread/activity-thread-list-page.ts +0 -304
  38. package/client/pages/activity-thread/activity-thread-page.ts +0 -572
  39. package/client/pages/activity-thread/activity-thread-view-page.ts +0 -346
  40. package/client/pages/activity-thread/activity-thread-view.ts +0 -325
  41. package/client/pages/dashboard/dashboard-home.ts +0 -23
  42. package/client/pages/installable-activity/installable-activity-list-page.ts +0 -419
  43. package/client/pages/installable-activity/installable-activity-model-item-list.ts +0 -18
  44. package/client/pages/todo/approval-done-list-page.ts +0 -342
  45. package/client/pages/todo/approval-pending-list-page.ts +0 -416
  46. package/client/pages/todo/done-list-calendar-page.ts +0 -112
  47. package/client/pages/todo/done-list-page.ts +0 -363
  48. package/client/pages/todo/draft-list-page.ts +0 -280
  49. package/client/pages/todo/pickable-list-page.ts +0 -308
  50. package/client/pages/todo/todo-list-page.ts +0 -391
  51. package/client/pages/worklist-home.ts +0 -16
  52. package/client/route.ts +0 -103
  53. package/client/templates/activity-approval-context-template.ts +0 -170
  54. package/client/templates/activity-instance-context-template.ts +0 -281
  55. package/client/templates/activity-thread-context-template.ts +0 -146
  56. package/client/themes/calendar-theme.css +0 -54
  57. package/client/tsconfig.json +0 -13
  58. package/client/types/activity-approval.ts +0 -62
  59. package/client/types/activity-instance-type.ts +0 -125
  60. package/client/types/activity-instance.ts +0 -128
  61. package/client/types/activity-model-type.ts +0 -40
  62. package/client/types/activity-search-key-item-type.ts +0 -9
  63. package/client/types/activity-thread-history.ts +0 -47
  64. package/client/types/activity-thread-type.ts +0 -19
  65. package/client/types/activity-thread.ts +0 -60
  66. package/client/types/activity.ts +0 -102
  67. package/client/types/types.ts +0 -46
  68. package/server/controllers/activity-approval/_abort.ts +0 -31
  69. package/server/controllers/activity-approval/abort.ts +0 -41
  70. package/server/controllers/activity-approval/approve.ts +0 -96
  71. package/server/controllers/activity-approval/delegate.ts +0 -62
  72. package/server/controllers/activity-approval/reject.ts +0 -57
  73. package/server/controllers/activity-installation/activity-installation-controller.ts +0 -36
  74. package/server/controllers/activity-installation/call-webhook.ts +0 -40
  75. package/server/controllers/activity-instance/abort.ts +0 -78
  76. package/server/controllers/activity-instance/assign.ts +0 -56
  77. package/server/controllers/activity-instance/draft.ts +0 -91
  78. package/server/controllers/activity-instance/end.ts +0 -81
  79. package/server/controllers/activity-instance/index.ts +0 -6
  80. package/server/controllers/activity-instance/issue.ts +0 -179
  81. package/server/controllers/activity-instance/pick.ts +0 -45
  82. package/server/controllers/activity-thread/_abort.ts +0 -40
  83. package/server/controllers/activity-thread/abort.ts +0 -45
  84. package/server/controllers/activity-thread/delegate.ts +0 -64
  85. package/server/controllers/activity-thread/end.ts +0 -51
  86. package/server/controllers/activity-thread/index.ts +0 -7
  87. package/server/controllers/activity-thread/restart.ts +0 -51
  88. package/server/controllers/activity-thread/save.ts +0 -50
  89. package/server/controllers/activity-thread/start.ts +0 -49
  90. package/server/controllers/activity-thread/submit.ts +0 -89
  91. package/server/controllers/common.ts +0 -311
  92. package/server/controllers/index.ts +0 -2
  93. package/server/index.ts +0 -4
  94. package/server/routes.ts +0 -73
  95. package/server/service/activity/activity-history.ts +0 -187
  96. package/server/service/activity/activity-model-type.ts +0 -106
  97. package/server/service/activity/activity-mutation.ts +0 -388
  98. package/server/service/activity/activity-query.ts +0 -257
  99. package/server/service/activity/activity-search-key-item-type.ts +0 -16
  100. package/server/service/activity/activity-type.ts +0 -192
  101. package/server/service/activity/activity.ts +0 -261
  102. package/server/service/activity/event-subscriber.ts +0 -17
  103. package/server/service/activity/index.ts +0 -9
  104. package/server/service/activity-approval/activity-approval-mutation.ts +0 -75
  105. package/server/service/activity-approval/activity-approval-query.ts +0 -152
  106. package/server/service/activity-approval/activity-approval-subscription.ts +0 -45
  107. package/server/service/activity-approval/activity-approval-type.ts +0 -28
  108. package/server/service/activity-approval/activity-approval.ts +0 -124
  109. package/server/service/activity-approval/event-subscriber.ts +0 -45
  110. package/server/service/activity-approval/index.ts +0 -9
  111. package/server/service/activity-instance/activity-instance-history-query.ts +0 -48
  112. package/server/service/activity-instance/activity-instance-history-type.ts +0 -13
  113. package/server/service/activity-instance/activity-instance-history.ts +0 -244
  114. package/server/service/activity-instance/activity-instance-mutation.ts +0 -116
  115. package/server/service/activity-instance/activity-instance-query.ts +0 -330
  116. package/server/service/activity-instance/activity-instance-subscription.ts +0 -52
  117. package/server/service/activity-instance/activity-instance-type.ts +0 -205
  118. package/server/service/activity-instance/activity-instance.ts +0 -262
  119. package/server/service/activity-instance/event-subscriber.ts +0 -44
  120. package/server/service/activity-instance/index.ts +0 -11
  121. package/server/service/activity-stats/activity-stats-query.ts +0 -94
  122. package/server/service/activity-stats/activity-stats-type.ts +0 -34
  123. package/server/service/activity-stats/index.ts +0 -3
  124. package/server/service/activity-summary/activity-summary-query.ts +0 -114
  125. package/server/service/activity-summary/activity-summary.ts +0 -16
  126. package/server/service/activity-summary/index.ts +0 -5
  127. package/server/service/activity-template/activity-template-history.ts +0 -140
  128. package/server/service/activity-template/activity-template-mutation.ts +0 -203
  129. package/server/service/activity-template/activity-template-query.ts +0 -75
  130. package/server/service/activity-template/activity-template-type.ts +0 -120
  131. package/server/service/activity-template/activity-template.ts +0 -134
  132. package/server/service/activity-template/event-subscriber.ts +0 -20
  133. package/server/service/activity-template/index.ts +0 -9
  134. package/server/service/activity-thread/activity-thread-history-query.ts +0 -34
  135. package/server/service/activity-thread/activity-thread-history.ts +0 -168
  136. package/server/service/activity-thread/activity-thread-mutation.ts +0 -97
  137. package/server/service/activity-thread/activity-thread-query.ts +0 -145
  138. package/server/service/activity-thread/activity-thread-subscription.ts +0 -41
  139. package/server/service/activity-thread/activity-thread-type.ts +0 -33
  140. package/server/service/activity-thread/activity-thread.ts +0 -164
  141. package/server/service/activity-thread/event-subscriber.ts +0 -47
  142. package/server/service/activity-thread/index.ts +0 -11
  143. package/server/service/index.ts +0 -70
  144. package/server/service/installable-activity/index.ts +0 -7
  145. package/server/service/installable-activity/installable-activity-mutation.ts +0 -61
  146. package/server/service/installable-activity/installable-activity-query.ts +0 -36
  147. package/server/service/installable-activity/installable-activity-type.ts +0 -12
  148. package/server/service/installable-activity/installable-activity.ts +0 -74
  149. package/server/tsconfig.json +0 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/worklist",
3
- "version": "7.0.1-alpha.54",
3
+ "version": "7.0.1-alpha.56",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -32,13 +32,13 @@
32
32
  "@operato/graphql": "^2.0.0-alpha.0",
33
33
  "@operato/grist-editor": "^2.0.0-alpha.0",
34
34
  "@operato/moment-timezone-es": "^2.0.0-alpha.0",
35
- "@things-factory/attachment-base": "^7.0.1-alpha.47",
36
- "@things-factory/auth-base": "^7.0.1-alpha.47",
37
- "@things-factory/board-service": "^7.0.1-alpha.54",
38
- "@things-factory/context-ui": "^7.0.1-alpha.47",
39
- "@things-factory/organization": "^7.0.1-alpha.47",
40
- "@things-factory/scheduler-client": "^7.0.1-alpha.47",
41
- "@things-factory/shell": "^7.0.1-alpha.47"
35
+ "@things-factory/attachment-base": "^7.0.1-alpha.56",
36
+ "@things-factory/auth-base": "^7.0.1-alpha.56",
37
+ "@things-factory/board-service": "^7.0.1-alpha.56",
38
+ "@things-factory/context-ui": "^7.0.1-alpha.55",
39
+ "@things-factory/organization": "^7.0.1-alpha.56",
40
+ "@things-factory/scheduler-client": "^7.0.1-alpha.56",
41
+ "@things-factory/shell": "^7.0.1-alpha.55"
42
42
  },
43
- "gitHead": "ddb9a5718d20e2ee6c089db80319e9302270e5d4"
43
+ "gitHead": "ab36f9da6d820735cc62003e3576c483682cac47"
44
44
  }
@@ -1,132 +0,0 @@
1
- import debounce from 'lodash-es/debounce'
2
- import gql from 'graphql-tag'
3
- import { client, subscribe } from '@operato/graphql'
4
- import { AsyncLock } from '@operato/utils'
5
-
6
- async function subscribeActivityInstance() {
7
- return await subscribe(
8
- {
9
- query: gql`
10
- subscription {
11
- activityInstance {
12
- name
13
- }
14
- }
15
- `
16
- },
17
- {
18
- next: async ({ data }) => {
19
- if (data) {
20
- fetchActivitySummary()
21
- }
22
- }
23
- }
24
- )
25
- }
26
-
27
- async function subscribeActivityThread() {
28
- return await subscribe(
29
- {
30
- query: gql`
31
- subscription {
32
- activityThread {
33
- transaction
34
- }
35
- }
36
- `
37
- },
38
- {
39
- next: async ({ data }) => {
40
- if (data) {
41
- fetchActivitySummary()
42
- }
43
- }
44
- }
45
- )
46
- }
47
-
48
- async function subscribeActivityApproval() {
49
- return await subscribe(
50
- {
51
- query: gql`
52
- subscription {
53
- activityApproval {
54
- judgment
55
- }
56
- }
57
- `
58
- },
59
- {
60
- next: async ({ data }) => {
61
- if (data) {
62
- fetchActivitySummary()
63
- }
64
- }
65
- }
66
- )
67
- }
68
-
69
- var summary = {}
70
- var generatorLocks = {
71
- numberOfToDos: new AsyncLock(true),
72
- numberOfApprovalPendings: new AsyncLock(true),
73
- numberOfPicks: new AsyncLock(true),
74
- numberOfDrafts: new AsyncLock(true)
75
- }
76
-
77
- const fetchActivitySummary = debounce(async () => {
78
- const response = await client.query({
79
- query: gql`
80
- query {
81
- activitySummary {
82
- numberOfToDos
83
- numberOfApprovalPendings
84
- numberOfPicks
85
- numberOfDrafts
86
- }
87
- }
88
- `
89
- })
90
-
91
- if (response.data) {
92
- const { numberOfToDos, numberOfApprovalPendings, numberOfPicks, numberOfDrafts } = response.data.activitySummary
93
-
94
- summary['numberOfToDos'] = numberOfToDos
95
- summary['numberOfApprovalPendings'] = numberOfApprovalPendings
96
- summary['numberOfPicks'] = numberOfPicks
97
- summary['numberOfDrafts'] = numberOfDrafts
98
-
99
- generatorLocks['numberOfToDos']?.unlock(numberOfToDos)
100
- generatorLocks['numberOfApprovalPendings']?.unlock(numberOfApprovalPendings)
101
- generatorLocks['numberOfPicks']?.unlock(numberOfPicks)
102
- generatorLocks['numberOfDrafts']?.unlock(numberOfDrafts)
103
- }
104
- }, 1000)
105
-
106
- export async function* generateActivitySummary(name: string) {
107
- /* 1. 앞에 사용되었던 generator가 종료될 기회를 준다. */
108
- generatorLocks[name]?.unlock()
109
-
110
- /* 2. 마지막 값을 일단 yield 한다. */
111
- yield summary[name]
112
-
113
- while (true) {
114
- generatorLocks[name].lock()
115
-
116
- let badge = await generatorLocks[name].promise
117
- if (badge === undefined) {
118
- /* 새로운 generator가 생성된 경우이면, 기존 generator는 종료한다. */
119
- return
120
- }
121
-
122
- yield badge
123
- }
124
- }
125
-
126
- export async function startSubscribeActivitySummary() {
127
- await subscribeActivityInstance()
128
- await subscribeActivityThread()
129
- await subscribeActivityApproval()
130
-
131
- fetchActivitySummary()
132
- }
@@ -1,70 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
- import './templates/activity-approval-context-template.js'
3
- import './templates/activity-thread-context-template.js'
4
- import './templates/activity-instance-context-template.js'
5
-
6
- import { html } from 'lit-html'
7
- import { store } from '@operato/shell'
8
- import { appendViewpart, openOverlay, TOOL_POSITION, VIEWPART_POSITION } from '@operato/layout'
9
- import { APPEND_CONTEXT_TOOL } from '@things-factory/context-ui'
10
-
11
- import { registerEditor as registerGristEditor, registerRenderer as registerGristRenderer } from '@operato/data-grist'
12
- import { OxGristEditorDuration } from '@operato/grist-editor/ox-grist-editor-duration.js'
13
- import { OxGristEditorQuantifier } from '@operato/grist-editor/ox-grist-editor-quantifier.js'
14
- import { OxGristRendererDuration } from '@operato/grist-editor/ox-grist-renderer-duration.js'
15
- import { OxGristRendererQuantifier } from '@operato/grist-editor/ox-grist-renderer-quantifier.js'
16
- import { GristEditorActivitySearchKeys } from './grist-editor/grist-editor-activity-search-key.js'
17
- import { GristRendererActivitySearchKeys } from './grist-editor/grist-renderer-activity-search-key.js'
18
-
19
- export default function bootstrap() {
20
- appendViewpart({
21
- name: 'activity-info-overlay',
22
- viewpart: {
23
- show: false,
24
- hovering: 'edge',
25
- backdrop: true,
26
- template: html``
27
- },
28
- position: VIEWPART_POSITION.ASIDEBAR
29
- })
30
- ;[
31
- {
32
- template: html` <activity-approval-context-template></activity-approval-context-template> `,
33
- context: 'activityApproval'
34
- },
35
- {
36
- template: html` <activity-thread-context-template></activity-thread-context-template> `,
37
- context: 'activityThread'
38
- },
39
- {
40
- template: html` <activity-instance-context-template></activity-instance-context-template> `,
41
- context: 'activityInstance'
42
- }
43
- ].forEach(({ template, context }) => {
44
- store.dispatch({
45
- type: APPEND_CONTEXT_TOOL,
46
- tool: {
47
- position: TOOL_POSITION.FRONT,
48
- template: html`
49
- <md-icon
50
- @click=${async e => {
51
- openOverlay('context-toolbar-overlay', {
52
- template
53
- })
54
- }}
55
- >info</md-icon
56
- >
57
- `,
58
- context
59
- }
60
- })
61
- })
62
-
63
- registerGristEditor('duration', OxGristEditorDuration)
64
- registerGristRenderer('duration', OxGristRendererDuration)
65
- registerGristEditor('quantifier', OxGristEditorQuantifier)
66
- registerGristRenderer('quantifier', OxGristRendererQuantifier)
67
-
68
- registerGristEditor('activity-search-keys', GristEditorActivitySearchKeys)
69
- registerGristRenderer('activity-search-keys', GristRendererActivitySearchKeys)
70
- }
@@ -1,100 +0,0 @@
1
- import '@material/web/button/elevated-button.js'
2
-
3
- import gql from 'graphql-tag'
4
- import { css, html, LitElement } from 'lit'
5
- import { customElement, property } from 'lit/decorators.js'
6
-
7
- import { client } from '@operato/graphql'
8
- import { i18next, localize } from '@operato/i18n'
9
- import { ScrollbarStyles } from '@operato/styles'
10
-
11
- @customElement('activity-owner-view')
12
- class ActivityOwnerView extends localize(i18next)(LitElement) {
13
- static styles = [
14
- ScrollbarStyles,
15
- css`
16
- :host {
17
- display: flex;
18
- flex-direction: column;
19
-
20
- background-color: #fff;
21
- }
22
-
23
- content {
24
- flex: 1;
25
- display: flex;
26
- flex-direction: column;
27
- padding: var(--padding-default);
28
- overflow: auto;
29
- }
30
-
31
- section {
32
- display: flex;
33
- flex-direction: column;
34
- }
35
- `
36
- ]
37
- @property({ type: String }) activityId?: string
38
- @property({ type: Object }) activity: any
39
- @property({ type: Object }) activityInstance: any
40
-
41
- constructor() {
42
- super()
43
-
44
- this.activityInstance = {}
45
- }
46
-
47
- render() {
48
- const { name, description, thumbnail } = this.activity || {}
49
-
50
- return html`
51
- <content>
52
- <section>
53
- <div>name: ${name}</div>
54
- <div>description: ${description}</div>
55
- </section>
56
-
57
- <section>
58
- <img src=${thumbnail} />
59
- </section>
60
- </content>
61
- `
62
- }
63
-
64
- firstUpdated() {
65
- this.fetchActivity(this.activityId)
66
- }
67
-
68
- async fetchActivity(id) {
69
- const response = await client.query({
70
- query: gql`
71
- query activity($id: String!) {
72
- activity(id: $id) {
73
- id
74
- name
75
- description
76
- state
77
- thumbnail
78
- model {
79
- name
80
- description
81
- active
82
- tag
83
- inout
84
- type
85
- unit
86
- options
87
- quantifier
88
- spec
89
- }
90
- }
91
- }
92
- `,
93
- variables: {
94
- id
95
- }
96
- })
97
-
98
- this.activity = response.data.activity
99
- }
100
- }
@@ -1,155 +0,0 @@
1
- import '@operato/property-editor/ox-properties-dynamic-view.js'
2
- import '@things-factory/organization/dist-client/component/approval-line-brief.js'
3
- import '../templates/activity-approval-context-template.js'
4
-
5
- import { css, html, LitElement } from 'lit'
6
- import { customElement, property, state } from 'lit/decorators.js'
7
-
8
- import { i18next, localize } from '@operato/i18n'
9
- import { toggleOverlay } from '@operato/layout'
10
-
11
- @customElement('activity-approval-ribon')
12
- export class ActivityApprovalRibon extends localize(i18next)(LitElement) {
13
- static styles = [
14
- css`
15
- :host {
16
- display: flex;
17
- background-color: var(--worklist-status-color);
18
- color: var(--theme-white-color);
19
- align-items: center;
20
- min-height: 44px;
21
- --fontsize-small: 12px;
22
- }
23
-
24
- div {
25
- border-left: var(--border-dark-color);
26
- padding: var(--padding-narrow) var(--padding-default);
27
- align-self: center;
28
- }
29
-
30
- :host([state='assigned']) {
31
- --worklist-status-color: #5f7184;
32
- }
33
-
34
- :host([state='started']) {
35
- --worklist-status-color: #56af45;
36
- }
37
-
38
- :host([state='delegated']) {
39
- --worklist-status-color: #8654b0;
40
- }
41
-
42
- :host([state='submitted']) {
43
- --worklist-status-color: #428df3;
44
- }
45
-
46
- :host([state='escalated']) {
47
- --worklist-status-color: #595de5;
48
- }
49
-
50
- :host([state='rejected']) {
51
- --worklist-status-color: #f27429;
52
- }
53
-
54
- :host([state='ended']) {
55
- --worklist-status-color: #02acae;
56
- }
57
-
58
- :host([state='aborted']) {
59
- --worklist-status-color: #cb3a33;
60
- }
61
-
62
- md-icon {
63
- font-size: 24px;
64
- }
65
-
66
- [desc] {
67
- flex: 2;
68
- font-size: var(--fontsize-small);
69
- }
70
-
71
- [desc] * {
72
- vertical-align: middle;
73
- }
74
-
75
- [assignee] {
76
- text-align: center;
77
- font-size: var(--fontsize-small);
78
- line-height: 1.3;
79
- }
80
-
81
- [assignee] span {
82
- display: block;
83
- font-size: var(--fontsize-large);
84
- font-weight: bold;
85
- }
86
-
87
- approval-line-brief {
88
- background-color: var(--worklist-status-color);
89
- font-size: var(--fontsize-small);
90
- }
91
-
92
- [state] {
93
- text-align: right;
94
- font-size: var(--fontsize-small);
95
- }
96
-
97
- @media only screen and (max-width: 460px) {
98
- div {
99
- border-left: none;
100
- }
101
-
102
- [assignee] {
103
- display: none;
104
- }
105
- md-icon {
106
- padding: 0;
107
- }
108
- approval-line-brief {
109
- display: none;
110
- }
111
- }
112
- `
113
- ]
114
-
115
- @property({ type: Object }) activityApproval: any
116
-
117
- render() {
118
- const { activityInstance, state } = this.activityApproval?.activityThread || {}
119
- const { description, assignee, approvalLine, activity } = activityInstance || {}
120
- const { startingType } = activity || {}
121
-
122
- return html`
123
- <div desc>
124
- <md-icon
125
- @click=${() => {
126
- toggleOverlay('activity-info-overlay', {
127
- template: html`<activity-approval-context-template .activityApproval=${this.activityApproval} state=${state}></activity-approval-context-template>`
128
- })
129
- }}
130
- >description</md-icon
131
- >
132
- ${description}
133
- </div>
134
- ${startingType == 'issue' && assignee
135
- ? html`
136
- <div assignee>
137
- ${i18next.t('field.assignee')}
138
- <span>${assignee?.name}&nbsp;</span>
139
- </div>
140
- `
141
- : html``}
142
- ${approvalLine ? html`<approval-line-brief .model=${approvalLine} .current=${this.activityApproval.order}></approval-line-brief>` : html``}
143
-
144
- <div state>${i18next.t('label.activity-state-' + state)}</div>
145
- `
146
- }
147
-
148
- updated(changes) {
149
- if (changes.has('activityApproval') && this.activityApproval) {
150
- const { state } = this.activityApproval.activityThread
151
-
152
- this.setAttribute('state', state)
153
- }
154
- }
155
- }
@@ -1,184 +0,0 @@
1
- import '@material/web/button/elevated-button.js'
2
- import '@operato/property-editor/ox-properties-dynamic-view.js'
3
-
4
- import gql from 'graphql-tag'
5
- import { css, html, LitElement } from 'lit'
6
- import { customElement, property, state } from 'lit/decorators.js'
7
-
8
- import { client } from '@operato/graphql'
9
- import { i18next, localize } from '@operato/i18n'
10
- import { notify } from '@operato/layout'
11
- import { ScrollbarStyles } from '@operato/styles'
12
-
13
- @customElement('activity-instance-preview')
14
- class ActivityInstancePreview extends localize(i18next)(LitElement) {
15
- static styles = [
16
- ScrollbarStyles,
17
- css`
18
- :host {
19
- display: flex;
20
- flex-direction: column;
21
-
22
- background-color: #fff;
23
- }
24
-
25
- content {
26
- flex: 1;
27
- display: flex;
28
- flex-direction: column;
29
- padding: var(--padding-default);
30
- overflow: auto;
31
- }
32
-
33
- section {
34
- display: flex;
35
- flex-direction: column;
36
- }
37
-
38
- #description {
39
- height: 60px;
40
- }
41
-
42
- .button-container {
43
- display: flex;
44
- margin-left: auto;
45
- padding: var(--padding-default);
46
- }
47
-
48
- md-elevated-button {
49
- margin-left: var(--margin-default);
50
- }
51
- `
52
- ]
53
-
54
- @property({ type: String }) activityInstanceId?: string
55
- @property({ type: Object }) activityInstance: any = {}
56
- @property({ type: Array }) activityThreads: any
57
-
58
- @state() picked: boolean = false
59
-
60
- render() {
61
- const { id, name, description, input, state, threadsMin = 0, threadsMax = 0, activity } = this.activityInstance || {}
62
- const { model, thumbnail } = activity || {}
63
-
64
- const inputSpec = (model || [])
65
- .filter(item => item.inout === 'in' || item.inout === 'inout')
66
- .map(item => {
67
- return {
68
- ...item,
69
- label: item.name
70
- }
71
- })
72
-
73
- const pickable = !this.picked && this.activityThreads?.length < threadsMax
74
-
75
- return html`
76
- <content>
77
- <section>
78
- <h2>mission statement</h2>
79
- <div>title: ${name}</div>
80
- <div>${description}</div>
81
- <div>min-max: ${threadsMin} - ${threadsMax}</div>
82
- <img src=${thumbnail} />
83
- </section>
84
-
85
- <label>Input</label>
86
- ${!model
87
- ? html``
88
- : html`
89
- <ox-properties-dynamic-view
90
- .props=${inputSpec}
91
- .value=${input}
92
- @property-change=${e => {
93
- this.activityInstance.input = e.currentTarget.value
94
- console.log('activity-instance', this.activityInstance.input)
95
- }}
96
- ></ox-properties-dynamic-view>
97
- `}
98
- </content>
99
-
100
- <div class="button-container">
101
- <md-elevated-button raised @click=${e => history.back()}>${i18next.t('button.close')}</md-elevated-button>
102
- ${pickable ? html`<md-elevated-button raised @click=${this.pickActivityInstance.bind(this)}>${i18next.t('button.pick')}</md-elevated-button>` : html``}
103
- </div>
104
- `
105
- }
106
-
107
- updated(changes) {
108
- if (changes.has('activityInstanceId')) {
109
- this.fetchAll(this.activityInstanceId)
110
- }
111
- }
112
-
113
- async fetchAll(id) {
114
- const response = await client.query({
115
- query: gql`
116
- {
117
- activityInstance(id: "${id}") {
118
- id
119
- name
120
- description
121
- input
122
- state
123
- threadsMin
124
- threadsMax
125
- activity {
126
- id
127
- name
128
- description
129
- state
130
- thumbnail
131
- model {
132
- name
133
- description
134
- active
135
- tag
136
- inout
137
- type
138
- unit
139
- options
140
- quantifier
141
- spec
142
- }
143
- }
144
- }
145
-
146
- activityThreads(filters: [{ name: "activityInstanceId", operator: "eq", value: "${id}"}]) {
147
- items {
148
- id
149
- }
150
- total
151
- }
152
- }
153
- `
154
- })
155
-
156
- this.activityInstance = response.data.activityInstance
157
- this.activityThreads = response.data.activityThreads.items
158
- }
159
-
160
- async pickActivityInstance() {
161
- const response = await client.mutate({
162
- mutation: gql`
163
- mutation ($id: String!) {
164
- pickActivityInstance(id: $id) {
165
- id
166
- }
167
- }
168
- `,
169
- variables: {
170
- id: this.activityInstanceId
171
- }
172
- })
173
-
174
- if (!response.errors) {
175
- this.picked = true
176
- this.activityThreads = [response.data.pickActivityInstance]
177
- notify({
178
- message: i18next.t('text.info_x_successfully', {
179
- x: `${i18next.t('label.activity-instance')} ${i18next.t('text.pick')}`
180
- })
181
- })
182
- }
183
- }
184
- }