Commit 9b2009a50131bfd4cb4b36551d4158ac41ace56f

Authored by Vladyslav_Prykhodko
1 parent f0413055

UI: Refactoring dashboard logo

... ... @@ -46,26 +46,18 @@
46 46 <mat-icon>view_compact</mat-icon>
47 47 </button>
48 48 </div>
49   -
50   - <div fxFlex.lt-md fxLayout="row"
51   - fxLayoutAlign.gt-sm="start center"
52   - fxLayoutAlign="end center" fxLayoutGap="12px" class="db-logo-and-title" >
53   -
54   - <img [fxShow]="showDashboardLogo() && isFullscreen" [src]="dashboard_logo"
55   - aria-label="white_label_logo" class="whitelabel-logo-db"/>
56   -
57   - <tb-states-component fxFlex.lt-md
58   - [statesControllerId]="isEdit ? 'default' : dashboardConfiguration.settings.stateControllerId"
59   - [dashboardCtrl]="this"
60   - [dashboardId]="(!embedded && dashboard.id) ? dashboard.id.id : ''"
61   - [isMobile]="isMobile"
62   - [state]="dashboardCtx.state"
63   - [currentState]="currentState"
64   - [syncStateWithQueryParam]="syncStateWithQueryParam"
65   - [states]="dashboardConfiguration.states">
66   - </tb-states-component>
67   -
68   - </div>
  49 + <tb-states-component fxFlex.lt-md
  50 + [statesControllerId]="isEdit ? 'default' : dashboardConfiguration.settings.stateControllerId"
  51 + [dashboardCtrl]="this"
  52 + [dashboardId]="(!embedded && dashboard.id) ? dashboard.id.id : ''"
  53 + [isMobile]="isMobile"
  54 + [state]="dashboardCtx.state"
  55 + [currentState]="currentState"
  56 + [syncStateWithQueryParam]="syncStateWithQueryParam"
  57 + [states]="dashboardConfiguration.states">
  58 + </tb-states-component>
  59 + <img *ngIf="showDashboardLogo() && isFullscreen" [src]="dashboardLogo"
  60 + aria-label="dashboard_logo" class="dashboard_logo"/>
69 61 </div>
70 62 <div class="tb-dashboard-action-panel" fxFlex="1 0 auto" fxLayout="row-reverse"
71 63 fxLayoutAlign.gt-sm="start center" fxLayoutAlign="space-between center" fxLayoutGap="12px">
... ... @@ -297,4 +289,4 @@
297 289 </mat-drawer>
298 290 </mat-drawer-container>
299 291 </section>
300   -</div>
\ No newline at end of file
  292 +</div>
