@valtimo/milestone 4.15.2-next-main.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/README.md +24 -0
  2. package/bundles/valtimo-milestone.umd.js +1015 -0
  3. package/bundles/valtimo-milestone.umd.js.map +1 -0
  4. package/bundles/valtimo-milestone.umd.min.js +2 -0
  5. package/bundles/valtimo-milestone.umd.min.js.map +1 -0
  6. package/esm2015/lib/milestone-create/milestone-create.component.js +102 -0
  7. package/esm2015/lib/milestone-edit/milestone-edit.component.js +141 -0
  8. package/esm2015/lib/milestone-list/milestone-list.component.js +88 -0
  9. package/esm2015/lib/milestone-routing.module.js +72 -0
  10. package/esm2015/lib/milestone-set-create/milestone-set-create.component.js +61 -0
  11. package/esm2015/lib/milestone-set-edit/milestone-set-edit.component.js +85 -0
  12. package/esm2015/lib/milestone.component.js +31 -0
  13. package/esm2015/lib/milestone.module.js +49 -0
  14. package/esm2015/lib/milestone.service.js +72 -0
  15. package/esm2015/public-api.js +22 -0
  16. package/esm2015/valtimo-milestone.js +11 -0
  17. package/fesm2015/valtimo-milestone.js +679 -0
  18. package/fesm2015/valtimo-milestone.js.map +1 -0
  19. package/lib/milestone-create/milestone-create.component.d.ts +28 -0
  20. package/lib/milestone-edit/milestone-edit.component.d.ts +33 -0
  21. package/lib/milestone-list/milestone-list.component.d.ts +23 -0
  22. package/lib/milestone-routing.module.d.ts +2 -0
  23. package/lib/milestone-set-create/milestone-set-create.component.d.ts +19 -0
  24. package/lib/milestone-set-edit/milestone-set-edit.component.d.ts +23 -0
  25. package/lib/milestone.component.d.ts +5 -0
  26. package/lib/milestone.module.d.ts +2 -0
  27. package/lib/milestone.service.d.ts +21 -0
  28. package/package.json +20 -0
  29. package/public-api.d.ts +3 -0
  30. package/valtimo-milestone.d.ts +10 -0
  31. package/valtimo-milestone.metadata.json +1 -0
