Commit 5d9ea35fd9d0b773aaeba6cb07e0e39cbf9212d3

Authored by Igor Kulikov
Committed by GitHub
2 parents e5089251 9b2009a5

Merge pull request #4284 from TTvanWillegen/master

UI: Added show logo option in dashboard settings [Issue #3544]
@@ -56,6 +56,8 @@ @@ -56,6 +56,8 @@
56 [syncStateWithQueryParam]="syncStateWithQueryParam" 56 [syncStateWithQueryParam]="syncStateWithQueryParam"
57 [states]="dashboardConfiguration.states"> 57 [states]="dashboardConfiguration.states">
58 </tb-states-component> 58 </tb-states-component>
  59 + <img *ngIf="showDashboardLogo() && isFullscreen" [src]="dashboardLogo"
  60 + aria-label="dashboard_logo" class="dashboard_logo"/>
59 </div> 61 </div>
60 <div class="tb-dashboard-action-panel" fxFlex="1 0 auto" fxLayout="row-reverse" 62 <div class="tb-dashboard-action-panel" fxFlex="1 0 auto" fxLayout="row-reverse"
61 fxLayoutAlign.gt-sm="start center" fxLayoutAlign="space-between center" fxLayoutGap="12px"> 63 fxLayoutAlign.gt-sm="start center" fxLayoutAlign="space-between center" fxLayoutGap="12px">
@@ -54,6 +54,11 @@ div.tb-dashboard-page { @@ -54,6 +54,11 @@ div.tb-dashboard-page {
54 z-index: 13; 54 z-index: 13;
55 pointer-events: none; 55 pointer-events: none;
56 56
  57 + .dashboard_logo{
  58 + height: 75%;
  59 + margin-right: 16px;
  60 + }
  61 +
57 &.tb-dashboard-toolbar-opened { 62 &.tb-dashboard-toolbar-opened {
58 right: 0; 63 right: 0;
59 // transition: right .3s cubic-bezier(.55, 0, .55, .2); 64 // transition: right .3s cubic-bezier(.55, 0, .55, .2);
@@ -191,6 +191,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC @@ -191,6 +191,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
191 191
192 addingLayoutCtx: DashboardPageLayoutContext; 192 addingLayoutCtx: DashboardPageLayoutContext;
193 193
  194 + logo = 'assets/logo_title_white.svg';
194 195
195 dashboardCtx: DashboardContext = { 196 dashboardCtx: DashboardContext = {
196 instanceId: this.utils.guid(), 197 instanceId: this.utils.guid(),
@@ -484,6 +485,19 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC @@ -484,6 +485,19 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
484 } 485 }
485 } 486 }
486 487
  488 + public showDashboardLogo(): boolean {
  489 + if (this.dashboard.configuration.settings &&
  490 + isDefined(this.dashboard.configuration.settings.showDashboardLogo)) {
  491 + return this.dashboard.configuration.settings.showDashboardLogo;
  492 + } else {
  493 + return false;
  494 + }
  495 + }
  496 +
  497 + public get dashboardLogo(): string {
  498 + return this.dashboard.configuration.settings.dashboardLogoUrl || this.logo;
  499 + }
  500 +
487 public showRightLayoutSwitch(): boolean { 501 public showRightLayoutSwitch(): boolean {
488 return this.isMobile && this.layouts.right.show; 502 return this.isMobile && this.layouts.right.show;
489 } 503 }
@@ -605,7 +619,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC @@ -605,7 +619,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
605 panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], 619 panelClass: ['tb-dialog', 'tb-fullscreen-dialog'],
606 data: { 620 data: {
607 settings: deepClone(this.dashboard.configuration.settings), 621 settings: deepClone(this.dashboard.configuration.settings),
608 - gridSettings 622 + gridSettings,
609 } 623 }
610 }).afterClosed().subscribe((data) => { 624 }).afterClosed().subscribe((data) => {
611 if (data) { 625 if (data) {
@@ -52,7 +52,8 @@ @@ -52,7 +52,8 @@
52 formControlName="titleColor"> 52 formControlName="titleColor">
53 </tb-color-input> 53 </tb-color-input>
54 </div> 54 </div>
55 - <div fxLayout="row" fxLayoutAlign="start center" fxLayout.lt-md="column" fxLayoutAlign.lt-md fxLayoutGap="8px"> 55 + <div fxLayout="row" fxLayoutAlign="start center" style="margin-bottom: 8px;"
  56 + fxLayout.lt-md="column" fxLayoutAlign.lt-md fxLayoutGap="8px">
56 <mat-checkbox fxFlex formControlName="showDashboardsSelect"> 57 <mat-checkbox fxFlex formControlName="showDashboardsSelect">
57 {{ 'dashboard.display-dashboards-selection' | translate }} 58 {{ 'dashboard.display-dashboards-selection' | translate }}
58 </mat-checkbox> 59 </mat-checkbox>
@@ -69,6 +70,13 @@ @@ -69,6 +70,13 @@
69 {{ 'dashboard.display-dashboard-export' | translate }} 70 {{ 'dashboard.display-dashboard-export' | translate }}
70 </mat-checkbox> 71 </mat-checkbox>
71 </div> 72 </div>
  73 + <mat-checkbox formControlName="showDashboardLogo">
  74 + {{ 'dashboard.display-dashboard-toolbar-logo' | translate }}
  75 + </mat-checkbox>
  76 + <tb-image-input fxFlex *ngIf="settingsFormGroup.get('showDashboardLogo').value"
  77 + label="{{'dashboard.dashboard-logo-image' | translate}}"
  78 + formControlName="dashboardLogoUrl">
  79 + </tb-image-input>
72 </div> 80 </div>
73 <div *ngIf="gridSettings" [formGroup]="gridSettingsFormGroup"> 81 <div *ngIf="gridSettings" [formGroup]="gridSettingsFormGroup">
74 <tb-color-input fxFlex 82 <tb-color-input fxFlex
@@ -79,6 +79,8 @@ export class DashboardSettingsDialogComponent extends DialogComponent<DashboardS @@ -79,6 +79,8 @@ export class DashboardSettingsDialogComponent extends DialogComponent<DashboardS
79 showDashboardsSelect: [isUndefined(this.settings.showDashboardsSelect) ? true : this.settings.showDashboardsSelect, []], 79 showDashboardsSelect: [isUndefined(this.settings.showDashboardsSelect) ? true : this.settings.showDashboardsSelect, []],
80 showEntitiesSelect: [isUndefined(this.settings.showEntitiesSelect) ? true : this.settings.showEntitiesSelect, []], 80 showEntitiesSelect: [isUndefined(this.settings.showEntitiesSelect) ? true : this.settings.showEntitiesSelect, []],
81 showFilters: [isUndefined(this.settings.showFilters) ? true : this.settings.showFilters, []], 81 showFilters: [isUndefined(this.settings.showFilters) ? true : this.settings.showFilters, []],
  82 + showDashboardLogo: [isUndefined(this.settings.showDashboardLogo) ? false : this.settings.showDashboardLogo, []],
  83 + dashboardLogoUrl: [isUndefined(this.settings.dashboardLogoUrl) ? null : this.settings.dashboardLogoUrl, []],
82 showDashboardTimewindow: [isUndefined(this.settings.showDashboardTimewindow) ? true : this.settings.showDashboardTimewindow, []], 84 showDashboardTimewindow: [isUndefined(this.settings.showDashboardTimewindow) ? true : this.settings.showDashboardTimewindow, []],
83 showDashboardExport: [isUndefined(this.settings.showDashboardExport) ? true : this.settings.showDashboardExport, []] 85 showDashboardExport: [isUndefined(this.settings.showDashboardExport) ? true : this.settings.showDashboardExport, []]
84 }); 86 });
@@ -4413,7 +4413,8 @@ @@ -4413,7 +4413,8 @@
4413 "showDashboardExport": false, 4413 "showDashboardExport": false,
4414 "toolbarAlwaysOpen": true, 4414 "toolbarAlwaysOpen": true,
4415 "titleColor": "rgba(0,0,0,0.870588)", 4415 "titleColor": "rgba(0,0,0,0.870588)",
4416 - "showFilters": false 4416 + "showFilters": false,
  4417 + "showDashboardLogo": false
