@c8y/ngx-components 1021.54.4 → 1021.54.10
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/context-dashboard/context-dashboard.component.d.ts.map +1 -1
- package/context-dashboard/context-dashboard.model.d.ts +1 -0
- package/context-dashboard/context-dashboard.model.d.ts.map +1 -1
- package/context-dashboard/context-dashboard.service.d.ts +1 -0
- package/context-dashboard/context-dashboard.service.d.ts.map +1 -1
- package/esm2022/context-dashboard/context-dashboard.component.mjs +15 -33
- package/esm2022/context-dashboard/context-dashboard.model.mjs +1 -1
- package/esm2022/context-dashboard/context-dashboard.service.mjs +31 -21
- package/fesm2022/c8y-ngx-components-context-dashboard.mjs +44 -52
- package/fesm2022/c8y-ngx-components-context-dashboard.mjs.map +1 -1
- package/locales/de.po +125 -119
- package/locales/es.po +6 -0
- package/locales/fr.po +143 -135
- package/locales/ja_JP.po +76 -46
- package/locales/ko.po +6 -0
- package/locales/locales.pot +6 -0
- package/locales/nl.po +6 -0
- package/locales/pl.po +6 -0
- package/locales/pt_BR.po +6 -0
- package/locales/zh_CN.po +6 -0
- package/locales/zh_TW.po +6 -0
- package/package.json +1 -1
|
@@ -482,10 +482,7 @@ class ContextDashboardService {
|
|
|
482
482
|
await this.modal.confirm(gettext('Delete dashboard'), this.translateService.instant(msg, {
|
|
483
483
|
dashboardName: dashboard.c8y_Dashboard.name,
|
|
484
484
|
deviceType: dashboard.c8y_Dashboard.deviceTypeValue
|
|
485
|
-
}), Status.DANGER, {
|
|
486
|
-
ok: gettext('Delete'),
|
|
487
|
-
cancel: gettext('Cancel')
|
|
488
|
-
});
|
|
485
|
+
}), Status.DANGER, { ok: gettext('Delete'), cancel: gettext('Cancel') });
|
|
489
486
|
}
|
|
490
487
|
await this.inventory.delete(dashboard);
|
|
491
488
|
const tabToRemove = Array.from(this.tabs.state).find(tab => {
|
|
@@ -532,10 +529,21 @@ class ContextDashboardService {
|
|
|
532
529
|
}
|
|
533
530
|
getNamedDashboardOrCreate(name, defaultWidgets, context) {
|
|
534
531
|
const children = this.mapWidgets(defaultWidgets);
|
|
535
|
-
return this.getDashboard$(name, [ContextDashboardType.Named]).pipe(throwIfEmpty(), catchError(() =>
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
532
|
+
return this.getDashboard$(name, [ContextDashboardType.Named]).pipe(throwIfEmpty(), catchError(() => {
|
|
533
|
+
if (!this.hasPermissionsToCopyDashboard()) {
|
|
534
|
+
this.alert.warning(gettext('You are viewing a read-only dashboard because you don’t have the necessary permissions to modify it.'));
|
|
535
|
+
return of(this.getTemporaryDashboard({
|
|
536
|
+
name,
|
|
537
|
+
children,
|
|
538
|
+
widgetClasses: { 'dashboard-theme-light': true, 'panel-title-regular': true }
|
|
539
|
+
}));
|
|
540
|
+
}
|
|
541
|
+
else
|
|
542
|
+
return from(this.create({
|
|
543
|
+
children,
|
|
544
|
+
widgetClasses: { 'dashboard-theme-light': true, 'panel-title-regular': true }
|
|
545
|
+
}, context, name));
|
|
546
|
+
}));
|
|
539
547
|
}
|
|
540
548
|
updateNavigatorItem(mo) {
|
|
541
549
|
this.navigator.state.forEach(node => {
|
|
@@ -766,11 +774,7 @@ class ContextDashboardService {
|
|
|
766
774
|
const finalFilterCriteria = typeFilterCriteria
|
|
767
775
|
? [...filterCriteria, typeFilterCriteria]
|
|
768
776
|
: filterCriteria;
|
|
769
|
-
const query = this.queriesUtil.buildQuery({
|
|
770
|
-
__filter: {
|
|
771
|
-
__or: finalFilterCriteria
|
|
772
|
-
}
|
|
773
|
-
});
|
|
777
|
+
const query = this.queriesUtil.buildQuery({ __filter: { __or: finalFilterCriteria } });
|
|
774
778
|
const now = Date.now();
|
|
775
779
|
const cacheHasValidResponse = this.contextDashboardsCache &&
|
|
776
780
|
this.contextDashboardsCache.query === query &&
|
|
@@ -783,10 +787,7 @@ class ContextDashboardService {
|
|
|
783
787
|
}
|
|
784
788
|
this.contextDashboardsCache = {
|
|
785
789
|
query,
|
|
786
|
-
result: this.inventory.list({
|
|
787
|
-
query,
|
|
788
|
-
pageSize: this.DEFAULT_PAGESIZE
|
|
789
|
-
}),
|
|
790
|
+
result: this.inventory.list({ query, pageSize: this.DEFAULT_PAGESIZE }),
|
|
790
791
|
timestamp: now
|
|
791
792
|
};
|
|
792
793
|
return this.contextDashboardsCache.result;
|
|
@@ -1060,14 +1061,23 @@ class ContextDashboardService {
|
|
|
1060
1061
|
}
|
|
1061
1062
|
return null;
|
|
1062
1063
|
}
|
|
1064
|
+
getTemporaryDashboard(dashboardCfg) {
|
|
1065
|
+
return {
|
|
1066
|
+
c8y_Dashboard: {
|
|
1067
|
+
...dashboardCfg,
|
|
1068
|
+
name: dashboardCfg.name || 'Temporary Dashboard',
|
|
1069
|
+
isTransient: true,
|
|
1070
|
+
description: gettext('This is a temporary, non-editable dashboard displayed due to insufficient permissions.')
|
|
1071
|
+
},
|
|
1072
|
+
[`c8y_Dashboard!name!${dashboardCfg.name}`]: {}
|
|
1073
|
+
};
|
|
1074
|
+
}
|
|
1063
1075
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: ContextDashboardService, deps: [{ token: i1$1.InventoryService }, { token: i2.TabsService }, { token: i2.ModalService }, { token: i2$1.TranslateService }, { token: i1.Router }, { token: i2.NavigatorService }, { token: i2.Permissions }, { token: i2.AlertService }, { token: i2.DynamicComponentService }, { token: i2.GroupService }, { token: i2.OptionsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1064
1076
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: ContextDashboardService, providedIn: 'root' }); }
|
|
1065
1077
|
}
|
|
1066
1078
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: ContextDashboardService, decorators: [{
|
|
1067
1079
|
type: Injectable,
|
|
1068
|
-
args: [{
|
|
1069
|
-
providedIn: 'root'
|
|
1070
|
-
}]
|
|
1080
|
+
args: [{ providedIn: 'root' }]
|
|
1071
1081
|
}], ctorParameters: () => [{ type: i1$1.InventoryService }, { type: i2.TabsService }, { type: i2.ModalService }, { type: i2$1.TranslateService }, { type: i1.Router }, { type: i2.NavigatorService }, { type: i2.Permissions }, { type: i2.AlertService }, { type: i2.DynamicComponentService }, { type: i2.GroupService }, { type: i2.OptionsService }] });
|
|
1072
1082
|
|
|
1073
1083
|
class DashboardDetailService {
|
|
@@ -2614,9 +2624,7 @@ class ContextDashboardComponent {
|
|
|
2614
2624
|
}
|
|
2615
2625
|
const isNewDashboard = this.route.snapshot.queryParams[NEW_DASHBOARD_QUERY_PARAM];
|
|
2616
2626
|
if (isNewDashboard) {
|
|
2617
|
-
this.router.navigate([], {
|
|
2618
|
-
queryParams: null
|
|
2619
|
-
});
|
|
2627
|
+
this.router.navigate([], { queryParams: null });
|
|
2620
2628
|
}
|
|
2621
2629
|
}
|
|
2622
2630
|
/**
|
|
@@ -2646,9 +2654,7 @@ class ContextDashboardComponent {
|
|
|
2646
2654
|
});
|
|
2647
2655
|
this.isLoading = true;
|
|
2648
2656
|
this.mo.c8y_Dashboard.children = this.contextDashboardService.mapWidgets(this.defaultWidgets);
|
|
2649
|
-
this.mo.c8y_Dashboard.historyDescription = {
|
|
2650
|
-
changeType: 'reset'
|
|
2651
|
-
};
|
|
2657
|
+
this.mo.c8y_Dashboard.historyDescription = { changeType: 'reset' };
|
|
2652
2658
|
await this.contextDashboardService.update(this.mo);
|
|
2653
2659
|
await this.onLoad();
|
|
2654
2660
|
}
|
|
@@ -2723,10 +2729,7 @@ class ContextDashboardComponent {
|
|
|
2723
2729
|
this.contextDashboardService.copyClipboard = {
|
|
2724
2730
|
dashboardId: this.mo.id,
|
|
2725
2731
|
dashboard: cloneDeep(this.mo.c8y_Dashboard),
|
|
2726
|
-
context: cloneDeep({
|
|
2727
|
-
context: viewContext,
|
|
2728
|
-
contextData: this.context
|
|
2729
|
-
})
|
|
2732
|
+
context: cloneDeep({ context: viewContext, contextData: this.context })
|
|
2730
2733
|
};
|
|
2731
2734
|
if (viewContext) {
|
|
2732
2735
|
const ctx = viewContext.split('/').shift();
|
|
@@ -2771,10 +2774,7 @@ class ContextDashboardComponent {
|
|
|
2771
2774
|
*/
|
|
2772
2775
|
async addWidget(selected) {
|
|
2773
2776
|
const partialCloneSelected = selected
|
|
2774
|
-
? {
|
|
2775
|
-
...selected,
|
|
2776
|
-
data: cloneDeep(selected.data)
|
|
2777
|
-
}
|
|
2777
|
+
? { ...selected, data: cloneDeep(selected.data) }
|
|
2778
2778
|
: selected;
|
|
2779
2779
|
const activeContext = this.context.contextData ? this.context.contextData : this.context;
|
|
2780
2780
|
const initialState = {
|
|
@@ -2804,10 +2804,9 @@ class ContextDashboardComponent {
|
|
|
2804
2804
|
...this.editModeService.getCurrentState().children,
|
|
2805
2805
|
[newWidget.id]: newWidget
|
|
2806
2806
|
};
|
|
2807
|
-
this.setNewState({
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
}, 'config', [newWidget]);
|
|
2807
|
+
this.setNewState({ name: DASHBOARD_CHILDREN_STATE_NAME.config, children }, 'config', [
|
|
2808
|
+
newWidget
|
|
2809
|
+
]);
|
|
2811
2810
|
}
|
|
2812
2811
|
modal.close();
|
|
2813
2812
|
}
|
|
@@ -2902,11 +2901,13 @@ class ContextDashboardComponent {
|
|
|
2902
2901
|
});
|
|
2903
2902
|
}
|
|
2904
2903
|
async onLoad(trackExperience) {
|
|
2905
|
-
this.hasPermissionToEditDashboard =
|
|
2906
|
-
|
|
2907
|
-
|
|
2904
|
+
this.hasPermissionToEditDashboard =
|
|
2905
|
+
this.dashboard && !this.dashboard.isTransient
|
|
2906
|
+
? await this.contextDashboardService.canEditDashboard(this.mo)
|
|
2907
|
+
: false;
|
|
2908
2908
|
this.canCopy =
|
|
2909
2909
|
this._canCopy &&
|
|
2910
|
+
!this.dashboard?.isTransient &&
|
|
2910
2911
|
(this.contextDashboardService.isDeviceDashboard(this.mo) ||
|
|
2911
2912
|
this.contextDashboardService.isDeviceType(this.mo) ||
|
|
2912
2913
|
this.contextDashboardService.isGroupDashboard(this.mo));
|
|
@@ -3024,22 +3025,13 @@ class ContextDashboardComponent {
|
|
|
3024
3025
|
componentToWidget(child) {
|
|
3025
3026
|
return {
|
|
3026
3027
|
...omit(child.data, ['componentTransformConfigWithContext', 'transformConfigWithContext']), // remove legacy
|
|
3027
|
-
...{
|
|
3028
|
-
_x: child.x,
|
|
3029
|
-
_y: child.y,
|
|
3030
|
-
_width: child.width,
|
|
3031
|
-
_height: child.height
|
|
3032
|
-
}
|
|
3028
|
+
...{ _x: child.x, _y: child.y, _width: child.width, _height: child.height }
|
|
3033
3029
|
};
|
|
3034
3030
|
}
|
|
3035
3031
|
addReportDashboardSettings() {
|
|
3036
3032
|
this.setTitle = true;
|
|
3037
3033
|
this.title = this.context?.name || gettext('New report');
|
|
3038
|
-
this.breadcrumbSettings = {
|
|
3039
|
-
icon: 'th',
|
|
3040
|
-
label: 'Reports',
|
|
3041
|
-
path: 'reports'
|
|
3042
|
-
};
|
|
3034
|
+
this.breadcrumbSettings = { icon: 'th', label: 'Reports', path: 'reports' };
|
|
3043
3035
|
this.canDelete = false;
|
|
3044
3036
|
}
|
|
3045
3037
|
getDashboardCopyPermissionState() {
|