... ...
... ... @@ -54,12 +54,9 @@ div.tb-dashboard-page {
54 54 z-index: 13;
55 55 pointer-events: none;
56 56
57   - .db-logo-and-title {
58   - height: $toolbar-height;
59   - .whitelabel-logo-db{
60   - height: 100%;
61   - width: auto;
62   - }
  57 + .dashboard_logo{
  58 + height: 75%;
  59 + margin-right: 16px;
63 60 }
64 61
65 62 &.tb-dashboard-toolbar-opened {
... ... @@ -71,9 +68,8 @@ div.tb-dashboard-page {
71 68 right: 18px;
72 69 transition: right .3s cubic-bezier(.55, 0, .55, .2) .2s;
73 70 }
74   -
  71 + }
75 72
76   - }
77 73 .tb-dashboard-container {
78 74 &.tb-dashboard-toolbar-opened {
79 75 &.is-fullscreen {
... ...
... ... @@ -121,8 +121,6 @@ import {
121 121 DisplayWidgetTypesPanelData,
122 122 WidgetTypes
123 123 } from '@home/components/dashboard-page/widget-types-panel.component';
124   -import { LogoComponent } from '@app/shared/components/logo.component';
125   -import { concat } from 'lodash';
126 124 import { DashboardWidgetSelectComponent } from '@home/components/dashboard-page/dashboard-widget-select.component';
127 125
128 126 // @dynamic
... ... @@ -192,9 +190,8 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
192 190
193 191 addingLayoutCtx: DashboardPageLayoutContext;
194 192
195   - logo_name_local = 'example_logo.png';
196   - dashboard_logo = 'assets/' + this.logo_name_local;
197   -
  193 + logo = 'assets/logo_title_white.svg';
  194 +
198 195 dashboardCtx: DashboardContext = {
199 196 instanceId: this.utils.guid(),
200 197 getDashboard: () => this.dashboard,
... ... @@ -490,15 +487,14 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
490 487 isDefined(this.dashboard.configuration.settings.showDashboardLogo)) {
491 488 return this.dashboard.configuration.settings.showDashboardLogo;
492 489 } else {
493   - return true;
  490 + return false;
494 491 }
495 492 }
496 493
497   - public updateLogoName(): string {
498   - this.dashboard_logo = 'assets/' + this.dashboard.configuration.settings.logoName
499   - return this.dashboard.configuration.settings.logoName;
  494 + public get dashboardLogo(): string {
  495 + return this.dashboard.configuration.settings.dashboardLogoUrl || this.logo;
500 496 }
501   -
  497 +
502 498 public showRightLayoutSwitch(): boolean {
503 499 return this.isMobile && this.layouts.right.show;
504 500 }
... ... @@ -621,14 +617,9 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
621 617 settings: deepClone(this.dashboard.configuration.settings),
622 618 gridSettings,
623 619 }
624   - }
625   - ).afterClosed().subscribe((data) => {
  620 + }).afterClosed().subscribe((data) => {
626 621 if (data) {
627 622 this.dashboard.configuration.settings = data.settings;
628   - if (this.dashboard.configuration.settings)
629   - {
630   - this.updateLogoName();
631   - }
632 623 const newGridSettings = data.gridSettings;
633 624 if (newGridSettings) {
634 625 const layout = this.dashboard.configuration.states[layoutKeys.state].layouts[layoutKeys.layout];
... ...
... ... @@ -51,15 +51,9 @@
51 51 openOnInput
52 52 formControlName="titleColor">
53 53 </tb-color-input>
54   - <mat-form-field class="mat-block" fxFlex floatLabel="always">
55   - <mat-label translate>dashboard.display-dashboard-enterLogoName</mat-label>
56   - <input #searchInput matInput formControlName="logoName" placeholder="{{ 'dashboard.display-dashboard-exampleLogoName' | translate }}"/>
57   - </mat-form-field>
58 54 </div>
59   - <div fxLayout="row" fxLayoutAlign="start center" fxLayout.lt-md="column" fxLayoutAlign.lt-md fxLayoutGap="8px">
60   - <mat-checkbox fxFlex formControlName="showDashboardLogo">
61   - {{ 'dashboard.display-dashboard-showDashboardLogo' | translate }}
62   - </mat-checkbox>
  55 + <div fxLayout="row" fxLayoutAlign="start center" style="margin-bottom: 8px;"
  56 + fxLayout.lt-md="column" fxLayoutAlign.lt-md fxLayoutGap="8px">
63 57 <mat-checkbox fxFlex formControlName="showDashboardsSelect">
64 58 {{ 'dashboard.display-dashboards-selection' | translate }}
65 59 </mat-checkbox>
... ... @@ -76,6 +70,13 @@
76 70 {{ 'dashboard.display-dashboard-export' | translate }}
77 71 </mat-checkbox>
78 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>
79 80 </div>
80 81 <div *ngIf="gridSettings" [formGroup]="gridSettingsFormGroup">
81 82 <tb-color-input fxFlex
... ...
... ... @@ -34,7 +34,6 @@ export interface DashboardSettingsDialogData {
34 34 gridSettings?: GridSettings;
35 35 }
36 36
37   -
38 37 @Component({
39 38 selector: 'tb-dashboard-settings-dialog',
40 39 templateUrl: './dashboard-settings-dialog.component.html',
... ... @@ -46,16 +45,13 @@ export class DashboardSettingsDialogComponent extends DialogComponent<DashboardS
46 45
47 46 settings: DashboardSettings;
48 47 gridSettings: GridSettings;
49   - logo_name;
50 48
51   -
52 49 settingsFormGroup: FormGroup;
53 50 gridSettingsFormGroup: FormGroup;
54 51
55 52 stateControllerIds: string[];
56 53
57 54 submitted = false;
58   -
59 55
60 56 constructor(protected store: Store<AppState>,
61 57 protected router: Router,
... ... @@ -73,7 +69,6 @@ export class DashboardSettingsDialogComponent extends DialogComponent<DashboardS
73 69
74 70 this.settings = this.data.settings;
75 71 this.gridSettings = this.data.gridSettings;
76   - this.logo_name = 'example_logo.png';
77 72
78 73 if (this.settings) {
79 74 this.settingsFormGroup = this.fb.group({
... ... @@ -84,8 +79,8 @@ export class DashboardSettingsDialogComponent extends DialogComponent<DashboardS
84 79 showDashboardsSelect: [isUndefined(this.settings.showDashboardsSelect) ? true : this.settings.showDashboardsSelect, []],
85 80 showEntitiesSelect: [isUndefined(this.settings.showEntitiesSelect) ? true : this.settings.showEntitiesSelect, []],
86 81 showFilters: [isUndefined(this.settings.showFilters) ? true : this.settings.showFilters, []],
87   - showDashboardLogo: [isUndefined(this.settings.showDashboardLogo) ? true : this.settings.showDashboardLogo, []],
88   - logoName: [isUndefined(this.settings.logoName) ? this.logo_name : this.settings.logoName, []],
  82 + showDashboardLogo: [isUndefined(this.settings.showDashboardLogo) ? false : this.settings.showDashboardLogo, []],
  83 + dashboardLogoUrl: [isUndefined(this.settings.dashboardLogoUrl) ? null : this.settings.dashboardLogoUrl, []],
89 84 showDashboardTimewindow: [isUndefined(this.settings.showDashboardTimewindow) ? true : this.settings.showDashboardTimewindow, []],
90 85 showDashboardExport: [isUndefined(this.settings.showDashboardExport) ? true : this.settings.showDashboardExport, []]
91 86 });
... ...
... ... @@ -76,18 +76,6 @@ tb-dashboard-toolbar {
76 76 height: $mobile-toolbar-height;
77 77 min-height: $mobile-toolbar-height;
78 78 }
79   - & > div {
80   - height: $toolbar-height;
81   - .whitelabel-logo-db {
82   - width: auto;
83   - max-width: 100%;
84   - height: 30px;
85   - max-height: 100%;
86   - margin-left: 20px;
87   - margin-top: 5px;
88   - margin-right: 30px;
89   - }
90   - }
91 79
92 80 @media #{$mat-gt-sm} {
93 81 height: $toolbar-height;
... ...
... ... @@ -43,6 +43,4 @@ export class DashboardToolbarComponent implements OnInit {
43 43 this.triggerClick.emit();
44 44 }
45 45
46   - white_label_logo = 'assets/white_label_logo.png';
47   -
48 46 }
... ...
... ... @@ -86,8 +86,8 @@ export interface DashboardSettings {
86 86 showDashboardsSelect?: boolean;
87 87 showEntitiesSelect?: boolean;
88 88 showFilters?: boolean;
89   - showDashboardLogo?: boolean;
90   - logoName?: string;
  89 + showDashboardLogo?: boolean;
  90 + dashboardLogoUrl?: string;
91 91 showDashboardTimewindow?: boolean;
92 92 showDashboardExport?: boolean;
93 93 toolbarAlwaysOpen?: boolean;
... ...
... ... @@ -725,9 +725,8 @@
725 725 "display-filters": "Display filters",
726 726 "display-dashboard-timewindow": "Display timewindow",
727 727 "display-dashboard-export": "Display export",
728   - "display-dashboard-showDashboardLogo": "Display dashboard logo",
729   - "display-dashboard-enterLogoName": "Enter logo filename (must be in assets folder)",
730   - "display-dashboard-exampleLogoName": "example_logo.png",
  728 + "display-dashboard-toolbar-logo": "Display dashboard logo in fullscreen mode",
  729 + "dashboard-logo-image": "Dashboard image logo",
731 730 "import": "Import dashboard",
732 731 "export": "Export dashboard",
733 732 "export-failed-error": "Unable to export dashboard: {{error}}",
... ...