@@ -0,0 +1,679 @@
1
+ import { ɵɵdefineInjectable, ɵɵinject, Injectable, Component, NgModule } from '@angular/core';
2
+ import { HttpClient } from '@angular/common/http';
3
+ import { ConfigService } from '@valtimo/config';
4
+ import { FormControl, Validators, FormBuilder, ReactiveFormsModule } from '@angular/forms';
5
+ import { AlertService, ListModule, WidgetModule } from '@valtimo/components';
6
+ import { Router, ActivatedRoute, RouterModule } from '@angular/router';
7
+ import { CommonModule } from '@angular/common';
8
+ import { AuthGuardService } from '@valtimo/security';
9
+ import { ProcessService } from '@valtimo/process';
10
+ import { switchMap } from 'rxjs/operators';
11
+ import { ROLE_ADMIN } from '@valtimo/contract';
12
+ import { combineLatest } from 'rxjs';
13
+ import { ColorPickerModule } from 'ngx-color-picker';
14
+ import { TranslateModule } from '@ngx-translate/core';
15
+
16
+ /*
17
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
18
+ *
19
+ * Licensed under EUPL, Version 1.2 (the "License");
20
+ * you may not use this file except in compliance with the License.
21
+ * You may obtain a copy of the License at
22
+ *
23
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
24
+ *
25
+ * Unless required by applicable law or agreed to in writing, software
26
+ * distributed under the License is distributed on an "AS IS" basis,
27
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28
+ * See the License for the specific language governing permissions and
29
+ * limitations under the License.
30
+ */
31
+ class MilestoneService {
32
+ constructor(configService, http) {
33
+ this.configService = configService;
34
+ this.http = http;
35
+ this.valtimoApiConfig = configService.config.valtimoApi;
36
+ }
37
+ getMilestones() {
38
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}milestones`);
39
+ }
40
+ getMilestone(milestoneId) {
41
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}milestones/${milestoneId}`);
42
+ }
43
+ createMilestone(milestone) {
44
+ return this.http.post(`${this.valtimoApiConfig.endpointUri}milestones`, milestone);
45
+ }
46
+ updateMilestone(milestone) {
47
+ return this.http.post(`${this.valtimoApiConfig.endpointUri}milestones`, milestone);
48
+ }
49
+ deleteMilestone(milestoneId) {
50
+ return this.http.delete(`${this.valtimoApiConfig.endpointUri}milestones/${milestoneId}`);
51
+ }
52
+ getMilestoneSets() {
53
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}milestone-sets`);
54
+ }
55
+ getMilestoneSet(milestoneSetId) {
56
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}milestone-sets/${milestoneSetId}`);
57
+ }
58
+ createMilestoneSet(milestoneSet) {
59
+ return this.http.post(`${this.valtimoApiConfig.endpointUri}milestone-sets`, milestoneSet);
60
+ }
61
+ updateMilestoneSet(milestoneSet) {
62
+ return this.http.post(`${this.valtimoApiConfig.endpointUri}milestone-sets`, milestoneSet);
63
+ }
64
+ deleteMilestoneSet(milestoneSetId) {
65
+ return this.http.delete(`${this.valtimoApiConfig.endpointUri}milestone-sets/${milestoneSetId}`);
66
+ }
67
+ getFlownodes(processDefinitionId) {
68
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}milestones/${processDefinitionId}/flownodes`);
69
+ }
70
+ }
71
+ MilestoneService.ɵprov = ɵɵdefineInjectable({ factory: function MilestoneService_Factory() { return new MilestoneService(ɵɵinject(ConfigService), ɵɵinject(HttpClient)); }, token: MilestoneService, providedIn: "root" });
72
+ MilestoneService.decorators = [
73
+ { type: Injectable, args: [{
74
+ providedIn: 'root'
75
+ },] }
76
+ ];
77
+ MilestoneService.ctorParameters = () => [
78
+ { type: ConfigService },
79
+ { type: HttpClient }
80
+ ];
81
+
82
+ /*
83
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
84
+ *
85
+ * Licensed under EUPL, Version 1.2 (the "License");
86
+ * you may not use this file except in compliance with the License.
87
+ * You may obtain a copy of the License at
88
+ *
89
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
90
+ *
91
+ * Unless required by applicable law or agreed to in writing, software
92
+ * distributed under the License is distributed on an "AS IS" basis,
93
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
94
+ * See the License for the specific language governing permissions and
95
+ * limitations under the License.
96
+ */
97
+ class MilestoneComponent {
98
+ constructor() {
99
+ }
100
+ ngOnInit() {
101
+ }
102
+ }
103
+ MilestoneComponent.decorators = [
104
+ { type: Component, args: [{
105
+ selector: 'valtimo-milestone',
106
+ 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 pt-0\">\n <div class=\"container-fluid\">\n <div class=\"text-right\">\n <div class=\"btn-group mt-m3px mb-3\">\n <button [routerLink]=\"'sets/create'\" class=\"btn btn-primary btn-space\">\n <i class=\"icon mdi mdi-plus\"></i> &nbsp;\n <span>{{ 'Create new Milestone Set' | translate }}</span>\n </button>\n <button [routerLink]=\"'create'\" class=\"btn btn-primary btn-space mr-0\">\n <i class=\"icon mdi mdi-plus\"></i> &nbsp;\n <span>{{ 'Create new Milestone' | translate }}</span>\n </button>\n </div>\n </div>\n <valtimo-milestone-list></valtimo-milestone-list>\n </div>\n</div>\n",
107
+ 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 */"]
108
+ },] }
109
+ ];
110
+ MilestoneComponent.ctorParameters = () => [];
111
+
112
+ /*
113
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
114
+ *
115
+ * Licensed under EUPL, Version 1.2 (the "License");
116
+ * you may not use this file except in compliance with the License.
117
+ * You may obtain a copy of the License at
118
+ *
119
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
120
+ *
121
+ * Unless required by applicable law or agreed to in writing, software
122
+ * distributed under the License is distributed on an "AS IS" basis,
123
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
124
+ * See the License for the specific language governing permissions and
125
+ * limitations under the License.
126
+ */
127
+ class MilestoneSetCreateComponent {
128
+ constructor(milestoneService, formBuilder, router, alertService) {
129
+ this.milestoneService = milestoneService;
130
+ this.formBuilder = formBuilder;
131
+ this.router = router;
132
+ this.alertService = alertService;
133
+ }
134
+ get formControls() {
135
+ return this.form.controls;
136
+ }
137
+ ngOnInit() {
138
+ this.form = this.formBuilder.group({
139
+ title: new FormControl('', Validators.required)
140
+ });
141
+ }
142
+ reset() {
143
+ this.form.setValue({
144
+ title: ''
145
+ });
146
+ }
147
+ createMilestoneSet() {
148
+ this.milestoneService.createMilestoneSet(this.form.value).subscribe(() => {
149
+ this.router.navigate(['/milestones']);
150
+ this.alertService.success('New Milestone set has been created');
151
+ });
152
+ }
153
+ }
154
+ MilestoneSetCreateComponent.decorators = [
155
+ { type: Component, args: [{
156
+ selector: 'valtimo-milestone-set-create',
157
+ 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 <div class=\"col-12 px-0 mb-5\">\n <valtimo-widget>\n <div class=\"bg-white p-5\">\n <form [formGroup]=\"form\" (ngSubmit)=\"createMilestoneSet()\">\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"title\">Title</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input type=\"text\" id=\"title\" formControlName=\"title\"\n class=\"form-control\" placeholder=\"Milestone set title\"\n [ngClass]=\"{'is-valid': formControls.title.touched && formControls.title.valid, 'is-invalid': formControls.title.touched && formControls.title.errors}\"\n required/>\n <div *ngIf=\"formControls.title.touched && formControls.title.errors\"\n class=\"invalid-feedback\">\n <div *ngIf=\"formControls.title.errors.required\">Title is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"row pt-3 mt-1\">\n <div class=\"col-12 col-sm-6 text-left\">\n <a [routerLink]=\"'/milestones'\" class=\"btn btn-space btn-default\">Back</a>\n </div>\n <div class=\"col-12 col-sm-6 text-right\">\n <button class=\"btn btn-space btn-secondary\" type=\"button\" (click)=\"reset()\">Reset\n </button>\n <button class=\"btn btn-space btn-primary\" type=\"submit\" [disabled]=\"form.invalid\">\n Submit\n </button>\n </div>\n </div>\n </form>\n </div>\n </valtimo-widget>\n </div>\n </div>\n</div>\n",
158
+ 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 */"]
159
+ },] }
160
+ ];
161
+ MilestoneSetCreateComponent.ctorParameters = () => [
162
+ { type: MilestoneService },
163
+ { type: FormBuilder },
164
+ { type: Router },
165
+ { type: AlertService }
166
+ ];
167
+
168
+ /*
169
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
170
+ *
171
+ * Licensed under EUPL, Version 1.2 (the "License");
172
+ * you may not use this file except in compliance with the License.
173
+ * You may obtain a copy of the License at
174
+ *
175
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
176
+ *
177
+ * Unless required by applicable law or agreed to in writing, software
178
+ * distributed under the License is distributed on an "AS IS" basis,
179
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
180
+ * See the License for the specific language governing permissions and
181
+ * limitations under the License.
182
+ */
183
+ class MilestoneCreateComponent {
184
+ constructor(milestoneService, formBuilder, router, alertService, processService) {
185
+ this.milestoneService = milestoneService;
186
+ this.formBuilder = formBuilder;
187
+ this.router = router;
188
+ this.alertService = alertService;
189
+ this.processService = processService;
190
+ this.milestoneSets = [];
191
+ this.processDefinitions = [];
192
+ this.taskDefinitions = [];
193
+ }
194
+ get formControls() {
195
+ return this.form.controls;
196
+ }
197
+ ngOnInit() {
198
+ this.form = this.formBuilder.group({
199
+ milestoneSet: new FormControl('', Validators.required),
200
+ title: new FormControl('', Validators.required),
201
+ processDefinitionKey: new FormControl('', Validators.required),
202
+ taskDefinitionKey: new FormControl('', Validators.required),
203
+ plannedIntervalInDays: new FormControl('', [Validators.required, Validators.pattern('^[0-9]*$')]),
204
+ color: new FormControl('', [Validators.required, Validators.pattern('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')])
205
+ });
206
+ this.getMilestoneSets();
207
+ this.getMilestones();
208
+ }
209
+ reset() {
210
+ this.form.patchValue({
211
+ milestoneSet: '',
212
+ title: '',
213
+ processDefinitionKey: '',
214
+ taskDefinitionKey: '',
215
+ plannedIntervalInDays: '',
216
+ color: ''
217
+ });
218
+ }
219
+ getMilestoneSets() {
220
+ this.milestoneService.getMilestoneSets().subscribe((milesetoneSets) => {
221
+ this.milestoneSets = milesetoneSets;
222
+ });
223
+ }
224
+ getMilestones() {
225
+ this.processService.getProcessDefinitions().subscribe((processDefinitions) => {
226
+ this.processDefinitions = processDefinitions;
227
+ });
228
+ }
229
+ getFlownodes(processDefinitionId) {
230
+ if (processDefinitionId) {
231
+ this.milestoneService.getFlownodes(processDefinitionId).subscribe((flowNodes) => {
232
+ this.taskDefinitions = flowNodes['flowNodeMap'];
233
+ this.form.controls.taskDefinitionKey.setValue('');
234
+ });
235
+ }
236
+ }
237
+ createMilestone() {
238
+ const milestone = this.form.value;
239
+ milestone.processDefinitionKey = milestone.processDefinitionKey['key'];
240
+ milestone.id = null;
241
+ this.milestoneService.createMilestone(milestone).subscribe(() => {
242
+ this.router.navigate(['/milestones']);
243
+ this.alertService.success('New Milestone has been created');
244
+ }, (err) => {
245
+ this.alertService.error('Error creating new milestone');
246
+ });
247
+ }
248
+ }
249
+ MilestoneCreateComponent.decorators = [
250
+ { type: Component, args: [{
251
+ selector: 'valtimo-milestone-create',
252
+ 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 <div class=\"col-12 px-0 mb-5\">\n <valtimo-widget>\n <div class=\"bg-white p-5\">\n <form [formGroup]=\"form\" (ngSubmit)=\"createMilestone()\">\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"title\">Milestone set</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <select type=\"text\" id=\"milestoneSet\" formControlName=\"milestoneSet\"\n class=\"form-control\"\n [ngClass]=\"{'is-valid': formControls.milestoneSet.touched && formControls.milestoneSet.valid, 'is-invalid': formControls.milestoneSet.touched && formControls.milestoneSet.errors}\"\n required>\n <option value=\"\" selected disabled>Choose a Milestone set</option>\n <option *ngFor=\"let milestoneSet of milestoneSets\" [value]=\"milestoneSet.id\">{{milestoneSet.title}} ({{milestoneSet.id}})</option>\n </select>\n <div *ngIf=\"formControls.milestoneSet.touched && formControls.milestoneSet.errors\"\n class=\"invalid-feedback\">\n <div *ngIf=\"formControls.milestoneSet.errors.required\">Milestone set is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"title\">Title</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input type=\"text\" id=\"title\" formControlName=\"title\"\n class=\"form-control\" placeholder=\"Milestone title\"\n [ngClass]=\"{'is-valid': formControls.title.touched && formControls.title.valid, 'is-invalid': formControls.title.touched && formControls.title.errors}\"\n required/>\n <div *ngIf=\"formControls.title.touched && formControls.title.errors\"\n class=\"invalid-feedback\">\n <div *ngIf=\"formControls.title.errors.required\">Title is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"process\">Process definition</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <select type=\"text\" id=\"process\" formControlName=\"processDefinitionKey\"\n class=\"form-control\" (ngModelChange)=\"getFlownodes($event.id)\"\n [ngClass]=\"{'is-valid': formControls.processDefinitionKey.touched && formControls.processDefinitionKey.valid, 'is-invalid': formControls.processDefinitionKey.touched && formControls.processDefinitionKey.errors}\"\n required>\n <option value=\"\" selected disabled>Choose a process</option>\n <option *ngFor=\"let processDefinition of processDefinitions\" [ngValue]=\"processDefinition\">{{processDefinition.name}} ({{processDefinition.key}})</option>\n </select>\n <div *ngIf=\"formControls.processDefinitionKey.touched && formControls.processDefinitionKey.errors\"\n class=\"invalid-feedback\">\n <div *ngIf=\"formControls.processDefinitionKey.errors.required\">Process is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"process\">Task</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <select type=\"text\" id=\"task\" formControlName=\"taskDefinitionKey\"\n class=\"form-control\"\n [ngClass]=\"{'is-valid': formControls.taskDefinitionKey.touched && formControls.taskDefinitionKey.valid, 'is-invalid': formControls.taskDefinitionKey.touched && formControls.taskDefinitionKey.errors}\"\n required>\n <option value=\"\" selected disabled>Choose a task</option>\n <option *ngFor=\"let taskDefinition of taskDefinitions |keyvalue\" [value]=\"taskDefinition.key\">{{taskDefinition.value}} ({{taskDefinition.key}})</option>\n </select>\n <div *ngIf=\"formControls.taskDefinitionKey.touched && formControls.taskDefinitionKey.errors\"\n class=\"invalid-feedback\">\n <div *ngIf=\"formControls.taskDefinitionKey.errors.required\">Task is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"interval\">Interval (in days)</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input type=\"text\" id=\"interval\" formControlName=\"plannedIntervalInDays\"\n class=\"form-control\" placeholder=\"Interval (in days)\"\n [ngClass]=\"{'is-valid': formControls.plannedIntervalInDays.touched && formControls.plannedIntervalInDays.valid, 'is-invalid': formControls.plannedIntervalInDays.touched && formControls.plannedIntervalInDays.errors}\"\n required/>\n <div *ngIf=\"formControls.plannedIntervalInDays.touched && formControls.plannedIntervalInDays.errors\"\n class=\"invalid-feedback\">\n <div *ngIf=\"formControls.plannedIntervalInDays.errors.required\">Interval is required</div>\n <div *ngIf=\"formControls.plannedIntervalInDays.errors.pattern\">Interval is not a valid number</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"color\">Color</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n\n <input [colorPicker]=\"form.value.color\"\n (colorPickerChange)=\"form.controls.color.setValue($event)\"\n [style.background]=\"form.value.color\"\n type=\"text\" id=\"color\" formControlName=\"color\"\n class=\"form-control\" placeholder=\"Color\"\n [ngClass]=\"{'is-valid': formControls.color.touched && formControls.color.valid, 'is-invalid': formControls.color.touched && formControls.color.errors}\"\n required/>\n <div *ngIf=\"formControls.color.touched && formControls.color.errors\"\n class=\"invalid-feedback\">\n <div *ngIf=\"formControls.color.errors.required\">Interval is required</div>\n <div *ngIf=\"formControls.color.errors.pattern\">Color is not a valid hex code</div>\n </div>\n </div>\n </div>\n\n <div class=\"row pt-3 mt-1\">\n <div class=\"col-12 col-sm-6 text-left\">\n <a [routerLink]=\"'/milestones'\" class=\"btn btn-space btn-default\">Back</a>\n </div>\n <div class=\"col-12 col-sm-6 text-right\">\n <button class=\"btn btn-space btn-secondary\" type=\"button\" (click)=\"reset()\">Reset\n </button>\n <button class=\"btn btn-space btn-primary\" type=\"submit\" [disabled]=\"form.invalid\">\n Submit\n </button>\n </div>\n </div>\n </form>\n </div>\n </valtimo-widget>\n </div>\n </div>\n</div>\n",
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 */"]
254
+ },] }
255
+ ];
256
+ MilestoneCreateComponent.ctorParameters = () => [
257
+ { type: MilestoneService },
258
+ { type: FormBuilder },
259
+ { type: Router },
260
+ { type: AlertService },
261
+ { type: ProcessService }
262
+ ];
263
+
264
+ /*
265
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
266
+ *
267
+ * Licensed under EUPL, Version 1.2 (the "License");
268
+ * you may not use this file except in compliance with the License.
269
+ * You may obtain a copy of the License at
270
+ *
271
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
272
+ *
273
+ * Unless required by applicable law or agreed to in writing, software
274
+ * distributed under the License is distributed on an "AS IS" basis,
275
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
276
+ * See the License for the specific language governing permissions and
277
+ * limitations under the License.
278
+ */
279
+ class MilestoneSetEditComponent {
280
+ constructor(milestoneService, formBuilder, router, alertService, route) {
281
+ this.milestoneService = milestoneService;
282
+ this.formBuilder = formBuilder;
283
+ this.router = router;
284
+ this.alertService = alertService;
285
+ this.route = route;
286
+ }
287
+ get formControls() {
288
+ return this.form.controls;
289
+ }
290
+ ngOnInit() {
291
+ this.form = this.formBuilder.group({
292
+ id: new FormControl({ value: '', disabled: true }, Validators.required),
293
+ title: new FormControl({}, Validators.required)
294
+ });
295
+ this.getMilestoneSet();
296
+ }
297
+ reset() {
298
+ this.form.controls.title.setValue('');
299
+ }
300
+ getMilestoneSet() {
301
+ const milestoneSetId = this.route.snapshot.paramMap.get('id');
302
+ this.milestoneService.getMilestoneSet(+milestoneSetId).subscribe((milestoneSet) => {
303
+ this.form.setValue({
304
+ id: milestoneSet.id,
305
+ title: milestoneSet.title
306
+ });
307
+ });
308
+ }
309
+ delete() {
310
+ // Todo: add confirmation dialog after it's fixed
311
+ this.deleteMilestoneSet();
312
+ }
313
+ deleteMilestoneSet() {
314
+ this.milestoneService.deleteMilestoneSet(this.form.getRawValue().id).subscribe(() => {
315
+ this.router.navigate(['/milestones']);
316
+ this.alertService.success('Milestone set has been deleted');
317
+ }, (err) => {
318
+ this.router.navigate(['/milestones']);
319
+ this.alertService.error('Could not delete Milestone set. Make sure this Milestone set does not contain any milestones.');
320
+ });
321
+ }
322
+ updateMilestoneSet() {
323
+ this.milestoneService.updateMilestoneSet(this.form.getRawValue()).subscribe(() => {
324
+ this.router.navigate(['/milestones']);
325
+ this.alertService.success('Milestone set has been updated');
326
+ });
327
+ }
328
+ }
329
+ MilestoneSetEditComponent.decorators = [
330
+ { type: Component, args: [{
331
+ selector: 'valtimo-milestone-set-edit',
332
+ 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 <div class=\"col-12 px-0 mb-5\">\n <valtimo-widget>\n <div class=\"card-body bg-light\">\n <div class=\"row py-5\">\n <div class=\"col-12\">\n <div class=\"row\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>ID</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">{{ form.getRawValue().id }}</div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"bg-white p-5\">\n <form [formGroup]=\"form\" (ngSubmit)=\"updateMilestoneSet()\">\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"title\">Title</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input type=\"text\" id=\"title\" formControlName=\"title\"\n class=\"form-control\" placeholder=\"Milestone set title\"\n [ngClass]=\"{'is-valid': formControls.title.touched && formControls.title.valid, 'is-invalid': formControls.title.touched && formControls.title.errors}\"\n required/>\n <div *ngIf=\"formControls.title.touched && formControls.title.errors\"\n class=\"invalid-feedback\">\n <div *ngIf=\"formControls.title.errors.required\">Title is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"row pt-3 mt-1\">\n <div class=\"col-12 col-sm-6 text-left\">\n <a [routerLink]=\"'/milestones'\" class=\"btn btn-space btn-default\">Back</a>\n <button type=\"button\" class=\"btn btn-space btn-danger\" (click)=\"delete()\">\n Delete\n </button>\n </div>\n <div class=\"col-12 col-sm-6 text-right\">\n <button class=\"btn btn-space btn-secondary\" type=\"button\" (click)=\"reset()\">Reset\n </button>\n <button class=\"btn btn-space btn-primary\" type=\"submit\" [disabled]=\"form.invalid\">\n Submit\n </button>\n </div>\n </div>\n </form>\n </div>\n </valtimo-widget>\n </div>\n </div>\n</div>\n",
333
+ 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 */"]
334
+ },] }
335
+ ];
336
+ MilestoneSetEditComponent.ctorParameters = () => [
337
+ { type: MilestoneService },
338
+ { type: FormBuilder },
339
+ { type: Router },
340
+ { type: AlertService },
341
+ { type: ActivatedRoute }
342
+ ];
343
+
344
+ /*
345
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
346
+ *
347
+ * Licensed under EUPL, Version 1.2 (the "License");
348
+ * you may not use this file except in compliance with the License.
349
+ * You may obtain a copy of the License at
350
+ *
351
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
352
+ *
353
+ * Unless required by applicable law or agreed to in writing, software
354
+ * distributed under the License is distributed on an "AS IS" basis,
355
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
356
+ * See the License for the specific language governing permissions and
357
+ * limitations under the License.
358
+ */
359
+ class MilestoneEditComponent {
360
+ constructor(milestoneService, formBuilder, router, alertService, processService, route) {
361
+ this.milestoneService = milestoneService;
362
+ this.formBuilder = formBuilder;
363
+ this.router = router;
364
+ this.alertService = alertService;
365
+ this.processService = processService;
366
+ this.route = route;
367
+ this.milestoneSets = [];
368
+ this.processDefinitions = [];
369
+ this.taskDefinitions = [];
370
+ }
371
+ get formControls() {
372
+ return this.form.controls;
373
+ }
374
+ ngOnInit() {
375
+ this.form = this.formBuilder.group({
376
+ id: new FormControl({ value: '', disabled: true }, Validators.required),
377
+ milestoneSet: new FormControl('', Validators.required),
378
+ title: new FormControl('', Validators.required),
379
+ processDefinitionKey: new FormControl('', Validators.required),
380
+ taskDefinitionKey: new FormControl('', Validators.required),
381
+ plannedIntervalInDays: new FormControl('', [Validators.required, Validators.pattern('^[0-9]*$')]),
382
+ color: new FormControl('', [Validators.required, Validators.pattern('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')])
383
+ });
384
+ this.getMilestone();
385
+ this.getMilestoneSets();
386
+ this.getProcessDefinitions();
387
+ }
388
+ reset() {
389
+ this.form.patchValue({
390
+ milestoneSet: '',
391
+ title: '',
392
+ processDefinitionKey: '',
393
+ taskDefinitionKey: '',
394
+ plannedIntervalInDays: '',
395
+ color: ''
396
+ });
397
+ }
398
+ getMilestone() {
399
+ const milestoneId = this.route.snapshot.paramMap.get('id');
400
+ this.milestoneService.getMilestone(+milestoneId)
401
+ .pipe(switchMap((milestone) => {
402
+ this.form.patchValue({
403
+ id: milestone.id,
404
+ milestoneSet: milestone.milestoneSet.id,
405
+ title: milestone.title,
406
+ plannedIntervalInDays: milestone.plannedIntervalInDays,
407
+ color: milestone.color,
408
+ taskDefinitionKey: milestone.taskDefinitionKey,
409
+ });
410
+ return this.processService.getProcessDefinition(milestone.processDefinitionKey);
411
+ }))
412
+ .subscribe((processDefinition) => {
413
+ this.form.patchValue({
414
+ processDefinitionKey: processDefinition
415
+ });
416
+ });
417
+ }
418
+ compareProcessDefinitions(processDefinition1, processDefinition2) {
419
+ return processDefinition1.id === processDefinition2.id;
420
+ }
421
+ getMilestoneSets() {
422
+ this.milestoneService.getMilestoneSets().subscribe((milesetoneSets) => {
423
+ this.milestoneSets = milesetoneSets;
424
+ });
425
+ }
426
+ getProcessDefinitions() {
427
+ this.processService.getProcessDefinitions().subscribe((processDefinitions) => {
428
+ this.processDefinitions = processDefinitions;
429
+ });
430
+ }
431
+ getFlownodes(processDefinitionId) {
432
+ if (processDefinitionId) {
433
+ this.milestoneService.getFlownodes(processDefinitionId).subscribe((flowNodes) => {
434
+ this.taskDefinitions = flowNodes['flowNodeMap'];
435
+ });
436
+ }
437
+ }
438
+ delete() {
439
+ // Todo: add confirmation dialog after it's fixed
440
+ this.deleteMilestone();
441
+ }
442
+ deleteMilestone() {
443
+ this.milestoneService.deleteMilestone(this.form.getRawValue().id).subscribe(() => {
444
+ this.router.navigate(['/milestones']);
445
+ this.alertService.success('Milestone has been deleted');
446
+ }, (err) => {
447
+ this.router.navigate(['/milestones']);
448
+ this.alertService.error('Could not delete Milestone');
449
+ });
450
+ }
451
+ updateMilestone() {
452
+ const milestone = this.form.getRawValue();
453
+ milestone.processDefinitionKey = milestone.processDefinitionKey['key'];
454
+ this.milestoneService.updateMilestone(milestone).subscribe(() => {
455
+ this.router.navigate(['/milestones']);
456
+ this.alertService.success('Milestone has been updated');
457
+ }, (err) => {
458
+ this.alertService.error('Error updating milestone');
459
+ });
460
+ }
461
+ }
462
+ MilestoneEditComponent.decorators = [
463
+ { type: Component, args: [{
464
+ selector: 'valtimo-milestone-edit',
465
+ 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 <div class=\"col-12 px-0 mb-5\">\n <valtimo-widget>\n <div class=\"card-body bg-light\">\n <div class=\"row py-5\">\n <div class=\"col-12\">\n <div class=\"row\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>ID</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">{{ form.getRawValue().id }}</div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"bg-white p-5\">\n <form [formGroup]=\"form\" (ngSubmit)=\"updateMilestone()\">\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"title\">Milestone set</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <select type=\"text\" id=\"milestoneSet\" formControlName=\"milestoneSet\"\n class=\"form-control\"\n [ngClass]=\"{'is-valid': formControls.milestoneSet.touched && formControls.milestoneSet.valid, 'is-invalid': formControls.milestoneSet.touched && formControls.milestoneSet.errors}\"\n required>\n <option value=\"\" selected disabled>Choose a Milestone set</option>\n <option *ngFor=\"let milestoneSet of milestoneSets\" [value]=\"milestoneSet.id\">{{milestoneSet.title}} ({{milestoneSet.id}})</option>\n </select>\n <div *ngIf=\"formControls.milestoneSet.touched && formControls.milestoneSet.errors\"\n class=\"invalid-feedback\">\n <div *ngIf=\"formControls.milestoneSet.errors.required\">Milestone set is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"title\">Title</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input type=\"text\" id=\"title\" formControlName=\"title\"\n class=\"form-control\" placeholder=\"Milestone title\"\n [ngClass]=\"{'is-valid': formControls.title.touched && formControls.title.valid, 'is-invalid': formControls.title.touched && formControls.title.errors}\"\n required/>\n <div *ngIf=\"formControls.title.touched && formControls.title.errors\"\n class=\"invalid-feedback\">\n <div *ngIf=\"formControls.title.errors.required\">Title is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"process\">Process definition</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <select type=\"text\" id=\"process\" formControlName=\"processDefinitionKey\"\n class=\"form-control\" (ngModelChange)=\"getFlownodes($event.id)\"\n [ngClass]=\"{'is-valid': formControls.processDefinitionKey.touched && formControls.processDefinitionKey.valid, 'is-invalid': formControls.processDefinitionKey.touched && formControls.processDefinitionKey.errors}\"\n required [compareWith]=\"compareProcessDefinitions\">\n <option value=\"\" disabled>Choose a process</option>\n <option *ngFor=\"let processDefinition of processDefinitions\" [ngValue]=\"processDefinition\">{{processDefinition.name}} ({{processDefinition.key}})</option>\n </select>\n <div *ngIf=\"formControls.processDefinitionKey.touched && formControls.processDefinitionKey.errors\"\n class=\"invalid-feedback\">\n <div *ngIf=\"formControls.processDefinitionKey.errors.required\">Process is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"process\">Task</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <select type=\"text\" id=\"task\" formControlName=\"taskDefinitionKey\"\n class=\"form-control\"\n [ngClass]=\"{'is-valid': formControls.taskDefinitionKey.touched && formControls.taskDefinitionKey.valid, 'is-invalid': formControls.taskDefinitionKey.touched && formControls.taskDefinitionKey.errors}\"\n required>\n <option value=\"\" disabled>Choose a task</option>\n <option *ngFor=\"let taskDefinition of taskDefinitions |keyvalue\" [value]=\"taskDefinition.key\">{{taskDefinition.value}} ({{taskDefinition.key}})</option>\n </select>\n <div *ngIf=\"formControls.taskDefinitionKey.touched && formControls.taskDefinitionKey.errors\"\n class=\"invalid-feedback\">\n <div *ngIf=\"formControls.taskDefinitionKey.errors.required\">Task is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"interval\">Interval (in days)</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input type=\"text\" id=\"interval\" formControlName=\"plannedIntervalInDays\"\n class=\"form-control\" placeholder=\"Interval (in days)\"\n [ngClass]=\"{'is-valid': formControls.plannedIntervalInDays.touched && formControls.plannedIntervalInDays.valid, 'is-invalid': formControls.plannedIntervalInDays.touched && formControls.plannedIntervalInDays.errors}\"\n required/>\n <div *ngIf=\"formControls.plannedIntervalInDays.touched && formControls.plannedIntervalInDays.errors\"\n class=\"invalid-feedback\">\n <div *ngIf=\"formControls.plannedIntervalInDays.errors.required\">Interval is required</div>\n <div *ngIf=\"formControls.plannedIntervalInDays.errors.pattern\">Interval is not a valid number</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"color\">Color</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n\n <input [colorPicker]=\"form.value.color\"\n (colorPickerChange)=\"form.controls.color.setValue($event)\"\n [style.background]=\"form.value.color\"\n type=\"text\" id=\"color\" formControlName=\"color\"\n class=\"form-control\" placeholder=\"Color\"\n [ngClass]=\"{'is-valid': formControls.color.touched && formControls.color.valid, 'is-invalid': formControls.color.touched && formControls.color.errors}\"\n required/>\n <div *ngIf=\"formControls.color.touched && formControls.color.errors\"\n class=\"invalid-feedback\">\n <div *ngIf=\"formControls.color.errors.required\">Color is required</div>\n <div *ngIf=\"formControls.color.errors.pattern\">Color is not a valid hex code</div>\n </div>\n </div>\n </div>\n\n <div class=\"row pt-3 mt-1\">\n <div class=\"col-12 col-sm-6 text-left\">\n <a [routerLink]=\"'/milestones'\" class=\"btn btn-space btn-default\">Back</a>\n <button type=\"button\" class=\"btn btn-space btn-danger\" (click)=\"delete()\">\n Delete\n </button>\n </div>\n <div class=\"col-12 col-sm-6 text-right\">\n <button class=\"btn btn-space btn-secondary\" type=\"button\" (click)=\"reset()\">Reset\n </button>\n <button class=\"btn btn-space btn-primary\" type=\"submit\" [disabled]=\"form.invalid\">\n Submit\n </button>\n </div>\n </div>\n </form>\n </div>\n </valtimo-widget>\n </div>\n </div>\n</div>\n",
466
+ 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 */"]
467
+ },] }
468
+ ];
469
+ MilestoneEditComponent.ctorParameters = () => [
470
+ { type: MilestoneService },
471
+ { type: FormBuilder },
472
+ { type: Router },
473
+ { type: AlertService },
474
+ { type: ProcessService },
475
+ { type: ActivatedRoute }
476
+ ];
477
+
478
+ /*
479
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
480
+ *
481
+ * Licensed under EUPL, Version 1.2 (the "License");
482
+ * you may not use this file except in compliance with the License.
483
+ * You may obtain a copy of the License at
484
+ *
485
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
486
+ *
487
+ * Unless required by applicable law or agreed to in writing, software
488
+ * distributed under the License is distributed on an "AS IS" basis,
489
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
490
+ * See the License for the specific language governing permissions and
491
+ * limitations under the License.
492
+ */
493
+ const ɵ0 = { title: 'Milestones', roles: [ROLE_ADMIN] }, ɵ1 = { title: 'Create new Milestone Set', roles: [ROLE_ADMIN] }, ɵ2 = { title: 'Create new Milestone', roles: [ROLE_ADMIN] }, ɵ3 = { title: 'Milestone Set details', roles: [ROLE_ADMIN] }, ɵ4 = { title: 'Milestone details', roles: [ROLE_ADMIN] };
494
+ const routes = [
495
+ {
496
+ path: 'milestones',
497
+ component: MilestoneComponent,
498
+ canActivate: [AuthGuardService],
499
+ data: ɵ0
500
+ },
501
+ {
502
+ path: 'milestones/sets/create',
503
+ component: MilestoneSetCreateComponent,
504
+ canActivate: [AuthGuardService],
505
+ data: ɵ1
506
+ },
507
+ {
508
+ path: 'milestones/create',
509
+ component: MilestoneCreateComponent,
510
+ canActivate: [AuthGuardService],
511
+ data: ɵ2
512
+ },
513
+ {
514
+ path: 'milestones/sets/set/:id',
515
+ component: MilestoneSetEditComponent,
516
+ canActivate: [AuthGuardService],
517
+ data: ɵ3
518
+ },
519
+ {
520
+ path: 'milestones/milestone/:id',
521
+ component: MilestoneEditComponent,
522
+ canActivate: [AuthGuardService],
523
+ data: ɵ4
524
+ },
525
+ ];
526
+ class MilestoneRoutingModule {
527
+ }
528
+ MilestoneRoutingModule.decorators = [
529
+ { type: NgModule, args: [{
530
+ declarations: [],
531
+ imports: [
532
+ CommonModule,
533
+ RouterModule.forChild(routes),
534
+ ],
535
+ exports: [RouterModule]
536
+ },] }
537
+ ];
538
+
539
+ /*
540
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
541
+ *
542
+ * Licensed under EUPL, Version 1.2 (the "License");
543
+ * you may not use this file except in compliance with the License.
544
+ * You may obtain a copy of the License at
545
+ *
546
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
547
+ *
548
+ * Unless required by applicable law or agreed to in writing, software
549
+ * distributed under the License is distributed on an "AS IS" basis,
550
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
551
+ * See the License for the specific language governing permissions and
552
+ * limitations under the License.
553
+ */
554
+ class MilestoneListComponent {
555
+ constructor(milestoneService, router) {
556
+ this.milestoneService = milestoneService;
557
+ this.router = router;
558
+ this.milestones = [];
559
+ this.milestoneFields = [
560
+ { key: 'id', label: 'ID' },
561
+ { key: 'title', label: 'Title' },
562
+ { key: 'processDefinitionKey', label: 'Process' },
563
+ { key: 'taskDefinitionKey', label: 'Task' },
564
+ { key: 'plannedIntervalInDays', label: 'Interval (in days)' },
565
+ { key: 'color', label: 'Color' },
566
+ ];
567
+ }
568
+ editMilestoneSet(milestoneSetId) {
569
+ this.router.navigate(['milestones/sets/set', milestoneSetId]);
570
+ }
571
+ editMilestone(milestone) {
572
+ this.router.navigate(['milestones/milestone', milestone.id]);
573
+ }
574
+ ngOnInit() {
575
+ combineLatest([this.milestoneService.getMilestones(), this.milestoneService.getMilestoneSets()])
576
+ .subscribe(([milestones, milestoneSets]) => this.handleMilestoneResult(milestones, milestoneSets));
577
+ }
578
+ handleMilestoneResult(milestones, milestoneSets) {
579
+ const milestoneSetsMap = this.getMilestoneSetsMap(milestones, milestoneSets);
580
+ this.setMilestones(milestoneSetsMap);
581
+ }
582
+ setMilestones(milestoneSetsMap) {
583
+ this.milestones = Array.from(milestoneSetsMap.entries()).map(entry => {
584
+ entry[0] = JSON.parse(entry[0]);
585
+ return entry;
586
+ });
587
+ }
588
+ getMilestoneSetsMap(milestones, milestoneSets) {
589
+ const mapWithSets = this.addMilestoneSetsToMap(milestoneSets, this.getEmptyMap());
590
+ return this.addMilestonesToMap(milestones, mapWithSets);
591
+ }
592
+ getEmptyMap() {
593
+ return new Map();
594
+ }
595
+ addMilestoneSetsToMap(milestoneSets, map) {
596
+ milestoneSets.forEach((milestoneSet) => {
597
+ map.set(JSON.stringify(milestoneSet), []);
598
+ });
599
+ return map;
600
+ }
601
+ addMilestonesToMap(milestones, map) {
602
+ milestones.forEach((milestone) => {
603
+ const milestoneSetString = JSON.stringify(milestone.milestoneSet);
604
+ const arr = map.get(milestoneSetString);
605
+ arr.push(milestone);
606
+ map.set(milestoneSetString, arr);
607
+ });
608
+ return map;
609
+ }
610
+ }
611
+ MilestoneListComponent.decorators = [
612
+ { type: Component, args: [{
613
+ selector: 'valtimo-milestone-list',
614
+ 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 *ngFor=\"let milestoneGroup of milestones\" class=\"mb-4\">\n <valtimo-widget>\n <h4 (click)=\"editMilestoneSet(milestoneGroup[0].id)\" class=\"milestone-title\">{{milestoneGroup[0].title}} ({{milestoneGroup[0].id}})</h4>\n <valtimo-list [items]=\"milestoneGroup[1]\" [fields]=\"milestoneFields\" (rowClicked)=\"editMilestone($event)\">\n </valtimo-list>\n </valtimo-widget>\n</div>\n",
615
+ 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 */.milestone-title{background-color:#f8f9f9;border-bottom:1px solid #dee2e6;cursor:pointer;margin:0;padding:1em}"]
616
+ },] }
617
+ ];
618
+ MilestoneListComponent.ctorParameters = () => [
619
+ { type: MilestoneService },
620
+ { type: Router }
621
+ ];
622
+
623
+ /*
624
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
625
+ *
626
+ * Licensed under EUPL, Version 1.2 (the "License");
627
+ * you may not use this file except in compliance with the License.
628
+ * You may obtain a copy of the License at
629
+ *
630
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
631
+ *
632
+ * Unless required by applicable law or agreed to in writing, software
633
+ * distributed under the License is distributed on an "AS IS" basis,
634
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
635
+ * See the License for the specific language governing permissions and
636
+ * limitations under the License.
637
+ */
638
+ class MilestoneModule {
639
+ }
640
+ MilestoneModule.decorators = [
641
+ { type: NgModule, args: [{
642
+ declarations: [MilestoneComponent, MilestoneSetCreateComponent, MilestoneListComponent,
643
+ MilestoneCreateComponent, MilestoneEditComponent, MilestoneSetEditComponent],
644
+ imports: [
645
+ RouterModule,
646
+ MilestoneRoutingModule,
647
+ CommonModule,
648
+ ListModule,
649
+ WidgetModule,
650
+ ReactiveFormsModule,
651
+ ColorPickerModule,
652
+ TranslateModule
653
+ ],
654
+ exports: [MilestoneComponent]
655
+ },] }
656
+ ];
657
+
658
+ /*
659
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
660
+ *
661
+ * Licensed under EUPL, Version 1.2 (the "License");
662
+ * you may not use this file except in compliance with the License.
663
+ * You may obtain a copy of the License at
664
+ *
665
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
666
+ *
667
+ * Unless required by applicable law or agreed to in writing, software
668
+ * distributed under the License is distributed on an "AS IS" basis,
669
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
670
+ * See the License for the specific language governing permissions and
671
+ * limitations under the License.
672
+ */
673
+
674
+ /**
675
+ * Generated bundle index. Do not edit.
676
+ */
677
+
678
+ export { MilestoneComponent, MilestoneModule, MilestoneService, MilestoneSetCreateComponent as ɵa, MilestoneListComponent as ɵb, MilestoneCreateComponent as ɵc, MilestoneEditComponent as ɵd, MilestoneSetEditComponent as ɵe, MilestoneRoutingModule as ɵf };
679
+ //# sourceMappingURL=valtimo-milestone.js.map