UI: Fixed permission check in show alarm details
This commit is contained in:
parent
9a77fb8abd
commit
a2422dab00
@ -44,9 +44,15 @@ import {
|
|||||||
AlarmDetailsDialogData
|
AlarmDetailsDialogData
|
||||||
} from '@home/components/alarm/alarm-details-dialog.component';
|
} from '@home/components/alarm/alarm-details-dialog.component';
|
||||||
import { DAY, historyInterval } from '@shared/models/time/time.models';
|
import { DAY, historyInterval } from '@shared/models/time/time.models';
|
||||||
|
import { Store } from '@ngrx/store';
|
||||||
|
import { AppState } from '@core/core.state';
|
||||||
|
import { getCurrentAuthUser } from '@core/auth/auth.selectors';
|
||||||
|
import { Authority } from '@shared/models/authority.enum';
|
||||||
|
|
||||||
export class AlarmTableConfig extends EntityTableConfig<AlarmInfo, TimePageLink> {
|
export class AlarmTableConfig extends EntityTableConfig<AlarmInfo, TimePageLink> {
|
||||||
|
|
||||||
|
private authUser = getCurrentAuthUser(this.store);
|
||||||
|
|
||||||
searchStatus: AlarmSearchStatus;
|
searchStatus: AlarmSearchStatus;
|
||||||
|
|
||||||
constructor(private alarmService: AlarmService,
|
constructor(private alarmService: AlarmService,
|
||||||
@ -55,7 +61,8 @@ export class AlarmTableConfig extends EntityTableConfig<AlarmInfo, TimePageLink>
|
|||||||
private datePipe: DatePipe,
|
private datePipe: DatePipe,
|
||||||
private dialog: MatDialog,
|
private dialog: MatDialog,
|
||||||
public entityId: EntityId = null,
|
public entityId: EntityId = null,
|
||||||
private defaultSearchStatus: AlarmSearchStatus = AlarmSearchStatus.ANY) {
|
private defaultSearchStatus: AlarmSearchStatus = AlarmSearchStatus.ANY,
|
||||||
|
private store: Store<AppState>) {
|
||||||
super();
|
super();
|
||||||
this.loadDataOnInit = false;
|
this.loadDataOnInit = false;
|
||||||
this.tableTitle = '';
|
this.tableTitle = '';
|
||||||
@ -102,7 +109,7 @@ export class AlarmTableConfig extends EntityTableConfig<AlarmInfo, TimePageLink>
|
|||||||
{
|
{
|
||||||
name: this.translate.instant('alarm.details'),
|
name: this.translate.instant('alarm.details'),
|
||||||
icon: 'more_horiz',
|
icon: 'more_horiz',
|
||||||
isEnabled: () => true,
|
isEnabled: (entity) => this.authUser.authority !== Authority.CUSTOMER_USER || entity.customerId.id === this.authUser.customerId,
|
||||||
onAction: ($event, entity) => this.showAlarmDetails(entity)
|
onAction: ($event, entity) => this.showAlarmDetails(entity)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -24,6 +24,8 @@ import { DialogService } from '@core/services/dialog.service';
|
|||||||
import { AlarmTableConfig } from './alarm-table-config';
|
import { AlarmTableConfig } from './alarm-table-config';
|
||||||
import { AlarmSearchStatus } from '@shared/models/alarm.models';
|
import { AlarmSearchStatus } from '@shared/models/alarm.models';
|
||||||
import { AlarmService } from '@app/core/http/alarm.service';
|
import { AlarmService } from '@app/core/http/alarm.service';
|
||||||
|
import { Store } from '@ngrx/store';
|
||||||
|
import { AppState } from '@core/core.state';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tb-alarm-table',
|
selector: 'tb-alarm-table',
|
||||||
@ -68,7 +70,8 @@ export class AlarmTableComponent implements OnInit {
|
|||||||
private dialogService: DialogService,
|
private dialogService: DialogService,
|
||||||
private translate: TranslateService,
|
private translate: TranslateService,
|
||||||
private datePipe: DatePipe,
|
private datePipe: DatePipe,
|
||||||
private dialog: MatDialog) {
|
private dialog: MatDialog,
|
||||||
|
private store: Store<AppState>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -80,7 +83,8 @@ export class AlarmTableComponent implements OnInit {
|
|||||||
this.datePipe,
|
this.datePipe,
|
||||||
this.dialog,
|
this.dialog,
|
||||||
this.entityIdValue,
|
this.entityIdValue,
|
||||||
AlarmSearchStatus.ANY
|
AlarmSearchStatus.ANY,
|
||||||
|
this.store
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user