Commit f0413055b0f65a2fdcdacf25f7c9100b8b019416
Committed by
GitHub
Merge pull request #2 from TTvanWillegen/dashboard_logo
Dashboard logo - added functionality to change the desired logo path from the settings menu
Showing
7 changed files
with
31 additions
and
6 deletions
@@ -51,7 +51,7 @@ | @@ -51,7 +51,7 @@ | ||
51 | fxLayoutAlign.gt-sm="start center" | 51 | fxLayoutAlign.gt-sm="start center" |
52 | fxLayoutAlign="end center" fxLayoutGap="12px" class="db-logo-and-title" > | 52 | fxLayoutAlign="end center" fxLayoutGap="12px" class="db-logo-and-title" > |
53 | 53 | ||
54 | - <img [fxShow]="showDashboardLogo()" [src]="dashboard_logo" | 54 | + <img [fxShow]="showDashboardLogo() && isFullscreen" [src]="dashboard_logo" |
55 | aria-label="white_label_logo" class="whitelabel-logo-db"/> | 55 | aria-label="white_label_logo" class="whitelabel-logo-db"/> |
56 | 56 | ||
57 | <tb-states-component fxFlex.lt-md | 57 | <tb-states-component fxFlex.lt-md |
@@ -121,6 +121,8 @@ import { | @@ -121,6 +121,8 @@ import { | ||
121 | DisplayWidgetTypesPanelData, | 121 | DisplayWidgetTypesPanelData, |
122 | WidgetTypes | 122 | WidgetTypes |
123 | } from '@home/components/dashboard-page/widget-types-panel.component'; | 123 | } from '@home/components/dashboard-page/widget-types-panel.component'; |
124 | +import { LogoComponent } from '@app/shared/components/logo.component'; | ||
125 | +import { concat } from 'lodash'; | ||
124 | import { DashboardWidgetSelectComponent } from '@home/components/dashboard-page/dashboard-widget-select.component'; | 126 | import { DashboardWidgetSelectComponent } from '@home/components/dashboard-page/dashboard-widget-select.component'; |
125 | 127 | ||
126 | // @dynamic | 128 | // @dynamic |
@@ -189,10 +191,10 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | @@ -189,10 +191,10 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | ||
189 | currentDashboardScope: DashboardPageScope; | 191 | currentDashboardScope: DashboardPageScope; |
190 | 192 | ||
191 | addingLayoutCtx: DashboardPageLayoutContext; | 193 | addingLayoutCtx: DashboardPageLayoutContext; |
192 | - | ||
193 | - dashboard_logo = 'assets/example_logo.png'; | ||
194 | - | ||
195 | 194 | ||
195 | + logo_name_local = 'example_logo.png'; | ||
196 | + dashboard_logo = 'assets/' + this.logo_name_local; | ||
197 | + | ||
196 | dashboardCtx: DashboardContext = { | 198 | dashboardCtx: DashboardContext = { |
197 | instanceId: this.utils.guid(), | 199 | instanceId: this.utils.guid(), |
198 | getDashboard: () => this.dashboard, | 200 | getDashboard: () => this.dashboard, |
@@ -491,6 +493,11 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | @@ -491,6 +493,11 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | ||
491 | return true; | 493 | return true; |
492 | } | 494 | } |
493 | } | 495 | } |
496 | + | ||
497 | + public updateLogoName(): string { | ||
498 | + this.dashboard_logo = 'assets/' + this.dashboard.configuration.settings.logoName | ||
499 | + return this.dashboard.configuration.settings.logoName; | ||
500 | + } | ||
494 | 501 | ||
495 | public showRightLayoutSwitch(): boolean { | 502 | public showRightLayoutSwitch(): boolean { |
496 | return this.isMobile && this.layouts.right.show; | 503 | return this.isMobile && this.layouts.right.show; |
@@ -612,11 +619,16 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | @@ -612,11 +619,16 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | ||
612 | panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], | 619 | panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], |
613 | data: { | 620 | data: { |
614 | settings: deepClone(this.dashboard.configuration.settings), | 621 | settings: deepClone(this.dashboard.configuration.settings), |
615 | - gridSettings | 622 | + gridSettings, |
616 | } | 623 | } |
617 | - }).afterClosed().subscribe((data) => { | 624 | + } |
625 | + ).afterClosed().subscribe((data) => { | ||
618 | if (data) { | 626 | if (data) { |
619 | this.dashboard.configuration.settings = data.settings; | 627 | this.dashboard.configuration.settings = data.settings; |
628 | + if (this.dashboard.configuration.settings) | ||
629 | + { | ||
630 | + this.updateLogoName(); | ||
631 | + } | ||
620 | const newGridSettings = data.gridSettings; | 632 | const newGridSettings = data.gridSettings; |
621 | if (newGridSettings) { | 633 | if (newGridSettings) { |
622 | const layout = this.dashboard.configuration.states[layoutKeys.state].layouts[layoutKeys.layout]; | 634 | const layout = this.dashboard.configuration.states[layoutKeys.state].layouts[layoutKeys.layout]; |
@@ -51,6 +51,10 @@ | @@ -51,6 +51,10 @@ | ||
51 | openOnInput | 51 | openOnInput |
52 | formControlName="titleColor"> | 52 | formControlName="titleColor"> |
53 | </tb-color-input> | 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> | ||
54 | </div> | 58 | </div> |
55 | <div fxLayout="row" fxLayoutAlign="start center" fxLayout.lt-md="column" fxLayoutAlign.lt-md fxLayoutGap="8px"> | 59 | <div fxLayout="row" fxLayoutAlign="start center" fxLayout.lt-md="column" fxLayoutAlign.lt-md fxLayoutGap="8px"> |
56 | <mat-checkbox fxFlex formControlName="showDashboardLogo"> | 60 | <mat-checkbox fxFlex formControlName="showDashboardLogo"> |
@@ -34,6 +34,7 @@ export interface DashboardSettingsDialogData { | @@ -34,6 +34,7 @@ export interface DashboardSettingsDialogData { | ||
34 | gridSettings?: GridSettings; | 34 | gridSettings?: GridSettings; |
35 | } | 35 | } |
36 | 36 | ||
37 | + | ||
37 | @Component({ | 38 | @Component({ |
38 | selector: 'tb-dashboard-settings-dialog', | 39 | selector: 'tb-dashboard-settings-dialog', |
39 | templateUrl: './dashboard-settings-dialog.component.html', | 40 | templateUrl: './dashboard-settings-dialog.component.html', |
@@ -45,13 +46,16 @@ export class DashboardSettingsDialogComponent extends DialogComponent<DashboardS | @@ -45,13 +46,16 @@ export class DashboardSettingsDialogComponent extends DialogComponent<DashboardS | ||
45 | 46 | ||
46 | settings: DashboardSettings; | 47 | settings: DashboardSettings; |
47 | gridSettings: GridSettings; | 48 | gridSettings: GridSettings; |
49 | + logo_name; | ||
48 | 50 | ||
51 | + | ||
49 | settingsFormGroup: FormGroup; | 52 | settingsFormGroup: FormGroup; |
50 | gridSettingsFormGroup: FormGroup; | 53 | gridSettingsFormGroup: FormGroup; |
51 | 54 | ||
52 | stateControllerIds: string[]; | 55 | stateControllerIds: string[]; |
53 | 56 | ||
54 | submitted = false; | 57 | submitted = false; |
58 | + | ||
55 | 59 | ||
56 | constructor(protected store: Store<AppState>, | 60 | constructor(protected store: Store<AppState>, |
57 | protected router: Router, | 61 | protected router: Router, |
@@ -69,6 +73,7 @@ export class DashboardSettingsDialogComponent extends DialogComponent<DashboardS | @@ -69,6 +73,7 @@ export class DashboardSettingsDialogComponent extends DialogComponent<DashboardS | ||
69 | 73 | ||
70 | this.settings = this.data.settings; | 74 | this.settings = this.data.settings; |
71 | this.gridSettings = this.data.gridSettings; | 75 | this.gridSettings = this.data.gridSettings; |
76 | + this.logo_name = 'example_logo.png'; | ||
72 | 77 | ||
73 | if (this.settings) { | 78 | if (this.settings) { |
74 | this.settingsFormGroup = this.fb.group({ | 79 | this.settingsFormGroup = this.fb.group({ |
@@ -80,6 +85,7 @@ export class DashboardSettingsDialogComponent extends DialogComponent<DashboardS | @@ -80,6 +85,7 @@ export class DashboardSettingsDialogComponent extends DialogComponent<DashboardS | ||
80 | showEntitiesSelect: [isUndefined(this.settings.showEntitiesSelect) ? true : this.settings.showEntitiesSelect, []], | 85 | showEntitiesSelect: [isUndefined(this.settings.showEntitiesSelect) ? true : this.settings.showEntitiesSelect, []], |
81 | showFilters: [isUndefined(this.settings.showFilters) ? true : this.settings.showFilters, []], | 86 | showFilters: [isUndefined(this.settings.showFilters) ? true : this.settings.showFilters, []], |
82 | showDashboardLogo: [isUndefined(this.settings.showDashboardLogo) ? true : this.settings.showDashboardLogo, []], | 87 | showDashboardLogo: [isUndefined(this.settings.showDashboardLogo) ? true : this.settings.showDashboardLogo, []], |
88 | + logoName: [isUndefined(this.settings.logoName) ? this.logo_name : this.settings.logoName, []], | ||
83 | showDashboardTimewindow: [isUndefined(this.settings.showDashboardTimewindow) ? true : this.settings.showDashboardTimewindow, []], | 89 | showDashboardTimewindow: [isUndefined(this.settings.showDashboardTimewindow) ? true : this.settings.showDashboardTimewindow, []], |
84 | showDashboardExport: [isUndefined(this.settings.showDashboardExport) ? true : this.settings.showDashboardExport, []] | 90 | showDashboardExport: [isUndefined(this.settings.showDashboardExport) ? true : this.settings.showDashboardExport, []] |
85 | }); | 91 | }); |
@@ -87,6 +87,7 @@ export interface DashboardSettings { | @@ -87,6 +87,7 @@ export interface DashboardSettings { | ||
87 | showEntitiesSelect?: boolean; | 87 | showEntitiesSelect?: boolean; |
88 | showFilters?: boolean; | 88 | showFilters?: boolean; |
89 | showDashboardLogo?: boolean; | 89 | showDashboardLogo?: boolean; |
90 | + logoName?: string; | ||
90 | showDashboardTimewindow?: boolean; | 91 | showDashboardTimewindow?: boolean; |
91 | showDashboardExport?: boolean; | 92 | showDashboardExport?: boolean; |
92 | toolbarAlwaysOpen?: boolean; | 93 | toolbarAlwaysOpen?: boolean; |
@@ -726,6 +726,8 @@ | @@ -726,6 +726,8 @@ | ||
726 | "display-dashboard-timewindow": "Display timewindow", | 726 | "display-dashboard-timewindow": "Display timewindow", |
727 | "display-dashboard-export": "Display export", | 727 | "display-dashboard-export": "Display export", |
728 | "display-dashboard-showDashboardLogo": "Display dashboard logo", | 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", | ||
729 | "import": "Import dashboard", | 731 | "import": "Import dashboard", |
730 | "export": "Export dashboard", | 732 | "export": "Export dashboard", |
731 | "export-failed-error": "Unable to export dashboard: {{error}}", | 733 | "export-failed-error": "Unable to export dashboard: {{error}}", |
ui-ngx/src/assets/nasa.png
0 → 100644
97.5 KB