@c8y/ngx-components 1023.14.193 → 1023.14.196
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/index.d.ts +7 -3
- package/context-dashboard/index.d.ts.map +1 -1
- package/fesm2022/c8y-ngx-components-context-dashboard.mjs +28 -13
- package/fesm2022/c8y-ngx-components-context-dashboard.mjs.map +1 -1
- package/locales/es.po +1 -1
- package/locales/ja_JP.po +1 -2
- package/locales/locales.pot +4 -1
- package/locales/zh_CN.po +1 -1
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ import { InjectionToken, OnInit, OnChanges, OnDestroy, EventEmitter, Renderer2,
|
|
|
7
7
|
import { ContextDashboardStateService } from '@c8y/ngx-components/context-dashboard-state';
|
|
8
8
|
import { TranslateService } from '@ngx-translate/core';
|
|
9
9
|
import * as _c8y_client from '@c8y/client';
|
|
10
|
-
import { IManagedObject, QueriesUtil, InventoryService, IResultList } from '@c8y/client';
|
|
10
|
+
import { IManagedObject, QueriesUtil, InventoryService, IIdentified, IResultList } from '@c8y/client';
|
|
11
11
|
import { Observable } from 'rxjs/internal/Observable';
|
|
12
12
|
import { SupportedIconsSuggestions } from '@c8y/ngx-components/icon-selector/icons';
|
|
13
13
|
import * as rxjs from 'rxjs';
|
|
@@ -415,16 +415,20 @@ declare class ContextDashboardService {
|
|
|
415
415
|
activateDashboards(route: ActivatedRouteSnapshot, types: ContextDashboardType[], options?: {
|
|
416
416
|
strictAppFilter?: boolean;
|
|
417
417
|
}): Observable$1<boolean | Tab[]>;
|
|
418
|
-
getDashboard(name: string, defaultWidgets: Widget[]): Observable$1<ContextDashboardManagedObject>;
|
|
418
|
+
getDashboard(name: string, defaultWidgets: Widget[], context?: IIdentified): Observable$1<ContextDashboardManagedObject>;
|
|
419
419
|
updateNavigatorItem(mo: IManagedObject): void;
|
|
420
420
|
navigateToDashboard(dashboardMO: ContextDashboardManagedObject, isNewDashboard?: boolean): Promise<void>;
|
|
421
421
|
/**
|
|
422
422
|
* Checks if user is able to edit dashboard according to his roles and dashboard ownership.
|
|
423
|
+
* When the dashboard managed object has no ID (e.g. a default in-memory dashboard), the check
|
|
424
|
+
* falls back to the provided `fallbackContext` managed object (e.g. the device or group), which
|
|
425
|
+
* allows group-level inventory roles to be evaluated correctly via the request-based check.
|
|
423
426
|
*
|
|
424
427
|
* @param mo - Dashboard managed object.
|
|
428
|
+
* @param fallbackContext - Optional context (device or group) used for permission checks when `mo` has no ID.
|
|
425
429
|
* @returns True if user is able to edit dashboard, false if he cannot.
|
|
426
430
|
*/
|
|
427
|
-
canEditDashboard(mo: ContextDashboardManagedObject): Promise<boolean>;
|
|
431
|
+
canEditDashboard(mo: ContextDashboardManagedObject, fallbackContext?: IIdentified): Promise<boolean>;
|
|
428
432
|
/**
|
|
429
433
|
* Checks if user has permissions to copy dashboard according to his roles.
|
|
430
434
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sources":["../../context-dashboard/add-dashboard.component.ts","../../context-dashboard/add-dashboard.factory.ts","../../context-dashboard/context-dashboard.model.ts","../../context-dashboard/context-dashboard.service.ts","../../context-dashboard/dashboard-detail.service.ts","../../context-dashboard/dashboard-detail.component.ts","../../context-dashboard/memento/dashboard-originator.service.ts","../../context-dashboard/memento/dashboard-caretaker.service.ts","../../context-dashboard/memento/dashboard-edit-mode.service.ts","../../context-dashboard/widget.service.ts","../../context-dashboard/context-dashboard.component.ts","../../context-dashboard/widget-config/appearance-settings.component.ts","../../context-dashboard/type-dashboard-info/type-dashboard-info.component.ts","../../context-dashboard/widget-config-hook/widget-config-hook.model.ts","../../context-dashboard/widget-config-hook/widget-config-hook.service.ts","../../context-dashboard/widget-config.service.ts","../../context-dashboard/widget-config/widget-config-root.component.ts","../../context-dashboard/widget-config.component.ts","../../context-dashboard/widget-config/widget-preview.component.ts","../../context-dashboard/widget-config/widget-config-section.component.ts","../../context-dashboard/widget-config/widget-preview-wrapper.component.ts","../../context-dashboard/paste-dashboard-action.component.ts","../../context-dashboard/context-dashboard.module.ts","../../context-dashboard/dashboard-action-bar.factory.ts","../../context-dashboard/device-info-dashboard/device-info-dashboard.component.ts","../../context-dashboard/device-info-dashboard/device-info-dashboard.module.ts","../../context-dashboard/device-management-home-dashboard/device-management-home-dashboard.component.ts","../../context-dashboard/device-management-home-dashboard/device-management-home-dashboard.module.ts","../../context-dashboard/widget-config/widget-config-appearance.component.ts","../../context-dashboard/widget-config/widget-config-general.component.ts","../../context-dashboard/widget-config/widget-asset-selector.component.ts","../../context-dashboard/new-dashboard.guard.ts","../../context-dashboard/widget-config/global-context-section.component.ts","../../context-dashboard/widget-config/widget-config-feedback.component.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKA;AAQI;AACA;AADQ;;;;AAoBX;;ACpBD;AACE;;;;AAMM;;AAoCP;;ACzCD;AACA;;;;;;;;;;;;;;;;;AAkBE;;AAEG;AACH;AACD;;AAGC;;;AAGG;;AAGH;;AAEG;;AAGH;;AAEG;AACH;AACE;;AAEG;AACH;;AAEF;;;AAGG;AACH;AACE;;AAEA;;AAEF;;;;;AAKG;AACH;AACA;;;;;;AAMG;AACH;AAEA;;AAEG;AACH;AACD;AAEK;;;AAGJ;AACD;;AAGC;AACA;AACA;AACA;AACA;AACA;AACA;AAAY;AAAwB;AACpC;AAAkB;AAAwB;AAC1C;AACA;AACA;AACA;AACA;;;AAGG;AACH;AACA;AACE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AAAmB;;AACpB;AACD;;AAEG;;AAED;;AAEG;;AAEH;;AAEG;AACH;AACA;;AAEG;AACH;AACA;;;;;;;;AAQG;AACH;AACE;AACA;AACA;AACA;AACD;AACD;;AAEG;;AAEJ;AAED;;;;;;;AAOA;;;AAGG;AACG;AACJ;;AAEG;;AAEH;;AAEG;AACH;AACA;;;;;;;;;;;;;AAaG;;AAKG;AACD;;AAKP;AACE;AACA;AACA;AACA;AACA;AACD;AAED;AACE;AACA;AACA;AACD;AAEK;;AAE0D;;;;;AAO/D;AAED;;;;;;;;;;;;;;;;;AAuBA;;;;;;;;;;;;;;;;;;;;;AA4BA;;;;;;;;;;;;;;;;;AA2BA;;;;;AAUC;;;AAIC;AACD;AAED;AACM;AAEN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCE;AACD;AAED;AAMM;AAEN;AAMA;AAKA;AAKA;AAEM;AAEN;AACA;;;;;;;;;;;;AAaC;;AC9VD;AAyCI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnDF;AACA;;;;;AAKA;;AAKA;AACA;AACA;AACA;AACA;AACA;;;;;AAUA;AAGA;AAIA;;;;AAmEM;AAyBA;AAqCN;AAuBA;;AAGyC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":["../../context-dashboard/add-dashboard.component.ts","../../context-dashboard/add-dashboard.factory.ts","../../context-dashboard/context-dashboard.model.ts","../../context-dashboard/context-dashboard.service.ts","../../context-dashboard/dashboard-detail.service.ts","../../context-dashboard/dashboard-detail.component.ts","../../context-dashboard/memento/dashboard-originator.service.ts","../../context-dashboard/memento/dashboard-caretaker.service.ts","../../context-dashboard/memento/dashboard-edit-mode.service.ts","../../context-dashboard/widget.service.ts","../../context-dashboard/context-dashboard.component.ts","../../context-dashboard/widget-config/appearance-settings.component.ts","../../context-dashboard/type-dashboard-info/type-dashboard-info.component.ts","../../context-dashboard/widget-config-hook/widget-config-hook.model.ts","../../context-dashboard/widget-config-hook/widget-config-hook.service.ts","../../context-dashboard/widget-config.service.ts","../../context-dashboard/widget-config/widget-config-root.component.ts","../../context-dashboard/widget-config.component.ts","../../context-dashboard/widget-config/widget-preview.component.ts","../../context-dashboard/widget-config/widget-config-section.component.ts","../../context-dashboard/widget-config/widget-preview-wrapper.component.ts","../../context-dashboard/paste-dashboard-action.component.ts","../../context-dashboard/context-dashboard.module.ts","../../context-dashboard/dashboard-action-bar.factory.ts","../../context-dashboard/device-info-dashboard/device-info-dashboard.component.ts","../../context-dashboard/device-info-dashboard/device-info-dashboard.module.ts","../../context-dashboard/device-management-home-dashboard/device-management-home-dashboard.component.ts","../../context-dashboard/device-management-home-dashboard/device-management-home-dashboard.module.ts","../../context-dashboard/widget-config/widget-config-appearance.component.ts","../../context-dashboard/widget-config/widget-config-general.component.ts","../../context-dashboard/widget-config/widget-asset-selector.component.ts","../../context-dashboard/new-dashboard.guard.ts","../../context-dashboard/widget-config/global-context-section.component.ts","../../context-dashboard/widget-config/widget-config-feedback.component.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKA;AAQI;AACA;AADQ;;;;AAoBX;;ACpBD;AACE;;;;AAMM;;AAoCP;;ACzCD;AACA;;;;;;;;;;;;;;;;;AAkBE;;AAEG;AACH;AACD;;AAGC;;;AAGG;;AAGH;;AAEG;;AAGH;;AAEG;AACH;AACE;;AAEG;AACH;;AAEF;;;AAGG;AACH;AACE;;AAEA;;AAEF;;;;;AAKG;AACH;AACA;;;;;;AAMG;AACH;AAEA;;AAEG;AACH;AACD;AAEK;;;AAGJ;AACD;;AAGC;AACA;AACA;AACA;AACA;AACA;AACA;AAAY;AAAwB;AACpC;AAAkB;AAAwB;AAC1C;AACA;AACA;AACA;AACA;;;AAGG;AACH;AACA;AACE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AAAmB;;AACpB;AACD;;AAEG;;AAED;;AAEG;;AAEH;;AAEG;AACH;AACA;;AAEG;AACH;AACA;;;;;;;;AAQG;AACH;AACE;AACA;AACA;AACA;AACD;AACD;;AAEG;;AAEJ;AAED;;;;;;;AAOA;;;AAGG;AACG;AACJ;;AAEG;;AAEH;;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this.getTabs$(mo, types, route?.parent?.data, options);
|
|
432
432
|
return this.dashboardTabs$;
|
|
433
433
|
}
|
|
434
|
-
getDashboard(name, defaultWidgets) {
|
|
434
|
+
getDashboard(name, defaultWidgets, context) {
|
|
435
435
|
const children = this.mapWidgets(defaultWidgets);
|
|
436
|
+
const defaultDashboard = this.getDefaultDashboard({
|
|
437
|
+
name,
|
|
438
|
+
children,
|
|
439
|
+
translateWidgetTitle: true,
|
|
440
|
+
widgetClasses: { 'dashboard-theme-light': true, 'panel-title-regular': true }
|
|
441
|
+
});
|
|
436
442
|
return this.getDashboard$(name, [ContextDashboardType.Named]).pipe(throwIfEmpty(), catchError(() => {
|
|
437
|
-
|
|
438
|
-
this.
|
|
439
|
-
|
|
440
|
-
return
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
}));
|
|
443
|
+
const canCreate$ = context?.id
|
|
444
|
+
? from(this.permissions.canEdit(this.INVENTORY_ROLES, context))
|
|
445
|
+
: of(this.hasPermissionsToCopyDashboard());
|
|
446
|
+
return canCreate$.pipe(tap(hasPermission => {
|
|
447
|
+
if (!hasPermission) {
|
|
448
|
+
this.alert.warning(gettext('You are viewing a read-only dashboard because you don’t have the necessary permissions to modify it.'));
|
|
449
|
+
}
|
|
450
|
+
}), map(() => defaultDashboard));
|
|
445
451
|
}));
|
|
446
452
|
}
|
|
447
453
|
updateNavigatorItem(mo) {
|
|
@@ -498,12 +504,19 @@ class ContextDashboardService {
|
|
|
498
504
|
}
|
|
499
505
|
/**
|
|
500
506
|
* Checks if user is able to edit dashboard according to his roles and dashboard ownership.
|
|
507
|
+
* When the dashboard managed object has no ID (e.g. a default in-memory dashboard), the check
|
|
508
|
+
* falls back to the provided `fallbackContext` managed object (e.g. the device or group), which
|
|
509
|
+
* allows group-level inventory roles to be evaluated correctly via the request-based check.
|
|
501
510
|
*
|
|
502
511
|
* @param mo - Dashboard managed object.
|
|
512
|
+
* @param fallbackContext - Optional context (device or group) used for permission checks when `mo` has no ID.
|
|
503
513
|
* @returns True if user is able to edit dashboard, false if he cannot.
|
|
504
514
|
*/
|
|
505
|
-
async canEditDashboard(mo) {
|
|
506
|
-
|
|
515
|
+
async canEditDashboard(mo, fallbackContext) {
|
|
516
|
+
if (!isEmpty(mo.id) || !fallbackContext?.id) {
|
|
517
|
+
return await this.permissions.canEdit(this.INVENTORY_ROLES, mo);
|
|
518
|
+
}
|
|
519
|
+
return await this.permissions.canEdit(this.INVENTORY_ROLES, fallbackContext);
|
|
507
520
|
}
|
|
508
521
|
/**
|
|
509
522
|
* Checks if user has permissions to copy dashboard according to his roles.
|
|
@@ -3207,8 +3220,9 @@ class ContextDashboardComponent {
|
|
|
3207
3220
|
}
|
|
3208
3221
|
async onLoad(trackExperience) {
|
|
3209
3222
|
this.isNamedDashboard = this.contextDashboardService.isNamed(this.mo);
|
|
3223
|
+
const activeContext = this.context?.contextData || this.context;
|
|
3210
3224
|
this.hasPermissionToEditDashboard = this.dashboard
|
|
3211
|
-
? await this.contextDashboardService.canEditDashboard(this.mo)
|
|
3225
|
+
? await this.contextDashboardService.canEditDashboard(this.mo, activeContext)
|
|
3212
3226
|
: false;
|
|
3213
3227
|
this.canCopy =
|
|
3214
3228
|
this._canCopy &&
|
|
@@ -3310,8 +3324,9 @@ class ContextDashboardComponent {
|
|
|
3310
3324
|
}
|
|
3311
3325
|
}
|
|
3312
3326
|
loadNamedDashboard() {
|
|
3327
|
+
const activeContext = this.context?.contextData || this.context;
|
|
3313
3328
|
this.dataSub = this.contextDashboardService
|
|
3314
|
-
.getDashboard(this.name, this.defaultWidgets)
|
|
3329
|
+
.getDashboard(this.name, this.defaultWidgets, activeContext)
|
|
3315
3330
|
.subscribe(mo => {
|
|
3316
3331
|
this.context = this.context || {};
|
|
3317
3332
|
this.mo = mo;
|