@valtimo/task 4.23.0 → 5.2.0
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/esm2020/lib/assign-user-to-task/assign-user-to-task.component.mjs +125 -0
- package/esm2020/lib/models/index.mjs +21 -0
- package/esm2020/lib/models/task-definition.model.mjs +17 -0
- package/esm2020/lib/models/task-list.model.mjs +29 -0
- package/esm2020/lib/models/task.model.mjs +17 -0
- package/esm2020/lib/task-detail-modal/task-detail-modal.component.mjs +198 -0
- package/esm2020/lib/task-list/task-list.component.mjs +160 -0
- package/esm2020/lib/task-routing.module.mjs +45 -0
- package/esm2020/lib/task.module.mjs +107 -0
- package/esm2020/lib/task.service.mjs +59 -0
- package/esm2020/public_api.mjs +25 -0
- package/esm2020/valtimo-task.mjs +5 -0
- package/fesm2015/valtimo-task.mjs +724 -0
- package/fesm2015/valtimo-task.mjs.map +1 -0
- package/fesm2020/valtimo-task.mjs +758 -0
- package/fesm2020/valtimo-task.mjs.map +1 -0
- package/lib/assign-user-to-task/assign-user-to-task.component.d.ts +4 -0
- package/lib/assign-user-to-task/assign-user-to-task.component.d.ts.map +1 -0
- package/lib/models/index.d.ts +1 -0
- package/lib/models/index.d.ts.map +1 -0
- package/lib/models/task-definition.model.d.ts +1 -0
- package/lib/models/task-definition.model.d.ts.map +1 -0
- package/lib/models/task-list.model.d.ts +1 -0
- package/lib/models/task-list.model.d.ts.map +1 -0
- package/lib/models/task.model.d.ts +10 -0
- package/lib/models/task.model.d.ts.map +1 -0
- package/lib/task-detail-modal/task-detail-modal.component.d.ts +31 -10
- package/lib/task-detail-modal/task-detail-modal.component.d.ts.map +1 -0
- package/lib/task-list/task-list.component.d.ts +4 -0
- package/lib/task-list/task-list.component.d.ts.map +1 -0
- package/lib/task-routing.module.d.ts +7 -0
- package/lib/task-routing.module.d.ts.map +1 -0
- package/lib/task.module.d.ts +16 -0
- package/lib/task.module.d.ts.map +1 -0
- package/lib/task.service.d.ts +6 -1
- package/lib/task.service.d.ts.map +1 -0
- package/package.json +23 -11
- package/public_api.d.ts +2 -0
- package/public_api.d.ts.map +1 -0
- package/valtimo-task.d.ts +2 -2
- package/valtimo-task.d.ts.map +1 -0
- package/bundles/valtimo-task.umd.js +0 -960
- package/bundles/valtimo-task.umd.js.map +0 -1
- package/bundles/valtimo-task.umd.min.js +0 -2
- package/bundles/valtimo-task.umd.min.js.map +0 -1
- package/esm2015/lib/assign-user-to-task/assign-user-to-task.component.js +0 -124
- package/esm2015/lib/models/index.js +0 -21
- package/esm2015/lib/models/task-definition.model.js +0 -16
- package/esm2015/lib/models/task-list.model.js +0 -29
- package/esm2015/lib/models/task.model.js +0 -16
- package/esm2015/lib/task-detail-modal/task-detail-modal.component.js +0 -127
- package/esm2015/lib/task-list/task-list.component.js +0 -166
- package/esm2015/lib/task-routing.module.js +0 -41
- package/esm2015/lib/task.module.js +0 -66
- package/esm2015/lib/task.service.js +0 -60
- package/esm2015/public_api.js +0 -24
- package/esm2015/valtimo-task.js +0 -7
- package/fesm2015/valtimo-task.js +0 -653
- package/fesm2015/valtimo-task.js.map +0 -1
- package/valtimo-task.metadata.json +0 -1
package/fesm2015/valtimo-task.js
DELETED
|
@@ -1,653 +0,0 @@
|
|
|
1
|
-
import { ɵɵdefineInjectable, ɵɵinject, Injectable, EventEmitter, Component, ViewEncapsulation, ViewChild, Output, NgModule, Input } from '@angular/core';
|
|
2
|
-
import { HttpClient } from '@angular/common/http';
|
|
3
|
-
import { ConfigService, ROLE_USER, HttpLoaderFactory } from '@valtimo/config';
|
|
4
|
-
import { CommonModule } from '@angular/common';
|
|
5
|
-
import { FormsModule } from '@angular/forms';
|
|
6
|
-
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
7
|
-
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
|
8
|
-
import { TranslateService, TranslateModule, TranslateLoader } from '@ngx-translate/core';
|
|
9
|
-
import { FormioOptionsImpl, ListModule, PageHeaderModule, WidgetModule, SpinnerModule, SearchableDropdownSelectModule, CamundaFormModule, FormIoModule, ModalModule } from '@valtimo/components';
|
|
10
|
-
import { ToastrService, ToastrModule } from 'ngx-toastr';
|
|
11
|
-
import { Router, ActivatedRoute, RouterModule } from '@angular/router';
|
|
12
|
-
import { FormLinkService } from '@valtimo/form-link';
|
|
13
|
-
import * as momentImported from 'moment';
|
|
14
|
-
import { NGXLogger } from 'ngx-logger';
|
|
15
|
-
import { take, tap } from 'rxjs/operators';
|
|
16
|
-
import { combineLatest, BehaviorSubject } from 'rxjs';
|
|
17
|
-
import { AuthGuardService } from '@valtimo/security';
|
|
18
|
-
|
|
19
|
-
/*
|
|
20
|
-
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
21
|
-
*
|
|
22
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
23
|
-
* you may not use this file except in compliance with the License.
|
|
24
|
-
* You may obtain a copy of the License at
|
|
25
|
-
*
|
|
26
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
27
|
-
*
|
|
28
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
29
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
30
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
31
|
-
* See the License for the specific language governing permissions and
|
|
32
|
-
* limitations under the License.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
/*
|
|
36
|
-
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
37
|
-
*
|
|
38
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
39
|
-
* you may not use this file except in compliance with the License.
|
|
40
|
-
* You may obtain a copy of the License at
|
|
41
|
-
*
|
|
42
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
43
|
-
*
|
|
44
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
45
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
46
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
47
|
-
* See the License for the specific language governing permissions and
|
|
48
|
-
* limitations under the License.
|
|
49
|
-
*/
|
|
50
|
-
|
|
51
|
-
/*
|
|
52
|
-
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
53
|
-
*
|
|
54
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
55
|
-
* you may not use this file except in compliance with the License.
|
|
56
|
-
* You may obtain a copy of the License at
|
|
57
|
-
*
|
|
58
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
59
|
-
*
|
|
60
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
61
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
62
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
63
|
-
* See the License for the specific language governing permissions and
|
|
64
|
-
* limitations under the License.
|
|
65
|
-
*/
|
|
66
|
-
class TaskList {
|
|
67
|
-
constructor() {
|
|
68
|
-
this.tasks = [];
|
|
69
|
-
this.fields = [];
|
|
70
|
-
this.pagination = {
|
|
71
|
-
collectionSize: 0,
|
|
72
|
-
page: 1,
|
|
73
|
-
size: 10,
|
|
74
|
-
maxPaginationItemSize: 5,
|
|
75
|
-
};
|
|
76
|
-
this.page = 0;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/*
|
|
81
|
-
*
|
|
82
|
-
* * Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
83
|
-
* *
|
|
84
|
-
* * Licensed under EUPL, Version 1.2 (the "License");
|
|
85
|
-
* * you may not use this file except in compliance with the License.
|
|
86
|
-
* * You may obtain a copy of the License at
|
|
87
|
-
* *
|
|
88
|
-
* * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
89
|
-
* *
|
|
90
|
-
* * Unless required by applicable law or agreed to in writing, software
|
|
91
|
-
* * distributed under the License is distributed on an "AS IS" basis,
|
|
92
|
-
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
93
|
-
* * See the License for the specific language governing permissions and
|
|
94
|
-
* * limitations under the License.
|
|
95
|
-
*
|
|
96
|
-
*/
|
|
97
|
-
|
|
98
|
-
/*
|
|
99
|
-
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
100
|
-
*
|
|
101
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
102
|
-
* you may not use this file except in compliance with the License.
|
|
103
|
-
* You may obtain a copy of the License at
|
|
104
|
-
*
|
|
105
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
106
|
-
*
|
|
107
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
108
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
109
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
110
|
-
* See the License for the specific language governing permissions and
|
|
111
|
-
* limitations under the License.
|
|
112
|
-
*/
|
|
113
|
-
class TaskService {
|
|
114
|
-
constructor(http, configService) {
|
|
115
|
-
this.http = http;
|
|
116
|
-
this.valtimoEndpointUri = configService.config.valtimoApi.endpointUri;
|
|
117
|
-
}
|
|
118
|
-
queryTasks(params) {
|
|
119
|
-
return this.http.get(`${this.valtimoEndpointUri}task`, { observe: 'response', params: params });
|
|
120
|
-
}
|
|
121
|
-
getTasks() {
|
|
122
|
-
return this.http.get(`${this.valtimoEndpointUri}task?filter=all`);
|
|
123
|
-
}
|
|
124
|
-
getTask(id) {
|
|
125
|
-
return this.http.get(this.valtimoEndpointUri + 'task/' + id);
|
|
126
|
-
}
|
|
127
|
-
getCandidateUsers(id) {
|
|
128
|
-
return this.http.get(this.valtimoEndpointUri + 'task/' + id + '/candidate-user');
|
|
129
|
-
}
|
|
130
|
-
assignTask(id, assigneeRequest) {
|
|
131
|
-
return this.http.post(this.valtimoEndpointUri + 'task/' + id + '/assign', assigneeRequest);
|
|
132
|
-
}
|
|
133
|
-
unassignTask(id) {
|
|
134
|
-
return this.http.post(this.valtimoEndpointUri + 'task/' + id + '/unassign', null);
|
|
135
|
-
}
|
|
136
|
-
completeTask(id, variables) {
|
|
137
|
-
return this.http.post(this.valtimoEndpointUri + 'task/' + id + '/complete', {
|
|
138
|
-
variables: variables,
|
|
139
|
-
filesToDelete: [],
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
TaskService.ɵprov = ɵɵdefineInjectable({ factory: function TaskService_Factory() { return new TaskService(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: TaskService, providedIn: "root" });
|
|
144
|
-
TaskService.decorators = [
|
|
145
|
-
{ type: Injectable, args: [{ providedIn: 'root' },] }
|
|
146
|
-
];
|
|
147
|
-
TaskService.ctorParameters = () => [
|
|
148
|
-
{ type: HttpClient },
|
|
149
|
-
{ type: ConfigService }
|
|
150
|
-
];
|
|
151
|
-
|
|
152
|
-
/*
|
|
153
|
-
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
154
|
-
*
|
|
155
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
156
|
-
* you may not use this file except in compliance with the License.
|
|
157
|
-
* You may obtain a copy of the License at
|
|
158
|
-
*
|
|
159
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
160
|
-
*
|
|
161
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
162
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
163
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
164
|
-
* See the License for the specific language governing permissions and
|
|
165
|
-
* limitations under the License.
|
|
166
|
-
*/
|
|
167
|
-
const moment = momentImported;
|
|
168
|
-
moment.locale(localStorage.getItem('langKey') || '');
|
|
169
|
-
class TaskDetailModalComponent {
|
|
170
|
-
constructor(toastr, formLinkService, router, logger, route) {
|
|
171
|
-
this.toastr = toastr;
|
|
172
|
-
this.formLinkService = formLinkService;
|
|
173
|
-
this.router = router;
|
|
174
|
-
this.logger = logger;
|
|
175
|
-
this.route = route;
|
|
176
|
-
this.task = null;
|
|
177
|
-
this.page = null;
|
|
178
|
-
this.formSubmit = new EventEmitter();
|
|
179
|
-
this.assignmentOfTaskChanged = new EventEmitter();
|
|
180
|
-
this.errorMessage = null;
|
|
181
|
-
this.formioOptions = new FormioOptionsImpl();
|
|
182
|
-
this.formioOptions.disableAlerts = true;
|
|
183
|
-
}
|
|
184
|
-
resetFormDefinition() {
|
|
185
|
-
// reset formDefinition in order to reload form-io component
|
|
186
|
-
this.formDefinition = null;
|
|
187
|
-
}
|
|
188
|
-
openTaskDetails(task) {
|
|
189
|
-
this.resetFormDefinition();
|
|
190
|
-
this.task = task;
|
|
191
|
-
this.page = {
|
|
192
|
-
title: task.name,
|
|
193
|
-
subtitle: `Created ${task.created}`,
|
|
194
|
-
};
|
|
195
|
-
this.formLinkService
|
|
196
|
-
.getPreFilledFormDefinitionByFormLinkId(task.processDefinitionKey, task.businessKey, task.taskDefinitionKey, task.id // taskInstanceId
|
|
197
|
-
)
|
|
198
|
-
.subscribe(formDefinition => {
|
|
199
|
-
this.formAssociation = formDefinition.formAssociation;
|
|
200
|
-
const className = this.formAssociation.formLink.className.split('.');
|
|
201
|
-
const linkType = className[className.length - 1];
|
|
202
|
-
switch (linkType) {
|
|
203
|
-
case 'BpmnElementFormIdLink':
|
|
204
|
-
this.formDefinition = formDefinition;
|
|
205
|
-
this.modal.show();
|
|
206
|
-
break;
|
|
207
|
-
case 'BpmnElementUrlLink':
|
|
208
|
-
const url = this.router.serializeUrl(this.router.createUrlTree([formDefinition.formAssociation.formLink.url]));
|
|
209
|
-
window.open(url, '_blank');
|
|
210
|
-
break;
|
|
211
|
-
case 'BpmnElementAngularStateUrlLink':
|
|
212
|
-
this.route.params.pipe(take(1)).subscribe(params => {
|
|
213
|
-
const taskId = task === null || task === void 0 ? void 0 : task.id;
|
|
214
|
-
const documentId = params === null || params === void 0 ? void 0 : params.documentId;
|
|
215
|
-
this.router.navigate([formDefinition.formAssociation.formLink.url], {
|
|
216
|
-
state: Object.assign(Object.assign({}, (taskId && { taskId })), (documentId && { documentId })),
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
break;
|
|
220
|
-
default:
|
|
221
|
-
this.logger.fatal('Unsupported class name');
|
|
222
|
-
}
|
|
223
|
-
}, errors => {
|
|
224
|
-
var _a;
|
|
225
|
-
if ((_a = errors === null || errors === void 0 ? void 0 : errors.error) === null || _a === void 0 ? void 0 : _a.detail) {
|
|
226
|
-
this.errorMessage = errors.error.detail;
|
|
227
|
-
}
|
|
228
|
-
this.modal.show();
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
gotoFormLinkScreen() {
|
|
232
|
-
this.modal.hide();
|
|
233
|
-
this.router.navigate(['form-links']);
|
|
234
|
-
}
|
|
235
|
-
onSubmit(submission) {
|
|
236
|
-
this.formLinkService
|
|
237
|
-
.onSubmit(this.task.processDefinitionKey, this.formAssociation.formLink.id, submission.data, this.task.businessKey, this.task.id)
|
|
238
|
-
.subscribe((formSubmissionResult) => {
|
|
239
|
-
this.toastr.success(this.task.name + ' has successfully been completed');
|
|
240
|
-
this.modal.hide();
|
|
241
|
-
this.task = null;
|
|
242
|
-
this.formSubmit.emit();
|
|
243
|
-
}, errors => {
|
|
244
|
-
this.form.showErrors(errors);
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
TaskDetailModalComponent.decorators = [
|
|
249
|
-
{ type: Component, args: [{
|
|
250
|
-
selector: 'valtimo-task-detail-modal',
|
|
251
|
-
template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<valtimo-modal\n #taskDetailModal\n elementId=\"taskDetailModal\"\n [title]=\"page?.title\"\n [subtitle]=\"page?.subtitle\"\n [templateBelowSubtitle]=\"assignUserToTask\"\n>\n <div body *ngIf=\"formDefinition\">\n <valtimo-form-io\n #form\n [form]=\"formDefinition\"\n (submit)=\"onSubmit($event)\"\n [options]=\"formioOptions\"\n ></valtimo-form-io>\n </div>\n <div body *ngIf=\"!formDefinition && !errorMessage\">\n <div\n class=\"bg-warning text-black mb-0 p-3 text-center\"\n [translate]=\"'formManagement.noFormDefinitionFound'\"\n ></div>\n </div>\n <div body *ngIf=\"errorMessage\">\n <div class=\"bg-danger text-black mb-0 p-3 text-center\">\n {{ errorMessage }}\n </div>\n </div>\n <div footer>\n <div class=\"mb-0 p-3 text-center\" *ngIf=\"!formDefinition\">\n <button\n class=\"btn btn-secondary btn-space\"\n type=\"button\"\n (click)=\"gotoFormLinkScreen()\"\n id=\"form-link-button\"\n >\n {{ 'formManagement.gotoFormLinksButton' | translate }}\n </button>\n </div>\n </div>\n</valtimo-modal>\n\n<ng-template #assignUserToTask>\n <valtimo-assign-user-to-task\n *ngIf=\"task && assignmentOfTaskChanged\"\n [taskId]=\"task.id\"\n [assigneeEmail]=\"task.assignee\"\n (assignmentOfTaskChanged)=\"assignmentOfTaskChanged.emit()\"\n ></valtimo-assign-user-to-task>\n</ng-template>\n",
|
|
252
|
-
encapsulation: ViewEncapsulation.None,
|
|
253
|
-
styles: ["/*!\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */#taskDetailModal .formio-component-submit{text-align:right}"]
|
|
254
|
-
},] }
|
|
255
|
-
];
|
|
256
|
-
TaskDetailModalComponent.ctorParameters = () => [
|
|
257
|
-
{ type: ToastrService },
|
|
258
|
-
{ type: FormLinkService },
|
|
259
|
-
{ type: Router },
|
|
260
|
-
{ type: NGXLogger },
|
|
261
|
-
{ type: ActivatedRoute }
|
|
262
|
-
];
|
|
263
|
-
TaskDetailModalComponent.propDecorators = {
|
|
264
|
-
form: [{ type: ViewChild, args: ['form',] }],
|
|
265
|
-
modal: [{ type: ViewChild, args: ['taskDetailModal',] }],
|
|
266
|
-
formSubmit: [{ type: Output }],
|
|
267
|
-
assignmentOfTaskChanged: [{ type: Output }]
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
/*
|
|
271
|
-
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
272
|
-
*
|
|
273
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
274
|
-
* you may not use this file except in compliance with the License.
|
|
275
|
-
* You may obtain a copy of the License at
|
|
276
|
-
*
|
|
277
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
278
|
-
*
|
|
279
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
280
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
281
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
282
|
-
* See the License for the specific language governing permissions and
|
|
283
|
-
* limitations under the License.
|
|
284
|
-
*/
|
|
285
|
-
const moment$1 = momentImported;
|
|
286
|
-
moment$1.locale(localStorage.getItem('langKey') || '');
|
|
287
|
-
class TaskListComponent {
|
|
288
|
-
constructor(taskService, router, logger, translateService) {
|
|
289
|
-
this.taskService = taskService;
|
|
290
|
-
this.router = router;
|
|
291
|
-
this.logger = logger;
|
|
292
|
-
this.translateService = translateService;
|
|
293
|
-
this.tasks = {
|
|
294
|
-
mine: new TaskList(),
|
|
295
|
-
open: new TaskList(),
|
|
296
|
-
all: new TaskList(),
|
|
297
|
-
};
|
|
298
|
-
this.currentTaskType = 'mine';
|
|
299
|
-
this.listTitle = null;
|
|
300
|
-
this.listDescription = null;
|
|
301
|
-
}
|
|
302
|
-
paginationClicked(page, type) {
|
|
303
|
-
this.tasks[type].page = page - 1;
|
|
304
|
-
this.getTasks(type);
|
|
305
|
-
}
|
|
306
|
-
paginationSet() {
|
|
307
|
-
this.tasks.mine.pagination.size =
|
|
308
|
-
this.tasks.all.pagination.size =
|
|
309
|
-
this.tasks.open.pagination.size =
|
|
310
|
-
this.tasks[this.currentTaskType].pagination.size;
|
|
311
|
-
this.getTasks(this.currentTaskType);
|
|
312
|
-
}
|
|
313
|
-
clearPagination(type) {
|
|
314
|
-
this.tasks[type].page = 0;
|
|
315
|
-
}
|
|
316
|
-
tabChange(tab) {
|
|
317
|
-
this.clearPagination(this.currentTaskType);
|
|
318
|
-
switch (tab.nextId) {
|
|
319
|
-
case 'ngb-tab-0':
|
|
320
|
-
this.getTasks('mine');
|
|
321
|
-
break;
|
|
322
|
-
case 'ngb-tab-1':
|
|
323
|
-
this.getTasks('open');
|
|
324
|
-
break;
|
|
325
|
-
case 'ngb-tab-2':
|
|
326
|
-
this.getTasks('all');
|
|
327
|
-
break;
|
|
328
|
-
default:
|
|
329
|
-
this.logger.fatal('Unreachable case');
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
showTask(task) {
|
|
333
|
-
this.router.navigate(['tasks', task.id]);
|
|
334
|
-
}
|
|
335
|
-
getTasks(type) {
|
|
336
|
-
let params;
|
|
337
|
-
this.translationSubscription = combineLatest([
|
|
338
|
-
this.translateService.stream(`task-list.${type}.title`),
|
|
339
|
-
this.translateService.stream(`task-list.${type}.description`),
|
|
340
|
-
]).subscribe(([title, description]) => {
|
|
341
|
-
this.listTitle = title;
|
|
342
|
-
this.listDescription = description;
|
|
343
|
-
});
|
|
344
|
-
switch (type) {
|
|
345
|
-
case 'mine':
|
|
346
|
-
params = {
|
|
347
|
-
page: this.tasks.mine.page,
|
|
348
|
-
size: this.tasks.mine.pagination.size,
|
|
349
|
-
filter: 'mine',
|
|
350
|
-
};
|
|
351
|
-
this.currentTaskType = 'mine';
|
|
352
|
-
break;
|
|
353
|
-
case 'open':
|
|
354
|
-
params = {
|
|
355
|
-
page: this.tasks.open.page,
|
|
356
|
-
size: this.tasks.open.pagination.size,
|
|
357
|
-
filter: 'open',
|
|
358
|
-
};
|
|
359
|
-
this.currentTaskType = 'open';
|
|
360
|
-
break;
|
|
361
|
-
case 'all':
|
|
362
|
-
params = { page: this.tasks.all.page, size: this.tasks.open.pagination.size, filter: 'all' };
|
|
363
|
-
this.currentTaskType = 'all';
|
|
364
|
-
break;
|
|
365
|
-
default:
|
|
366
|
-
this.logger.fatal('Unreachable case');
|
|
367
|
-
}
|
|
368
|
-
this.taskService.queryTasks(params).subscribe((results) => {
|
|
369
|
-
this.tasks[type].pagination.collectionSize = results.headers.get('x-total-count');
|
|
370
|
-
this.tasks[type].tasks = results.body;
|
|
371
|
-
this.tasks[type].tasks.map((task) => {
|
|
372
|
-
task.created = moment$1(task.created).format('DD MMM YYYY HH:mm');
|
|
373
|
-
if (task.due) {
|
|
374
|
-
task.due = moment$1(task.due).format('DD MMM YYYY HH:mm');
|
|
375
|
-
}
|
|
376
|
-
});
|
|
377
|
-
this.tasks[type].fields = [
|
|
378
|
-
{
|
|
379
|
-
key: 'created',
|
|
380
|
-
label: 'Created on',
|
|
381
|
-
},
|
|
382
|
-
{
|
|
383
|
-
key: 'name',
|
|
384
|
-
label: 'Name',
|
|
385
|
-
},
|
|
386
|
-
{
|
|
387
|
-
key: 'valtimoAssignee.fullName',
|
|
388
|
-
label: 'Assignee',
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
key: 'due',
|
|
392
|
-
label: 'Due date',
|
|
393
|
-
},
|
|
394
|
-
];
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
rowOpenTaskClick(task) {
|
|
398
|
-
if (!task.endTime) {
|
|
399
|
-
this.taskDetail.openTaskDetails(task);
|
|
400
|
-
}
|
|
401
|
-
else {
|
|
402
|
-
return false;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
ngOnDestroy() {
|
|
406
|
-
this.translationSubscription.unsubscribe();
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
TaskListComponent.decorators = [
|
|
410
|
-
{ type: Component, args: [{
|
|
411
|
-
selector: 'valtimo-task-list',
|
|
412
|
-
template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"main-content\">\n <div class=\"container-fluid\">\n <valtimo-widget>\n <valtimo-list\n [items]=\"tasks[currentTaskType].tasks\"\n [fields]=\"tasks[currentTaskType].fields\"\n [pagination]=\"tasks[currentTaskType].pagination\"\n [viewMode]=\"true\"\n (paginationClicked)=\"paginationClicked($event, currentTaskType)\"\n (paginationSet)=\"paginationSet()\"\n paginationIdentifier=\"taskList\"\n [isSearchable]=\"true\"\n [header]=\"true\"\n (rowClicked)=\"rowOpenTaskClick($event)\"\n >\n <div header>\n <h3 class=\"list-header-title\">{{ listTitle }}</h3>\n <h5 class=\"list-header-description\">{{ listDescription }}</h5>\n </div>\n <div tabs>\n <ngb-tabset [destroyOnHide]=\"false\" (tabChange)=\"tabChange($event)\">\n <ngb-tab id=\"ngb-tab-0\" [title]=\"'task-list.mine.title' | translate\"> </ngb-tab>\n <ngb-tab id=\"ngb-tab-1\" [title]=\"'task-list.open.title' | translate\"> </ngb-tab>\n <ngb-tab id=\"ngb-tab-2\" [title]=\"'task-list.all.title' | translate\"> </ngb-tab>\n </ngb-tabset>\n </div>\n </valtimo-list>\n </valtimo-widget>\n <valtimo-task-detail-modal\n #taskDetail\n (formSubmit)=\"getTasks(currentTaskType)\"\n (assignmentOfTaskChanged)=\"getTasks(currentTaskType)\"\n ></valtimo-task-detail-modal>\n </div>\n</div>\n",
|
|
413
|
-
encapsulation: ViewEncapsulation.None,
|
|
414
|
-
styles: ["/*!\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.tab-content{margin:0;padding:0}.nav.nav-tabs{background-color:#f5f5f5}"]
|
|
415
|
-
},] }
|
|
416
|
-
];
|
|
417
|
-
TaskListComponent.ctorParameters = () => [
|
|
418
|
-
{ type: TaskService },
|
|
419
|
-
{ type: Router },
|
|
420
|
-
{ type: NGXLogger },
|
|
421
|
-
{ type: TranslateService }
|
|
422
|
-
];
|
|
423
|
-
TaskListComponent.propDecorators = {
|
|
424
|
-
taskDetail: [{ type: ViewChild, args: ['taskDetail',] }]
|
|
425
|
-
};
|
|
426
|
-
|
|
427
|
-
/*
|
|
428
|
-
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
429
|
-
*
|
|
430
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
431
|
-
* you may not use this file except in compliance with the License.
|
|
432
|
-
* You may obtain a copy of the License at
|
|
433
|
-
*
|
|
434
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
435
|
-
*
|
|
436
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
437
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
438
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
439
|
-
* See the License for the specific language governing permissions and
|
|
440
|
-
* limitations under the License.
|
|
441
|
-
*/
|
|
442
|
-
const ɵ0 = { title: 'Tasks', roles: [ROLE_USER] };
|
|
443
|
-
const routes = [
|
|
444
|
-
{
|
|
445
|
-
path: 'tasks',
|
|
446
|
-
component: TaskListComponent,
|
|
447
|
-
canActivate: [AuthGuardService],
|
|
448
|
-
data: ɵ0,
|
|
449
|
-
},
|
|
450
|
-
];
|
|
451
|
-
class TaskRoutingModule {
|
|
452
|
-
}
|
|
453
|
-
TaskRoutingModule.decorators = [
|
|
454
|
-
{ type: NgModule, args: [{
|
|
455
|
-
declarations: [],
|
|
456
|
-
imports: [CommonModule, RouterModule.forChild(routes)],
|
|
457
|
-
exports: [RouterModule],
|
|
458
|
-
},] }
|
|
459
|
-
];
|
|
460
|
-
|
|
461
|
-
/*
|
|
462
|
-
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
463
|
-
*
|
|
464
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
465
|
-
* you may not use this file except in compliance with the License.
|
|
466
|
-
* You may obtain a copy of the License at
|
|
467
|
-
*
|
|
468
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
469
|
-
*
|
|
470
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
471
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
472
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
473
|
-
* See the License for the specific language governing permissions and
|
|
474
|
-
* limitations under the License.
|
|
475
|
-
*/
|
|
476
|
-
class AssignUserToTaskComponent {
|
|
477
|
-
constructor(taskService) {
|
|
478
|
-
this.taskService = taskService;
|
|
479
|
-
this.assignmentOfTaskChanged = new EventEmitter();
|
|
480
|
-
this.candidateUsersForTask$ = new BehaviorSubject(undefined);
|
|
481
|
-
this.disabled$ = new BehaviorSubject(true);
|
|
482
|
-
this.assignedEmailOnServer$ = new BehaviorSubject(null);
|
|
483
|
-
this.userEmailToAssign = null;
|
|
484
|
-
this.assignedUserFullName$ = new BehaviorSubject(null);
|
|
485
|
-
}
|
|
486
|
-
ngOnInit() {
|
|
487
|
-
this.taskService.getCandidateUsers(this.taskId).subscribe(candidateUsers => {
|
|
488
|
-
this.candidateUsersForTask$.next(candidateUsers);
|
|
489
|
-
if (this.assigneeEmail) {
|
|
490
|
-
this.assignedEmailOnServer$.next(this.assigneeEmail);
|
|
491
|
-
this.userEmailToAssign = this.assigneeEmail;
|
|
492
|
-
this.assignedUserFullName$.next(this.getAssignedUserName(candidateUsers, this.assigneeEmail));
|
|
493
|
-
}
|
|
494
|
-
this.enable();
|
|
495
|
-
});
|
|
496
|
-
}
|
|
497
|
-
ngOnChanges(changes) {
|
|
498
|
-
const assigneeEmail = changes.assigneeEmail;
|
|
499
|
-
if (assigneeEmail) {
|
|
500
|
-
this.candidateUsersForTask$.pipe(take(1)).subscribe(candidateUsers => {
|
|
501
|
-
const currentUserEmail = assigneeEmail.currentValue;
|
|
502
|
-
this.assignedEmailOnServer$.next(currentUserEmail || null);
|
|
503
|
-
this.userEmailToAssign = currentUserEmail || null;
|
|
504
|
-
this.assignedUserFullName$.next(this.getAssignedUserName(candidateUsers, currentUserEmail));
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
else {
|
|
508
|
-
this.clear();
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
assignTask(userEmail) {
|
|
512
|
-
this.disable();
|
|
513
|
-
combineLatest([
|
|
514
|
-
this.candidateUsersForTask$,
|
|
515
|
-
this.taskService.assignTask(this.taskId, { assignee: userEmail }),
|
|
516
|
-
])
|
|
517
|
-
.pipe(take(1), tap(([candidateUsers]) => {
|
|
518
|
-
this.userEmailToAssign = userEmail;
|
|
519
|
-
this.assignedEmailOnServer$.next(userEmail);
|
|
520
|
-
this.assignedUserFullName$.next(this.getAssignedUserName(candidateUsers, userEmail));
|
|
521
|
-
this.emitChange();
|
|
522
|
-
this.enable();
|
|
523
|
-
}))
|
|
524
|
-
.subscribe();
|
|
525
|
-
}
|
|
526
|
-
unassignTask() {
|
|
527
|
-
this.disable();
|
|
528
|
-
this.taskService
|
|
529
|
-
.unassignTask(this.taskId)
|
|
530
|
-
.pipe(tap(() => {
|
|
531
|
-
this.clear();
|
|
532
|
-
this.emitChange();
|
|
533
|
-
this.enable();
|
|
534
|
-
}))
|
|
535
|
-
.subscribe();
|
|
536
|
-
}
|
|
537
|
-
getAssignedUserName(users, userEmail) {
|
|
538
|
-
if (users && userEmail) {
|
|
539
|
-
const findUser = users.find(user => user.email === userEmail);
|
|
540
|
-
return findUser ? findUser.fullName : '';
|
|
541
|
-
}
|
|
542
|
-
return '';
|
|
543
|
-
}
|
|
544
|
-
mapUsersForDropdown(users) {
|
|
545
|
-
return (users &&
|
|
546
|
-
users
|
|
547
|
-
.map(user => { var _a; return (Object.assign(Object.assign({}, user), { lastName: ((_a = user.lastName) === null || _a === void 0 ? void 0 : _a.split(' ').splice(-1)[0]) || '' })); })
|
|
548
|
-
.sort((a, b) => a.lastName.localeCompare(b.lastName))
|
|
549
|
-
.map(user => ({ text: user.fullName, id: user.email })));
|
|
550
|
-
}
|
|
551
|
-
clear() {
|
|
552
|
-
this.assignedEmailOnServer$.next(null);
|
|
553
|
-
this.userEmailToAssign = null;
|
|
554
|
-
}
|
|
555
|
-
emitChange() {
|
|
556
|
-
this.assignmentOfTaskChanged.emit();
|
|
557
|
-
}
|
|
558
|
-
enable() {
|
|
559
|
-
this.disabled$.next(false);
|
|
560
|
-
}
|
|
561
|
-
disable() {
|
|
562
|
-
this.disabled$.next(true);
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
AssignUserToTaskComponent.decorators = [
|
|
566
|
-
{ type: Component, args: [{
|
|
567
|
-
selector: 'valtimo-assign-user-to-task',
|
|
568
|
-
template: "<ng-container\n *ngIf=\"{\n candidateUsers: candidateUsersForTask$ | async,\n disabled: disabled$ | async,\n emailOnServer: assignedEmailOnServer$ | async\n } as obs\"\n>\n <div class=\"container-fluid\">\n <div class=\"row mt-2 mb-2\">\n <div class=\"col-12 pl-0 d-flex flex-row align-items-center\">\n <ng-container *ngIf=\"obs.candidateUsers; else loading\">\n <valtimo-searchable-dropdown-select\n [style]=\"'underlinedText'\"\n [items]=\"mapUsersForDropdown(obs.candidateUsers)\"\n [buttonText]=\"'assignTask.header' | translate\"\n [searchText]=\"'interface.typeToSearch' | translate\"\n [noResultsText]=\"'interface.noSearchResults' | translate\"\n [disabled]=\"obs.disabled\"\n [selectedText]=\"'assignTask.assignedTo' | translate\"\n [selectedTextValue]=\"assignedUserFullName$ | async\"\n [clearSelectionButtonTitle]=\"'assignTask.remove' | translate\"\n [hasSelection]=\"userEmailToAssign === obs.emailOnServer && obs.emailOnServer !== null\"\n [width]=\"250\"\n (itemSelected)=\"assignTask($event)\"\n (clearSelection)=\"unassignTask()\"\n >\n </valtimo-searchable-dropdown-select>\n </ng-container>\n </div>\n </div>\n </div>\n</ng-container>\n\n<ng-template #loading>\n <h5>\n <b>{{ 'assignTask.fetchingUsers' | translate }}</b>\n </h5>\n</ng-template>\n",
|
|
569
|
-
styles: [".container-fluid{color:#959595}i{font-size:13px}"]
|
|
570
|
-
},] }
|
|
571
|
-
];
|
|
572
|
-
AssignUserToTaskComponent.ctorParameters = () => [
|
|
573
|
-
{ type: TaskService }
|
|
574
|
-
];
|
|
575
|
-
AssignUserToTaskComponent.propDecorators = {
|
|
576
|
-
taskId: [{ type: Input }],
|
|
577
|
-
assigneeEmail: [{ type: Input }],
|
|
578
|
-
assignmentOfTaskChanged: [{ type: Output }]
|
|
579
|
-
};
|
|
580
|
-
|
|
581
|
-
/*
|
|
582
|
-
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
583
|
-
*
|
|
584
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
585
|
-
* you may not use this file except in compliance with the License.
|
|
586
|
-
* You may obtain a copy of the License at
|
|
587
|
-
*
|
|
588
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
589
|
-
*
|
|
590
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
591
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
592
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
593
|
-
* See the License for the specific language governing permissions and
|
|
594
|
-
* limitations under the License.
|
|
595
|
-
*/
|
|
596
|
-
const ɵ0$1 = HttpLoaderFactory;
|
|
597
|
-
class TaskModule {
|
|
598
|
-
}
|
|
599
|
-
TaskModule.decorators = [
|
|
600
|
-
{ type: NgModule, args: [{
|
|
601
|
-
declarations: [TaskListComponent, TaskDetailModalComponent, AssignUserToTaskComponent],
|
|
602
|
-
imports: [
|
|
603
|
-
CommonModule,
|
|
604
|
-
TaskRoutingModule,
|
|
605
|
-
ListModule,
|
|
606
|
-
PageHeaderModule,
|
|
607
|
-
WidgetModule,
|
|
608
|
-
SpinnerModule,
|
|
609
|
-
SearchableDropdownSelectModule,
|
|
610
|
-
CamundaFormModule,
|
|
611
|
-
BrowserAnimationsModule,
|
|
612
|
-
FormsModule,
|
|
613
|
-
ToastrModule.forRoot({
|
|
614
|
-
positionClass: 'toast-bottom-full-width',
|
|
615
|
-
preventDuplicates: true,
|
|
616
|
-
}),
|
|
617
|
-
TranslateModule.forRoot({
|
|
618
|
-
loader: {
|
|
619
|
-
provide: TranslateLoader,
|
|
620
|
-
useFactory: ɵ0$1,
|
|
621
|
-
deps: [HttpClient],
|
|
622
|
-
},
|
|
623
|
-
}),
|
|
624
|
-
NgbModule,
|
|
625
|
-
FormIoModule,
|
|
626
|
-
ModalModule,
|
|
627
|
-
],
|
|
628
|
-
exports: [TaskListComponent, TaskDetailModalComponent, AssignUserToTaskComponent],
|
|
629
|
-
},] }
|
|
630
|
-
];
|
|
631
|
-
|
|
632
|
-
/*
|
|
633
|
-
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
634
|
-
*
|
|
635
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
636
|
-
* you may not use this file except in compliance with the License.
|
|
637
|
-
* You may obtain a copy of the License at
|
|
638
|
-
*
|
|
639
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
640
|
-
*
|
|
641
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
642
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
643
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
644
|
-
* See the License for the specific language governing permissions and
|
|
645
|
-
* limitations under the License.
|
|
646
|
-
*/
|
|
647
|
-
|
|
648
|
-
/**
|
|
649
|
-
* Generated bundle index. Do not edit.
|
|
650
|
-
*/
|
|
651
|
-
|
|
652
|
-
export { TaskDetailModalComponent, TaskList, TaskListComponent, TaskModule, TaskService, ɵ0$1 as ɵ0, AssignUserToTaskComponent as ɵa, TaskRoutingModule as ɵb };
|
|
653
|
-
//# sourceMappingURL=valtimo-task.js.map
|