@things-factory/worklist 6.0.45 → 6.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/bootstrap.ts +5 -0
- package/client/components/activity-starter-form.ts +52 -303
- package/client/pages/activity/activity-list-page.ts +44 -28
- package/client/pages/activity/activity-page.ts +3 -3
- package/client/pages/activity/activity-partial-view.ts +2 -1
- package/client/pages/activity/starter-list-page.ts +16 -11
- package/client/pages/activity-instance/activity-instance-search-page.ts +2 -19
- package/client/pages/activity-instance/activity-instance-start-page.ts +514 -0
- package/client/pages/activity-thread/activity-thread-page.ts +1 -1
- package/client/pages/installable-activity/installable-activity-list-page.ts +7 -5
- package/client/pages/todo/approval-pending-list-page.ts +1 -1
- package/client/pages/todo/done-list-page.ts +1 -1
- package/client/pages/todo/draft-list-page.ts +26 -102
- package/client/pages/todo/todo-list-page.ts +1 -1
- package/client/route.ts +2 -2
- package/client/templates/activity-approval-context-template.ts +4 -0
- package/client/templates/activity-instance-context-template.ts +171 -0
- package/client/templates/activity-thread-context-template.ts +4 -0
- package/client/types/activity-instance-type.ts +4 -2
- package/client/types/activity-instance.ts +2 -2
- package/client/types/activity.ts +7 -0
- package/client/types/types.ts +8 -0
- package/dist-client/bootstrap.d.ts +1 -0
- package/dist-client/bootstrap.js +5 -0
- package/dist-client/bootstrap.js.map +1 -1
- package/dist-client/components/activity-starter-form.d.ts +2 -5
- package/dist-client/components/activity-starter-form.js +54 -247
- package/dist-client/components/activity-starter-form.js.map +1 -1
- package/dist-client/pages/activity/activity-list-page.d.ts +1 -1
- package/dist-client/pages/activity/activity-list-page.js +45 -30
- package/dist-client/pages/activity/activity-list-page.js.map +1 -1
- package/dist-client/pages/activity/activity-page.d.ts +1 -1
- package/dist-client/pages/activity/activity-page.js +3 -3
- package/dist-client/pages/activity/activity-page.js.map +1 -1
- package/dist-client/pages/activity/activity-partial-view.js +2 -2
- package/dist-client/pages/activity/activity-partial-view.js.map +1 -1
- package/dist-client/pages/activity/starter-list-page.d.ts +1 -0
- package/dist-client/pages/activity/starter-list-page.js +14 -11
- package/dist-client/pages/activity/starter-list-page.js.map +1 -1
- package/dist-client/pages/activity-instance/activity-instance-page.d.ts +2 -2
- package/dist-client/pages/activity-instance/activity-instance-page.js +19 -10
- package/dist-client/pages/activity-instance/activity-instance-page.js.map +1 -1
- package/dist-client/pages/activity-instance/activity-instance-search-page.js +1 -8
- package/dist-client/pages/activity-instance/activity-instance-search-page.js.map +1 -1
- package/dist-client/pages/activity-instance/activity-instance-start-page.d.ts +49 -0
- package/dist-client/pages/activity-instance/activity-instance-start-page.js +450 -0
- package/dist-client/pages/activity-instance/activity-instance-start-page.js.map +1 -0
- package/dist-client/pages/activity-thread/activity-thread-page.js +1 -1
- package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
- package/dist-client/pages/installable-activity/installable-activity-list-page.js +7 -5
- package/dist-client/pages/installable-activity/installable-activity-list-page.js.map +1 -1
- package/dist-client/pages/todo/approval-pending-list-page.js +1 -1
- package/dist-client/pages/todo/approval-pending-list-page.js.map +1 -1
- package/dist-client/pages/todo/done-list-page.js +1 -1
- package/dist-client/pages/todo/done-list-page.js.map +1 -1
- package/dist-client/pages/todo/draft-list-page.d.ts +1 -0
- package/dist-client/pages/todo/draft-list-page.js +25 -99
- package/dist-client/pages/todo/draft-list-page.js.map +1 -1
- package/dist-client/pages/todo/todo-list-page.js +1 -1
- package/dist-client/pages/todo/todo-list-page.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +2 -2
- package/dist-client/route.js.map +1 -1
- package/dist-client/templates/activity-approval-context-template.js +4 -0
- package/dist-client/templates/activity-approval-context-template.js.map +1 -1
- package/dist-client/templates/activity-instance-context-template.d.ts +2 -0
- package/dist-client/templates/activity-instance-context-template.js +145 -0
- package/dist-client/templates/activity-instance-context-template.js.map +1 -0
- package/dist-client/templates/activity-thread-context-template.js +4 -0
- package/dist-client/templates/activity-thread-context-template.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/types/activity-instance-type.d.ts +3 -2
- package/dist-client/types/activity-instance-type.js +2 -2
- package/dist-client/types/activity-instance-type.js.map +1 -1
- package/dist-client/types/activity-instance.d.ts +1 -1
- package/dist-client/types/activity-instance.js +2 -2
- package/dist-client/types/activity-instance.js.map +1 -1
- package/dist-client/types/activity.d.ts +5 -0
- package/dist-client/types/activity.js +5 -0
- package/dist-client/types/activity.js.map +1 -1
- package/dist-client/types/types.d.ts +4 -0
- package/dist-client/types/types.js +6 -0
- package/dist-client/types/types.js.map +1 -1
- package/dist-server/controllers/activity-instance/assign.js +1 -1
- package/dist-server/controllers/activity-instance/assign.js.map +1 -1
- package/dist-server/controllers/activity-instance/draft.js +24 -6
- package/dist-server/controllers/activity-instance/draft.js.map +1 -1
- package/dist-server/controllers/activity-instance/index.js +1 -1
- package/dist-server/controllers/activity-instance/index.js.map +1 -1
- package/dist-server/controllers/activity-instance/issue.js +105 -0
- package/dist-server/controllers/activity-instance/issue.js.map +1 -0
- package/dist-server/controllers/activity-instance/pick.js +1 -1
- package/dist-server/controllers/activity-instance/pick.js.map +1 -1
- package/dist-server/controllers/activity-instance/post.js +7 -7
- package/dist-server/controllers/activity-instance/post.js.map +1 -1
- package/dist-server/controllers/common.js +33 -9
- package/dist-server/controllers/common.js.map +1 -1
- package/dist-server/routes.js +2 -2
- package/dist-server/routes.js.map +1 -1
- package/dist-server/service/activity/activity-history.js +6 -2
- package/dist-server/service/activity/activity-history.js.map +1 -1
- package/dist-server/service/activity/activity-query.js +84 -1
- package/dist-server/service/activity/activity-query.js.map +1 -1
- package/dist-server/service/activity/activity-type.js +8 -0
- package/dist-server/service/activity/activity-type.js.map +1 -1
- package/dist-server/service/activity/activity.js +36 -3
- package/dist-server/service/activity/activity.js.map +1 -1
- package/dist-server/service/activity-instance/activity-instance-history.js +1 -1
- package/dist-server/service/activity-instance/activity-instance-history.js.map +1 -1
- package/dist-server/service/activity-instance/activity-instance-mutation.js +6 -6
- package/dist-server/service/activity-instance/activity-instance-mutation.js.map +1 -1
- package/dist-server/service/activity-instance/activity-instance-query.js +2 -2
- package/dist-server/service/activity-instance/activity-instance-query.js.map +1 -1
- package/dist-server/service/activity-instance/activity-instance-type.js +62 -50
- package/dist-server/service/activity-instance/activity-instance-type.js.map +1 -1
- package/dist-server/service/activity-instance/activity-instance.js +4 -23
- package/dist-server/service/activity-instance/activity-instance.js.map +1 -1
- package/dist-server/service/activity-summary/activity-summary-query.js +1 -1
- package/dist-server/service/activity-summary/activity-summary-query.js.map +1 -1
- package/dist-server/service/installable-activity/installable-activity.js +4 -0
- package/dist-server/service/installable-activity/installable-activity.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/helps/worklist/activity.md +91 -0
- package/helps/worklist/draft-list.md +5 -1
- package/helps/worklist/starter-list.md +34 -0
- package/package.json +2 -2
- package/server/controllers/activity-instance/assign.ts +1 -1
- package/server/controllers/activity-instance/draft.ts +33 -6
- package/server/controllers/activity-instance/index.ts +1 -1
- package/server/controllers/activity-instance/issue.ts +175 -0
- package/server/controllers/activity-instance/pick.ts +1 -1
- package/server/controllers/common.ts +43 -9
- package/server/routes.ts +2 -2
- package/server/service/activity/activity-history.ts +5 -2
- package/server/service/activity/activity-query.ts +85 -2
- package/server/service/activity/activity-type.ts +15 -2
- package/server/service/activity/activity.ts +28 -2
- package/server/service/activity-instance/activity-instance-history.ts +1 -1
- package/server/service/activity-instance/activity-instance-mutation.ts +7 -7
- package/server/service/activity-instance/activity-instance-query.ts +3 -3
- package/server/service/activity-instance/activity-instance-type.ts +13 -4
- package/server/service/activity-instance/activity-instance.ts +4 -16
- package/server/service/activity-summary/activity-summary-query.ts +1 -1
- package/server/service/installable-activity/installable-activity.ts +4 -1
- package/things-factory.config.js +1 -1
- package/translations/en.json +13 -0
- package/translations/ko.json +17 -4
- package/translations/ms.json +13 -0
- package/translations/zh.json +13 -0
- package/client/pages/activity-instance/activity-instance-page.ts +0 -445
- package/server/controllers/activity-instance/post.ts +0 -140
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import '@operato/property-editor/ox-properties-dynamic-view.js';
|
|
3
|
+
import '@operato/board/ox-board-viewer.js';
|
|
4
|
+
import '@things-factory/organization';
|
|
5
|
+
import gql from 'graphql-tag';
|
|
6
|
+
import { css, html } from 'lit';
|
|
7
|
+
import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
|
|
8
|
+
import { customElement, query, state } from 'lit/decorators.js';
|
|
9
|
+
import { keyed } from 'lit/directives/keyed.js';
|
|
10
|
+
import { connect } from 'pwa-helpers/connect-mixin.js';
|
|
11
|
+
import { client } from '@operato/graphql';
|
|
12
|
+
import { i18next, localize } from '@operato/i18n';
|
|
13
|
+
import { PageView, store } from '@operato/shell';
|
|
14
|
+
import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
|
|
15
|
+
import { provider } from '@things-factory/board-ui';
|
|
16
|
+
import { notify } from '@operato/layout';
|
|
17
|
+
let ActivityInstanceStartPage = class ActivityInstanceStartPage extends connect(store)(localize(i18next)(PageView)) {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.activity = {};
|
|
21
|
+
this.activityInstance = {};
|
|
22
|
+
}
|
|
23
|
+
get context() {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
const { startingType } = this.activity;
|
|
26
|
+
const { state } = this.activityInstance;
|
|
27
|
+
const issuable = state === 'draft';
|
|
28
|
+
return {
|
|
29
|
+
title: ((_b = (_a = this.lifecycle) === null || _a === void 0 ? void 0 : _a.params) === null || _b === void 0 ? void 0 : _b['title']) || i18next.t('title.activity'),
|
|
30
|
+
help: 'worklist/activity-instance-single-post',
|
|
31
|
+
actions: [
|
|
32
|
+
issuable && Object.assign({ title: i18next.t('button.draft'), action: this.draftActivityInstance.bind(this) }, CommonButtonStyles.save),
|
|
33
|
+
issuable && Object.assign({ title: i18next.t(startingType == 'issue' ? 'button.issue' : 'button.post'), action: this.issueActivityInstance.bind(this) }, CommonButtonStyles.submit)
|
|
34
|
+
].filter(Boolean /* truthy only */),
|
|
35
|
+
activityInstance: this.activityInstance
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
|
+
return html ` ${this.activityContent()}`;
|
|
40
|
+
}
|
|
41
|
+
activityContent() {
|
|
42
|
+
var _a;
|
|
43
|
+
switch ((_a = this.activityInstance) === null || _a === void 0 ? void 0 : _a.uiType) {
|
|
44
|
+
case 'template':
|
|
45
|
+
return this.templateContent();
|
|
46
|
+
case 'generated':
|
|
47
|
+
return this.generatedContent();
|
|
48
|
+
case 'board':
|
|
49
|
+
return this.boardContent();
|
|
50
|
+
case 'custom-element':
|
|
51
|
+
return this.customElementContent();
|
|
52
|
+
case 'page':
|
|
53
|
+
case 'external':
|
|
54
|
+
default:
|
|
55
|
+
return html ``;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
templateContent() {
|
|
59
|
+
const { uiSource: template } = this.activityInstance;
|
|
60
|
+
return unsafeHTML(template);
|
|
61
|
+
}
|
|
62
|
+
getInputSpec() {
|
|
63
|
+
var _a;
|
|
64
|
+
const model = (_a = this.activity) === null || _a === void 0 ? void 0 : _a.model;
|
|
65
|
+
return (model || [])
|
|
66
|
+
.filter(item => item.inout === 'in' || item.inout === 'inout')
|
|
67
|
+
.map(item => {
|
|
68
|
+
return Object.assign(Object.assign({}, item), { label: item.name });
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
getOutputSpec() {
|
|
72
|
+
var _a;
|
|
73
|
+
const model = (_a = this.activity) === null || _a === void 0 ? void 0 : _a.model;
|
|
74
|
+
return (model || [])
|
|
75
|
+
.filter(item => item.inout === 'inout' || item.inout === 'out')
|
|
76
|
+
.map(item => {
|
|
77
|
+
return Object.assign(Object.assign({}, item), { label: item.name });
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
generatedContent() {
|
|
81
|
+
var { input, output } = this.activityInstance || {};
|
|
82
|
+
const inputSpec = this.getInputSpec();
|
|
83
|
+
const outputSpec = this.getOutputSpec();
|
|
84
|
+
if (!output) {
|
|
85
|
+
output = inputSpec
|
|
86
|
+
.filter(item => item.inout === 'inout')
|
|
87
|
+
.reduce((inout, item) => {
|
|
88
|
+
inout[item.name] = input[item.name];
|
|
89
|
+
return inout;
|
|
90
|
+
}, {});
|
|
91
|
+
}
|
|
92
|
+
return keyed(this.activityInstance.id, html `
|
|
93
|
+
<fieldset>
|
|
94
|
+
<legend>Input</legend>
|
|
95
|
+
<ox-properties-dynamic-view
|
|
96
|
+
data-name="input"
|
|
97
|
+
.props=${inputSpec}
|
|
98
|
+
.value=${input}
|
|
99
|
+
@property-change=${e => (this.activityInstance.input = e.currentTarget.value)}
|
|
100
|
+
></ox-properties-dynamic-view>
|
|
101
|
+
</fieldset>
|
|
102
|
+
|
|
103
|
+
<fieldset>
|
|
104
|
+
<legend>Output</legend>
|
|
105
|
+
<ox-properties-dynamic-view
|
|
106
|
+
data-name="output"
|
|
107
|
+
.props=${outputSpec}
|
|
108
|
+
.value=${output}
|
|
109
|
+
@property-change=${e => (this.activityInstance.output = e.currentTarget.value)}
|
|
110
|
+
></ox-properties-dynamic-view>
|
|
111
|
+
</fieldset>
|
|
112
|
+
`);
|
|
113
|
+
}
|
|
114
|
+
boardContent() {
|
|
115
|
+
const { uiSource: boardId, input, output } = this.activityInstance;
|
|
116
|
+
if (!this.board || this.board.id !== boardId) {
|
|
117
|
+
this.board = {
|
|
118
|
+
id: boardId
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/*
|
|
122
|
+
ox-board-viewer에서 provider에 의해 공급되는 board가 각 id별로 instance를 하나씩 밖에 가지지 않으므로,
|
|
123
|
+
동일한 id의 보드를 다른 page에 뺏기는 경우가 있다.
|
|
124
|
+
따라서, Page가 active될 때마다 타임스탬프를 refresh key로 설정하였다.
|
|
125
|
+
*/
|
|
126
|
+
return keyed(this.activityInstance.id, html `
|
|
127
|
+
<ox-board-viewer
|
|
128
|
+
style="background-color: white;"
|
|
129
|
+
.board=${this.board}
|
|
130
|
+
.provider=${provider}
|
|
131
|
+
.values=${Object.assign(Object.assign({}, input), output)}
|
|
132
|
+
hide-fullscreen
|
|
133
|
+
hide-navigation
|
|
134
|
+
></ox-board-viewer>
|
|
135
|
+
`);
|
|
136
|
+
}
|
|
137
|
+
customElementContent() {
|
|
138
|
+
const { uiSource: tagName, input, output } = this.activityInstance;
|
|
139
|
+
const element = document.createElement(tagName);
|
|
140
|
+
element.id = 'custom-content';
|
|
141
|
+
element.input = input;
|
|
142
|
+
element.output = output;
|
|
143
|
+
element.addEventListener('change-input', (e) => {
|
|
144
|
+
this.activityInstance.input = e.detail;
|
|
145
|
+
});
|
|
146
|
+
element.addEventListener('change-output', (e) => {
|
|
147
|
+
this.activityInstance.output = e.detail;
|
|
148
|
+
});
|
|
149
|
+
/* DEPRECATED 일반적으로 output만 수정될 가능성이 높기때문에, change 이벤트는 output을 수정하는 것으로 한다. */
|
|
150
|
+
element.addEventListener('change', (e) => {
|
|
151
|
+
this.activityInstance.output = e.detail;
|
|
152
|
+
});
|
|
153
|
+
return element;
|
|
154
|
+
}
|
|
155
|
+
getInOutFromBoard() {
|
|
156
|
+
var _a;
|
|
157
|
+
const inputSpec = this.getInputSpec();
|
|
158
|
+
const outputSpec = this.getOutputSpec();
|
|
159
|
+
const data = ((_a = this.viewer) === null || _a === void 0 ? void 0 : _a.getSceneValues()) || {};
|
|
160
|
+
const input = inputSpec.reduce((input, spec) => {
|
|
161
|
+
input[spec.name] = data[spec.name];
|
|
162
|
+
return input;
|
|
163
|
+
}, {});
|
|
164
|
+
const output = outputSpec.reduce((output, spec) => {
|
|
165
|
+
output[spec.name] = data[spec.name];
|
|
166
|
+
return output;
|
|
167
|
+
}, {});
|
|
168
|
+
return [input, output];
|
|
169
|
+
}
|
|
170
|
+
updated(changes) {
|
|
171
|
+
if (changes.has('activityInstance')) {
|
|
172
|
+
this.updateContext();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
async pageUpdated(changes, lifecycle, changedBefore) {
|
|
176
|
+
if (this.active) {
|
|
177
|
+
this.fetchActivityInstance(lifecycle.resourceId);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
async fetchActivityInstance(id) {
|
|
181
|
+
const response = await client.query({
|
|
182
|
+
query: gql `
|
|
183
|
+
query activityInstance($id: String!) {
|
|
184
|
+
activityInstance(id: $id) {
|
|
185
|
+
id
|
|
186
|
+
name
|
|
187
|
+
description
|
|
188
|
+
state
|
|
189
|
+
activity {
|
|
190
|
+
startingType
|
|
191
|
+
model {
|
|
192
|
+
name
|
|
193
|
+
description
|
|
194
|
+
active
|
|
195
|
+
tag
|
|
196
|
+
inout
|
|
197
|
+
type
|
|
198
|
+
unit
|
|
199
|
+
options
|
|
200
|
+
quantifier
|
|
201
|
+
spec
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
thumbnail
|
|
205
|
+
input
|
|
206
|
+
output
|
|
207
|
+
uiType
|
|
208
|
+
uiSource
|
|
209
|
+
approvalLine {
|
|
210
|
+
type
|
|
211
|
+
value
|
|
212
|
+
approver {
|
|
213
|
+
id
|
|
214
|
+
name
|
|
215
|
+
description
|
|
216
|
+
controlNo
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
dueAt
|
|
220
|
+
createdAt
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
`,
|
|
224
|
+
variables: {
|
|
225
|
+
id
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
this.activityInstance = response.data.activityInstance;
|
|
229
|
+
this.activity = this.activityInstance.activity;
|
|
230
|
+
}
|
|
231
|
+
async draftActivityInstance() {
|
|
232
|
+
var { id: activityId } = this.activity;
|
|
233
|
+
var { id, name, description, priority, threadsMin, threadsMax, dueAt, input, output, reason, uiType, assignees, approvalLine } = this.activityInstance;
|
|
234
|
+
if (uiType === 'board') {
|
|
235
|
+
;
|
|
236
|
+
[input, output] = this.getInOutFromBoard();
|
|
237
|
+
}
|
|
238
|
+
name || (name = this.activity.name);
|
|
239
|
+
description || (description = this.activity.description);
|
|
240
|
+
assignees || (assignees = this.activity.assignees);
|
|
241
|
+
approvalLine || (approvalLine = this.activity.approvalLine);
|
|
242
|
+
var activityInstance = {
|
|
243
|
+
id,
|
|
244
|
+
activityId,
|
|
245
|
+
name,
|
|
246
|
+
description,
|
|
247
|
+
priority,
|
|
248
|
+
threadsMax,
|
|
249
|
+
threadsMin,
|
|
250
|
+
dueAt,
|
|
251
|
+
input,
|
|
252
|
+
output,
|
|
253
|
+
reason,
|
|
254
|
+
assignees,
|
|
255
|
+
approvalLine
|
|
256
|
+
};
|
|
257
|
+
const response = await client.mutate({
|
|
258
|
+
mutation: gql `
|
|
259
|
+
mutation ($activityInstance: ActivityInstanceDraft!) {
|
|
260
|
+
draftActivityInstance(activityInstance: $activityInstance) {
|
|
261
|
+
id
|
|
262
|
+
name
|
|
263
|
+
description
|
|
264
|
+
input
|
|
265
|
+
state
|
|
266
|
+
activity {
|
|
267
|
+
startingType
|
|
268
|
+
model {
|
|
269
|
+
name
|
|
270
|
+
description
|
|
271
|
+
active
|
|
272
|
+
tag
|
|
273
|
+
inout
|
|
274
|
+
type
|
|
275
|
+
unit
|
|
276
|
+
options
|
|
277
|
+
quantifier
|
|
278
|
+
spec
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
assignees {
|
|
282
|
+
type
|
|
283
|
+
value
|
|
284
|
+
assignee {
|
|
285
|
+
id
|
|
286
|
+
name
|
|
287
|
+
description
|
|
288
|
+
controlNo
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
approvalLine {
|
|
292
|
+
type
|
|
293
|
+
value
|
|
294
|
+
approver {
|
|
295
|
+
id
|
|
296
|
+
name
|
|
297
|
+
description
|
|
298
|
+
controlNo
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
uiType
|
|
302
|
+
uiSource
|
|
303
|
+
threadsMin
|
|
304
|
+
threadsMax
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
`,
|
|
308
|
+
variables: {
|
|
309
|
+
activityInstance
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
if (!response.errors) {
|
|
313
|
+
this.activityInstance = response.data.draftActivityInstance;
|
|
314
|
+
this.activity = this.activityInstance.activity;
|
|
315
|
+
notify({
|
|
316
|
+
message: i18next.t('text.info_x_successfully', {
|
|
317
|
+
x: `${i18next.t('label.activity-instance')} ${i18next.t('text.draft')}`
|
|
318
|
+
})
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
async issueActivityInstance() {
|
|
323
|
+
var { id, name, description, input, output, reason, uiType, threadsMin = 0, threadsMax = 0, assignees, approvalLine } = this.activityInstance;
|
|
324
|
+
if (uiType === 'board') {
|
|
325
|
+
;
|
|
326
|
+
[input, output] = this.getInOutFromBoard();
|
|
327
|
+
}
|
|
328
|
+
const activityInstance = {
|
|
329
|
+
id,
|
|
330
|
+
name: name || this.activity.name,
|
|
331
|
+
description: description || this.activity.description,
|
|
332
|
+
threadsMin,
|
|
333
|
+
threadsMax,
|
|
334
|
+
input,
|
|
335
|
+
output,
|
|
336
|
+
reason,
|
|
337
|
+
assignees,
|
|
338
|
+
approvalLine
|
|
339
|
+
};
|
|
340
|
+
const response = await client.mutate({
|
|
341
|
+
mutation: gql `
|
|
342
|
+
mutation ($activityInstance: ActivityInstanceIssue!) {
|
|
343
|
+
issueActivityInstance(activityInstance: $activityInstance) {
|
|
344
|
+
id
|
|
345
|
+
name
|
|
346
|
+
description
|
|
347
|
+
input
|
|
348
|
+
output
|
|
349
|
+
state
|
|
350
|
+
activity {
|
|
351
|
+
startingType
|
|
352
|
+
model {
|
|
353
|
+
name
|
|
354
|
+
description
|
|
355
|
+
active
|
|
356
|
+
tag
|
|
357
|
+
inout
|
|
358
|
+
type
|
|
359
|
+
unit
|
|
360
|
+
options
|
|
361
|
+
quantifier
|
|
362
|
+
spec
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
assignees {
|
|
366
|
+
type
|
|
367
|
+
value
|
|
368
|
+
assignee {
|
|
369
|
+
id
|
|
370
|
+
name
|
|
371
|
+
description
|
|
372
|
+
controlNo
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
approvalLine {
|
|
376
|
+
type
|
|
377
|
+
value
|
|
378
|
+
approver {
|
|
379
|
+
id
|
|
380
|
+
name
|
|
381
|
+
description
|
|
382
|
+
controlNo
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
uiType
|
|
386
|
+
uiSource
|
|
387
|
+
threadsMin
|
|
388
|
+
threadsMax
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
`,
|
|
392
|
+
variables: {
|
|
393
|
+
activityInstance
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
if (!response.errors) {
|
|
397
|
+
this.activityInstance = response.data.issueActivityInstance;
|
|
398
|
+
this.activity = this.activityInstance.activity;
|
|
399
|
+
notify({
|
|
400
|
+
message: i18next.t('text.info_x_successfully', {
|
|
401
|
+
x: `${i18next.t('label.activity-instance')} ${i18next.t('text.assign')}`
|
|
402
|
+
})
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
ActivityInstanceStartPage.styles = [
|
|
408
|
+
ScrollbarStyles,
|
|
409
|
+
CommonGristStyles,
|
|
410
|
+
css `
|
|
411
|
+
:host {
|
|
412
|
+
display: flex;
|
|
413
|
+
flex-direction: column;
|
|
414
|
+
|
|
415
|
+
width: 100%;
|
|
416
|
+
padding: 5px;
|
|
417
|
+
overflow: auto;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
ox-board-viewer {
|
|
421
|
+
width: 100%;
|
|
422
|
+
height: 100%;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
#custom-content {
|
|
426
|
+
flex: 1;
|
|
427
|
+
}
|
|
428
|
+
`
|
|
429
|
+
];
|
|
430
|
+
__decorate([
|
|
431
|
+
state(),
|
|
432
|
+
__metadata("design:type", Object)
|
|
433
|
+
], ActivityInstanceStartPage.prototype, "activity", void 0);
|
|
434
|
+
__decorate([
|
|
435
|
+
state(),
|
|
436
|
+
__metadata("design:type", Object)
|
|
437
|
+
], ActivityInstanceStartPage.prototype, "activityInstance", void 0);
|
|
438
|
+
__decorate([
|
|
439
|
+
state(),
|
|
440
|
+
__metadata("design:type", Object)
|
|
441
|
+
], ActivityInstanceStartPage.prototype, "board", void 0);
|
|
442
|
+
__decorate([
|
|
443
|
+
query('ox-board-viewer'),
|
|
444
|
+
__metadata("design:type", Object)
|
|
445
|
+
], ActivityInstanceStartPage.prototype, "viewer", void 0);
|
|
446
|
+
ActivityInstanceStartPage = __decorate([
|
|
447
|
+
customElement('activity-instance-start-page')
|
|
448
|
+
], ActivityInstanceStartPage);
|
|
449
|
+
export { ActivityInstanceStartPage };
|
|
450
|
+
//# sourceMappingURL=activity-instance-start-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-instance-start-page.js","sourceRoot":"","sources":["../../../client/pages/activity-instance/activity-instance-start-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,EAAY,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AACtD,OAAO,EAAE,MAAM,EA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SACb,CAAA;QAED,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkDZ;YACD,SAAS,EAAE;gBACT,gBAAgB;aACjB;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;YACpB,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CAAA;YAC3D,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAA;YAE9C,MAAM,CAAC;gBACL,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,0BAA0B,EAAE;oBAC7C,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,yBAAyB,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE;iBACzE,CAAC;aACH,CAAC,CAAA;SACH;IACH,CAAC;;AA7eM,gCAAM,GAAG;IACd,eAAe;IACf,iBAAiB;IACjB,GAAG,CAAA;;;;;;;;;;;;;;;;;;KAkBF;CACF,CAAA;AAED;IAAC,KAAK,EAAE;;2DAAmB;AAC3B;IAAC,KAAK,EAAE;;mEAA2B;AACnC;IAAC,KAAK,EAAE;;wDAAW;AAEnB;IAAC,KAAK,CAAC,iBAAiB,CAAC;;yDAAY;AA7B1B,yBAAyB;IADrC,aAAa,CAAC,8BAA8B,CAAC;GACjC,yBAAyB,CA+erC;SA/eY,yBAAyB","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, state } from 'lit/decorators.js'\nimport { keyed } from 'lit/directives/keyed.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\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'\nimport { notify } from '@operato/layout'\n\n@customElement('activity-instance-start-page')\nexport class ActivityInstanceStartPage 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 #custom-content {\n flex: 1;\n }\n `\n ]\n\n @state() activity: any = {}\n @state() activityInstance: any = {}\n @state() board: any\n\n @query('ox-board-viewer') viewer: any\n\n get context() {\n const { startingType } = this.activity\n const { state } = this.activityInstance\n\n const issuable = state === 'draft'\n\n return {\n title: this.lifecycle?.params?.['title'] || i18next.t('title.activity'),\n help: 'worklist/activity-instance-single-post',\n actions: [\n issuable && {\n title: i18next.t('button.draft'),\n action: this.draftActivityInstance.bind(this),\n ...CommonButtonStyles.save\n },\n issuable && {\n title: i18next.t(startingType == 'issue' ? 'button.issue' : 'button.post'),\n action: this.issueActivityInstance.bind(this),\n ...CommonButtonStyles.submit\n }\n ].filter(Boolean /* truthy only */),\n activityInstance: this.activityInstance\n }\n }\n\n render() {\n return html` ${this.activityContent()}`\n }\n\n activityContent() {\n switch (this.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 'custom-element':\n return this.customElementContent()\n case 'page':\n case 'external':\n default:\n return html``\n }\n }\n\n templateContent() {\n const { uiSource: template } = this.activityInstance\n return unsafeHTML(template)\n }\n\n getInputSpec() {\n const model = this.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.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 { input, output } = this.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 this.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 @property-change=${e => (this.activityInstance.input = e.currentTarget.value)}\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.activityInstance.output = e.currentTarget.value)}\n ></ox-properties-dynamic-view>\n </fieldset>\n `\n )\n }\n\n boardContent() {\n const { uiSource: boardId, input, output } = this.activityInstance\n\n if (!this.board || this.board.id !== boardId) {\n this.board = {\n id: boardId\n }\n }\n\n /* \n ox-board-viewer에서 provider에 의해 공급되는 board가 각 id별로 instance를 하나씩 밖에 가지지 않으므로,\n 동일한 id의 보드를 다른 page에 뺏기는 경우가 있다.\n 따라서, Page가 active될 때마다 타임스탬프를 refresh key로 설정하였다.\n */\n return keyed(\n this.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 customElementContent() {\n const { uiSource: tagName, input, output } = this.activityInstance\n\n const element = document.createElement(tagName)\n element.id = 'custom-content'\n element.input = input\n element.output = output\n\n element.addEventListener('change-input', (e: CustomEvent) => {\n this.activityInstance.input = e.detail\n })\n element.addEventListener('change-output', (e: CustomEvent) => {\n this.activityInstance.output = e.detail\n })\n\n /* DEPRECATED 일반적으로 output만 수정될 가능성이 높기때문에, change 이벤트는 output을 수정하는 것으로 한다. */\n element.addEventListener('change', (e: CustomEvent) => {\n this.activityInstance.output = e.detail\n })\n\n return element\n }\n\n getInOutFromBoard() {\n const inputSpec = this.getInputSpec()\n const outputSpec = this.getOutputSpec()\n const data = this.viewer?.getSceneValues() || {}\n\n const input = inputSpec.reduce((input, spec) => {\n input[spec.name] = data[spec.name]\n return input\n }, {})\n\n const output = outputSpec.reduce((output, spec) => {\n output[spec.name] = data[spec.name]\n return output\n }, {})\n\n return [input, output]\n }\n\n updated(changes) {\n if (changes.has('activityInstance')) {\n this.updateContext()\n }\n }\n\n async pageUpdated(changes, lifecycle, changedBefore) {\n if (this.active) {\n this.fetchActivityInstance(lifecycle.resourceId)\n }\n }\n\n async fetchActivityInstance(id) {\n const response = await client.query({\n query: gql`\n query activityInstance($id: String!) {\n activityInstance(id: $id) {\n id\n name\n description\n state\n activity {\n startingType\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 thumbnail\n input\n output\n uiType\n uiSource\n approvalLine {\n type\n value\n approver {\n id\n name\n description\n controlNo\n }\n }\n dueAt\n createdAt\n }\n }\n `,\n variables: {\n id\n }\n })\n\n this.activityInstance = response.data.activityInstance\n this.activity = this.activityInstance.activity\n }\n\n async draftActivityInstance() {\n var { id: activityId } = this.activity\n var {\n id,\n name,\n description,\n priority,\n threadsMin,\n threadsMax,\n dueAt,\n input,\n output,\n reason,\n uiType,\n assignees,\n approvalLine\n } = this.activityInstance\n\n if (uiType === 'board') {\n ;[input, output] = this.getInOutFromBoard()\n }\n\n name ||= this.activity.name\n description ||= this.activity.description\n assignees ||= this.activity.assignees\n approvalLine ||= this.activity.approvalLine\n\n var activityInstance = {\n id,\n activityId,\n name,\n description,\n priority,\n threadsMax,\n threadsMin,\n dueAt,\n input,\n output,\n reason,\n assignees,\n approvalLine\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($activityInstance: ActivityInstanceDraft!) {\n draftActivityInstance(activityInstance: $activityInstance) {\n id\n name\n description\n input\n state\n activity {\n startingType\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 assignees {\n type\n value\n assignee {\n id\n name\n description\n controlNo\n }\n }\n approvalLine {\n type\n value\n approver {\n id\n name\n description\n controlNo\n }\n }\n uiType\n uiSource\n threadsMin\n threadsMax\n }\n }\n `,\n variables: {\n activityInstance\n }\n })\n\n if (!response.errors) {\n this.activityInstance = response.data.draftActivityInstance\n this.activity = this.activityInstance.activity\n\n notify({\n message: i18next.t('text.info_x_successfully', {\n x: `${i18next.t('label.activity-instance')} ${i18next.t('text.draft')}`\n })\n })\n }\n }\n\n async issueActivityInstance() {\n var {\n id,\n name,\n description,\n input,\n output,\n reason,\n uiType,\n threadsMin = 0,\n threadsMax = 0,\n assignees,\n approvalLine\n } = this.activityInstance\n\n if (uiType === 'board') {\n ;[input, output] = this.getInOutFromBoard()\n }\n\n const activityInstance = {\n id,\n name: name || this.activity.name,\n description: description || this.activity.description,\n threadsMin,\n threadsMax,\n input,\n output,\n reason,\n assignees,\n approvalLine\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($activityInstance: ActivityInstanceIssue!) {\n issueActivityInstance(activityInstance: $activityInstance) {\n id\n name\n description\n input\n output\n state\n activity {\n startingType\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 assignees {\n type\n value\n assignee {\n id\n name\n description\n controlNo\n }\n }\n approvalLine {\n type\n value\n approver {\n id\n name\n description\n controlNo\n }\n }\n uiType\n uiSource\n threadsMin\n threadsMax\n }\n }\n `,\n variables: {\n activityInstance\n }\n })\n\n if (!response.errors) {\n this.activityInstance = response.data.issueActivityInstance\n this.activity = this.activityInstance.activity\n\n notify({\n message: i18next.t('text.info_x_successfully', {\n x: `${i18next.t('label.activity-instance')} ${i18next.t('text.assign')}`\n })\n })\n }\n }\n}\n"]}
|
|
@@ -84,7 +84,7 @@ let ActivityThreadPage = class ActivityThreadPage extends connect(store)(localiz
|
|
|
84
84
|
help: 'worklist/activity',
|
|
85
85
|
actions: [
|
|
86
86
|
savable && Object.assign({ title: i18next.t('button.save'), action: this._saveActivityThread.bind(this) }, CommonButtonStyles.save),
|
|
87
|
-
submittable && Object.assign({ title: i18next.t('button.submit'), action: this._submitActivityThread.bind(this) }, CommonButtonStyles.
|
|
87
|
+
submittable && Object.assign({ title: i18next.t('button.submit'), action: this._submitActivityThread.bind(this) }, CommonButtonStyles.submit),
|
|
88
88
|
delegatable && Object.assign({ title: i18next.t('button.delegate'), action: this._delegateActivityThread.bind(this) }, CommonButtonStyles.save),
|
|
89
89
|
restartable && Object.assign({ title: i18next.t('button.restart'), action: this._restartActivityThread.bind(this) }, CommonButtonStyles.save),
|
|
90
90
|
abortable && Object.assign({ title: i18next.t('button.abort'), action: this._abortActivityThread.bind(this) }, CommonButtonStyles.cancel)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity-thread-page.js","sourceRoot":"","sources":["../../../client/pages/activity-thread/activity-thread-page.ts"],"names":[],"mappings":";AAAA,OAAO,wDAAwD,CAAA;AAC/D,OAAO,mCAAmC,CAAA;AAE1C,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,EAAY,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,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,EAA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MAAM,CAAC,MAAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;0DAEuC,yBAAyB;;OAE5E;YACD,SAAS,EAAE;gBACT,EAAE;gBACF,MAAM;aACP;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;YACpB,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAA;YAEvD,QAAQ,CAAC,aAAa,CACpB,IAAI,WAAW,CAAC,QAAQ,EAAE;gBACxB,MAAM,EAAE;oBACN,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,mCAAmC,CAAC;iBACxD;aACF,CAAC,CACH,CAAA;SACF;IACH,CAAC;;AAlaM,yBAAM,GAAG;IACd,eAAe;IACf,iBAAiB;IACjB,GAAG,CAAA;;;;;;;;;;;;;;;;;;KAkBF;CACF,CAAA;AAED;IAAC,KAAK,EAAE;;0DAAoB;AAC5B;IAAC,KAAK,EAAE;;iDAAW;AA2LnB;IAAC,KAAK,CAAC,iBAAiB,CAAC;;yDAAmB;AArNjC,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAoa9B;SApaY,kBAAkB","sourcesContent":["import '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@operato/board/ox-board-viewer.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js'\nimport { customElement, property, query, state } 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 ActivityThreadFetchResult = `\\\n{\n id\n state\n dueAt\n assignedAt\n assignee {\n id\n name\n }\n output\n round\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 value\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\nexport const ActivityThreadStatus = {\n Assigned: 'assigned',\n Started: 'started',\n Delegated: 'delegated',\n Rejected: 'rejected',\n Ended: 'ended',\n Aborted: 'aborted'\n}\n\n@customElement('activity-thread-page')\nexport class ActivityThreadPage 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 #custom-content {\n flex: 1;\n }\n `\n ]\n\n @state() activityThread: any\n @state() board: any\n\n get context() {\n const state = this.activityThread?.state\n\n const restartable = [ActivityThreadStatus.Rejected].includes(state)\n const savable = [ActivityThreadStatus.Assigned, ActivityThreadStatus.Started].includes(state)\n const submittable = savable\n const delegatable = savable\n const abortable = savable\n\n return {\n title: this.lifecycle?.params?.['title'] || i18next.t('title.activity'),\n help: 'worklist/activity',\n actions: [\n savable && {\n title: i18next.t('button.save'),\n action: this._saveActivityThread.bind(this),\n ...CommonButtonStyles.save\n },\n\n submittable && {\n title: i18next.t('button.submit'),\n action: this._submitActivityThread.bind(this),\n ...CommonButtonStyles.save\n },\n\n delegatable && {\n title: i18next.t('button.delegate'),\n action: this._delegateActivityThread.bind(this),\n ...CommonButtonStyles.save\n },\n\n restartable && {\n title: i18next.t('button.restart'),\n action: this._restartActivityThread.bind(this),\n ...CommonButtonStyles.save\n },\n\n abortable && {\n title: i18next.t('button.abort'),\n action: this._abortActivityThread.bind(this),\n ...CommonButtonStyles.cancel\n }\n ].filter(Boolean /* truthy only */),\n activityThread: this.activityThread\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 'custom-element':\n return this.customElementContent()\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 this.activityThread.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.activityThread.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 /* \n ox-board-viewer에서 provider에 의해 공급되는 board가 각 id별로 instance를 하나씩 밖에 가지지 않으므로,\n 동일한 id의 보드를 다른 page에 뺏기는 경우가 있다.\n 따라서, Page가 active될 때마다 타임스탬프를 refresh key로 설정하였다.\n */\n return keyed(\n this.activityThread.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 customElementContent() {\n const { output, activityInstance } = this.activityThread\n const { uiSource: tagName, input } = activityInstance || {}\n\n const element = document.createElement(tagName)\n element.id = 'custom-content'\n element.input = input\n element.output = output\n element.addEventListener('change', (e: CustomEvent) => {\n this.activityThread.output = e.detail\n })\n\n return element\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('activityThread')) {\n this.updateContext()\n }\n }\n\n async pageUpdated(changes, lifecycle, changedBefore) {\n if (this.active) {\n this.fetchActivityThread(lifecycle.resourceId)\n }\n }\n\n async fetchActivityThread(id) {\n const response = await client.query({\n query: gql`\n query activityThread($id: String!) {\n activityThread(id: $id) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id\n }\n })\n\n this.activityThread = response.data.activityThread\n\n this.updateContext()\n }\n\n async _startActivityThread() {\n var { id, output, reason, activityInstance } = this.activityThread\n var { uiType } = activityInstance\n\n if (uiType === 'board') {\n output = this.getOutputFromBoard()\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $output: Object) {\n startActivityThread(id: $id, output: $output) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id,\n output\n }\n })\n\n if (!response.errors) {\n this.activityThread = response.data.startActivityThread\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_started_successfully')\n }\n })\n )\n }\n }\n\n async _restartActivityThread() {\n var { id, output, activityInstance } = this.activityThread\n var { uiType } = activityInstance\n\n if (uiType === 'board') {\n output = this.getOutputFromBoard()\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $output: Object) {\n restartActivityThread(id: $id, output: $output) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id,\n output\n }\n })\n\n if (!response.errors) {\n this.activityThread = response.data.restartActivityThread\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_restarted_successfully')\n }\n })\n )\n }\n }\n\n async _delegateActivityThread() {\n throw 'not implemented yet'\n }\n\n async _saveActivityThread() {\n var { id, output, reason, activityInstance } = this.activityThread\n var { uiType } = activityInstance || {}\n\n if (uiType === 'board') {\n output = this.getOutputFromBoard()\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $save: ActivityThreadSave!) {\n saveActivityThread(id: $id, save: $save) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id,\n save: {\n output\n }\n }\n })\n\n if (!response.errors) {\n this.activityThread = response.data.saveActivityThread\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 async _submitActivityThread() {\n var { id, output, reason, activityInstance } = this.activityThread\n var { uiType } = activityInstance || {}\n\n if (uiType === 'board') {\n output = this.getOutputFromBoard()\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $output: Object, $reason: String) {\n submitActivityThread(id: $id, output: $output, reason: $reason) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id,\n output,\n reason\n }\n })\n\n if (!response.errors) {\n this.activityThread = response.data.submitActivityThread\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_finished_successfully')\n }\n })\n )\n }\n }\n\n async _abortActivityThread() {\n var { id, reason } = this.activityThread\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $reason: String) {\n abortActivityThread(id: $id, reason: $reason) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id,\n reason\n }\n })\n\n if (!response.errors) {\n this.activityThread = response.data.abortActivityThread\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_aborted_successfully')\n }\n })\n )\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"activity-thread-page.js","sourceRoot":"","sources":["../../../client/pages/activity-thread/activity-thread-page.ts"],"names":[],"mappings":";AAAA,OAAO,wDAAwD,CAAA;AAC/D,OAAO,mCAAmC,CAAA;AAE1C,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,EAAY,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,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,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiDhC,CAAA;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;CACnB,CAAA;AAGM,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eAAe;IACf,iBAAiB;IACjB,GAAG,CAAA;;;;;;;;;;;;;;;;;;KAkBF;CACF,CAAA;AAED;IAAC,KAAK,EAAE;;0DAAoB;AAC5B;IAAC,KAAK,EAAE;;iDAAW;AA2LnB;IAAC,KAAK,CAAC,iBAAiB,CAAC;;yDAAmB;AArNjC,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAoa9B;SApaY,kBAAkB","sourcesContent":["import '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@operato/board/ox-board-viewer.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js'\nimport { customElement, property, query, state } 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 ActivityThreadFetchResult = `\\\n{\n id\n state\n dueAt\n assignedAt\n assignee {\n id\n name\n }\n output\n round\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 value\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\nexport const ActivityThreadStatus = {\n Assigned: 'assigned',\n Started: 'started',\n Delegated: 'delegated',\n Rejected: 'rejected',\n Ended: 'ended',\n Aborted: 'aborted'\n}\n\n@customElement('activity-thread-page')\nexport class ActivityThreadPage 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 #custom-content {\n flex: 1;\n }\n `\n ]\n\n @state() activityThread: any\n @state() board: any\n\n get context() {\n const state = this.activityThread?.state\n\n const restartable = [ActivityThreadStatus.Rejected].includes(state)\n const savable = [ActivityThreadStatus.Assigned, ActivityThreadStatus.Started].includes(state)\n const submittable = savable\n const delegatable = savable\n const abortable = savable\n\n return {\n title: this.lifecycle?.params?.['title'] || i18next.t('title.activity'),\n help: 'worklist/activity',\n actions: [\n savable && {\n title: i18next.t('button.save'),\n action: this._saveActivityThread.bind(this),\n ...CommonButtonStyles.save\n },\n\n submittable && {\n title: i18next.t('button.submit'),\n action: this._submitActivityThread.bind(this),\n ...CommonButtonStyles.submit\n },\n\n delegatable && {\n title: i18next.t('button.delegate'),\n action: this._delegateActivityThread.bind(this),\n ...CommonButtonStyles.save\n },\n\n restartable && {\n title: i18next.t('button.restart'),\n action: this._restartActivityThread.bind(this),\n ...CommonButtonStyles.save\n },\n\n abortable && {\n title: i18next.t('button.abort'),\n action: this._abortActivityThread.bind(this),\n ...CommonButtonStyles.cancel\n }\n ].filter(Boolean /* truthy only */),\n activityThread: this.activityThread\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 'custom-element':\n return this.customElementContent()\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 this.activityThread.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.activityThread.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 /* \n ox-board-viewer에서 provider에 의해 공급되는 board가 각 id별로 instance를 하나씩 밖에 가지지 않으므로,\n 동일한 id의 보드를 다른 page에 뺏기는 경우가 있다.\n 따라서, Page가 active될 때마다 타임스탬프를 refresh key로 설정하였다.\n */\n return keyed(\n this.activityThread.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 customElementContent() {\n const { output, activityInstance } = this.activityThread\n const { uiSource: tagName, input } = activityInstance || {}\n\n const element = document.createElement(tagName)\n element.id = 'custom-content'\n element.input = input\n element.output = output\n element.addEventListener('change', (e: CustomEvent) => {\n this.activityThread.output = e.detail\n })\n\n return element\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('activityThread')) {\n this.updateContext()\n }\n }\n\n async pageUpdated(changes, lifecycle, changedBefore) {\n if (this.active) {\n this.fetchActivityThread(lifecycle.resourceId)\n }\n }\n\n async fetchActivityThread(id) {\n const response = await client.query({\n query: gql`\n query activityThread($id: String!) {\n activityThread(id: $id) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id\n }\n })\n\n this.activityThread = response.data.activityThread\n\n this.updateContext()\n }\n\n async _startActivityThread() {\n var { id, output, reason, activityInstance } = this.activityThread\n var { uiType } = activityInstance\n\n if (uiType === 'board') {\n output = this.getOutputFromBoard()\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $output: Object) {\n startActivityThread(id: $id, output: $output) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id,\n output\n }\n })\n\n if (!response.errors) {\n this.activityThread = response.data.startActivityThread\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_started_successfully')\n }\n })\n )\n }\n }\n\n async _restartActivityThread() {\n var { id, output, activityInstance } = this.activityThread\n var { uiType } = activityInstance\n\n if (uiType === 'board') {\n output = this.getOutputFromBoard()\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $output: Object) {\n restartActivityThread(id: $id, output: $output) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id,\n output\n }\n })\n\n if (!response.errors) {\n this.activityThread = response.data.restartActivityThread\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_restarted_successfully')\n }\n })\n )\n }\n }\n\n async _delegateActivityThread() {\n throw 'not implemented yet'\n }\n\n async _saveActivityThread() {\n var { id, output, reason, activityInstance } = this.activityThread\n var { uiType } = activityInstance || {}\n\n if (uiType === 'board') {\n output = this.getOutputFromBoard()\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $save: ActivityThreadSave!) {\n saveActivityThread(id: $id, save: $save) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id,\n save: {\n output\n }\n }\n })\n\n if (!response.errors) {\n this.activityThread = response.data.saveActivityThread\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 async _submitActivityThread() {\n var { id, output, reason, activityInstance } = this.activityThread\n var { uiType } = activityInstance || {}\n\n if (uiType === 'board') {\n output = this.getOutputFromBoard()\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $output: Object, $reason: String) {\n submitActivityThread(id: $id, output: $output, reason: $reason) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id,\n output,\n reason\n }\n })\n\n if (!response.errors) {\n this.activityThread = response.data.submitActivityThread\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_finished_successfully')\n }\n })\n )\n }\n }\n\n async _abortActivityThread() {\n var { id, reason } = this.activityThread\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $reason: String) {\n abortActivityThread(id: $id, reason: $reason) ${ActivityThreadFetchResult}\n }\n `,\n variables: {\n id,\n reason\n }\n })\n\n if (!response.errors) {\n this.activityThread = response.data.abortActivityThread\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.task_is_aborted_successfully')\n }\n })\n )\n }\n }\n}\n"]}
|
|
@@ -12,7 +12,7 @@ import { openPopup } from '@operato/layout';
|
|
|
12
12
|
import { PageView, store } from '@operato/shell';
|
|
13
13
|
import { CommonGristStyles, ScrollbarStyles } from '@operato/styles';
|
|
14
14
|
import { isMobileDevice } from '@operato/utils';
|
|
15
|
-
import { ActivityTypes, ActivityUITypes } from '../../types/types.js';
|
|
15
|
+
import { ActivityStartingTypes, ActivityTypes, ActivityUITypes } from '../../types/types.js';
|
|
16
16
|
let ActivityTemplateListPage = class ActivityTemplateListPage extends connect(store)(localize(i18next)(PageView)) {
|
|
17
17
|
constructor() {
|
|
18
18
|
super(...arguments);
|
|
@@ -275,12 +275,13 @@ let ActivityTemplateListPage = class ActivityTemplateListPage extends connect(st
|
|
|
275
275
|
width: 140
|
|
276
276
|
},
|
|
277
277
|
{
|
|
278
|
-
type: '
|
|
279
|
-
name: '
|
|
278
|
+
type: 'select',
|
|
279
|
+
name: 'startingType',
|
|
280
280
|
label: true,
|
|
281
|
-
header: i18next.t('field.
|
|
281
|
+
header: i18next.t('field.starting-type'),
|
|
282
282
|
record: {
|
|
283
|
-
editable: false
|
|
283
|
+
editable: false,
|
|
284
|
+
options: ActivityStartingTypes
|
|
284
285
|
},
|
|
285
286
|
sortable: true,
|
|
286
287
|
width: 60
|
|
@@ -315,6 +316,7 @@ let ActivityTemplateListPage = class ActivityTemplateListPage extends connect(st
|
|
|
315
316
|
activityType
|
|
316
317
|
priority
|
|
317
318
|
startable
|
|
319
|
+
startingType
|
|
318
320
|
model {
|
|
319
321
|
name
|
|
320
322
|
description
|