From 1c2f357585981f19cea4221d076c8e49cc405b51 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Mon, 17 Jan 2022 19:51:14 +0200 Subject: [PATCH] Fix getAlarms permissions. Fix entities tables persistent page link. Improve details button in autocomplete. --- .../server/controller/AlarmController.java | 2 +- .../components/entity/entities-table.component.ts | 2 +- .../device-profile-autocomplete.component.html | 13 +++++-------- .../device-profile-autocomplete.component.ts | 4 ++-- .../tenant-profile-autocomplete.component.html | 13 +++++-------- .../tenant-profile-autocomplete.component.ts | 4 ++-- .../app/modules/home/menu/menu-link.component.html | 2 +- .../modules/home/pages/device/device.component.html | 2 ++ .../ota-package-autocomplete.component.html | 13 +++++-------- 9 files changed, 24 insertions(+), 31 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/controller/AlarmController.java b/application/src/main/java/org/thingsboard/server/controller/AlarmController.java index a52ece65f9..bdeec8d0ae 100644 --- a/application/src/main/java/org/thingsboard/server/controller/AlarmController.java +++ b/application/src/main/java/org/thingsboard/server/controller/AlarmController.java @@ -229,7 +229,7 @@ public class AlarmController extends BaseController { @ApiOperation(value = "Get Alarms (getAlarms)", notes = "Returns a page of alarms for the selected entity. Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. " + PAGE_DATA_PARAMETERS + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH, produces = MediaType.APPLICATION_JSON_VALUE) - @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") + @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") @RequestMapping(value = "/alarm/{entityType}/{entityId}", method = RequestMethod.GET) @ResponseBody public PageData getAlarms( diff --git a/ui-ngx/src/app/modules/home/components/entity/entities-table.component.ts b/ui-ngx/src/app/modules/home/components/entity/entities-table.component.ts index cd22f0c6bb..68b18dfcd4 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entities-table.component.ts +++ b/ui-ngx/src/app/modules/home/components/entity/entities-table.component.ts @@ -172,6 +172,7 @@ export class EntitiesTableComponent extends PageComponent implements IEntitiesTa private init(entitiesTableConfig: EntityTableConfig>) { this.isDetailsOpen = false; this.entitiesTableConfig = entitiesTableConfig; + this.pageMode = this.entitiesTableConfig.pageMode; if (this.entitiesTableConfig.headerComponent) { const componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.entitiesTableConfig.headerComponent); const viewContainerRef = this.entityTableHeaderAnchor.viewContainerRef; @@ -233,7 +234,6 @@ export class EntitiesTableComponent extends PageComponent implements IEntitiesTa this.displayPagination = this.entitiesTableConfig.displayPagination; this.defaultPageSize = this.entitiesTableConfig.defaultPageSize; - this.pageMode = this.entitiesTableConfig.pageMode; this.pageSizeOptions = [this.defaultPageSize, this.defaultPageSize * 2, this.defaultPageSize * 3]; if (this.entitiesTableConfig.useTimePageLink) { diff --git a/ui-ngx/src/app/modules/home/components/profile/device-profile-autocomplete.component.html b/ui-ngx/src/app/modules/home/components/profile/device-profile-autocomplete.component.html index 8741260bfa..1b9ba6c6b4 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device-profile-autocomplete.component.html +++ b/ui-ngx/src/app/modules/home/components/profile/device-profile-autocomplete.component.html @@ -23,7 +23,11 @@ [required]="required" (keydown)="deviceProfileEnter($event)" (keypress)="deviceProfileEnter($event)" - [matAutocomplete]="deviceProfileAutocomplete"> + [matAutocomplete]="deviceProfileAutocomplete" + [fxShow]="!showDetailsPageLink || !disabled || !selectDeviceProfileFormGroup.get('deviceProfile').value"> + + {{ displayDeviceProfileFn(selectDeviceProfileFormGroup.get('deviceProfile').value) }} + - + [matAutocomplete]="tenantProfileAutocomplete" + [fxShow]="!showDetailsPageLink || !disabled || !selectTenantProfileFormGroup.get('tenantProfile').value"> + + {{ displayTenantProfileFn(selectTenantProfileFormGroup.get('tenantProfile').value) }} + - - + {{section.icon}} {{section.name | translate}} diff --git a/ui-ngx/src/app/modules/home/pages/device/device.component.html b/ui-ngx/src/app/modules/home/pages/device/device.component.html index d6a608d279..744b1a1b4b 100644 --- a/ui-ngx/src/app/modules/home/pages/device/device.component.html +++ b/ui-ngx/src/app/modules/home/pages/device/device.component.html @@ -116,12 +116,14 @@ diff --git a/ui-ngx/src/app/shared/components/ota-package/ota-package-autocomplete.component.html b/ui-ngx/src/app/shared/components/ota-package/ota-package-autocomplete.component.html index 0a52f23dea..971a9f9a51 100644 --- a/ui-ngx/src/app/shared/components/ota-package/ota-package-autocomplete.component.html +++ b/ui-ngx/src/app/shared/components/ota-package/ota-package-autocomplete.component.html @@ -22,20 +22,17 @@ (focusin)="onFocus()" [required]="required" [matAutocomplete]="packageAutocomplete" - [matAutocompleteDisabled]="disabled"> + [matAutocompleteDisabled]="disabled" + [fxShow]="!showDetailsPageLink || !disabled || !otaPackageFormGroup.get('packageId').value"> + + {{ displayPackageFn(otaPackageFormGroup.get('packageId').value) }} + -