Commit 68fc5b996bc9285ec1695ee235dd56aa29b457dd
1 parent
2e23ee98
Improve dashboard edit button appearence depending on multiple conditions.
Showing
2 changed files
with
9 additions
and
7 deletions
@@ -196,14 +196,13 @@ | @@ -196,14 +196,13 @@ | ||
196 | </tb-dashboard-layout> | 196 | </tb-dashboard-layout> |
197 | </mat-drawer-content> | 197 | </mat-drawer-content> |
198 | </mat-drawer-container> | 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 | relative | 202 | relative |
203 | [footerFabButtons]="addWidgetFabButtons"> | 203 | [footerFabButtons]="addWidgetFabButtons"> |
204 | </tb-footer-fab-buttons> | 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 | [ngClass]="{'tb-hide': !isEdit || isAddingWidget}" | 206 | [ngClass]="{'tb-hide': !isEdit || isAddingWidget}" |
208 | [disabled]="isLoading$ | async" | 207 | [disabled]="isLoading$ | async" |
209 | (click)="saveDashboard()" | 208 | (click)="saveDashboard()" |
@@ -211,8 +210,7 @@ | @@ -211,8 +210,7 @@ | ||
211 | matTooltipPosition="above"> | 210 | matTooltipPosition="above"> |
212 | <mat-icon>done</mat-icon> | 211 | <mat-icon>done</mat-icon> |
213 | </button> | 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 | [ngClass]="{'tb-hide': isAddingWidget || (isLoading$ | async)}" | 214 | [ngClass]="{'tb-hide': isAddingWidget || (isLoading$ | async)}" |
217 | [disabled]="isLoading$ | async" | 215 | [disabled]="isLoading$ | async" |
218 | (click)="toggleDashboardEditMode()" | 216 | (click)="toggleDashboardEditMode()" |
@@ -183,6 +183,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | @@ -183,6 +183,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | ||
183 | singlePageMode: boolean; | 183 | singlePageMode: boolean; |
184 | forceFullscreen = this.authState.forceFullscreen; | 184 | forceFullscreen = this.authState.forceFullscreen; |
185 | 185 | ||
186 | + readonly = false; | ||
186 | isMobileApp = this.mobileService.isMobileApp(); | 187 | isMobileApp = this.mobileService.isMobileApp(); |
187 | isFullscreen = false; | 188 | isFullscreen = false; |
188 | isEdit = false; | 189 | isEdit = false; |
@@ -403,6 +404,9 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | @@ -403,6 +404,9 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | ||
403 | this.widgetEditMode = data.widgetEditMode; | 404 | this.widgetEditMode = data.widgetEditMode; |
404 | this.singlePageMode = data.singlePageMode; | 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 | this.dashboardCtx.aliasController = new AliasController(this.utils, | 410 | this.dashboardCtx.aliasController = new AliasController(this.utils, |
407 | this.entityService, | 411 | this.entityService, |
408 | this.translate, | 412 | this.translate, |