@things-factory/worklist 6.0.25 → 6.0.26
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.
- package/client/bootstrap.ts +37 -0
- package/client/pages/activity-approval/activity-approval-page.ts +5 -50
- package/client/pages/activity-thread/activity-thread-page.ts +5 -44
- package/client/pages/installable-activity/installable-activity-list-page.ts +3 -13
- package/client/templates/activity-approval-context-template.ts +67 -0
- package/client/templates/activity-thread-context-template.ts +62 -0
- package/dist-client/bootstrap.d.ts +2 -0
- package/dist-client/bootstrap.js +35 -0
- package/dist-client/bootstrap.js.map +1 -1
- package/dist-client/pages/activity-approval/activity-approval-page.d.ts +1 -0
- package/dist-client/pages/activity-approval/activity-approval-page.js +4 -48
- package/dist-client/pages/activity-approval/activity-approval-page.js.map +1 -1
- package/dist-client/pages/activity-thread/activity-thread-page.d.ts +1 -0
- package/dist-client/pages/activity-thread/activity-thread-page.js +4 -42
- package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
- package/dist-client/pages/installable-activity/installable-activity-list-page.js +3 -13
- package/dist-client/pages/installable-activity/installable-activity-list-page.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/templates/activity-approval-context-template.d.ts +2 -0
- package/dist-client/templates/activity-approval-context-template.js +62 -0
- package/dist-client/templates/activity-approval-context-template.js.map +1 -0
- package/dist-client/templates/activity-context-template.d.ts +2 -0
- package/dist-client/templates/activity-context-template.js +62 -0
- package/dist-client/templates/activity-context-template.js.map +1 -0
- package/dist-client/templates/activity-thread-context-template.d.ts +2 -0
- package/dist-client/templates/activity-thread-context-template.js +57 -0
- package/dist-client/templates/activity-thread-context-template.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/translations/en.json +1 -0
- package/translations/ko.json +1 -0
- package/translations/ms.json +1 -0
- package/translations/zh.json +1 -0
package/client/bootstrap.ts
CHANGED
|
@@ -1,10 +1,47 @@
|
|
|
1
|
+
import { html } from 'lit-html'
|
|
2
|
+
import { store } from '@operato/shell'
|
|
3
|
+
import { openOverlay, TOOL_POSITION } from '@operato/layout'
|
|
4
|
+
import { APPEND_CONTEXT_TOOL } from '@things-factory/context-ui'
|
|
5
|
+
|
|
1
6
|
import { registerEditor as registerGristEditor, registerRenderer as registerGristRenderer } from '@operato/data-grist'
|
|
2
7
|
import { OxGristEditorDuration } from '@operato/grist-editor/ox-grist-editor-duration.js'
|
|
3
8
|
import { OxGristEditorQuantifier } from '@operato/grist-editor/ox-grist-editor-quantifier.js'
|
|
4
9
|
import { OxGristRendererDuration } from '@operato/grist-editor/ox-grist-renderer-duration.js'
|
|
5
10
|
import { OxGristRendererQuantifier } from '@operato/grist-editor/ox-grist-renderer-quantifier.js'
|
|
6
11
|
|
|
12
|
+
import './templates/activity-approval-context-template.js'
|
|
13
|
+
import './templates/activity-thread-context-template.js'
|
|
14
|
+
|
|
7
15
|
export default function bootstrap() {
|
|
16
|
+
;[
|
|
17
|
+
{
|
|
18
|
+
template: html` <activity-approval-context-template></activity-approval-context-template> `,
|
|
19
|
+
context: 'activityApproval'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
template: html` <activity-thread-context-template></activity-thread-context-template> `,
|
|
23
|
+
context: 'activityThread'
|
|
24
|
+
}
|
|
25
|
+
].forEach(({ template, context }) => {
|
|
26
|
+
store.dispatch({
|
|
27
|
+
type: APPEND_CONTEXT_TOOL,
|
|
28
|
+
tool: {
|
|
29
|
+
position: TOOL_POSITION.FRONT,
|
|
30
|
+
template: html`
|
|
31
|
+
<mwc-icon
|
|
32
|
+
@click=${async e => {
|
|
33
|
+
openOverlay('context-toolbar-overlay', {
|
|
34
|
+
template
|
|
35
|
+
})
|
|
36
|
+
}}
|
|
37
|
+
>info</mwc-icon
|
|
38
|
+
>
|
|
39
|
+
`,
|
|
40
|
+
context
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
|
|
8
45
|
registerGristEditor('duration', OxGristEditorDuration)
|
|
9
46
|
registerGristRenderer('duration', OxGristRendererDuration)
|
|
10
47
|
registerGristEditor('quantifier', OxGristEditorQuantifier)
|
|
@@ -15,8 +15,6 @@ import { PageView, store } from '@operato/shell'
|
|
|
15
15
|
import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
|
16
16
|
import { provider } from '@things-factory/board-ui'
|
|
17
17
|
|
|
18
|
-
const formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' })
|
|
19
|
-
|
|
20
18
|
const ActivityApprovalFetchResult = `\
|
|
21
19
|
{
|
|
22
20
|
id
|
|
@@ -100,23 +98,6 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
|
|
|
100
98
|
overflow: auto;
|
|
101
99
|
}
|
|
102
100
|
|
|
103
|
-
[header] {
|
|
104
|
-
display: flex;
|
|
105
|
-
padding: 5px;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
[header] > div {
|
|
109
|
-
flex: 1;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
[content] {
|
|
113
|
-
clear: left;
|
|
114
|
-
|
|
115
|
-
flex: 1;
|
|
116
|
-
display: block;
|
|
117
|
-
padding: 5px;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
101
|
ox-board-viewer {
|
|
121
102
|
width: 100%;
|
|
122
103
|
height: 100%;
|
|
@@ -154,41 +135,13 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
|
|
|
154
135
|
action: this._saveActivityApproval.bind(this),
|
|
155
136
|
...CommonButtonStyles.save
|
|
156
137
|
}
|
|
157
|
-
]
|
|
138
|
+
],
|
|
139
|
+
activityApproval: this.activityApproval
|
|
158
140
|
}
|
|
159
141
|
}
|
|
160
142
|
|
|
161
143
|
render() {
|
|
162
|
-
|
|
163
|
-
const { state, dueAt, assignedAt, assignee, activityInstance } = this.activityThread || {}
|
|
164
|
-
const { name, description, thumbnail, approvalLine } = activityInstance || {}
|
|
165
|
-
|
|
166
|
-
return html`
|
|
167
|
-
<div header>
|
|
168
|
-
<div>
|
|
169
|
-
<div>name: ${name}</div>
|
|
170
|
-
<div>description: ${description}</div>
|
|
171
|
-
<div>state: ${state}</div>
|
|
172
|
-
<div>round: ${round}</div>
|
|
173
|
-
<div>order: ${order}</div>
|
|
174
|
-
<div>assigned at: ${assignedAt && formatter.format(new Date(assignedAt))}</div>
|
|
175
|
-
<div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>
|
|
176
|
-
<div>assignee: ${assignee?.name}</div>
|
|
177
|
-
<div>approver: ${approver?.name}</div>
|
|
178
|
-
<div>waited since: ${createdAt && formatter.format(new Date(createdAt))}</div>
|
|
179
|
-
</div>
|
|
180
|
-
<div>
|
|
181
|
-
<div approval-line>
|
|
182
|
-
${approvalLine
|
|
183
|
-
? html` <approval-line-view .model=${approvalLine} .current=${order}></approval-line-view> `
|
|
184
|
-
: html``}
|
|
185
|
-
</div>
|
|
186
|
-
<img src=${thumbnail} />
|
|
187
|
-
</div>
|
|
188
|
-
</div>
|
|
189
|
-
|
|
190
|
-
<div content>${this.activityContent()}</div>
|
|
191
|
-
`
|
|
144
|
+
return html` ${this.activityContent()}`
|
|
192
145
|
}
|
|
193
146
|
|
|
194
147
|
activityContent() {
|
|
@@ -341,6 +294,8 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
|
|
|
341
294
|
|
|
342
295
|
this.activityApproval = response.data.activityApproval
|
|
343
296
|
this.activityThread = this.activityApproval.activityThread
|
|
297
|
+
|
|
298
|
+
this.updateContext()
|
|
344
299
|
}
|
|
345
300
|
|
|
346
301
|
async _rejectActivityApproval() {
|
|
@@ -15,8 +15,6 @@ import { PageView, store } from '@operato/shell'
|
|
|
15
15
|
import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
|
16
16
|
import { provider } from '@things-factory/board-ui'
|
|
17
17
|
|
|
18
|
-
const formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' })
|
|
19
|
-
|
|
20
18
|
const ActivityThreadFetchResult = `\
|
|
21
19
|
{
|
|
22
20
|
id
|
|
@@ -91,23 +89,6 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
|
|
|
91
89
|
overflow: auto;
|
|
92
90
|
}
|
|
93
91
|
|
|
94
|
-
[header] {
|
|
95
|
-
display: flex;
|
|
96
|
-
padding: 5px;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
[header] > div {
|
|
100
|
-
flex: 1;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
[content] {
|
|
104
|
-
clear: left;
|
|
105
|
-
|
|
106
|
-
flex: 1;
|
|
107
|
-
display: block;
|
|
108
|
-
padding: 5px;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
92
|
ox-board-viewer {
|
|
112
93
|
width: 100%;
|
|
113
94
|
height: 100%;
|
|
@@ -167,35 +148,13 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
|
|
|
167
148
|
action: this._abortActivityThread.bind(this),
|
|
168
149
|
...CommonButtonStyles.cancel
|
|
169
150
|
}
|
|
170
|
-
].filter(Boolean /* truthy only */)
|
|
151
|
+
].filter(Boolean /* truthy only */),
|
|
152
|
+
activityThread: this.activityThread
|
|
171
153
|
}
|
|
172
154
|
}
|
|
173
155
|
|
|
174
156
|
render() {
|
|
175
|
-
|
|
176
|
-
const { name, description, thumbnail, approvalLine } = activityInstance || {}
|
|
177
|
-
|
|
178
|
-
return html`
|
|
179
|
-
<div header>
|
|
180
|
-
<div>
|
|
181
|
-
<div>name: ${name}</div>
|
|
182
|
-
<div>description: ${description}</div>
|
|
183
|
-
<div>state: ${state}</div>
|
|
184
|
-
<div>round: ${round}</div>
|
|
185
|
-
<div>assigned at: ${assignedAt && formatter.format(new Date(assignedAt))}</div>
|
|
186
|
-
<div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>
|
|
187
|
-
<div>assignee: ${assignee?.name}</div>
|
|
188
|
-
</div>
|
|
189
|
-
<div>
|
|
190
|
-
<div approval-line>
|
|
191
|
-
${approvalLine ? html` <approval-line-view .model=${approvalLine}></approval-line-view> ` : html``}
|
|
192
|
-
</div>
|
|
193
|
-
<img src=${thumbnail} />
|
|
194
|
-
</div>
|
|
195
|
-
</div>
|
|
196
|
-
|
|
197
|
-
<div content>${this.activityContent()}</div>
|
|
198
|
-
`
|
|
157
|
+
return html` ${this.activityContent()}`
|
|
199
158
|
}
|
|
200
159
|
|
|
201
160
|
activityContent() {
|
|
@@ -347,6 +306,8 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
|
|
|
347
306
|
})
|
|
348
307
|
|
|
349
308
|
this.activityThread = response.data.activityThread
|
|
309
|
+
|
|
310
|
+
this.updateContext()
|
|
350
311
|
}
|
|
351
312
|
|
|
352
313
|
async _startActivityThread() {
|
|
@@ -99,7 +99,7 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
|
|
|
99
99
|
list: {
|
|
100
100
|
thumbnail: 'thumbnail',
|
|
101
101
|
fields: ['name', 'description'],
|
|
102
|
-
details: ['
|
|
102
|
+
details: ['provider', 'release']
|
|
103
103
|
},
|
|
104
104
|
columns: [
|
|
105
105
|
{ type: 'gutter', gutterName: 'sequence' },
|
|
@@ -165,8 +165,8 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
|
|
|
165
165
|
},
|
|
166
166
|
{
|
|
167
167
|
type: 'string',
|
|
168
|
-
name: '
|
|
169
|
-
header: i18next.t('field.
|
|
168
|
+
name: 'release',
|
|
169
|
+
header: i18next.t('field.release'),
|
|
170
170
|
record: {
|
|
171
171
|
editable: false
|
|
172
172
|
},
|
|
@@ -284,16 +284,6 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
|
|
|
284
284
|
// filter: true,
|
|
285
285
|
sortable: true,
|
|
286
286
|
width: 60
|
|
287
|
-
},
|
|
288
|
-
{
|
|
289
|
-
type: 'resource-object',
|
|
290
|
-
name: 'updater',
|
|
291
|
-
header: i18next.t('field.updater'),
|
|
292
|
-
record: {
|
|
293
|
-
editable: false
|
|
294
|
-
},
|
|
295
|
-
sortable: true,
|
|
296
|
-
width: 120
|
|
297
287
|
}
|
|
298
288
|
],
|
|
299
289
|
rows: {
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import '@material/mwc-icon'
|
|
2
|
+
|
|
3
|
+
import { html, css, LitElement } from 'lit'
|
|
4
|
+
import { customElement, state } from 'lit/decorators.js'
|
|
5
|
+
|
|
6
|
+
import { connect } from 'pwa-helpers/connect-mixin'
|
|
7
|
+
|
|
8
|
+
import { ContextToolbarOverlayStyle } from '@operato/context/ox-context-toolbar-overlay-style.js'
|
|
9
|
+
import { store } from '@operato/shell'
|
|
10
|
+
import { i18next } from '@operato/i18n'
|
|
11
|
+
|
|
12
|
+
import '@things-factory/organization/dist-client/component/approval-line-view.js'
|
|
13
|
+
|
|
14
|
+
const formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' })
|
|
15
|
+
|
|
16
|
+
@customElement('activity-approval-context-template')
|
|
17
|
+
class ActivityApprovalContextTemplate extends connect(store)(LitElement) {
|
|
18
|
+
static styles = [
|
|
19
|
+
ContextToolbarOverlayStyle,
|
|
20
|
+
css`
|
|
21
|
+
:host {
|
|
22
|
+
background-color: white;
|
|
23
|
+
|
|
24
|
+
width: 100%;
|
|
25
|
+
padding: 5px;
|
|
26
|
+
overflow: auto;
|
|
27
|
+
}
|
|
28
|
+
`
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
@state() private context
|
|
32
|
+
|
|
33
|
+
render() {
|
|
34
|
+
const activityApproval = this.context.activityApproval || {}
|
|
35
|
+
|
|
36
|
+
const { round, order, approver, createdAt, activityThread } = activityApproval || {}
|
|
37
|
+
const { state, dueAt, assignedAt, assignee, activityInstance } = activityThread || {}
|
|
38
|
+
const { name, description, thumbnail, approvalLine } = activityInstance || {}
|
|
39
|
+
|
|
40
|
+
return html`
|
|
41
|
+
<div>
|
|
42
|
+
<div>name: ${name}</div>
|
|
43
|
+
<div>description: ${description}</div>
|
|
44
|
+
<div>state: ${state}</div>
|
|
45
|
+
<div>round: ${round}</div>
|
|
46
|
+
<div>order: ${order}</div>
|
|
47
|
+
<div>assigned at: ${assignedAt && formatter.format(new Date(assignedAt))}</div>
|
|
48
|
+
<div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>
|
|
49
|
+
<div>assignee: ${assignee?.name}</div>
|
|
50
|
+
<div>approver: ${approver?.name}</div>
|
|
51
|
+
<div>waited since: ${createdAt && formatter.format(new Date(createdAt))}</div>
|
|
52
|
+
</div>
|
|
53
|
+
<div>
|
|
54
|
+
<div approval-line>
|
|
55
|
+
${approvalLine
|
|
56
|
+
? html` <approval-line-view .model=${approvalLine} .current=${order}></approval-line-view> `
|
|
57
|
+
: html``}
|
|
58
|
+
</div>
|
|
59
|
+
<img src=${thumbnail} />
|
|
60
|
+
</div>
|
|
61
|
+
`
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
stateChanged(state) {
|
|
65
|
+
this.context = state.route.context
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import '@material/mwc-icon'
|
|
2
|
+
|
|
3
|
+
import { html, css, LitElement } from 'lit'
|
|
4
|
+
import { customElement, state } from 'lit/decorators.js'
|
|
5
|
+
|
|
6
|
+
import { connect } from 'pwa-helpers/connect-mixin'
|
|
7
|
+
|
|
8
|
+
import { ContextToolbarOverlayStyle } from '@operato/context/ox-context-toolbar-overlay-style.js'
|
|
9
|
+
import { store } from '@operato/shell'
|
|
10
|
+
import { i18next } from '@operato/i18n'
|
|
11
|
+
|
|
12
|
+
import '@things-factory/organization/dist-client/component/approval-line-view.js'
|
|
13
|
+
|
|
14
|
+
const formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' })
|
|
15
|
+
|
|
16
|
+
@customElement('activity-thread-context-template')
|
|
17
|
+
class ActivityThreadContextTemplate extends connect(store)(LitElement) {
|
|
18
|
+
static styles = [
|
|
19
|
+
ContextToolbarOverlayStyle,
|
|
20
|
+
css`
|
|
21
|
+
:host {
|
|
22
|
+
background-color: white;
|
|
23
|
+
|
|
24
|
+
width: 100%;
|
|
25
|
+
padding: 5px;
|
|
26
|
+
overflow: auto;
|
|
27
|
+
}
|
|
28
|
+
`
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
@state() private context
|
|
32
|
+
|
|
33
|
+
render() {
|
|
34
|
+
const activityThread = this.context.activityThread || {}
|
|
35
|
+
|
|
36
|
+
const { state, round, dueAt, assignedAt, assignee, activityInstance } = activityThread || {}
|
|
37
|
+
const { name, description, thumbnail, approvalLine } = activityInstance || {}
|
|
38
|
+
|
|
39
|
+
return html`
|
|
40
|
+
<div>
|
|
41
|
+
<div>name: ${name}</div>
|
|
42
|
+
<div>description: ${description}</div>
|
|
43
|
+
<div>state: ${state}</div>
|
|
44
|
+
<div>round: ${round}</div>
|
|
45
|
+
<div>assigned at: ${assignedAt && formatter.format(new Date(assignedAt))}</div>
|
|
46
|
+
<div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>
|
|
47
|
+
<div>assignee: ${assignee?.name}</div>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div>
|
|
51
|
+
<div approval-line>
|
|
52
|
+
${approvalLine ? html` <approval-line-view .model=${approvalLine}></approval-line-view> ` : html``}
|
|
53
|
+
</div>
|
|
54
|
+
<img src=${thumbnail} />
|
|
55
|
+
</div>
|
|
56
|
+
`
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
stateChanged(state) {
|
|
60
|
+
this.context = state.route.context
|
|
61
|
+
}
|
|
62
|
+
}
|
package/dist-client/bootstrap.js
CHANGED
|
@@ -1,9 +1,44 @@
|
|
|
1
|
+
import { html } from 'lit-html';
|
|
2
|
+
import { store } from '@operato/shell';
|
|
3
|
+
import { openOverlay, TOOL_POSITION } from '@operato/layout';
|
|
4
|
+
import { APPEND_CONTEXT_TOOL } from '@things-factory/context-ui';
|
|
1
5
|
import { registerEditor as registerGristEditor, registerRenderer as registerGristRenderer } from '@operato/data-grist';
|
|
2
6
|
import { OxGristEditorDuration } from '@operato/grist-editor/ox-grist-editor-duration.js';
|
|
3
7
|
import { OxGristEditorQuantifier } from '@operato/grist-editor/ox-grist-editor-quantifier.js';
|
|
4
8
|
import { OxGristRendererDuration } from '@operato/grist-editor/ox-grist-renderer-duration.js';
|
|
5
9
|
import { OxGristRendererQuantifier } from '@operato/grist-editor/ox-grist-renderer-quantifier.js';
|
|
10
|
+
import './templates/activity-approval-context-template.js';
|
|
11
|
+
import './templates/activity-thread-context-template.js';
|
|
6
12
|
export default function bootstrap() {
|
|
13
|
+
;
|
|
14
|
+
[
|
|
15
|
+
{
|
|
16
|
+
template: html ` <activity-approval-context-template></activity-approval-context-template> `,
|
|
17
|
+
context: 'activityApproval'
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
template: html ` <activity-thread-context-template></activity-thread-context-template> `,
|
|
21
|
+
context: 'activityThread'
|
|
22
|
+
}
|
|
23
|
+
].forEach(({ template, context }) => {
|
|
24
|
+
store.dispatch({
|
|
25
|
+
type: APPEND_CONTEXT_TOOL,
|
|
26
|
+
tool: {
|
|
27
|
+
position: TOOL_POSITION.FRONT,
|
|
28
|
+
template: html `
|
|
29
|
+
<mwc-icon
|
|
30
|
+
@click=${async (e) => {
|
|
31
|
+
openOverlay('context-toolbar-overlay', {
|
|
32
|
+
template
|
|
33
|
+
});
|
|
34
|
+
}}
|
|
35
|
+
>info</mwc-icon
|
|
36
|
+
>
|
|
37
|
+
`,
|
|
38
|
+
context
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
7
42
|
registerGristEditor('duration', OxGristEditorDuration);
|
|
8
43
|
registerGristRenderer('duration', OxGristRendererDuration);
|
|
9
44
|
registerGristEditor('quantifier', OxGristEditorQuantifier);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,mBAAmB,EAAE,gBAAgB,IAAI,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AACtH,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAA;AACzF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAA;AAEjG,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,mBAAmB,CAAC,UAAU,EAAE,qBAAqB,CAAC,CAAA;IACtD,qBAAqB,CAAC,UAAU,EAAE,uBAAuB,CAAC,CAAA;IAC1D,mBAAmB,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAAA;IAC1D,qBAAqB,CAAC,YAAY,EAAE,yBAAyB,CAAC,CAAA;AAChE,CAAC","sourcesContent":["import { registerEditor as registerGristEditor, registerRenderer as registerGristRenderer } from '@operato/data-grist'\nimport { OxGristEditorDuration } from '@operato/grist-editor/ox-grist-editor-duration.js'\nimport { OxGristEditorQuantifier } from '@operato/grist-editor/ox-grist-editor-quantifier.js'\nimport { OxGristRendererDuration } from '@operato/grist-editor/ox-grist-renderer-duration.js'\nimport { OxGristRendererQuantifier } from '@operato/grist-editor/ox-grist-renderer-quantifier.js'\n\nexport default function bootstrap() {\n registerGristEditor('duration', OxGristEditorDuration)\n registerGristRenderer('duration', OxGristRendererDuration)\n registerGristEditor('quantifier', OxGristEditorQuantifier)\n registerGristRenderer('quantifier', OxGristRendererQuantifier)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU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,EAAE,uBAAuB,CAAC,CAAA;IAC1D,mBAAmB,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAAA;IAC1D,qBAAqB,CAAC,YAAY,EAAE,yBAAyB,CAAC,CAAA;AAChE,CAAC","sourcesContent":["import { html } from 'lit-html'\nimport { store } from '@operato/shell'\nimport { openOverlay, TOOL_POSITION } from '@operato/layout'\nimport { APPEND_CONTEXT_TOOL } from '@things-factory/context-ui'\n\nimport { registerEditor as registerGristEditor, registerRenderer as registerGristRenderer } from '@operato/data-grist'\nimport { OxGristEditorDuration } from '@operato/grist-editor/ox-grist-editor-duration.js'\nimport { OxGristEditorQuantifier } from '@operato/grist-editor/ox-grist-editor-quantifier.js'\nimport { OxGristRendererDuration } from '@operato/grist-editor/ox-grist-renderer-duration.js'\nimport { OxGristRendererQuantifier } from '@operato/grist-editor/ox-grist-renderer-quantifier.js'\n\nimport './templates/activity-approval-context-template.js'\nimport './templates/activity-thread-context-template.js'\n\nexport default function bootstrap() {\n ;[\n {\n template: html` <activity-approval-context-template></activity-approval-context-template> `,\n context: 'activityApproval'\n },\n {\n template: html` <activity-thread-context-template></activity-thread-context-template> `,\n context: 'activityThread'\n }\n ].forEach(({ template, context }) => {\n store.dispatch({\n type: APPEND_CONTEXT_TOOL,\n tool: {\n position: TOOL_POSITION.FRONT,\n template: html`\n <mwc-icon\n @click=${async e => {\n openOverlay('context-toolbar-overlay', {\n template\n })\n }}\n >info</mwc-icon\n >\n `,\n context\n }\n })\n })\n\n registerGristEditor('duration', OxGristEditorDuration)\n registerGristRenderer('duration', OxGristRendererDuration)\n registerGristEditor('quantifier', OxGristEditorQuantifier)\n registerGristRenderer('quantifier', OxGristRendererQuantifier)\n}\n"]}
|
|
@@ -35,6 +35,7 @@ export declare class ActivityApprovalPage extends ActivityApprovalPage_base {
|
|
|
35
35
|
title: string;
|
|
36
36
|
action: () => Promise<void>;
|
|
37
37
|
}[];
|
|
38
|
+
activityApproval: any;
|
|
38
39
|
};
|
|
39
40
|
render(): import("lit-html").TemplateResult<1>;
|
|
40
41
|
activityContent(): import("lit-html/directive").DirectiveResult<typeof import("lit-html/directives/unsafe-html.js").UnsafeHTMLDirective>;
|
|
@@ -13,7 +13,6 @@ import { i18next, localize } from '@operato/i18n';
|
|
|
13
13
|
import { PageView, store } from '@operato/shell';
|
|
14
14
|
import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
|
|
15
15
|
import { provider } from '@things-factory/board-ui';
|
|
16
|
-
const formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' });
|
|
17
16
|
const ActivityApprovalFetchResult = `\
|
|
18
17
|
{
|
|
19
18
|
id
|
|
@@ -93,39 +92,12 @@ let ActivityApprovalPage = class ActivityApprovalPage extends connect(store)(loc
|
|
|
93
92
|
Object.assign({ title: i18next.t('button.reject'), action: this._rejectActivityApproval.bind(this) }, CommonButtonStyles.play),
|
|
94
93
|
Object.assign({ title: i18next.t('button.approve'), action: this._approveActivityApproval.bind(this) }, CommonButtonStyles.save),
|
|
95
94
|
Object.assign({ title: i18next.t('button.save'), action: this._saveActivityApproval.bind(this) }, CommonButtonStyles.save)
|
|
96
|
-
]
|
|
95
|
+
],
|
|
96
|
+
activityApproval: this.activityApproval
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
render() {
|
|
100
|
-
|
|
101
|
-
const { state, dueAt, assignedAt, assignee, activityInstance } = this.activityThread || {};
|
|
102
|
-
const { name, description, thumbnail, approvalLine } = activityInstance || {};
|
|
103
|
-
return html `
|
|
104
|
-
<div header>
|
|
105
|
-
<div>
|
|
106
|
-
<div>name: ${name}</div>
|
|
107
|
-
<div>description: ${description}</div>
|
|
108
|
-
<div>state: ${state}</div>
|
|
109
|
-
<div>round: ${round}</div>
|
|
110
|
-
<div>order: ${order}</div>
|
|
111
|
-
<div>assigned at: ${assignedAt && formatter.format(new Date(assignedAt))}</div>
|
|
112
|
-
<div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>
|
|
113
|
-
<div>assignee: ${assignee === null || assignee === void 0 ? void 0 : assignee.name}</div>
|
|
114
|
-
<div>approver: ${approver === null || approver === void 0 ? void 0 : approver.name}</div>
|
|
115
|
-
<div>waited since: ${createdAt && formatter.format(new Date(createdAt))}</div>
|
|
116
|
-
</div>
|
|
117
|
-
<div>
|
|
118
|
-
<div approval-line>
|
|
119
|
-
${approvalLine
|
|
120
|
-
? html ` <approval-line-view .model=${approvalLine} .current=${order}></approval-line-view> `
|
|
121
|
-
: html ``}
|
|
122
|
-
</div>
|
|
123
|
-
<img src=${thumbnail} />
|
|
124
|
-
</div>
|
|
125
|
-
</div>
|
|
126
|
-
|
|
127
|
-
<div content>${this.activityContent()}</div>
|
|
128
|
-
`;
|
|
100
|
+
return html ` ${this.activityContent()}`;
|
|
129
101
|
}
|
|
130
102
|
activityContent() {
|
|
131
103
|
var _a, _b;
|
|
@@ -249,6 +221,7 @@ let ActivityApprovalPage = class ActivityApprovalPage extends connect(store)(loc
|
|
|
249
221
|
});
|
|
250
222
|
this.activityApproval = response.data.activityApproval;
|
|
251
223
|
this.activityThread = this.activityApproval.activityThread;
|
|
224
|
+
this.updateContext();
|
|
252
225
|
}
|
|
253
226
|
async _rejectActivityApproval() {
|
|
254
227
|
var { id } = this.activityApproval;
|
|
@@ -333,23 +306,6 @@ ActivityApprovalPage.styles = [
|
|
|
333
306
|
overflow: auto;
|
|
334
307
|
}
|
|
335
308
|
|
|
336
|
-
[header] {
|
|
337
|
-
display: flex;
|
|
338
|
-
padding: 5px;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
[header] > div {
|
|
342
|
-
flex: 1;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
[content] {
|
|
346
|
-
clear: left;
|
|
347
|
-
|
|
348
|
-
flex: 1;
|
|
349
|
-
display: block;
|
|
350
|
-
padding: 5px;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
309
|
ox-board-viewer {
|
|
354
310
|
width: 100%;
|
|
355
311
|
height: 100%;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity-approval-page.js","sourceRoot":"","sources":["../../../client/pages/activity-approval/activity-approval-page.ts"],"names":[],"mappings":";AAAA,OAAO,wDAAwD,CAAA;AAC/D,OAAO,mCAAmC,CAAA;AAC1C,OAAO,8BAA8B,CAAA;AAErC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAEnD,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAA;AAExG,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0DlC,CAAA;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;IACtB,KAAK,E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CACpB,IAAI,WAAW,CAAC,QAAQ,EAAE;gBACxB,MAAM,EAAE;oBACN,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,iCAAiC,CAAC;iBACtD;aACF,CAAC,CACH,CAAA;SACF;IACH,CAAC;;AArVM,2BAAM,GAAG;IACd,eAAe;IACf,iBAAiB;IACjB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8DAAsB;AACjD;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4DAAoB;AAC/C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAAW;AAiLtC;IAAC,KAAK,CAAC,iBAAiB,CAAC;;2DAAmB;AAzNjC,oBAAoB;IADhC,aAAa,CAAC,wBAAwB,CAAC;GAC3B,oBAAoB,CAuVhC;SAvVY,oBAAoB","sourcesContent":["import '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@operato/board/ox-board-viewer.js'\nimport '@things-factory/organization'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { keyed } from 'lit/directives/keyed.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { PageView, store } from '@operato/shell'\nimport { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { provider } from '@things-factory/board-ui'\n\nconst formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full', timeStyle: 'short' })\n\nconst ActivityApprovalFetchResult = `\\\n{\n id\n judgment\n comment\n approver {\n id\n name\n }\n round\n order\n createdAt\n activityThread {\n state\n dueAt\n assignedAt\n assignee {\n id\n name\n }\n output\n activityInstance {\n id\n name\n description\n state\n activity {\n model {\n name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n approvalLine {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n } \n }\n}`\n\nexport const ActivityThreadStatus = {\n Assigned: 'assigned',\n Started: 'started',\n Delegated: 'delegated',\n Ended: 'ended',\n Aborted: 'aborted'\n}\n\n@customElement('activity-approval-page')\nexport class ActivityApprovalPage extends connect(store)(localize(i18next)(PageView)) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n width: 100%;\n padding: 5px;\n overflow: auto;\n }\n\n [header] {\n display: flex;\n padding: 5px;\n }\n\n [header] > div {\n flex: 1;\n }\n\n [content] {\n clear: left;\n\n flex: 1;\n display: block;\n padding: 5px;\n }\n\n ox-board-viewer {\n width: 100%;\n height: 100%;\n }\n `\n ]\n\n @property({ type: Object }) activityApproval: any\n @property({ type: Object }) activityThread: any\n @property({ type: Object }) board: any\n\n get context() {\n const judgment = this.activityApproval?.judgment\n\n return {\n title: this.lifecycle?.params?.['title'] || i18next.t('title.activity-approval'),\n help: 'worklist/activity-approval',\n actions: judgment\n ? []\n : [\n {\n title: i18next.t('button.reject'),\n action: this._rejectActivityApproval.bind(this),\n ...CommonButtonStyles.play\n },\n\n {\n title: i18next.t('button.approve'),\n action: this._approveActivityApproval.bind(this),\n ...CommonButtonStyles.save\n },\n\n {\n title: i18next.t('button.save'),\n action: this._saveActivityApproval.bind(this),\n ...CommonButtonStyles.save\n }\n ]\n }\n }\n\n render() {\n const { round, order, approver, createdAt } = this.activityApproval || {}\n const { state, dueAt, assignedAt, assignee, activityInstance } = this.activityThread || {}\n const { name, description, thumbnail, approvalLine } = activityInstance || {}\n\n return html`\n <div header>\n <div>\n <div>name: ${name}</div>\n <div>description: ${description}</div>\n <div>state: ${state}</div>\n <div>round: ${round}</div>\n <div>order: ${order}</div>\n <div>assigned at: ${assignedAt && formatter.format(new Date(assignedAt))}</div>\n <div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>\n <div>assignee: ${assignee?.name}</div>\n <div>approver: ${approver?.name}</div>\n <div>waited since: ${createdAt && formatter.format(new Date(createdAt))}</div>\n </div>\n <div>\n <div approval-line>\n ${approvalLine\n ? html` <approval-line-view .model=${approvalLine} .current=${order}></approval-line-view> `\n : html``}\n </div>\n <img src=${thumbnail} />\n </div>\n </div>\n\n <div content>${this.activityContent()}</div>\n `\n }\n\n activityContent() {\n switch (this.activityThread?.activityInstance?.uiType) {\n case 'template':\n return this.templateContent()\n case 'generated':\n return this.generatedContent()\n case 'board':\n return this.boardContent()\n case 'page':\n case 'external':\n default:\n return html``\n }\n }\n\n templateContent() {\n const { uiSource: template } = this.activityThread?.activityInstance\n return unsafeHTML(template)\n }\n\n getInputSpec() {\n const model = this.activityThread?.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'in' || item.inout === 'inout')\n .map(item => {\n return {\n ...item,\n label: item.name\n }\n })\n }\n\n getOutputSpec() {\n const model = this.activityThread?.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'inout' || item.inout === 'out')\n .map(item => {\n return {\n ...item,\n label: item.name\n }\n })\n }\n\n generatedContent() {\n var { output, activityInstance } = this.activityThread || {}\n var { input } = activityInstance || {}\n\n const inputSpec = this.getInputSpec()\n const outputSpec = this.getOutputSpec()\n\n if (!output) {\n output = inputSpec\n .filter(item => item.inout === 'inout')\n .reduce((inout, item) => {\n inout[item.name] = input[item.name]\n return inout\n }, {})\n }\n\n return keyed(\n activityInstance.id,\n html`\n <fieldset>\n <legend>Input</legend>\n <ox-properties-dynamic-view\n data-name=\"input\"\n .props=${inputSpec}\n .value=${input}\n ></ox-properties-dynamic-view>\n </fieldset>\n\n <fieldset>\n <legend>Output</legend>\n <ox-properties-dynamic-view\n data-name=\"output\"\n .props=${outputSpec}\n .value=${output}\n @property-change=${e => (this.activityApproval.output = e.currentTarget.value)}\n ></ox-properties-dynamic-view>\n </fieldset>\n `\n )\n }\n\n boardContent() {\n const { output, activityInstance } = this.activityThread\n const { uiSource: boardId, input } = activityInstance || {}\n\n if (!this.board || this.board.id !== boardId) {\n this.board = {\n id: boardId\n }\n }\n\n return keyed(\n activityInstance.id,\n html`\n <ox-board-viewer\n style=\"background-color: white;\"\n .board=${this.board}\n .provider=${provider}\n .values=${{ ...input, ...output }}\n hide-fullscreen\n hide-navigation\n ></ox-board-viewer>\n `\n )\n }\n\n @query('ox-board-viewer') oxBoardViewer: any\n\n getOutputFromBoard() {\n const outputSpec = this.getOutputSpec()\n const data = this.oxBoardViewer.getSceneValues()\n\n return outputSpec.reduce((output, spec) => {\n output[spec.name] = data[spec.name]\n return output\n }, {})\n }\n\n updated(changes) {\n if (changes.has('activityApproval')) {\n this.updateContext()\n }\n }\n\n async pageUpdated(changes, lifecycle, changedBefore) {\n if (this.active) {\n this.fetchActivityApproval(lifecycle.resourceId)\n }\n }\n\n async fetchActivityApproval(id) {\n const response = await client.query({\n query: gql`\n query activityApproval($id: String!) {\n activityApproval(id: $id) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id\n }\n })\n\n this.activityApproval = response.data.activityApproval\n this.activityThread = this.activityApproval.activityThread\n }\n\n async _rejectActivityApproval() {\n var { id } = this.activityApproval\n var comment = 'xxxxxxxxxxxxxxxxxxx'\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $comment: String!) {\n rejectActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id,\n comment\n }\n })\n\n if (!response.errors) {\n this.activityApproval = response.data.rejectActivityApproval\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_rejected_successfully')\n }\n })\n )\n }\n }\n\n async _approveActivityApproval() {\n var { id } = this.activityApproval\n var comment = 'xxxxxxxxxxxxxxxxxxx'\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $comment: String!) {\n approveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id,\n comment\n }\n })\n\n if (!response.errors) {\n this.activityApproval = response.data.approveActivityApproval\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_approved_successfully')\n }\n })\n )\n }\n }\n\n async _saveActivityApproval() {\n var { id } = this.activityApproval\n var comment = 'yyyyyyyyyyyyyyyyyyy'\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $comment: String) {\n saveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id,\n comment\n }\n })\n\n if (!response.errors) {\n this.activityApproval = response.data.saveActivityApproval\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_saved_successfully')\n }\n })\n )\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"activity-approval-page.js","sourceRoot":"","sources":["../../../client/pages/activity-approval/activity-approval-page.ts"],"names":[],"mappings":";AAAA,OAAO,wDAAwD,CAAA;AAC/D,OAAO,mCAAmC,CAAA;AAC1C,OAAO,8BAA8B,CAAA;AAErC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,KAAK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AAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAAW;AAqJtC;IAAC,KAAK,CAAC,iBAAiB,CAAC;;2DAAmB;AA5KjC,oBAAoB;IADhC,aAAa,CAAC,wBAAwB,CAAC;GAC3B,oBAAoB,CA4ShC;SA5SY,oBAAoB","sourcesContent":["import '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@operato/board/ox-board-viewer.js'\nimport '@things-factory/organization'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { keyed } from 'lit/directives/keyed.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { PageView, store } from '@operato/shell'\nimport { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { provider } from '@things-factory/board-ui'\n\nconst ActivityApprovalFetchResult = `\\\n{\n id\n judgment\n comment\n approver {\n id\n name\n }\n round\n order\n createdAt\n activityThread {\n state\n dueAt\n assignedAt\n assignee {\n id\n name\n }\n output\n activityInstance {\n id\n name\n description\n state\n activity {\n model {\n name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n approvalLine {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n } \n }\n}`\n\nexport const ActivityThreadStatus = {\n Assigned: 'assigned',\n Started: 'started',\n Delegated: 'delegated',\n Ended: 'ended',\n Aborted: 'aborted'\n}\n\n@customElement('activity-approval-page')\nexport class ActivityApprovalPage extends connect(store)(localize(i18next)(PageView)) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n width: 100%;\n padding: 5px;\n overflow: auto;\n }\n\n ox-board-viewer {\n width: 100%;\n height: 100%;\n }\n `\n ]\n\n @property({ type: Object }) activityApproval: any\n @property({ type: Object }) activityThread: any\n @property({ type: Object }) board: any\n\n get context() {\n const judgment = this.activityApproval?.judgment\n\n return {\n title: this.lifecycle?.params?.['title'] || i18next.t('title.activity-approval'),\n help: 'worklist/activity-approval',\n actions: judgment\n ? []\n : [\n {\n title: i18next.t('button.reject'),\n action: this._rejectActivityApproval.bind(this),\n ...CommonButtonStyles.play\n },\n\n {\n title: i18next.t('button.approve'),\n action: this._approveActivityApproval.bind(this),\n ...CommonButtonStyles.save\n },\n\n {\n title: i18next.t('button.save'),\n action: this._saveActivityApproval.bind(this),\n ...CommonButtonStyles.save\n }\n ],\n activityApproval: this.activityApproval\n }\n }\n\n render() {\n return html` ${this.activityContent()}`\n }\n\n activityContent() {\n switch (this.activityThread?.activityInstance?.uiType) {\n case 'template':\n return this.templateContent()\n case 'generated':\n return this.generatedContent()\n case 'board':\n return this.boardContent()\n case 'page':\n case 'external':\n default:\n return html``\n }\n }\n\n templateContent() {\n const { uiSource: template } = this.activityThread?.activityInstance\n return unsafeHTML(template)\n }\n\n getInputSpec() {\n const model = this.activityThread?.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'in' || item.inout === 'inout')\n .map(item => {\n return {\n ...item,\n label: item.name\n }\n })\n }\n\n getOutputSpec() {\n const model = this.activityThread?.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'inout' || item.inout === 'out')\n .map(item => {\n return {\n ...item,\n label: item.name\n }\n })\n }\n\n generatedContent() {\n var { output, activityInstance } = this.activityThread || {}\n var { input } = activityInstance || {}\n\n const inputSpec = this.getInputSpec()\n const outputSpec = this.getOutputSpec()\n\n if (!output) {\n output = inputSpec\n .filter(item => item.inout === 'inout')\n .reduce((inout, item) => {\n inout[item.name] = input[item.name]\n return inout\n }, {})\n }\n\n return keyed(\n activityInstance.id,\n html`\n <fieldset>\n <legend>Input</legend>\n <ox-properties-dynamic-view\n data-name=\"input\"\n .props=${inputSpec}\n .value=${input}\n ></ox-properties-dynamic-view>\n </fieldset>\n\n <fieldset>\n <legend>Output</legend>\n <ox-properties-dynamic-view\n data-name=\"output\"\n .props=${outputSpec}\n .value=${output}\n @property-change=${e => (this.activityApproval.output = e.currentTarget.value)}\n ></ox-properties-dynamic-view>\n </fieldset>\n `\n )\n }\n\n boardContent() {\n const { output, activityInstance } = this.activityThread\n const { uiSource: boardId, input } = activityInstance || {}\n\n if (!this.board || this.board.id !== boardId) {\n this.board = {\n id: boardId\n }\n }\n\n return keyed(\n activityInstance.id,\n html`\n <ox-board-viewer\n style=\"background-color: white;\"\n .board=${this.board}\n .provider=${provider}\n .values=${{ ...input, ...output }}\n hide-fullscreen\n hide-navigation\n ></ox-board-viewer>\n `\n )\n }\n\n @query('ox-board-viewer') oxBoardViewer: any\n\n getOutputFromBoard() {\n const outputSpec = this.getOutputSpec()\n const data = this.oxBoardViewer.getSceneValues()\n\n return outputSpec.reduce((output, spec) => {\n output[spec.name] = data[spec.name]\n return output\n }, {})\n }\n\n updated(changes) {\n if (changes.has('activityApproval')) {\n this.updateContext()\n }\n }\n\n async pageUpdated(changes, lifecycle, changedBefore) {\n if (this.active) {\n this.fetchActivityApproval(lifecycle.resourceId)\n }\n }\n\n async fetchActivityApproval(id) {\n const response = await client.query({\n query: gql`\n query activityApproval($id: String!) {\n activityApproval(id: $id) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id\n }\n })\n\n this.activityApproval = response.data.activityApproval\n this.activityThread = this.activityApproval.activityThread\n\n this.updateContext()\n }\n\n async _rejectActivityApproval() {\n var { id } = this.activityApproval\n var comment = 'xxxxxxxxxxxxxxxxxxx'\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $comment: String!) {\n rejectActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id,\n comment\n }\n })\n\n if (!response.errors) {\n this.activityApproval = response.data.rejectActivityApproval\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_rejected_successfully')\n }\n })\n )\n }\n }\n\n async _approveActivityApproval() {\n var { id } = this.activityApproval\n var comment = 'xxxxxxxxxxxxxxxxxxx'\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $comment: String!) {\n approveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id,\n comment\n }\n })\n\n if (!response.errors) {\n this.activityApproval = response.data.approveActivityApproval\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_approved_successfully')\n }\n })\n )\n }\n }\n\n async _saveActivityApproval() {\n var { id } = this.activityApproval\n var comment = 'yyyyyyyyyyyyyyyyyyy'\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $comment: String) {\n saveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}\n }\n `,\n variables: {\n id,\n comment\n }\n })\n\n if (!response.errors) {\n this.activityApproval = response.data.saveActivityApproval\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_saved_successfully')\n }\n })\n )\n }\n }\n}\n"]}
|
|
@@ -35,6 +35,7 @@ export declare class ActivityThreadPage extends ActivityThreadPage_base {
|
|
|
35
35
|
title: string;
|
|
36
36
|
action: () => Promise<void>;
|
|
37
37
|
})[];
|
|
38
|
+
activityThread: any;
|
|
38
39
|
};
|
|
39
40
|
render(): import("lit-html").TemplateResult<1>;
|
|
40
41
|
activityContent(): import("lit-html/directive").DirectiveResult<typeof import("lit-html/directives/unsafe-html.js").UnsafeHTMLDirective>;
|