@valtimo/dashboard-management 10.8.0 → 11.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/components/dashboard-details/dashboard-details.component.mjs +153 -0
- package/esm2022/lib/components/dashboard-management/dashboard-management.component.mjs +119 -0
- package/esm2022/lib/components/edit-dashboard-modal/edit-dashboard-modal.mjs +99 -0
- package/esm2022/lib/components/widget-configuration-container/widget-configuration-container.component.mjs +137 -0
- package/esm2022/lib/components/widget-modal/widget-modal.component.mjs +250 -0
- package/{esm2020 → esm2022}/lib/dashboard-management-routing.module.mjs +5 -5
- package/esm2022/lib/dashboard-management.module.mjs +100 -0
- package/esm2022/lib/models/dashboard-item.type.mjs +17 -0
- package/esm2022/lib/models/index.mjs +18 -0
- package/esm2022/lib/models/widget.model.mjs +17 -0
- package/esm2022/lib/services/dashboard-management.service.mjs +88 -0
- package/{esm2020 → esm2022}/public-api.mjs +2 -2
- package/fesm2022/valtimo-dashboard-management.mjs +969 -0
- package/fesm2022/valtimo-dashboard-management.mjs.map +1 -0
- package/lib/components/dashboard-details/dashboard-details.component.d.ts +4 -4
- package/lib/components/dashboard-management/dashboard-management.component.d.ts +4 -4
- package/lib/components/edit-dashboard-modal/edit-dashboard-modal.d.ts +1 -1
- package/lib/components/widget-configuration-container/widget-configuration-container.component.d.ts +1 -1
- package/lib/components/widget-modal/widget-modal.component.d.ts +1 -1
- package/lib/dashboard-management.module.d.ts +4 -4
- package/lib/models/widget.model.d.ts +1 -1
- package/package.json +8 -14
- package/esm2020/lib/components/dashboard-details/dashboard-details.component.mjs +0 -155
- package/esm2020/lib/components/dashboard-management/dashboard-management.component.mjs +0 -106
- package/esm2020/lib/components/edit-dashboard-modal/edit-dashboard-modal.mjs +0 -99
- package/esm2020/lib/components/widget-configuration-container/widget-configuration-container.component.mjs +0 -137
- package/esm2020/lib/components/widget-modal/widget-modal.component.mjs +0 -235
- package/esm2020/lib/dashboard-management.module.mjs +0 -100
- package/esm2020/lib/models/dashboard-item.type.mjs +0 -2
- package/esm2020/lib/models/index.mjs +0 -3
- package/esm2020/lib/models/widget.model.mjs +0 -2
- package/esm2020/lib/services/dashboard-management.service.mjs +0 -88
- package/fesm2015/valtimo-dashboard-management.mjs +0 -949
- package/fesm2015/valtimo-dashboard-management.mjs.map +0 -1
- package/fesm2020/valtimo-dashboard-management.mjs +0 -940
- package/fesm2020/valtimo-dashboard-management.mjs.map +0 -1
- /package/{esm2020 → esm2022}/valtimo-dashboard-management.mjs +0 -0
|
@@ -1,940 +0,0 @@
|
|
|
1
|
-
import * as i6 from '@angular/common';
|
|
2
|
-
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
3
|
-
import * as i0 from '@angular/core';
|
|
4
|
-
import { Injectable, EventEmitter, ViewContainerRef, Component, ViewChild, Input, Output, ViewEncapsulation, Inject, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
|
5
|
-
import * as i1$1 from '@angular/forms';
|
|
6
|
-
import { Validators, ReactiveFormsModule } from '@angular/forms';
|
|
7
|
-
import * as i2$1 from '@ngx-translate/core';
|
|
8
|
-
import { TranslateModule } from '@ngx-translate/core';
|
|
9
|
-
import * as i4 from '@valtimo/components';
|
|
10
|
-
import { CARBON_CONSTANTS, createCarbonTableConfig, ColumnType, CarbonTableModule, ListModule, SpinnerModule, RenderInPageHeaderDirectiveModule, ConfirmationModalModule } from '@valtimo/components';
|
|
11
|
-
import * as i3 from 'carbon-components-angular';
|
|
12
|
-
import { NotificationService, ButtonModule, DropdownModule, InputModule, ModalModule, NotificationModule, IconModule } from 'carbon-components-angular';
|
|
13
|
-
import { ArrowDown16, ArrowUp16, Edit16 } from '@carbon/icons';
|
|
14
|
-
import { BehaviorSubject, take, tap, switchMap, catchError, of, Subscription, combineLatest, filter, map, finalize } from 'rxjs';
|
|
15
|
-
import * as i1 from '@angular/common/http';
|
|
16
|
-
import * as i2 from '@valtimo/config';
|
|
17
|
-
import { ROLE_ADMIN } from '@valtimo/config';
|
|
18
|
-
import * as i5$1 from '@angular/router';
|
|
19
|
-
import { RouterModule } from '@angular/router';
|
|
20
|
-
import * as i5 from '@valtimo/dashboard';
|
|
21
|
-
import { WidgetTranslatePipeModule } from '@valtimo/dashboard';
|
|
22
|
-
import { tap as tap$1 } from 'rxjs/operators';
|
|
23
|
-
import { AuthGuardService } from '@valtimo/security';
|
|
24
|
-
|
|
25
|
-
class DashboardManagementService {
|
|
26
|
-
constructor(http, configService) {
|
|
27
|
-
this.http = http;
|
|
28
|
-
this.configService = configService;
|
|
29
|
-
this.dashboards$ = new BehaviorSubject({
|
|
30
|
-
items: null,
|
|
31
|
-
loading: true,
|
|
32
|
-
});
|
|
33
|
-
this.valtimoEndpointUri = `${this.configService.config.valtimoApi.endpointUri}management/v1/dashboard`;
|
|
34
|
-
}
|
|
35
|
-
loadData() {
|
|
36
|
-
this.http
|
|
37
|
-
.get(this.valtimoEndpointUri)
|
|
38
|
-
.pipe(take(1), tap(() => {
|
|
39
|
-
this.dashboards$.next({ items: null, loading: true });
|
|
40
|
-
}))
|
|
41
|
-
.subscribe({
|
|
42
|
-
next: (items) => {
|
|
43
|
-
this.dashboards$.next({ items, loading: false });
|
|
44
|
-
},
|
|
45
|
-
error: error => {
|
|
46
|
-
console.error(error);
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
createDashboard(dashboard) {
|
|
51
|
-
return this.http.post(this.valtimoEndpointUri, dashboard);
|
|
52
|
-
}
|
|
53
|
-
updateDashboards(dashboards) {
|
|
54
|
-
return this.http.put(this.valtimoEndpointUri, dashboards);
|
|
55
|
-
}
|
|
56
|
-
updateDashboard(dashboard) {
|
|
57
|
-
return this.http.put(`${this.valtimoEndpointUri}/${dashboard.key}`, dashboard);
|
|
58
|
-
}
|
|
59
|
-
deleteDashboard(dashboardKey) {
|
|
60
|
-
return this.http.delete(`${this.valtimoEndpointUri}/${dashboardKey}`);
|
|
61
|
-
}
|
|
62
|
-
dispatchAction(actionResult) {
|
|
63
|
-
actionResult
|
|
64
|
-
.pipe(switchMap(() => this.getDashboards()), tap(() => {
|
|
65
|
-
this.dashboards$.next({ items: null, loading: true });
|
|
66
|
-
}), take(1), catchError(error => of(error)))
|
|
67
|
-
.subscribe({
|
|
68
|
-
next: (items) => this.dashboards$.next({ items, loading: false }),
|
|
69
|
-
error: error => {
|
|
70
|
-
console.error(error);
|
|
71
|
-
},
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
getDashboard(dashboardKey) {
|
|
75
|
-
return this.http.get(`${this.valtimoEndpointUri}/${dashboardKey}`);
|
|
76
|
-
}
|
|
77
|
-
getDashboardWidgetConfiguration(dashboardKey) {
|
|
78
|
-
return this.http.get(`${this.valtimoEndpointUri}/${dashboardKey}/widget-configuration`);
|
|
79
|
-
}
|
|
80
|
-
createDashboardWidgetConfiguration(dashboardKey, widgetConfiguration) {
|
|
81
|
-
return this.http.post(`${this.valtimoEndpointUri}/${dashboardKey}/widget-configuration`, widgetConfiguration);
|
|
82
|
-
}
|
|
83
|
-
updateDashboardWidgetConfigurations(dashboardKey, widgetConfigurations) {
|
|
84
|
-
return this.http.put(`${this.valtimoEndpointUri}/${dashboardKey}/widget-configuration`, widgetConfigurations);
|
|
85
|
-
}
|
|
86
|
-
updateDashboardWidgetConfiguration(dashboardKey, widgetConfiguration) {
|
|
87
|
-
return this.http.put(`${this.valtimoEndpointUri}/${dashboardKey}/widget-configuration/${widgetConfiguration.key}`, widgetConfiguration);
|
|
88
|
-
}
|
|
89
|
-
deleteDashboardWidgetConfiguration(dashboardKey, widgetKey) {
|
|
90
|
-
return this.http.delete(`${this.valtimoEndpointUri}/${dashboardKey}/widget-configuration/${widgetKey}`);
|
|
91
|
-
}
|
|
92
|
-
getDataSources() {
|
|
93
|
-
return this.http.get(`${this.valtimoEndpointUri}/widget-data-sources`);
|
|
94
|
-
}
|
|
95
|
-
getDashboards() {
|
|
96
|
-
return this.http.get(this.valtimoEndpointUri);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
DashboardManagementService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DashboardManagementService, deps: [{ token: i1.HttpClient }, { token: i2.ConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
100
|
-
DashboardManagementService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DashboardManagementService, providedIn: 'root' });
|
|
101
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DashboardManagementService, decorators: [{
|
|
102
|
-
type: Injectable,
|
|
103
|
-
args: [{
|
|
104
|
-
providedIn: 'root',
|
|
105
|
-
}]
|
|
106
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2.ConfigService }]; } });
|
|
107
|
-
|
|
108
|
-
/*
|
|
109
|
-
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
110
|
-
*
|
|
111
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
112
|
-
* you may not use this file except in compliance with the License.
|
|
113
|
-
* You may obtain a copy of the License at
|
|
114
|
-
*
|
|
115
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
116
|
-
*
|
|
117
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
118
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
119
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
120
|
-
* See the License for the specific language governing permissions and
|
|
121
|
-
* limitations under the License.
|
|
122
|
-
*/
|
|
123
|
-
class WidgetConfigurationContainerComponent {
|
|
124
|
-
constructor(widgetService) {
|
|
125
|
-
this.widgetService = widgetService;
|
|
126
|
-
this.configurationEvent = new EventEmitter();
|
|
127
|
-
this._subscriptions = new Subscription();
|
|
128
|
-
this._componentRef$ = new BehaviorSubject(undefined);
|
|
129
|
-
this._dataSourceKey$ = new BehaviorSubject('');
|
|
130
|
-
this._displayTypeKey$ = new BehaviorSubject('');
|
|
131
|
-
this._disabled$ = new BehaviorSubject(false);
|
|
132
|
-
this._prefillConfiguration$ = new BehaviorSubject(null);
|
|
133
|
-
}
|
|
134
|
-
set dataSourceKey(value) {
|
|
135
|
-
this._dataSourceKey$.next(value);
|
|
136
|
-
}
|
|
137
|
-
set displayTypeKey(value) {
|
|
138
|
-
this._displayTypeKey$.next(value);
|
|
139
|
-
}
|
|
140
|
-
set disabled(disabledValue) {
|
|
141
|
-
this._disabled$.next(disabledValue);
|
|
142
|
-
}
|
|
143
|
-
set prefillConfiguration(prefillConfigurationValue) {
|
|
144
|
-
this._prefillConfiguration$.next(prefillConfigurationValue);
|
|
145
|
-
}
|
|
146
|
-
ngOnInit() {
|
|
147
|
-
this.openConfigurationComponentSubscription();
|
|
148
|
-
this.openComponentInstanceSubscription();
|
|
149
|
-
this.openDisabledSubscription();
|
|
150
|
-
this.openPrefillConfigurationSubscription();
|
|
151
|
-
}
|
|
152
|
-
ngOnDestroy() {
|
|
153
|
-
this._subscriptions.unsubscribe();
|
|
154
|
-
}
|
|
155
|
-
openConfigurationComponentSubscription() {
|
|
156
|
-
this._subscriptions.add(combineLatest([
|
|
157
|
-
this._displayTypeKey$,
|
|
158
|
-
this._dataSourceKey$,
|
|
159
|
-
this.widgetService.supportedDisplayTypes$,
|
|
160
|
-
this.widgetService.supportedDataSources$,
|
|
161
|
-
])
|
|
162
|
-
.pipe(tap$1(([displayTypeKey, dataSourceKey, supportedDisplayTypes, supportedDataSources]) => {
|
|
163
|
-
let configurationComponent;
|
|
164
|
-
this._dynamicContainer.clear();
|
|
165
|
-
const displayTypeSpecification = displayTypeKey &&
|
|
166
|
-
supportedDisplayTypes.find(type => type.displayTypeKey === displayTypeKey);
|
|
167
|
-
const dataSourceSpecification = dataSourceKey &&
|
|
168
|
-
supportedDataSources.find(source => source.dataSourceKey === dataSourceKey);
|
|
169
|
-
if (displayTypeSpecification && displayTypeSpecification.configurationComponent) {
|
|
170
|
-
configurationComponent = displayTypeSpecification.configurationComponent;
|
|
171
|
-
}
|
|
172
|
-
else if (dataSourceSpecification && dataSourceSpecification.configurationComponent) {
|
|
173
|
-
configurationComponent = dataSourceSpecification.configurationComponent;
|
|
174
|
-
}
|
|
175
|
-
if (configurationComponent) {
|
|
176
|
-
const componentRef = this._dynamicContainer.createComponent(configurationComponent);
|
|
177
|
-
this.configurationEvent.emit({ valid: false, data: {} });
|
|
178
|
-
this._componentRef$.next(componentRef);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
this.configurationEvent.emit({ valid: true, data: {} });
|
|
182
|
-
}
|
|
183
|
-
}))
|
|
184
|
-
.subscribe());
|
|
185
|
-
}
|
|
186
|
-
openComponentInstanceSubscription() {
|
|
187
|
-
this._subscriptions.add(combineLatest([this._componentRef$, this._dataSourceKey$, this._displayTypeKey$]).subscribe(([ref, dataSourceKey, displayTypeKey]) => {
|
|
188
|
-
const instance = ref?.instance;
|
|
189
|
-
this._configurationSubscription?.unsubscribe();
|
|
190
|
-
if (instance) {
|
|
191
|
-
if (displayTypeKey) {
|
|
192
|
-
instance.displayTypeKey = displayTypeKey;
|
|
193
|
-
}
|
|
194
|
-
else if (dataSourceKey) {
|
|
195
|
-
instance.dataSourceKey = dataSourceKey;
|
|
196
|
-
}
|
|
197
|
-
this._configurationSubscription = instance.configurationEvent.subscribe(configuration => {
|
|
198
|
-
this.configurationEvent.emit(configuration);
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
}));
|
|
202
|
-
}
|
|
203
|
-
openDisabledSubscription() {
|
|
204
|
-
this._subscriptions.add(combineLatest([this._componentRef$, this._disabled$]).subscribe(([ref, disabled]) => {
|
|
205
|
-
const instance = ref?.instance;
|
|
206
|
-
if (instance) {
|
|
207
|
-
instance.disabled = disabled;
|
|
208
|
-
}
|
|
209
|
-
}));
|
|
210
|
-
}
|
|
211
|
-
openPrefillConfigurationSubscription() {
|
|
212
|
-
this._subscriptions.add(combineLatest([this._componentRef$, this._prefillConfiguration$]).subscribe(([ref, prefillConfiguration]) => {
|
|
213
|
-
const instance = ref?.instance;
|
|
214
|
-
if (instance && prefillConfiguration) {
|
|
215
|
-
instance.prefillConfiguration = prefillConfiguration;
|
|
216
|
-
}
|
|
217
|
-
}));
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
WidgetConfigurationContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: WidgetConfigurationContainerComponent, deps: [{ token: i5.WidgetService }], target: i0.ɵɵFactoryTarget.Component });
|
|
221
|
-
WidgetConfigurationContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: WidgetConfigurationContainerComponent, selector: "valtimo-widget-configuration-container", inputs: { dataSourceKey: "dataSourceKey", displayTypeKey: "displayTypeKey", disabled: "disabled", prefillConfiguration: "prefillConfiguration" }, outputs: { configurationEvent: "configurationEvent" }, viewQueries: [{ propertyName: "_dynamicContainer", first: true, predicate: ["widgetConfigurationComponent"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 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<ng-template #widgetConfigurationComponent></ng-template>\n" });
|
|
222
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: WidgetConfigurationContainerComponent, decorators: [{
|
|
223
|
-
type: Component,
|
|
224
|
-
args: [{ selector: 'valtimo-widget-configuration-container', template: "<!--\n ~ Copyright 2015-2023 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<ng-template #widgetConfigurationComponent></ng-template>\n" }]
|
|
225
|
-
}], ctorParameters: function () { return [{ type: i5.WidgetService }]; }, propDecorators: { _dynamicContainer: [{
|
|
226
|
-
type: ViewChild,
|
|
227
|
-
args: ['widgetConfigurationComponent', { static: true, read: ViewContainerRef }]
|
|
228
|
-
}], dataSourceKey: [{
|
|
229
|
-
type: Input
|
|
230
|
-
}], displayTypeKey: [{
|
|
231
|
-
type: Input
|
|
232
|
-
}], disabled: [{
|
|
233
|
-
type: Input
|
|
234
|
-
}], prefillConfiguration: [{
|
|
235
|
-
type: Input
|
|
236
|
-
}], configurationEvent: [{
|
|
237
|
-
type: Output
|
|
238
|
-
}] } });
|
|
239
|
-
|
|
240
|
-
class WidgetModalComponent {
|
|
241
|
-
constructor(document, fb, translateService, notificationService, dashboardManagementService, widgetService, widgetTranslationService) {
|
|
242
|
-
this.document = document;
|
|
243
|
-
this.fb = fb;
|
|
244
|
-
this.translateService = translateService;
|
|
245
|
-
this.notificationService = notificationService;
|
|
246
|
-
this.dashboardManagementService = dashboardManagementService;
|
|
247
|
-
this.widgetService = widgetService;
|
|
248
|
-
this.widgetTranslationService = widgetTranslationService;
|
|
249
|
-
this.saveEvent = new EventEmitter();
|
|
250
|
-
this.form = this.fb.group({
|
|
251
|
-
title: this.fb.control('', [Validators.required]),
|
|
252
|
-
dataSource: this.fb.control(null, [Validators.required]),
|
|
253
|
-
displayType: this.fb.control(null, [Validators.required]),
|
|
254
|
-
});
|
|
255
|
-
this.open$ = new BehaviorSubject(false);
|
|
256
|
-
this.selectedDataSourceKey$ = new BehaviorSubject('');
|
|
257
|
-
this.selectedDisplayTypeKey$ = new BehaviorSubject('');
|
|
258
|
-
this.dataSourceItems$ = combineLatest([
|
|
259
|
-
this.dashboardManagementService.getDataSources(),
|
|
260
|
-
this.selectedDataSourceKey$,
|
|
261
|
-
this.widgetService.supportedDataSources$,
|
|
262
|
-
this.translateService.stream('key'),
|
|
263
|
-
]).pipe(filter(([dataSources]) => !!dataSources), tap(([dataSources, selectedDataSourceKey]) => {
|
|
264
|
-
if (selectedDataSourceKey) {
|
|
265
|
-
this.setCompatibleDisplayTypes(dataSources, selectedDataSourceKey);
|
|
266
|
-
}
|
|
267
|
-
else {
|
|
268
|
-
this.resetCompatibleDisplayTypes();
|
|
269
|
-
}
|
|
270
|
-
}), map(([dataSources, selectedDataSourceKey, supportedDataSources]) => dataSources
|
|
271
|
-
.filter(dataSource => supportedDataSources.find(supportedDataSource => supportedDataSource.dataSourceKey === dataSource.key))
|
|
272
|
-
.map(dataSource => ({
|
|
273
|
-
content: this.widgetTranslationService.instant('title', dataSource.key),
|
|
274
|
-
selected: selectedDataSourceKey === dataSource.key,
|
|
275
|
-
key: dataSource.key,
|
|
276
|
-
}))));
|
|
277
|
-
this.dataSourcePrefillConfig$ = new BehaviorSubject(null);
|
|
278
|
-
this.displayTypePrefillConfig$ = new BehaviorSubject(null);
|
|
279
|
-
this._compatibleDisplayTypes$ = new BehaviorSubject([]);
|
|
280
|
-
this.displayTypeItems$ = combineLatest([
|
|
281
|
-
this._compatibleDisplayTypes$,
|
|
282
|
-
this.selectedDisplayTypeKey$,
|
|
283
|
-
this.translateService.stream('key'),
|
|
284
|
-
]).pipe(map(([compatibleDisplayTypes, selectedDisplayTypeKey]) => compatibleDisplayTypes.map(displayType => ({
|
|
285
|
-
content: this.widgetTranslationService.instant('title', displayType.displayTypeKey),
|
|
286
|
-
selected: displayType.displayTypeKey === selectedDisplayTypeKey,
|
|
287
|
-
key: displayType.displayTypeKey,
|
|
288
|
-
}))));
|
|
289
|
-
this.displayTypeDropdownDisabled$ = combineLatest([
|
|
290
|
-
this._compatibleDisplayTypes$,
|
|
291
|
-
this.selectedDataSourceKey$,
|
|
292
|
-
]).pipe(map(([compatibleDisplayTypes, selectedDataSourceKey]) => compatibleDisplayTypes?.length === 0 || !selectedDataSourceKey), tap(displayTypeDropdownDisabled => {
|
|
293
|
-
if (displayTypeDropdownDisabled) {
|
|
294
|
-
this.displayType?.disable();
|
|
295
|
-
}
|
|
296
|
-
else {
|
|
297
|
-
this.displayType?.enable();
|
|
298
|
-
}
|
|
299
|
-
}));
|
|
300
|
-
this.dataSourceConfiguration$ = new BehaviorSubject({
|
|
301
|
-
valid: false,
|
|
302
|
-
data: {},
|
|
303
|
-
});
|
|
304
|
-
this.displayTypeConfiguration$ = new BehaviorSubject({
|
|
305
|
-
valid: false,
|
|
306
|
-
data: {},
|
|
307
|
-
});
|
|
308
|
-
this.disabled$ = new BehaviorSubject(false);
|
|
309
|
-
}
|
|
310
|
-
set editWidgetConfiguration(configuration) {
|
|
311
|
-
if (configuration) {
|
|
312
|
-
this.title.setValue(configuration.title);
|
|
313
|
-
this.dataSourceSelected({ item: { key: configuration.dataSourceKey } });
|
|
314
|
-
this.displayTypeSelected({ item: { key: configuration.displayType } });
|
|
315
|
-
this.dataSourcePrefillConfig$.next(configuration.dataSourceProperties);
|
|
316
|
-
this.displayTypePrefillConfig$.next(configuration.displayTypeProperties);
|
|
317
|
-
}
|
|
318
|
-
else {
|
|
319
|
-
this.dataSourcePrefillConfig$.next(null);
|
|
320
|
-
this.displayTypePrefillConfig$.next(null);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
get title() {
|
|
324
|
-
return this.form.get('title');
|
|
325
|
-
}
|
|
326
|
-
get key() {
|
|
327
|
-
return this.form.get('key');
|
|
328
|
-
}
|
|
329
|
-
get dataSource() {
|
|
330
|
-
return this.form.get('dataSource');
|
|
331
|
-
}
|
|
332
|
-
get displayType() {
|
|
333
|
-
return this.form.get('displayType');
|
|
334
|
-
}
|
|
335
|
-
ngOnInit() {
|
|
336
|
-
this.openOpenSubscription();
|
|
337
|
-
}
|
|
338
|
-
ngOnDestroy() {
|
|
339
|
-
this._openSubscription?.unsubscribe();
|
|
340
|
-
}
|
|
341
|
-
closeModal() {
|
|
342
|
-
this.open$.next(false);
|
|
343
|
-
setTimeout(() => {
|
|
344
|
-
this.enable();
|
|
345
|
-
this.form.reset();
|
|
346
|
-
this.selectedDataSourceKey$.next('');
|
|
347
|
-
this.selectedDisplayTypeKey$.next('');
|
|
348
|
-
}, CARBON_CONSTANTS.modalAnimationMs);
|
|
349
|
-
}
|
|
350
|
-
save() {
|
|
351
|
-
this.disable();
|
|
352
|
-
combineLatest([
|
|
353
|
-
this.selectedDataSourceKey$,
|
|
354
|
-
this.selectedDisplayTypeKey$,
|
|
355
|
-
this.displayTypeConfiguration$,
|
|
356
|
-
this.dataSourceConfiguration$,
|
|
357
|
-
])
|
|
358
|
-
.pipe(take(1), map(([selectedDataSourceKey, selectedDisplayTypeKey, displayTypeConfiguration, dataSourceConfiguration,]) => ({
|
|
359
|
-
title: this.title.value,
|
|
360
|
-
displayType: selectedDisplayTypeKey,
|
|
361
|
-
dataSourceKey: selectedDataSourceKey,
|
|
362
|
-
dataSourceProperties: { ...dataSourceConfiguration.data },
|
|
363
|
-
displayTypeProperties: { ...displayTypeConfiguration.data },
|
|
364
|
-
})), switchMap(widgetUpdateObject => this.type === 'create'
|
|
365
|
-
? this.dashboardManagementService.createDashboardWidgetConfiguration(this.dashboard.key, widgetUpdateObject)
|
|
366
|
-
: this.dashboardManagementService.updateDashboardWidgetConfiguration(this.dashboard.key, { ...widgetUpdateObject, key: this.widgetKey })))
|
|
367
|
-
.subscribe({
|
|
368
|
-
complete: () => {
|
|
369
|
-
this.saveEvent.emit();
|
|
370
|
-
this.closeModal();
|
|
371
|
-
},
|
|
372
|
-
error: () => {
|
|
373
|
-
this.enable();
|
|
374
|
-
},
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
delete() {
|
|
378
|
-
this.disable();
|
|
379
|
-
this.dashboardManagementService
|
|
380
|
-
.deleteDashboardWidgetConfiguration(this.dashboard.key, this.widgetKey)
|
|
381
|
-
.subscribe({
|
|
382
|
-
complete: () => {
|
|
383
|
-
this.saveEvent.emit();
|
|
384
|
-
this.closeModal();
|
|
385
|
-
},
|
|
386
|
-
error: () => {
|
|
387
|
-
this.enable();
|
|
388
|
-
},
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
dataSourceSelected(dataSource) {
|
|
392
|
-
if (!dataSource) {
|
|
393
|
-
return;
|
|
394
|
-
}
|
|
395
|
-
this.selectedDataSourceKey$.next(dataSource?.item?.key);
|
|
396
|
-
this.dataSource.setValue(dataSource?.item?.key);
|
|
397
|
-
}
|
|
398
|
-
displayTypeSelected(displayType) {
|
|
399
|
-
if (!displayType) {
|
|
400
|
-
return;
|
|
401
|
-
}
|
|
402
|
-
this.selectedDisplayTypeKey$.next(displayType?.item?.key);
|
|
403
|
-
this.displayType.setValue(displayType?.item?.key);
|
|
404
|
-
}
|
|
405
|
-
dataSourceConfiguration(configuration) {
|
|
406
|
-
this.dataSourceConfiguration$.next(configuration);
|
|
407
|
-
}
|
|
408
|
-
displayTypeConfiguration(configuration) {
|
|
409
|
-
this.displayTypeConfiguration$.next(configuration);
|
|
410
|
-
}
|
|
411
|
-
openOpenSubscription() {
|
|
412
|
-
this._openSubscription = this.showModal$.subscribe(show => {
|
|
413
|
-
this.open$.next(show);
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
resetCompatibleDisplayTypes() {
|
|
417
|
-
this._compatibleDisplayTypes$.next([]);
|
|
418
|
-
}
|
|
419
|
-
setCompatibleDisplayTypes(dataSources, selectedDataSourceKey) {
|
|
420
|
-
this.widgetService.supportedDisplayTypes$.pipe(take(1)).subscribe(supportedDisplayTypes => {
|
|
421
|
-
const selectedDataSource = dataSources.find(source => source.key === selectedDataSourceKey);
|
|
422
|
-
const availableDataFeatures = selectedDataSource?.dataFeatures;
|
|
423
|
-
const compatibleDisplayTypes = supportedDisplayTypes.filter(displayType => {
|
|
424
|
-
const supportedDataFeatures = displayType.requiredDataFeatures.filter(feature => availableDataFeatures?.includes(feature));
|
|
425
|
-
return supportedDataFeatures.length === displayType.requiredDataFeatures.length;
|
|
426
|
-
});
|
|
427
|
-
this._compatibleDisplayTypes$.next(compatibleDisplayTypes);
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
disable() {
|
|
431
|
-
this.disabled$.next(true);
|
|
432
|
-
this.form.disable();
|
|
433
|
-
}
|
|
434
|
-
enable() {
|
|
435
|
-
this.disabled$.next(false);
|
|
436
|
-
this.form.enable();
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
WidgetModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: WidgetModalComponent, deps: [{ token: DOCUMENT }, { token: i1$1.FormBuilder }, { token: i2$1.TranslateService }, { token: i3.NotificationService }, { token: DashboardManagementService }, { token: i5.WidgetService }, { token: i5.WidgetTranslationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
440
|
-
WidgetModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: WidgetModalComponent, selector: "valtimo-widget-modal", inputs: { showModal$: "showModal$", type: "type", dashboard: "dashboard", widgetKey: "widgetKey", editWidgetConfiguration: "editWidgetConfiguration" }, outputs: { saveEvent: "saveEvent" }, providers: [NotificationService], ngImport: i0, template: "<ng-container\n *ngIf=\"{\n disabled: disabled$ | async,\n isCreate: type === 'create',\n isDelete: type === 'delete',\n isEdit: type === 'edit',\n open: open$ | async\n } as vars\"\n>\n <ng-container\n *ngIf=\"{\n create: vars.isCreate && ('dashboardManagement.widgets.add' | translate),\n delete: vars.isDelete && ('dashboardManagement.widgets.delete' | translate),\n edit: vars.isEdit && ('dashboardManagement.widgets.edit' | translate)\n } as titles\"\n >\n <cds-modal\n *ngIf=\"{\n title: titles.edit || titles.create || titles.delete\n } as translations\"\n valtimoCdsModal\n [open]=\"vars.open\"\n showFooter=\"true\"\n size=\"md\"\n title=\"{{ translations.title }}\"\n class=\"widget-modal\"\n >\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"closeModal()\">\n <h3 cdsModalHeaderHeading>\n {{ translations.title }}\n </h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <ng-container *ngIf=\"vars.isDelete\">\n {{ 'dashboardManagement.widgets.deleteDescription' | translate }}</ng-container\n >\n\n <ng-container *ngIf=\"vars.isEdit || vars.isCreate\">\n <ng-container *ngTemplateOutlet=\"widgetForm; context: {vars: vars}\"></ng-container>\n </ng-container>\n </section>\n\n <cds-modal-footer>\n <ng-container *ngIf=\"vars.isEdit || vars.isCreate\">\n <ng-container *ngTemplateOutlet=\"editButtons; context: {vars: vars}\"></ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"vars.isDelete\">\n <ng-container *ngTemplateOutlet=\"deleteButtons; context: {vars: vars}\"></ng-container>\n </ng-container>\n </cds-modal-footer>\n </cds-modal>\n </ng-container>\n</ng-container>\n\n<ng-template #widgetForm let-vars=\"vars\">\n <form\n *ngIf=\"\n form && {\n dataSourceItems: dataSourceItems$ | async,\n displayTypeDropdownDisabled: displayTypeDropdownDisabled$ | async,\n displayTypeItems: displayTypeItems$ | async,\n selectedDataSourceKey: selectedDataSourceKey$ | async,\n selectedDisplayTypeKey: selectedDisplayTypeKey$ | async\n } as obs\n \"\n [formGroup]=\"form\"\n class=\"dashboard-modal__form\"\n >\n <div class=\"form__element\">\n <cds-label\n [helperText]=\"'dashboardManagement.widgets.form.titleHelperText' | translate\"\n [invalidText]=\"'dashboardManagement.widgets.form.titleHelperText' | translate\"\n [invalid]=\"title.dirty && title.invalid\"\n >\n {{ 'dashboardManagement.widgets.form.title' | translate }}\n\n <input\n cdsText\n formControlName=\"title\"\n [invalid]=\"title.dirty && title.invalid\"\n [attr.modal-primary-focus]=\"true\"\n />\n </cds-label>\n </div>\n\n <div class=\"form__element\" *ngIf=\"obs.dataSourceItems\">\n <cds-dropdown\n formControlName=\"dataSource\"\n [helperText]=\"'dashboardManagement.widgets.form.dataSourceHelperText' | translate\"\n [invalidText]=\"'dashboardManagement.widgets.form.dateSourceHelperText' | translate\"\n [invalid]=\"dataSource.dirty && dataSource.invalid\"\n [label]=\"'dashboardManagement.widgets.form.dataSource' | translate\"\n (selected)=\"dataSourceSelected($event)\"\n >\n <cds-dropdown-list [items]=\"obs.dataSourceItems\" type=\"multi\"></cds-dropdown-list>\n </cds-dropdown>\n </div>\n\n <valtimo-widget-configuration-container\n *ngIf=\"obs.selectedDataSourceKey\"\n [dataSourceKey]=\"obs.selectedDataSourceKey\"\n [disabled]=\"vars.disabled\"\n [prefillConfiguration]=\"dataSourcePrefillConfig$ | async\"\n (configurationEvent)=\"dataSourceConfiguration($event)\"\n ></valtimo-widget-configuration-container>\n\n <div class=\"form__element\" *ngIf=\"obs.displayTypeItems\">\n <cds-dropdown\n formControlName=\"displayType\"\n [helperText]=\"'dashboardManagement.widgets.form.displayTypeHelperText' | translate\"\n [invalid]=\"displayType.dirty && displayType.invalid\"\n [invalidText]=\"'dashboardManagement.widgets.form.displayTypeHelperText' | translate\"\n [label]=\"'dashboardManagement.widgets.form.displayType' | translate\"\n (selected)=\"displayTypeSelected($event)\"\n >\n <cds-dropdown-list [items]=\"obs.displayTypeItems\" type=\"multi\"></cds-dropdown-list>\n </cds-dropdown>\n </div>\n\n <valtimo-widget-configuration-container\n *ngIf=\"obs.selectedDisplayTypeKey\"\n [disabled]=\"vars.disabled\"\n [displayTypeKey]=\"obs.selectedDisplayTypeKey\"\n [prefillConfiguration]=\"displayTypePrefillConfig$ | async\"\n (configurationEvent)=\"displayTypeConfiguration($event)\"\n ></valtimo-widget-configuration-container>\n </form>\n</ng-template>\n\n<ng-template #editButtons let-vars=\"vars\">\n <ng-container\n *ngIf=\"{\n dataSourceConfiguration: dataSourceConfiguration$ | async,\n displayTypeConfiguration: displayTypeConfiguration$ | async\n } as obs\"\n >\n <button cdsButton=\"ghost\" [disabled]=\"vars.disabled\" (click)=\"closeModal()\">\n {{ 'dashboardManagement.widgets.cancel' | translate }}\n </button>\n\n <button\n cdsButton=\"primary\"\n [disabled]=\"\n form.invalid ||\n !obs.dataSourceConfiguration.valid ||\n !obs.displayTypeConfiguration.valid ||\n vars.disabled\n \"\n (click)=\"save()\"\n >\n {{ 'dashboardManagement.widgets.save' | translate }}\n </button>\n </ng-container>\n</ng-template>\n\n<ng-template #deleteButtons let-vars=\"vars\">\n <button cdsButton=\"secondary\" [disabled]=\"vars.disabled\" (click)=\"closeModal()\">\n {{ 'dashboardManagement.widgets.cancel' | translate }}\n </button>\n\n <button cdsButton=\"danger\" [disabled]=\"vars.disabled\" (click)=\"delete()\">\n {{ 'dashboardManagement.widgets.delete' | translate }}\n </button>\n</ng-template>\n", styles: [".widget-modal .form__row{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-start}.widget-modal .form__spacer{width:32px}.widget-modal .form__element{width:100%;margin-bottom:32px}.widget-modal .form__element.--with-button{display:flex;align-items:flex-end;flex-direction:row}.widget-modal .form__element.--with-button button{margin-left:16px}.widget-modal .form__element.--readonly input{background-color:transparent}\n"], dependencies: [{ kind: "directive", type: i3.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3.Dropdown, selector: "cds-dropdown, ibm-dropdown", inputs: ["id", "label", "helperText", "placeholder", "displayValue", "clearText", "size", "type", "theme", "disabled", "skeleton", "inline", "disableArrowKeys", "invalid", "invalidText", "warn", "warnText", "appendInline", "scrollableContainer", "itemValueKey", "selectionFeedback", "menuButtonLabel", "selectedLabel", "dropUp"], outputs: ["selected", "onClose", "close"] }, { kind: "component", type: i3.DropdownList, selector: "cds-dropdown-list, ibm-dropdown-list", inputs: ["ariaLabel", "items", "listTpl", "type", "showTitles"], outputs: ["select", "scroll", "blurIntent"] }, { kind: "component", type: i3.Label, selector: "cds-label, ibm-label", inputs: ["labelInputID", "disabled", "skeleton", "helperText", "invalidText", "invalid", "warn", "warnText", "ariaLabel"] }, { kind: "directive", type: i3.TextInput, selector: "[cdsText], [ibmText]", inputs: ["theme", "size", "invalid", "warn", "skeleton"] }, { kind: "component", type: i3.Modal, selector: "cds-modal, ibm-modal", inputs: ["size", "theme", "ariaLabel", "open", "trigger", "hasScrollingContent"], outputs: ["overlaySelected", "close"] }, { kind: "component", type: i3.ModalHeader, selector: "cds-modal-header, ibm-modal-header", inputs: ["theme", "closeLabel", "showCloseButton"], outputs: ["closeSelect"] }, { kind: "component", type: i3.ModalFooter, selector: "cds-modal-footer, ibm-modal-footer" }, { kind: "directive", type: i3.ModalContent, selector: "[cdsModalContent], [ibmModalContent]", inputs: ["hasForm"] }, { kind: "directive", type: i3.ModalHeaderHeading, selector: "[cdsModalHeaderHeading], [ibmModalHeaderHeading]" }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: WidgetConfigurationContainerComponent, selector: "valtimo-widget-configuration-container", inputs: ["dataSourceKey", "displayTypeKey", "disabled", "prefillConfiguration"], outputs: ["configurationEvent"] }, { kind: "pipe", type: i6.AsyncPipe, name: "async" }, { kind: "pipe", type: i2$1.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None });
|
|
441
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: WidgetModalComponent, decorators: [{
|
|
442
|
-
type: Component,
|
|
443
|
-
args: [{ selector: 'valtimo-widget-modal', encapsulation: ViewEncapsulation.None, providers: [NotificationService], template: "<ng-container\n *ngIf=\"{\n disabled: disabled$ | async,\n isCreate: type === 'create',\n isDelete: type === 'delete',\n isEdit: type === 'edit',\n open: open$ | async\n } as vars\"\n>\n <ng-container\n *ngIf=\"{\n create: vars.isCreate && ('dashboardManagement.widgets.add' | translate),\n delete: vars.isDelete && ('dashboardManagement.widgets.delete' | translate),\n edit: vars.isEdit && ('dashboardManagement.widgets.edit' | translate)\n } as titles\"\n >\n <cds-modal\n *ngIf=\"{\n title: titles.edit || titles.create || titles.delete\n } as translations\"\n valtimoCdsModal\n [open]=\"vars.open\"\n showFooter=\"true\"\n size=\"md\"\n title=\"{{ translations.title }}\"\n class=\"widget-modal\"\n >\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"closeModal()\">\n <h3 cdsModalHeaderHeading>\n {{ translations.title }}\n </h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <ng-container *ngIf=\"vars.isDelete\">\n {{ 'dashboardManagement.widgets.deleteDescription' | translate }}</ng-container\n >\n\n <ng-container *ngIf=\"vars.isEdit || vars.isCreate\">\n <ng-container *ngTemplateOutlet=\"widgetForm; context: {vars: vars}\"></ng-container>\n </ng-container>\n </section>\n\n <cds-modal-footer>\n <ng-container *ngIf=\"vars.isEdit || vars.isCreate\">\n <ng-container *ngTemplateOutlet=\"editButtons; context: {vars: vars}\"></ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"vars.isDelete\">\n <ng-container *ngTemplateOutlet=\"deleteButtons; context: {vars: vars}\"></ng-container>\n </ng-container>\n </cds-modal-footer>\n </cds-modal>\n </ng-container>\n</ng-container>\n\n<ng-template #widgetForm let-vars=\"vars\">\n <form\n *ngIf=\"\n form && {\n dataSourceItems: dataSourceItems$ | async,\n displayTypeDropdownDisabled: displayTypeDropdownDisabled$ | async,\n displayTypeItems: displayTypeItems$ | async,\n selectedDataSourceKey: selectedDataSourceKey$ | async,\n selectedDisplayTypeKey: selectedDisplayTypeKey$ | async\n } as obs\n \"\n [formGroup]=\"form\"\n class=\"dashboard-modal__form\"\n >\n <div class=\"form__element\">\n <cds-label\n [helperText]=\"'dashboardManagement.widgets.form.titleHelperText' | translate\"\n [invalidText]=\"'dashboardManagement.widgets.form.titleHelperText' | translate\"\n [invalid]=\"title.dirty && title.invalid\"\n >\n {{ 'dashboardManagement.widgets.form.title' | translate }}\n\n <input\n cdsText\n formControlName=\"title\"\n [invalid]=\"title.dirty && title.invalid\"\n [attr.modal-primary-focus]=\"true\"\n />\n </cds-label>\n </div>\n\n <div class=\"form__element\" *ngIf=\"obs.dataSourceItems\">\n <cds-dropdown\n formControlName=\"dataSource\"\n [helperText]=\"'dashboardManagement.widgets.form.dataSourceHelperText' | translate\"\n [invalidText]=\"'dashboardManagement.widgets.form.dateSourceHelperText' | translate\"\n [invalid]=\"dataSource.dirty && dataSource.invalid\"\n [label]=\"'dashboardManagement.widgets.form.dataSource' | translate\"\n (selected)=\"dataSourceSelected($event)\"\n >\n <cds-dropdown-list [items]=\"obs.dataSourceItems\" type=\"multi\"></cds-dropdown-list>\n </cds-dropdown>\n </div>\n\n <valtimo-widget-configuration-container\n *ngIf=\"obs.selectedDataSourceKey\"\n [dataSourceKey]=\"obs.selectedDataSourceKey\"\n [disabled]=\"vars.disabled\"\n [prefillConfiguration]=\"dataSourcePrefillConfig$ | async\"\n (configurationEvent)=\"dataSourceConfiguration($event)\"\n ></valtimo-widget-configuration-container>\n\n <div class=\"form__element\" *ngIf=\"obs.displayTypeItems\">\n <cds-dropdown\n formControlName=\"displayType\"\n [helperText]=\"'dashboardManagement.widgets.form.displayTypeHelperText' | translate\"\n [invalid]=\"displayType.dirty && displayType.invalid\"\n [invalidText]=\"'dashboardManagement.widgets.form.displayTypeHelperText' | translate\"\n [label]=\"'dashboardManagement.widgets.form.displayType' | translate\"\n (selected)=\"displayTypeSelected($event)\"\n >\n <cds-dropdown-list [items]=\"obs.displayTypeItems\" type=\"multi\"></cds-dropdown-list>\n </cds-dropdown>\n </div>\n\n <valtimo-widget-configuration-container\n *ngIf=\"obs.selectedDisplayTypeKey\"\n [disabled]=\"vars.disabled\"\n [displayTypeKey]=\"obs.selectedDisplayTypeKey\"\n [prefillConfiguration]=\"displayTypePrefillConfig$ | async\"\n (configurationEvent)=\"displayTypeConfiguration($event)\"\n ></valtimo-widget-configuration-container>\n </form>\n</ng-template>\n\n<ng-template #editButtons let-vars=\"vars\">\n <ng-container\n *ngIf=\"{\n dataSourceConfiguration: dataSourceConfiguration$ | async,\n displayTypeConfiguration: displayTypeConfiguration$ | async\n } as obs\"\n >\n <button cdsButton=\"ghost\" [disabled]=\"vars.disabled\" (click)=\"closeModal()\">\n {{ 'dashboardManagement.widgets.cancel' | translate }}\n </button>\n\n <button\n cdsButton=\"primary\"\n [disabled]=\"\n form.invalid ||\n !obs.dataSourceConfiguration.valid ||\n !obs.displayTypeConfiguration.valid ||\n vars.disabled\n \"\n (click)=\"save()\"\n >\n {{ 'dashboardManagement.widgets.save' | translate }}\n </button>\n </ng-container>\n</ng-template>\n\n<ng-template #deleteButtons let-vars=\"vars\">\n <button cdsButton=\"secondary\" [disabled]=\"vars.disabled\" (click)=\"closeModal()\">\n {{ 'dashboardManagement.widgets.cancel' | translate }}\n </button>\n\n <button cdsButton=\"danger\" [disabled]=\"vars.disabled\" (click)=\"delete()\">\n {{ 'dashboardManagement.widgets.delete' | translate }}\n </button>\n</ng-template>\n", styles: [".widget-modal .form__row{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-start}.widget-modal .form__spacer{width:32px}.widget-modal .form__element{width:100%;margin-bottom:32px}.widget-modal .form__element.--with-button{display:flex;align-items:flex-end;flex-direction:row}.widget-modal .form__element.--with-button button{margin-left:16px}.widget-modal .form__element.--readonly input{background-color:transparent}\n"] }]
|
|
444
|
-
}], ctorParameters: function () { return [{ type: Document, decorators: [{
|
|
445
|
-
type: Inject,
|
|
446
|
-
args: [DOCUMENT]
|
|
447
|
-
}] }, { type: i1$1.FormBuilder }, { type: i2$1.TranslateService }, { type: i3.NotificationService }, { type: DashboardManagementService }, { type: i5.WidgetService }, { type: i5.WidgetTranslationService }]; }, propDecorators: { showModal$: [{
|
|
448
|
-
type: Input
|
|
449
|
-
}], type: [{
|
|
450
|
-
type: Input
|
|
451
|
-
}], dashboard: [{
|
|
452
|
-
type: Input
|
|
453
|
-
}], widgetKey: [{
|
|
454
|
-
type: Input
|
|
455
|
-
}], editWidgetConfiguration: [{
|
|
456
|
-
type: Input
|
|
457
|
-
}], saveEvent: [{
|
|
458
|
-
type: Output
|
|
459
|
-
}] } });
|
|
460
|
-
|
|
461
|
-
/*
|
|
462
|
-
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
463
|
-
*
|
|
464
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
465
|
-
* you may not use this file except in compliance with the License.
|
|
466
|
-
* You may obtain a copy of the License at
|
|
467
|
-
*
|
|
468
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
469
|
-
*
|
|
470
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
471
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
472
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
473
|
-
* See the License for the specific language governing permissions and
|
|
474
|
-
* limitations under the License.
|
|
475
|
-
*/
|
|
476
|
-
class EditDashboardModalComponent {
|
|
477
|
-
constructor(fb, dashboardManagementService) {
|
|
478
|
-
this.fb = fb;
|
|
479
|
-
this.dashboardManagementService = dashboardManagementService;
|
|
480
|
-
this.saveEvent = new EventEmitter();
|
|
481
|
-
this.open$ = new BehaviorSubject(false);
|
|
482
|
-
this.disabled$ = new BehaviorSubject(false);
|
|
483
|
-
this.editDashboardForm = this.fb.group({
|
|
484
|
-
title: this.fb.control('', [Validators.required]),
|
|
485
|
-
description: this.fb.control('', [Validators.required]),
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
get dashboardTitle() {
|
|
489
|
-
return this.editDashboardForm.get('title');
|
|
490
|
-
}
|
|
491
|
-
get dashboardDescription() {
|
|
492
|
-
return this.editDashboardForm.get('description');
|
|
493
|
-
}
|
|
494
|
-
ngOnInit() {
|
|
495
|
-
this.openOpenSubscription();
|
|
496
|
-
}
|
|
497
|
-
closeModal() {
|
|
498
|
-
this.open$.next(false);
|
|
499
|
-
setTimeout(() => {
|
|
500
|
-
this.editDashboardForm.reset();
|
|
501
|
-
}, CARBON_CONSTANTS.modalAnimationMs);
|
|
502
|
-
}
|
|
503
|
-
saveDashboard() {
|
|
504
|
-
this.disable();
|
|
505
|
-
this.dashboardManagementService
|
|
506
|
-
.updateDashboard({
|
|
507
|
-
description: this.dashboardDescription.value,
|
|
508
|
-
title: this.dashboardTitle.value,
|
|
509
|
-
key: this.dashboard.key,
|
|
510
|
-
})
|
|
511
|
-
.subscribe(() => {
|
|
512
|
-
this.saveEvent.emit();
|
|
513
|
-
this.closeModal();
|
|
514
|
-
});
|
|
515
|
-
}
|
|
516
|
-
setEditDashboardForm() {
|
|
517
|
-
if (this.dashboard) {
|
|
518
|
-
this.dashboardTitle?.setValue(this.dashboard.title);
|
|
519
|
-
this.dashboardDescription?.setValue(this.dashboard.description);
|
|
520
|
-
}
|
|
521
|
-
this.enable();
|
|
522
|
-
}
|
|
523
|
-
openOpenSubscription() {
|
|
524
|
-
this._openSubscription = this.showModal$.subscribe(show => {
|
|
525
|
-
this.setEditDashboardForm();
|
|
526
|
-
this.open$.next(show);
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
disable() {
|
|
530
|
-
this.disabled$.next(true);
|
|
531
|
-
}
|
|
532
|
-
enable() {
|
|
533
|
-
this.disabled$.next(false);
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
EditDashboardModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: EditDashboardModalComponent, deps: [{ token: i1$1.FormBuilder }, { token: DashboardManagementService }], target: i0.ɵɵFactoryTarget.Component });
|
|
537
|
-
EditDashboardModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: EditDashboardModalComponent, selector: "valtimo-edit-dashboard-modal", inputs: { showModal$: "showModal$", dashboard: "dashboard" }, outputs: { saveEvent: "saveEvent" }, providers: [NotificationService], ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 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<cds-modal\n *ngIf=\"{disabled: disabled$ | async} as obs\"\n valtimoCdsModal\n [open]=\"open$ | async\"\n showFooter=\"true\"\n title=\"{{ 'dashboardManagement.widgets.editDashboard' | translate }}\"\n class=\"edit-dashboard-modal\"\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"closeModal()\">\n <h3 cdsModalHeaderHeading>{{ 'dashboardManagement.widgets.editDashboard' | translate }}</h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <ng-container *ngTemplateOutlet=\"editDashboardFormTemplate;context:{obs: obs}\"></ng-container>\n </section>\n\n <cds-modal-footer>\n <ng-container *ngTemplateOutlet=\"editDashboardButtons;context:{obs: obs}\"></ng-container>\n </cds-modal-footer>\n</cds-modal>\n\n<ng-template #editDashboardFormTemplate let-obs=\"obs\">\n <form *ngIf=\"editDashboardForm\" [formGroup]=\"editDashboardForm\" class=\"dashboard-modal__form\">\n <div class=\"form__element\">\n <cds-label\n [disabled]=\"obs.disabled\"\n [invalid]=\"dashboardTitle.dirty && dashboardTitle.invalid\"\n >\n {{ 'dashboardManagement.widgets.form.dashboardTitle' | translate }}\n\n <input\n cdsText\n [disabled]=\"obs.disabled\"\n [invalid]=\"dashboardTitle.dirty && dashboardTitle.invalid\"\n formControlName=\"title\"\n [attr.modal-primary-focus]=\"true\"\n />\n </cds-label>\n </div>\n\n <div class=\"form__element\">\n <cds-label\n [disabled]=\"obs.disabled\"\n [helperText]=\"'dashboardManagement.widgets.form.dashboardDescriptionHelperText' | translate\"\n [invalid]=\"dashboardDescription.dirty && dashboardDescription.invalid\"\n [invalidText]=\"\n 'dashboardManagement.widgets.form.dashboardDescriptionHelperText' | translate\n \"\n >\n {{ 'dashboardManagement.widgets.form.dashboardDescription' | translate }}\n\n <input\n cdsText\n [disabled]=\"obs.disabled\"\n [invalid]=\"dashboardDescription.dirty && dashboardDescription.invalid\"\n formControlName=\"description\"\n />\n </cds-label>\n </div>\n </form>\n</ng-template>\n\n<ng-template #editDashboardButtons let-obs=\"obs\">\n <button cdsButton=\"ghost\" [disabled]=\"obs.disabled\" (click)=\"closeModal()\">\n {{ 'dashboardManagement.widgets.cancel' | translate }}\n </button>\n\n <button\n cdsButton=\"primary\"\n [disabled]=\"editDashboardForm.invalid || obs.disabled\"\n (click)=\"saveDashboard()\"\n >\n {{ 'dashboardManagement.widgets.complete' | translate }}\n </button>\n</ng-template>\n", styles: ["/*!\n * Copyright 2015-2023 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 */.edit-dashboard-modal .form__row{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-end}.edit-dashboard-modal .form__element{width:100%;margin-bottom:32px}\n"], dependencies: [{ kind: "directive", type: i3.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3.Label, selector: "cds-label, ibm-label", inputs: ["labelInputID", "disabled", "skeleton", "helperText", "invalidText", "invalid", "warn", "warnText", "ariaLabel"] }, { kind: "directive", type: i3.TextInput, selector: "[cdsText], [ibmText]", inputs: ["theme", "size", "invalid", "warn", "skeleton"] }, { kind: "component", type: i3.Modal, selector: "cds-modal, ibm-modal", inputs: ["size", "theme", "ariaLabel", "open", "trigger", "hasScrollingContent"], outputs: ["overlaySelected", "close"] }, { kind: "component", type: i3.ModalHeader, selector: "cds-modal-header, ibm-modal-header", inputs: ["theme", "closeLabel", "showCloseButton"], outputs: ["closeSelect"] }, { kind: "component", type: i3.ModalFooter, selector: "cds-modal-footer, ibm-modal-footer" }, { kind: "directive", type: i3.ModalContent, selector: "[cdsModalContent], [ibmModalContent]", inputs: ["hasForm"] }, { kind: "directive", type: i3.ModalHeaderHeading, selector: "[cdsModalHeaderHeading], [ibmModalHeaderHeading]" }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "pipe", type: i6.AsyncPipe, name: "async" }, { kind: "pipe", type: i2$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
538
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: EditDashboardModalComponent, decorators: [{
|
|
539
|
-
type: Component,
|
|
540
|
-
args: [{ selector: 'valtimo-edit-dashboard-modal', encapsulation: ViewEncapsulation.None, providers: [NotificationService], changeDetection: ChangeDetectionStrategy.OnPush, template: "<!--\n ~ Copyright 2015-2023 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<cds-modal\n *ngIf=\"{disabled: disabled$ | async} as obs\"\n valtimoCdsModal\n [open]=\"open$ | async\"\n showFooter=\"true\"\n title=\"{{ 'dashboardManagement.widgets.editDashboard' | translate }}\"\n class=\"edit-dashboard-modal\"\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"closeModal()\">\n <h3 cdsModalHeaderHeading>{{ 'dashboardManagement.widgets.editDashboard' | translate }}</h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <ng-container *ngTemplateOutlet=\"editDashboardFormTemplate;context:{obs: obs}\"></ng-container>\n </section>\n\n <cds-modal-footer>\n <ng-container *ngTemplateOutlet=\"editDashboardButtons;context:{obs: obs}\"></ng-container>\n </cds-modal-footer>\n</cds-modal>\n\n<ng-template #editDashboardFormTemplate let-obs=\"obs\">\n <form *ngIf=\"editDashboardForm\" [formGroup]=\"editDashboardForm\" class=\"dashboard-modal__form\">\n <div class=\"form__element\">\n <cds-label\n [disabled]=\"obs.disabled\"\n [invalid]=\"dashboardTitle.dirty && dashboardTitle.invalid\"\n >\n {{ 'dashboardManagement.widgets.form.dashboardTitle' | translate }}\n\n <input\n cdsText\n [disabled]=\"obs.disabled\"\n [invalid]=\"dashboardTitle.dirty && dashboardTitle.invalid\"\n formControlName=\"title\"\n [attr.modal-primary-focus]=\"true\"\n />\n </cds-label>\n </div>\n\n <div class=\"form__element\">\n <cds-label\n [disabled]=\"obs.disabled\"\n [helperText]=\"'dashboardManagement.widgets.form.dashboardDescriptionHelperText' | translate\"\n [invalid]=\"dashboardDescription.dirty && dashboardDescription.invalid\"\n [invalidText]=\"\n 'dashboardManagement.widgets.form.dashboardDescriptionHelperText' | translate\n \"\n >\n {{ 'dashboardManagement.widgets.form.dashboardDescription' | translate }}\n\n <input\n cdsText\n [disabled]=\"obs.disabled\"\n [invalid]=\"dashboardDescription.dirty && dashboardDescription.invalid\"\n formControlName=\"description\"\n />\n </cds-label>\n </div>\n </form>\n</ng-template>\n\n<ng-template #editDashboardButtons let-obs=\"obs\">\n <button cdsButton=\"ghost\" [disabled]=\"obs.disabled\" (click)=\"closeModal()\">\n {{ 'dashboardManagement.widgets.cancel' | translate }}\n </button>\n\n <button\n cdsButton=\"primary\"\n [disabled]=\"editDashboardForm.invalid || obs.disabled\"\n (click)=\"saveDashboard()\"\n >\n {{ 'dashboardManagement.widgets.complete' | translate }}\n </button>\n</ng-template>\n", styles: ["/*!\n * Copyright 2015-2023 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 */.edit-dashboard-modal .form__row{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-end}.edit-dashboard-modal .form__element{width:100%;margin-bottom:32px}\n"] }]
|
|
541
|
-
}], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: DashboardManagementService }]; }, propDecorators: { showModal$: [{
|
|
542
|
-
type: Input
|
|
543
|
-
}], dashboard: [{
|
|
544
|
-
type: Input
|
|
545
|
-
}], saveEvent: [{
|
|
546
|
-
type: Output
|
|
547
|
-
}] } });
|
|
548
|
-
|
|
549
|
-
class DashboardDetailsComponent {
|
|
550
|
-
constructor(dashboardManagementService, datePipe, iconService, pageTitleService, route, translateService) {
|
|
551
|
-
this.dashboardManagementService = dashboardManagementService;
|
|
552
|
-
this.datePipe = datePipe;
|
|
553
|
-
this.iconService = iconService;
|
|
554
|
-
this.pageTitleService = pageTitleService;
|
|
555
|
-
this.route = route;
|
|
556
|
-
this.translateService = translateService;
|
|
557
|
-
this.modalType = 'create';
|
|
558
|
-
this._dashboardKey$ = this.route.params.pipe(map(params => params.id));
|
|
559
|
-
this._refreshDashboardSubject$ = new BehaviorSubject(null);
|
|
560
|
-
this.currentDashboard$ = combineLatest([
|
|
561
|
-
this._dashboardKey$,
|
|
562
|
-
this.translateService.stream('key'),
|
|
563
|
-
this._refreshDashboardSubject$,
|
|
564
|
-
]).pipe(switchMap(([dashboardKey]) => this.dashboardManagementService.getDashboard(dashboardKey)), tap((currentDashboard) => {
|
|
565
|
-
if (!currentDashboard) {
|
|
566
|
-
return;
|
|
567
|
-
}
|
|
568
|
-
this.pageTitleService.setCustomPageTitle(currentDashboard.title);
|
|
569
|
-
this.pageTitleService.setCustomPageSubtitle(this.translateService.instant('dashboardManagement.widgets.metadata', {
|
|
570
|
-
createdBy: currentDashboard.createdBy,
|
|
571
|
-
createdOn: this.datePipe.transform(currentDashboard.createdOn ?? '', 'd/M/yy, H:mm'),
|
|
572
|
-
key: currentDashboard.key,
|
|
573
|
-
}));
|
|
574
|
-
}));
|
|
575
|
-
this.lastItemIndex$ = new BehaviorSubject(0);
|
|
576
|
-
this.loading$ = new BehaviorSubject(true);
|
|
577
|
-
this._refreshWidgetsSubject$ = new BehaviorSubject(null);
|
|
578
|
-
this._widgetData = null;
|
|
579
|
-
this.widgetData$ = combineLatest([
|
|
580
|
-
this._dashboardKey$,
|
|
581
|
-
this._refreshWidgetsSubject$,
|
|
582
|
-
]).pipe(switchMap(([dashboardKey, refreshWidgets]) => {
|
|
583
|
-
this.loading$.next(true);
|
|
584
|
-
if (!this._widgetData || !refreshWidgets) {
|
|
585
|
-
return this.dashboardManagementService.getDashboardWidgetConfiguration(dashboardKey);
|
|
586
|
-
}
|
|
587
|
-
const { direction, index } = refreshWidgets;
|
|
588
|
-
return this.dashboardManagementService.updateDashboardWidgetConfigurations(dashboardKey, direction === 'UP'
|
|
589
|
-
? this.swapWidgets(this._widgetData, index - 1, index)
|
|
590
|
-
: this.swapWidgets(this._widgetData, index, index + 1));
|
|
591
|
-
}), tap((data) => {
|
|
592
|
-
this._widgetData = data;
|
|
593
|
-
this.lastItemIndex$.next(data.length - 1);
|
|
594
|
-
this.loading$.next(false);
|
|
595
|
-
}));
|
|
596
|
-
this.showModal$ = new BehaviorSubject(false);
|
|
597
|
-
this.showEditDashboardModal$ = new BehaviorSubject(false);
|
|
598
|
-
this.editWidgetConfiguration$ = new BehaviorSubject(null);
|
|
599
|
-
}
|
|
600
|
-
ngAfterViewInit() {
|
|
601
|
-
this.iconService.registerAll([ArrowDown16, ArrowUp16, Edit16]);
|
|
602
|
-
this.setTableConfig();
|
|
603
|
-
}
|
|
604
|
-
addWidget() {
|
|
605
|
-
this.editWidgetConfiguration$.next(null);
|
|
606
|
-
this.modalType = 'create';
|
|
607
|
-
this.showModal();
|
|
608
|
-
}
|
|
609
|
-
editDashboard() {
|
|
610
|
-
this.showEditDashboardModal();
|
|
611
|
-
}
|
|
612
|
-
refreshWidgets() {
|
|
613
|
-
this._refreshWidgetsSubject$.next(null);
|
|
614
|
-
}
|
|
615
|
-
refreshDashboard() {
|
|
616
|
-
this._refreshDashboardSubject$.next(null);
|
|
617
|
-
}
|
|
618
|
-
onArrowDownClick(data) {
|
|
619
|
-
this._refreshWidgetsSubject$.next({ direction: 'DOWN', index: data.index });
|
|
620
|
-
}
|
|
621
|
-
onArrowUpClick(data) {
|
|
622
|
-
this._refreshWidgetsSubject$.next({ direction: 'UP', index: data.index });
|
|
623
|
-
}
|
|
624
|
-
setTableConfig() {
|
|
625
|
-
this.tableConfig = createCarbonTableConfig({
|
|
626
|
-
fields: [
|
|
627
|
-
{
|
|
628
|
-
columnType: ColumnType.TEXT,
|
|
629
|
-
fieldName: 'title',
|
|
630
|
-
translationKey: 'Name',
|
|
631
|
-
},
|
|
632
|
-
{
|
|
633
|
-
columnType: ColumnType.TEMPLATE,
|
|
634
|
-
template: this.moveButtonsTemplate,
|
|
635
|
-
className: 'dashboard-detail-table__actions',
|
|
636
|
-
fieldName: '',
|
|
637
|
-
translationKey: '',
|
|
638
|
-
},
|
|
639
|
-
{
|
|
640
|
-
columnType: ColumnType.ACTION,
|
|
641
|
-
className: 'dashboard-detail-table__actions',
|
|
642
|
-
fieldName: '',
|
|
643
|
-
translationKey: '',
|
|
644
|
-
actions: [
|
|
645
|
-
{
|
|
646
|
-
actionName: 'Edit',
|
|
647
|
-
callback: this.editWidget.bind(this),
|
|
648
|
-
},
|
|
649
|
-
{
|
|
650
|
-
actionName: 'Delete',
|
|
651
|
-
callback: this.deleteWidget.bind(this),
|
|
652
|
-
type: 'danger',
|
|
653
|
-
},
|
|
654
|
-
],
|
|
655
|
-
},
|
|
656
|
-
],
|
|
657
|
-
});
|
|
658
|
-
}
|
|
659
|
-
editWidget(event) {
|
|
660
|
-
this.editWidgetConfiguration$.next({ ...event });
|
|
661
|
-
this.modalType = 'edit';
|
|
662
|
-
this.showModal();
|
|
663
|
-
}
|
|
664
|
-
deleteWidget(event) {
|
|
665
|
-
this.editWidgetConfiguration$.next({ ...event });
|
|
666
|
-
this.modalType = 'delete';
|
|
667
|
-
this.showModal();
|
|
668
|
-
}
|
|
669
|
-
showModal() {
|
|
670
|
-
this.showModal$.next(true);
|
|
671
|
-
}
|
|
672
|
-
showEditDashboardModal() {
|
|
673
|
-
this.showEditDashboardModal$.next(true);
|
|
674
|
-
}
|
|
675
|
-
swapWidgets(dashboardWidgets, index1, index2) {
|
|
676
|
-
const temp = [...dashboardWidgets];
|
|
677
|
-
temp[index1] = temp.splice(index2, 1, temp[index1])[0];
|
|
678
|
-
return temp;
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
DashboardDetailsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DashboardDetailsComponent, deps: [{ token: DashboardManagementService }, { token: i6.DatePipe }, { token: i3.IconService }, { token: i4.PageTitleService }, { token: i5$1.ActivatedRoute }, { token: i2$1.TranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
682
|
-
DashboardDetailsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: DashboardDetailsComponent, selector: "ng-component", viewQueries: [{ propertyName: "moveButtonsTemplate", first: true, predicate: ["moveButtonsTemplate"], descendants: true }], ngImport: i0, template: "<ng-container\n *ngIf=\"\n tableConfig && {\n currentDashboard: currentDashboard$ | async,\n editWidgetConfiguration: editWidgetConfiguration$ | async,\n loading: loading$ | async,\n widgetData: widgetData$ | async\n } as obs\n \"\n>\n <div class=\"dashboard-detail-table\">\n <valtimo-carbon-table\n [data]=\"obs.widgetData\"\n [hideTableHeader]=\"true\"\n [loading]=\"obs.loading\"\n [tableConfig]=\"tableConfig\"\n >\n <div carbonToolbarContent>\n <ng-container [ngTemplateOutlet]=\"addWidgetButton\"></ng-container>\n </div>\n\n <valtimo-no-results\n [action]=\"addWidgetButton\"\n description=\"{{ 'dashboardManagement.widgets.noResults.description' | translate }}\"\n title=\"{{ 'dashboardManagement.widgets.noResults.title' | translate }}\"\n ></valtimo-no-results>\n </valtimo-carbon-table>\n </div>\n\n <valtimo-widget-modal\n [dashboard]=\"obs.currentDashboard\"\n [editWidgetConfiguration]=\"obs.editWidgetConfiguration\"\n [showModal$]=\"showModal$\"\n [type]=\"modalType\"\n [widgetKey]=\"obs.editWidgetConfiguration?.key\"\n (saveEvent)=\"refreshWidgets()\"\n ></valtimo-widget-modal>\n\n <valtimo-edit-dashboard-modal\n [dashboard]=\"obs.currentDashboard\"\n [showModal$]=\"showEditDashboardModal$\"\n (saveEvent)=\"refreshDashboard()\"\n >\n </valtimo-edit-dashboard-modal>\n</ng-container>\n\n<ng-template #moveButtonsTemplate let-data=\"data\">\n <div class=\"move-buttons-container\">\n <button\n cdsButton=\"tertiary\"\n [disabled]=\"data.index === 0\"\n [iconOnly]=\"true\"\n (click)=\"onArrowUpClick(data)\"\n >\n <svg cdsIcon=\"arrow--up\" size=\"16\" class=\"cds--btn__icon\"></svg>\n </button>\n\n <button\n cdsButton=\"tertiary\"\n [disabled]=\"(lastItemIndex$ | async) === data.index\"\n [iconOnly]=\"true\"\n (click)=\"onArrowDownClick(data)\"\n >\n <svg cdsIcon=\"arrow--down\" size=\"16\" class=\"cds--btn__icon\"></svg>\n </button>\n </div>\n</ng-template>\n\n<ng-container renderInPageHeader>\n <ng-template>\n <button cdsButton=\"tertiary\" size=\"md\" (click)=\"editDashboard()\">\n {{ 'dashboardManagement.widgets.editButton' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"edit\" size=\"16\"></svg>\n </button>\n </ng-template>\n</ng-container>\n\n<ng-template #addWidgetButton>\n <button cdsButton=\"primary\" [disabled]=\"loading$ | async\" (click)=\"addWidget()\">\n {{ 'dashboardManagement.widgets.add' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"add\" size=\"16\"></svg>\n </button>\n</ng-template>\n", styles: [".dashboard-detail-table .move-buttons-container{width:100%;justify-content:flex-end;display:flex;flex-direction:row;right:-1rem;position:relative}.dashboard-detail-table .move-buttons-container button:not(:last-child){margin-right:8px}.dashboard-detail-table__actions{width:1px}.dashboard-detail-table-no-results{display:flex;justify-content:space-around;padding:6.25rem 0;gap:4rem}.dashboard-detail-table-no-results__title{font-size:1.75rem}.dashboard-detail-table-no-results__content{display:flex;flex-direction:column;justify-content:space-around}\n"], dependencies: [{ kind: "directive", type: i3.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "component", type: i4.CarbonNoResultsComponent, selector: "valtimo-no-results", inputs: ["action", "description", "illustration", "title"] }, { kind: "component", type: i4.CarbonTableComponent, selector: "valtimo-carbon-table", inputs: ["tableConfig", "paginationConfig", "hideTableHeader", "data", "loading"], outputs: ["paginationChange", "rowClick", "search"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i4.RenderInPageHeaderDirective, selector: "[renderInPageHeader]" }, { kind: "directive", type: i3.IconDirective, selector: "[cdsIcon], [ibmIcon]", inputs: ["ibmIcon", "cdsIcon", "size", "title", "ariaLabel", "ariaLabelledBy", "ariaHidden", "isFocusable"] }, { kind: "component", type: WidgetModalComponent, selector: "valtimo-widget-modal", inputs: ["showModal$", "type", "dashboard", "widgetKey", "editWidgetConfiguration"], outputs: ["saveEvent"] }, { kind: "component", type: EditDashboardModalComponent, selector: "valtimo-edit-dashboard-modal", inputs: ["showModal$", "dashboard"], outputs: ["saveEvent"] }, { kind: "pipe", type: i6.AsyncPipe, name: "async" }, { kind: "pipe", type: i2$1.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None });
|
|
683
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DashboardDetailsComponent, decorators: [{
|
|
684
|
-
type: Component,
|
|
685
|
-
args: [{ encapsulation: ViewEncapsulation.None, template: "<ng-container\n *ngIf=\"\n tableConfig && {\n currentDashboard: currentDashboard$ | async,\n editWidgetConfiguration: editWidgetConfiguration$ | async,\n loading: loading$ | async,\n widgetData: widgetData$ | async\n } as obs\n \"\n>\n <div class=\"dashboard-detail-table\">\n <valtimo-carbon-table\n [data]=\"obs.widgetData\"\n [hideTableHeader]=\"true\"\n [loading]=\"obs.loading\"\n [tableConfig]=\"tableConfig\"\n >\n <div carbonToolbarContent>\n <ng-container [ngTemplateOutlet]=\"addWidgetButton\"></ng-container>\n </div>\n\n <valtimo-no-results\n [action]=\"addWidgetButton\"\n description=\"{{ 'dashboardManagement.widgets.noResults.description' | translate }}\"\n title=\"{{ 'dashboardManagement.widgets.noResults.title' | translate }}\"\n ></valtimo-no-results>\n </valtimo-carbon-table>\n </div>\n\n <valtimo-widget-modal\n [dashboard]=\"obs.currentDashboard\"\n [editWidgetConfiguration]=\"obs.editWidgetConfiguration\"\n [showModal$]=\"showModal$\"\n [type]=\"modalType\"\n [widgetKey]=\"obs.editWidgetConfiguration?.key\"\n (saveEvent)=\"refreshWidgets()\"\n ></valtimo-widget-modal>\n\n <valtimo-edit-dashboard-modal\n [dashboard]=\"obs.currentDashboard\"\n [showModal$]=\"showEditDashboardModal$\"\n (saveEvent)=\"refreshDashboard()\"\n >\n </valtimo-edit-dashboard-modal>\n</ng-container>\n\n<ng-template #moveButtonsTemplate let-data=\"data\">\n <div class=\"move-buttons-container\">\n <button\n cdsButton=\"tertiary\"\n [disabled]=\"data.index === 0\"\n [iconOnly]=\"true\"\n (click)=\"onArrowUpClick(data)\"\n >\n <svg cdsIcon=\"arrow--up\" size=\"16\" class=\"cds--btn__icon\"></svg>\n </button>\n\n <button\n cdsButton=\"tertiary\"\n [disabled]=\"(lastItemIndex$ | async) === data.index\"\n [iconOnly]=\"true\"\n (click)=\"onArrowDownClick(data)\"\n >\n <svg cdsIcon=\"arrow--down\" size=\"16\" class=\"cds--btn__icon\"></svg>\n </button>\n </div>\n</ng-template>\n\n<ng-container renderInPageHeader>\n <ng-template>\n <button cdsButton=\"tertiary\" size=\"md\" (click)=\"editDashboard()\">\n {{ 'dashboardManagement.widgets.editButton' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"edit\" size=\"16\"></svg>\n </button>\n </ng-template>\n</ng-container>\n\n<ng-template #addWidgetButton>\n <button cdsButton=\"primary\" [disabled]=\"loading$ | async\" (click)=\"addWidget()\">\n {{ 'dashboardManagement.widgets.add' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"add\" size=\"16\"></svg>\n </button>\n</ng-template>\n", styles: [".dashboard-detail-table .move-buttons-container{width:100%;justify-content:flex-end;display:flex;flex-direction:row;right:-1rem;position:relative}.dashboard-detail-table .move-buttons-container button:not(:last-child){margin-right:8px}.dashboard-detail-table__actions{width:1px}.dashboard-detail-table-no-results{display:flex;justify-content:space-around;padding:6.25rem 0;gap:4rem}.dashboard-detail-table-no-results__title{font-size:1.75rem}.dashboard-detail-table-no-results__content{display:flex;flex-direction:column;justify-content:space-around}\n"] }]
|
|
686
|
-
}], ctorParameters: function () { return [{ type: DashboardManagementService }, { type: i6.DatePipe }, { type: i3.IconService }, { type: i4.PageTitleService }, { type: i5$1.ActivatedRoute }, { type: i2$1.TranslateService }]; }, propDecorators: { moveButtonsTemplate: [{
|
|
687
|
-
type: ViewChild,
|
|
688
|
-
args: ['moveButtonsTemplate', { static: false }]
|
|
689
|
-
}] } });
|
|
690
|
-
|
|
691
|
-
class DashboardManagementComponent {
|
|
692
|
-
constructor(dashboardManagementService, fb, router) {
|
|
693
|
-
this.dashboardManagementService = dashboardManagementService;
|
|
694
|
-
this.fb = fb;
|
|
695
|
-
this.router = router;
|
|
696
|
-
this.deleteRowKey$ = new BehaviorSubject('');
|
|
697
|
-
this.openModal$ = new BehaviorSubject(false);
|
|
698
|
-
this.showDeleteModal$ = new BehaviorSubject(false);
|
|
699
|
-
this.tableData$ = this.dashboardManagementService.dashboards$;
|
|
700
|
-
this.tableConfig = createCarbonTableConfig({
|
|
701
|
-
fields: [
|
|
702
|
-
{
|
|
703
|
-
columnType: ColumnType.TEXT,
|
|
704
|
-
fieldName: 'title',
|
|
705
|
-
translationKey: 'dashboardManagement.name',
|
|
706
|
-
},
|
|
707
|
-
{
|
|
708
|
-
columnType: ColumnType.TEXT,
|
|
709
|
-
fieldName: 'description',
|
|
710
|
-
translationKey: 'dashboardManagement.description',
|
|
711
|
-
},
|
|
712
|
-
{
|
|
713
|
-
columnType: ColumnType.TEXT,
|
|
714
|
-
fieldName: 'key',
|
|
715
|
-
translationKey: 'dashboardManagement.key',
|
|
716
|
-
},
|
|
717
|
-
{
|
|
718
|
-
actions: [
|
|
719
|
-
{
|
|
720
|
-
actionName: 'Delete',
|
|
721
|
-
callback: this.deleteDashboard.bind(this),
|
|
722
|
-
type: 'danger',
|
|
723
|
-
},
|
|
724
|
-
],
|
|
725
|
-
className: 'valtimo-dashboard-management__actions',
|
|
726
|
-
columnType: ColumnType.ACTION,
|
|
727
|
-
translationKey: '',
|
|
728
|
-
fieldName: '',
|
|
729
|
-
sortable: false,
|
|
730
|
-
},
|
|
731
|
-
],
|
|
732
|
-
});
|
|
733
|
-
}
|
|
734
|
-
ngOnInit() {
|
|
735
|
-
this.dashboardManagementService.loadData();
|
|
736
|
-
this.form = this.fb.group({
|
|
737
|
-
description: this.fb.control('', [Validators.required]),
|
|
738
|
-
title: this.fb.control('', [Validators.required]),
|
|
739
|
-
});
|
|
740
|
-
}
|
|
741
|
-
closeModal() {
|
|
742
|
-
this.openModal$.next(false);
|
|
743
|
-
this.form.reset();
|
|
744
|
-
}
|
|
745
|
-
createDashboard() {
|
|
746
|
-
const control = this.form.get('title');
|
|
747
|
-
if (!control || !control.valid) {
|
|
748
|
-
return;
|
|
749
|
-
}
|
|
750
|
-
const newDashboard = this.form.getRawValue();
|
|
751
|
-
this.dashboardManagementService.dispatchAction(this.dashboardManagementService.createDashboard(newDashboard).pipe(finalize(() => {
|
|
752
|
-
this.closeModal();
|
|
753
|
-
})));
|
|
754
|
-
}
|
|
755
|
-
onConfirmEvent(dashboardKey) {
|
|
756
|
-
this.dashboardManagementService.dispatchAction(this.dashboardManagementService.deleteDashboard(dashboardKey).pipe(finalize(() => {
|
|
757
|
-
this.closeModal();
|
|
758
|
-
})));
|
|
759
|
-
}
|
|
760
|
-
getControlInvalid(controlKey) {
|
|
761
|
-
const control = this.form.get(controlKey);
|
|
762
|
-
if (!control) {
|
|
763
|
-
return true;
|
|
764
|
-
}
|
|
765
|
-
return !control.valid && !control.pristine;
|
|
766
|
-
}
|
|
767
|
-
openModal() {
|
|
768
|
-
this.openModal$.next(true);
|
|
769
|
-
}
|
|
770
|
-
onRowClick(item) {
|
|
771
|
-
this.router.navigate([`/dashboard-management/${item.key}`]);
|
|
772
|
-
}
|
|
773
|
-
deleteDashboard(dashboard) {
|
|
774
|
-
this.deleteRowKey$.next(dashboard.key);
|
|
775
|
-
this.showDeleteModal$.next(true);
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
DashboardManagementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DashboardManagementComponent, deps: [{ token: DashboardManagementService }, { token: i1$1.FormBuilder }, { token: i5$1.Router }], target: i0.ɵɵFactoryTarget.Component });
|
|
779
|
-
DashboardManagementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: DashboardManagementComponent, selector: "ng-component", ngImport: i0, template: "<ng-container *ngIf=\"tableData$ | async as data\">\n <valtimo-carbon-table\n [data]=\"data.items\"\n [loading]=\"data.loading\"\n [tableConfig]=\"tableConfig\"\n (rowClick)=\"onRowClick($event)\"\n class=\"valtimo-dashboard-management__table\"\n >\n <ng-container carbonTableTitle> {{ 'dashboardManagement.title' | translate }} </ng-container>\n\n <div carbonToolbarContent>\n <ng-container [ngTemplateOutlet]=\"addDashboardButton\"></ng-container>\n </div>\n\n <valtimo-no-results\n [action]=\"addDashboardButton\"\n description=\"{{ 'dashboardManagement.noResults.description' | translate }}\"\n title=\"{{ 'dashboardManagement.noResults.title' | translate }}\"\n ></valtimo-no-results>\n </valtimo-carbon-table>\n</ng-container>\n\n<cds-modal\n valtimoIbmModal\n [open]=\"openModal$ | async\"\n showFooter=\"true\"\n title=\"{{ 'dashboardManagement.addDashboard' | translate }}\"\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"closeModal()\">\n <h3 cdsModalHeaderHeading>\n {{ 'dashboardManagement.addDashboard' | translate }}\n </h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <form [formGroup]=\"form\" class=\"valtimo-dashboard-management__form\">\n <cds-label [invalid]=\"getControlInvalid('title')\">\n {{ 'dashboardManagement.addModal.name' | translate }}\n\n <input\n [attr.modal-primary-focus]=\"true\"\n [invalid]=\"getControlInvalid('title')\"\n formControlName=\"title\"\n cdsText\n placeholder=\"{{ 'dashboardManagement.addModal.namePlaceholder' | translate }}\"\n />\n </cds-label>\n\n <cds-label\n [helperText]=\"'dashboardManagement.addModal.descriptionHelperText' | translate\"\n [invalid]=\"getControlInvalid('description')\"\n >\n {{ 'dashboardManagement.description' | translate }}\n\n <input\n [invalid]=\"getControlInvalid('description')\"\n formControlName=\"description\"\n cdsText\n placeholder=\"{{ 'dashboardManagement.addModal.descriptionPlaceholder' | translate }}\"\n />\n </cds-label>\n </form>\n </section>\n\n <cds-modal-footer>\n <button cdsButton=\"ghost\" (click)=\"closeModal()\">\n {{ 'dashboardManagement.cancel' | translate }}\n </button>\n\n <button [disabled]=\"this.form.invalid\" cdsButton=\"primary\" (click)=\"createDashboard()\">\n {{ 'dashboardManagement.create' | translate }}\n </button>\n </cds-modal-footer>\n</cds-modal>\n\n<valtimo-confirmation-modal\n confirmButtonTextTranslationKey=\"dashboardManagement.deleteModal.confirm\"\n confirmButtonType=\"danger\"\n contentTranslationKey=\"dashboardManagement.deleteModalContent\"\n [outputOnConfirm]=\"deleteRowKey$ | async\"\n [showModalSubject$]=\"showDeleteModal$\"\n titleTranslationKey=\"dashboardManagement.delete\"\n (confirmEvent)=\"onConfirmEvent($event)\"\n></valtimo-confirmation-modal>\n\n<ng-template #addDashboardButton>\n <button cdsButton=\"primary\" (click)=\"openModal()\">\n {{ 'dashboardManagement.addDashboard' | translate }}\n\n <svg cdsIcon=\"add\" size=\"16\" class=\"cds--btn__icon\"></svg>\n </button>\n</ng-template>\n", styles: [".valtimo-dashboard-management__actions{width:1px}.valtimo-dashboard-management__form>*:not(:last-child){margin-bottom:32px}\n"], dependencies: [{ kind: "directive", type: i3.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "component", type: i4.CarbonNoResultsComponent, selector: "valtimo-no-results", inputs: ["action", "description", "illustration", "title"] }, { kind: "component", type: i4.CarbonTableComponent, selector: "valtimo-carbon-table", inputs: ["tableConfig", "paginationConfig", "hideTableHeader", "data", "loading"], outputs: ["paginationChange", "rowClick", "search"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3.Label, selector: "cds-label, ibm-label", inputs: ["labelInputID", "disabled", "skeleton", "helperText", "invalidText", "invalid", "warn", "warnText", "ariaLabel"] }, { kind: "directive", type: i3.TextInput, selector: "[cdsText], [ibmText]", inputs: ["theme", "size", "invalid", "warn", "skeleton"] }, { kind: "component", type: i3.Modal, selector: "cds-modal, ibm-modal", inputs: ["size", "theme", "ariaLabel", "open", "trigger", "hasScrollingContent"], outputs: ["overlaySelected", "close"] }, { kind: "component", type: i3.ModalHeader, selector: "cds-modal-header, ibm-modal-header", inputs: ["theme", "closeLabel", "showCloseButton"], outputs: ["closeSelect"] }, { kind: "component", type: i3.ModalFooter, selector: "cds-modal-footer, ibm-modal-footer" }, { kind: "directive", type: i3.ModalContent, selector: "[cdsModalContent], [ibmModalContent]", inputs: ["hasForm"] }, { kind: "directive", type: i3.ModalHeaderHeading, selector: "[cdsModalHeaderHeading], [ibmModalHeaderHeading]" }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i4.ConfirmationModalComponent, selector: "valtimo-confirmation-modal", inputs: ["titleTranslationKey", "title", "content", "contentTranslationKey", "confirmButtonText", "confirmButtonTextTranslationKey", "confirmButtonType", "cancelButtonText", "cancelButtonTextTranslationKey", "cancelButtonType", "showModalSubject$", "outputOnConfirm"], outputs: ["confirmEvent"] }, { kind: "directive", type: i3.IconDirective, selector: "[cdsIcon], [ibmIcon]", inputs: ["ibmIcon", "cdsIcon", "size", "title", "ariaLabel", "ariaLabelledBy", "ariaHidden", "isFocusable"] }, { kind: "pipe", type: i6.AsyncPipe, name: "async" }, { kind: "pipe", type: i2$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
780
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DashboardManagementComponent, decorators: [{
|
|
781
|
-
type: Component,
|
|
782
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<ng-container *ngIf=\"tableData$ | async as data\">\n <valtimo-carbon-table\n [data]=\"data.items\"\n [loading]=\"data.loading\"\n [tableConfig]=\"tableConfig\"\n (rowClick)=\"onRowClick($event)\"\n class=\"valtimo-dashboard-management__table\"\n >\n <ng-container carbonTableTitle> {{ 'dashboardManagement.title' | translate }} </ng-container>\n\n <div carbonToolbarContent>\n <ng-container [ngTemplateOutlet]=\"addDashboardButton\"></ng-container>\n </div>\n\n <valtimo-no-results\n [action]=\"addDashboardButton\"\n description=\"{{ 'dashboardManagement.noResults.description' | translate }}\"\n title=\"{{ 'dashboardManagement.noResults.title' | translate }}\"\n ></valtimo-no-results>\n </valtimo-carbon-table>\n</ng-container>\n\n<cds-modal\n valtimoIbmModal\n [open]=\"openModal$ | async\"\n showFooter=\"true\"\n title=\"{{ 'dashboardManagement.addDashboard' | translate }}\"\n>\n <cds-modal-header [showCloseButton]=\"true\" (closeSelect)=\"closeModal()\">\n <h3 cdsModalHeaderHeading>\n {{ 'dashboardManagement.addDashboard' | translate }}\n </h3>\n </cds-modal-header>\n\n <section cdsModalContent>\n <form [formGroup]=\"form\" class=\"valtimo-dashboard-management__form\">\n <cds-label [invalid]=\"getControlInvalid('title')\">\n {{ 'dashboardManagement.addModal.name' | translate }}\n\n <input\n [attr.modal-primary-focus]=\"true\"\n [invalid]=\"getControlInvalid('title')\"\n formControlName=\"title\"\n cdsText\n placeholder=\"{{ 'dashboardManagement.addModal.namePlaceholder' | translate }}\"\n />\n </cds-label>\n\n <cds-label\n [helperText]=\"'dashboardManagement.addModal.descriptionHelperText' | translate\"\n [invalid]=\"getControlInvalid('description')\"\n >\n {{ 'dashboardManagement.description' | translate }}\n\n <input\n [invalid]=\"getControlInvalid('description')\"\n formControlName=\"description\"\n cdsText\n placeholder=\"{{ 'dashboardManagement.addModal.descriptionPlaceholder' | translate }}\"\n />\n </cds-label>\n </form>\n </section>\n\n <cds-modal-footer>\n <button cdsButton=\"ghost\" (click)=\"closeModal()\">\n {{ 'dashboardManagement.cancel' | translate }}\n </button>\n\n <button [disabled]=\"this.form.invalid\" cdsButton=\"primary\" (click)=\"createDashboard()\">\n {{ 'dashboardManagement.create' | translate }}\n </button>\n </cds-modal-footer>\n</cds-modal>\n\n<valtimo-confirmation-modal\n confirmButtonTextTranslationKey=\"dashboardManagement.deleteModal.confirm\"\n confirmButtonType=\"danger\"\n contentTranslationKey=\"dashboardManagement.deleteModalContent\"\n [outputOnConfirm]=\"deleteRowKey$ | async\"\n [showModalSubject$]=\"showDeleteModal$\"\n titleTranslationKey=\"dashboardManagement.delete\"\n (confirmEvent)=\"onConfirmEvent($event)\"\n></valtimo-confirmation-modal>\n\n<ng-template #addDashboardButton>\n <button cdsButton=\"primary\" (click)=\"openModal()\">\n {{ 'dashboardManagement.addDashboard' | translate }}\n\n <svg cdsIcon=\"add\" size=\"16\" class=\"cds--btn__icon\"></svg>\n </button>\n</ng-template>\n", styles: [".valtimo-dashboard-management__actions{width:1px}.valtimo-dashboard-management__form>*:not(:last-child){margin-bottom:32px}\n"] }]
|
|
783
|
-
}], ctorParameters: function () { return [{ type: DashboardManagementService }, { type: i1$1.FormBuilder }, { type: i5$1.Router }]; } });
|
|
784
|
-
|
|
785
|
-
/*
|
|
786
|
-
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
787
|
-
*
|
|
788
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
789
|
-
* you may not use this file except in compliance with the License.
|
|
790
|
-
* You may obtain a copy of the License at
|
|
791
|
-
*
|
|
792
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
793
|
-
*
|
|
794
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
795
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
796
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
797
|
-
* See the License for the specific language governing permissions and
|
|
798
|
-
* limitations under the License.
|
|
799
|
-
*/
|
|
800
|
-
const routes = [
|
|
801
|
-
{
|
|
802
|
-
path: 'dashboard-management',
|
|
803
|
-
component: DashboardManagementComponent,
|
|
804
|
-
canActivate: [AuthGuardService],
|
|
805
|
-
data: { title: 'Dashboard configuration', roles: [ROLE_ADMIN] },
|
|
806
|
-
},
|
|
807
|
-
{
|
|
808
|
-
path: 'dashboard-management/:id',
|
|
809
|
-
component: DashboardDetailsComponent,
|
|
810
|
-
canActivate: [AuthGuardService],
|
|
811
|
-
data: {
|
|
812
|
-
title: 'Dashboard details',
|
|
813
|
-
roles: [ROLE_ADMIN],
|
|
814
|
-
customPageTitle: true,
|
|
815
|
-
customPageSubtitle: true,
|
|
816
|
-
},
|
|
817
|
-
},
|
|
818
|
-
];
|
|
819
|
-
class DashboardManagementRoutingModule {
|
|
820
|
-
}
|
|
821
|
-
DashboardManagementRoutingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DashboardManagementRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
822
|
-
DashboardManagementRoutingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: DashboardManagementRoutingModule, imports: [i5$1.RouterModule], exports: [RouterModule] });
|
|
823
|
-
DashboardManagementRoutingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DashboardManagementRoutingModule, imports: [RouterModule.forRoot(routes), RouterModule] });
|
|
824
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DashboardManagementRoutingModule, decorators: [{
|
|
825
|
-
type: NgModule,
|
|
826
|
-
args: [{
|
|
827
|
-
imports: [RouterModule.forRoot(routes)],
|
|
828
|
-
exports: [RouterModule],
|
|
829
|
-
declarations: [],
|
|
830
|
-
}]
|
|
831
|
-
}] });
|
|
832
|
-
|
|
833
|
-
/*
|
|
834
|
-
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
835
|
-
*
|
|
836
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
837
|
-
* you may not use this file except in compliance with the License.
|
|
838
|
-
* You may obtain a copy of the License at
|
|
839
|
-
*
|
|
840
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
841
|
-
*
|
|
842
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
843
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
844
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
845
|
-
* See the License for the specific language governing permissions and
|
|
846
|
-
* limitations under the License.
|
|
847
|
-
*/
|
|
848
|
-
class DashboardManagementModule {
|
|
849
|
-
}
|
|
850
|
-
DashboardManagementModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DashboardManagementModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
851
|
-
DashboardManagementModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: DashboardManagementModule, declarations: [DashboardManagementComponent,
|
|
852
|
-
DashboardDetailsComponent,
|
|
853
|
-
WidgetModalComponent,
|
|
854
|
-
EditDashboardModalComponent,
|
|
855
|
-
WidgetConfigurationContainerComponent], imports: [ButtonModule,
|
|
856
|
-
CarbonTableModule,
|
|
857
|
-
CommonModule,
|
|
858
|
-
DashboardManagementRoutingModule,
|
|
859
|
-
DropdownModule,
|
|
860
|
-
InputModule,
|
|
861
|
-
ListModule,
|
|
862
|
-
ModalModule,
|
|
863
|
-
ReactiveFormsModule,
|
|
864
|
-
SpinnerModule,
|
|
865
|
-
TranslateModule,
|
|
866
|
-
RenderInPageHeaderDirectiveModule,
|
|
867
|
-
ConfirmationModalModule,
|
|
868
|
-
NotificationModule,
|
|
869
|
-
IconModule,
|
|
870
|
-
WidgetTranslatePipeModule] });
|
|
871
|
-
DashboardManagementModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DashboardManagementModule, imports: [ButtonModule,
|
|
872
|
-
CarbonTableModule,
|
|
873
|
-
CommonModule,
|
|
874
|
-
DashboardManagementRoutingModule,
|
|
875
|
-
DropdownModule,
|
|
876
|
-
InputModule,
|
|
877
|
-
ListModule,
|
|
878
|
-
ModalModule,
|
|
879
|
-
ReactiveFormsModule,
|
|
880
|
-
SpinnerModule,
|
|
881
|
-
TranslateModule,
|
|
882
|
-
RenderInPageHeaderDirectiveModule,
|
|
883
|
-
ConfirmationModalModule,
|
|
884
|
-
NotificationModule,
|
|
885
|
-
IconModule,
|
|
886
|
-
WidgetTranslatePipeModule] });
|
|
887
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DashboardManagementModule, decorators: [{
|
|
888
|
-
type: NgModule,
|
|
889
|
-
args: [{
|
|
890
|
-
declarations: [
|
|
891
|
-
DashboardManagementComponent,
|
|
892
|
-
DashboardDetailsComponent,
|
|
893
|
-
WidgetModalComponent,
|
|
894
|
-
EditDashboardModalComponent,
|
|
895
|
-
WidgetConfigurationContainerComponent,
|
|
896
|
-
],
|
|
897
|
-
imports: [
|
|
898
|
-
ButtonModule,
|
|
899
|
-
CarbonTableModule,
|
|
900
|
-
CommonModule,
|
|
901
|
-
DashboardManagementRoutingModule,
|
|
902
|
-
DropdownModule,
|
|
903
|
-
InputModule,
|
|
904
|
-
ListModule,
|
|
905
|
-
ModalModule,
|
|
906
|
-
ReactiveFormsModule,
|
|
907
|
-
SpinnerModule,
|
|
908
|
-
TranslateModule,
|
|
909
|
-
RenderInPageHeaderDirectiveModule,
|
|
910
|
-
ConfirmationModalModule,
|
|
911
|
-
NotificationModule,
|
|
912
|
-
IconModule,
|
|
913
|
-
WidgetTranslatePipeModule,
|
|
914
|
-
],
|
|
915
|
-
exports: [],
|
|
916
|
-
}]
|
|
917
|
-
}] });
|
|
918
|
-
|
|
919
|
-
/*
|
|
920
|
-
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
921
|
-
*
|
|
922
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
923
|
-
* you may not use this file except in compliance with the License.
|
|
924
|
-
* You may obtain a copy of the License at
|
|
925
|
-
*
|
|
926
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
927
|
-
*
|
|
928
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
929
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
930
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
931
|
-
* See the License for the specific language governing permissions and
|
|
932
|
-
* limitations under the License.
|
|
933
|
-
*/
|
|
934
|
-
|
|
935
|
-
/**
|
|
936
|
-
* Generated bundle index. Do not edit.
|
|
937
|
-
*/
|
|
938
|
-
|
|
939
|
-
export { DashboardManagementModule };
|
|
940
|
-
//# sourceMappingURL=valtimo-dashboard-management.mjs.map
|