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