4417 } 4418 }
4418 }, 4419 },
4419 "name": "Api Usage" 4420 "name": "Api Usage"
@@ -86,6 +86,8 @@ export interface DashboardSettings { @@ -86,6 +86,8 @@ export interface DashboardSettings {
86 showDashboardsSelect?: boolean; 86 showDashboardsSelect?: boolean;
87 showEntitiesSelect?: boolean; 87 showEntitiesSelect?: boolean;
88 showFilters?: boolean; 88 showFilters?: boolean;
  89 + showDashboardLogo?: boolean;
  90 + dashboardLogoUrl?: string;
89 showDashboardTimewindow?: boolean; 91 showDashboardTimewindow?: boolean;
90 showDashboardExport?: boolean; 92 showDashboardExport?: boolean;
91 toolbarAlwaysOpen?: boolean; 93 toolbarAlwaysOpen?: boolean;
@@ -746,6 +746,8 @@ @@ -746,6 +746,8 @@
746 "display-filters": "Display filters", 746 "display-filters": "Display filters",
747 "display-dashboard-timewindow": "Display timewindow", 747 "display-dashboard-timewindow": "Display timewindow",
748 "display-dashboard-export": "Display export", 748 "display-dashboard-export": "Display export",
  749 + "display-dashboard-toolbar-logo": "Display dashboard logo in fullscreen mode",
  750 + "dashboard-logo-image": "Dashboard image logo",
749 "import": "Import dashboard", 751 "import": "Import dashboard",
750 "export": "Export dashboard", 752 "export": "Export dashboard",
751 "export-failed-error": "Unable to export dashboard: {{error}}", 753 "export-failed-error": "Unable to export dashboard: {{error}}",