Fix getAlarms permissions. Fix entities tables persistent page link. Improve details button in autocomplete.

This commit is contained in:
Igor Kulikov 2022-01-17 19:51:14 +02:00
parent 275fda0a37
commit 1c2f357585
9 changed files with 24 additions and 31 deletions

View File

@ -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<AlarmInfo> getAlarms(

View File

@ -172,6 +172,7 @@ export class EntitiesTableComponent extends PageComponent implements IEntitiesTa
private init(entitiesTableConfig: EntityTableConfig<BaseData<HasId>>) {
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) {

View File

@ -23,7 +23,11 @@
[required]="required"
(keydown)="deviceProfileEnter($event)"
(keypress)="deviceProfileEnter($event)"
[matAutocomplete]="deviceProfileAutocomplete">
[matAutocomplete]="deviceProfileAutocomplete"
[fxShow]="!showDetailsPageLink || !disabled || !selectDeviceProfileFormGroup.get('deviceProfile').value">
<a *ngIf="showDetailsPageLink && selectDeviceProfileFormGroup.get('deviceProfile').value && disabled" aria-label="Open tenant profile" [routerLink]=deviceProfileURL>
{{ displayDeviceProfileFn(selectDeviceProfileFormGroup.get('deviceProfile').value) }}
</a>
<button *ngIf="selectDeviceProfileFormGroup.get('deviceProfile').value && !disabled"
type="button"
matSuffix mat-button mat-icon-button aria-label="Clear"
@ -38,13 +42,6 @@
(click)="editDeviceProfile($event)">
<mat-icon class="material-icons">edit</mat-icon>
</button>
<button *ngIf="showDetailsPageLink && selectDeviceProfileFormGroup.get('deviceProfile').value && disabled"
type="button"
matSuffix mat-button mat-icon-button aria-label="Open device profile">
<a [routerLink]=deviceProfileURL>
<mat-icon class="material-icons">open_in_new</mat-icon>
</a>
</button>
<mat-autocomplete
class="tb-autocomplete"
(closed)="onPanelClosed()"

View File

@ -233,9 +233,9 @@ export class DeviceProfileAutocompleteComponent implements ControlValueAccessor,
setDisabledState(isDisabled: boolean): void {
this.disabled = isDisabled;
if (this.disabled) {
this.selectDeviceProfileFormGroup.disable();
this.selectDeviceProfileFormGroup.disable({emitEvent: false});
} else {
this.selectDeviceProfileFormGroup.enable();
this.selectDeviceProfileFormGroup.enable({emitEvent: false});
}
}

View File

@ -23,7 +23,11 @@
[required]="required"
(keydown)="tenantProfileEnter($event)"
(keypress)="tenantProfileEnter($event)"
[matAutocomplete]="tenantProfileAutocomplete">
[matAutocomplete]="tenantProfileAutocomplete"
[fxShow]="!showDetailsPageLink || !disabled || !selectTenantProfileFormGroup.get('tenantProfile').value">
<a *ngIf="showDetailsPageLink && selectTenantProfileFormGroup.get('tenantProfile').value && disabled" aria-label="Open tenant profile" [routerLink]=tenantProfileURL>
{{ displayTenantProfileFn(selectTenantProfileFormGroup.get('tenantProfile').value) }}
</a>
<button *ngIf="selectTenantProfileFormGroup.get('tenantProfile').value && !disabled"
type="button"
matSuffix mat-button mat-icon-button aria-label="Clear"
@ -38,13 +42,6 @@
(click)="editTenantProfile($event)">
<mat-icon class="material-icons">edit</mat-icon>
</button>
<button *ngIf="showDetailsPageLink && selectTenantProfileFormGroup.get('tenantProfile').value && disabled"
type="button"
matSuffix mat-button mat-icon-button aria-label="Open device profile">
<a [routerLink]=tenantProfileURL>
<mat-icon class="material-icons">open_in_new</mat-icon>
</a>
</button>
<mat-autocomplete
class="tb-autocomplete"
#tenantProfileAutocomplete="matAutocomplete"

View File

@ -139,9 +139,9 @@ export class TenantProfileAutocompleteComponent implements ControlValueAccessor,
setDisabledState(isDisabled: boolean): void {
this.disabled = isDisabled;
if (this.disabled) {
this.selectTenantProfileFormGroup.disable();
this.selectTenantProfileFormGroup.disable({emitEvent: false});
} else {
this.selectTenantProfileFormGroup.enable();
this.selectTenantProfileFormGroup.enable({emitEvent: false});
}
}

View File

@ -15,7 +15,7 @@
limitations under the License.
-->
<a mat-button routerLinkActive="tb-active" [routerLinkActiveOptions]="{exact: !section.notExact}" routerLink="{{section.path}}">
<a mat-button routerLinkActive="tb-active" [routerLinkActiveOptions]="{paths: 'exact', queryParams: 'ignored', matrixParams: 'ignored', fragment: 'ignored'}" routerLink="{{section.path}}">
<mat-icon *ngIf="!section.isMdiIcon && section.icon != null" class="material-icons">{{section.icon}}</mat-icon>
<mat-icon *ngIf="section.isMdiIcon && section.icon != null" [svgIcon]="section.icon"></mat-icon>
<span>{{section.name | translate}}</span>

View File

@ -116,12 +116,14 @@
</mat-form-field>
<tb-ota-package-autocomplete
[useFullEntityId]="true"
[showDetailsPageLink]="true"
[type]="otaUpdateType.FIRMWARE"
[deviceProfileId]="entityForm.get('deviceProfileId').value?.id"
formControlName="firmwareId">
</tb-ota-package-autocomplete>
<tb-ota-package-autocomplete
[useFullEntityId]="true"
[showDetailsPageLink]="true"
[type]="otaUpdateType.SOFTWARE"
[deviceProfileId]="entityForm.get('deviceProfileId').value?.id"
formControlName="softwareId">

View File

@ -22,20 +22,17 @@
(focusin)="onFocus()"
[required]="required"
[matAutocomplete]="packageAutocomplete"
[matAutocompleteDisabled]="disabled">
[matAutocompleteDisabled]="disabled"
[fxShow]="!showDetailsPageLink || !disabled || !otaPackageFormGroup.get('packageId').value">
<a *ngIf="showDetailsPageLink && otaPackageFormGroup.get('packageId').value && disabled" aria-label="Open ota package" [routerLink]=packageURL>
{{ displayPackageFn(otaPackageFormGroup.get('packageId').value) }}
</a>
<button *ngIf="otaPackageFormGroup.get('packageId').value && !disabled"
type="button"
matSuffix mat-button mat-icon-button aria-label="Clear"
(click)="clear()">
<mat-icon class="material-icons">close</mat-icon>
</button>
<button *ngIf="showDetailsPageLink && otaPackageFormGroup.get('packageId').value && disabled"
type="button"
matSuffix mat-button mat-icon-button aria-label="Open ota package">
<a [routerLink]=packageURL>
<mat-icon class="material-icons">open_in_new</mat-icon>
</a>
</button>
<mat-autocomplete class="tb-autocomplete"
#packageAutocomplete="matAutocomplete"
[displayWith]="displayPackageFn">