Browse Source

Merge pull request #15203 from vvlladd28/bug/sys-admin/hidden-show-on-widget

Hidden "Show on widgets" button on sysadmin level
pull/15195/merge
Viacheslav Klimov 3 months ago
committed by GitHub
parent
commit
4e676d741f
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 3
      ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html
  2. 7
      ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts

3
ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html

@ -93,7 +93,8 @@
(click)="deleteTelemetry($event)">
<mat-icon>delete</mat-icon>
</button>
<button mat-raised-button color="accent"
<button [class.!hidden]="isSysAdmin"
mat-raised-button color="accent"
class="button-widget-action"
[disabled]="isLoading$ | async"
matTooltip="{{ 'attribute.show-on-widget' | translate }}"

7
ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts

@ -56,6 +56,8 @@ import {
import { AttributeDatasource } from '@home/models/datasource/attribute-datasource';
import { AttributeService } from '@app/core/http/attribute.service';
import { EntityType } from '@shared/models/entity-type.models';
import { Authority } from '@shared/models/authority.enum';
import { getCurrentAuthUser } from '@core/auth/auth.selectors';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
import {
AddAttributeDialogComponent,
@ -76,7 +78,6 @@ import { AliasController } from '@core/api/alias-controller';
import { EntityAlias, EntityAliases } from '@shared/models/alias.models';
import { UtilsService } from '@core/services/utils.service';
import { DashboardUtilsService } from '@core/services/dashboard-utils.service';
import { NULL_UUID } from '@shared/models/id/has-uuid';
import { WidgetService } from '@core/http/widget.service';
import { toWidgetInfo } from '../../models/widget-component.models';
import { EntityService } from '@core/http/entity.service';
@ -90,7 +91,6 @@ import { hidePageSizePixelValue } from '@shared/models/constants';
import { DeleteTimeseriesPanelComponent } from '@home/components/attribute/delete-timeseries-panel.component';
import { FormBuilder } from '@angular/forms';
@Component({
selector: 'tb-attribute-table',
templateUrl: './attribute-table.component.html',
@ -185,6 +185,8 @@ export class AttributeTableComponent extends PageComponent implements AfterViewI
textSearch = this.fb.control('', {nonNullable: true});
isSysAdmin = false;
private destroy$ = new Subject<void>();
constructor(protected store: Store<AppState>,
@ -204,6 +206,7 @@ export class AttributeTableComponent extends PageComponent implements AfterViewI
private elementRef: ElementRef,
private fb: FormBuilder) {
super(store);
this.isSysAdmin = getCurrentAuthUser(this.store).authority === Authority.SYS_ADMIN;
this.dirtyValue = !this.activeValue;
const sortOrder: SortOrder = { property: 'key', direction: Direction.ASC };
this.pageLink = new PageLink(10, 0, null, sortOrder);

Loading…
Cancel
Save