Commit 68fc5b996bc9285ec1695ee235dd56aa29b457dd

Authored by Igor Kulikov
1 parent 2e23ee98

Improve dashboard edit button appearence depending on multiple conditions.

... ... @@ -196,14 +196,13 @@
196 196 </tb-dashboard-layout>
197 197 </mat-drawer-content>
198 198 </mat-drawer-container>
199   - <section data-html2canvas-ignore fxLayout="row" class="layout-wrap tb-footer-buttons" fxLayoutAlign="start end">
200   - <tb-footer-fab-buttons *ngIf="!embedded && !isMobileApp"
201   - [fxShow]="!isAddingWidget && isEdit && !widgetEditMode"
  199 + <section data-html2canvas-ignore fxLayout="row" class="layout-wrap tb-footer-buttons" fxLayoutAlign="start end"
  200 + *ngIf="!readonly">
  201 + <tb-footer-fab-buttons [fxShow]="!isAddingWidget && isEdit && !widgetEditMode"
202 202 relative
203 203 [footerFabButtons]="addWidgetFabButtons">
204 204 </tb-footer-fab-buttons>
205   - <button *ngIf="(isTenantAdmin() || isSystemAdmin()) && !forceFullscreen && !embedded && !isMobileApp"
206   - mat-fab color="accent" class="tb-btn-footer"
  205 + <button mat-fab color="accent" class="tb-btn-footer"
207 206 [ngClass]="{'tb-hide': !isEdit || isAddingWidget}"
208 207 [disabled]="isLoading$ | async"
209 208 (click)="saveDashboard()"
... ... @@ -211,8 +210,7 @@
211 210 matTooltipPosition="above">
212 211 <mat-icon>done</mat-icon>
213 212 </button>
214   - <button *ngIf="(isTenantAdmin() || isSystemAdmin()) && !forceFullscreen && !embedded && !isMobileApp"
215   - mat-fab color="accent" class="tb-btn-footer"
  213 + <button mat-fab color="accent" class="tb-btn-footer"
216 214 [ngClass]="{'tb-hide': isAddingWidget || (isLoading$ | async)}"
217 215 [disabled]="isLoading$ | async"
218 216 (click)="toggleDashboardEditMode()"
... ...
... ... @@ -183,6 +183,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
183 183 singlePageMode: boolean;
184 184 forceFullscreen = this.authState.forceFullscreen;
185 185
  186 + readonly = false;
186 187 isMobileApp = this.mobileService.isMobileApp();
187 188 isFullscreen = false;
188 189 isEdit = false;
... ... @@ -403,6 +404,9 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
403 404 this.widgetEditMode = data.widgetEditMode;
404 405 this.singlePageMode = data.singlePageMode;
405 406
  407 + this.readonly = this.embedded || (this.singlePageMode && !this.widgetEditMode && !this.route.snapshot.queryParamMap.get('edit'))
  408 + || this.forceFullscreen || this.isMobileApp || this.authUser.authority === Authority.CUSTOMER_USER;
  409 +
406 410 this.dashboardCtx.aliasController = new AliasController(this.utils,
407 411 this.entityService,
408 412 this.translate,
... ...