Commit 7fb88eca2045adaf4b132b4994e7107f032f2ef1
1 parent
9b5ec2e5
added functionality that lets you specify the path to the desired custom logo from the settings menu
Showing
6 changed files
with
30 additions
and
5 deletions
@@ -120,6 +120,8 @@ import { | @@ -120,6 +120,8 @@ import { | ||
120 | DisplayWidgetTypesPanelData, | 120 | DisplayWidgetTypesPanelData, |
121 | WidgetTypes | 121 | WidgetTypes |
122 | } from '@home/components/dashboard-page/widget-types-panel.component'; | 122 | } from '@home/components/dashboard-page/widget-types-panel.component'; |
123 | +import { LogoComponent } from '@app/shared/components/logo.component'; | ||
124 | +import { concat } from 'lodash'; | ||
123 | 125 | ||
124 | // @dynamic | 126 | // @dynamic |
125 | @Component({ | 127 | @Component({ |
@@ -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, |
@@ -490,6 +492,11 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | @@ -490,6 +492,11 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | ||
490 | return true; | 492 | return true; |
491 | } | 493 | } |
492 | } | 494 | } |
495 | + | ||
496 | + public updateLogoName(): string { | ||
497 | + this.dashboard_logo = 'assets/' + this.dashboard.configuration.settings.logoName | ||
498 | + return this.dashboard.configuration.settings.logoName; | ||
499 | + } | ||
493 | 500 | ||
494 | public showRightLayoutSwitch(): boolean { | 501 | public showRightLayoutSwitch(): boolean { |
495 | return this.isMobile && this.layouts.right.show; | 502 | return this.isMobile && this.layouts.right.show; |
@@ -611,11 +618,16 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | @@ -611,11 +618,16 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | ||
611 | panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], | 618 | panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], |
612 | data: { | 619 | data: { |
613 | settings: deepClone(this.dashboard.configuration.settings), | 620 | settings: deepClone(this.dashboard.configuration.settings), |
614 | - gridSettings | 621 | + gridSettings, |
615 | } | 622 | } |
616 | - }).afterClosed().subscribe((data) => { | 623 | + } |
624 | + ).afterClosed().subscribe((data) => { | ||
617 | if (data) { | 625 | if (data) { |
618 | this.dashboard.configuration.settings = data.settings; | 626 | this.dashboard.configuration.settings = data.settings; |
627 | + if (this.dashboard.configuration.settings) | ||
628 | + { | ||
629 | + this.updateLogoName(); | ||
630 | + } | ||
619 | const newGridSettings = data.gridSettings; | 631 | const newGridSettings = data.gridSettings; |
620 | if (newGridSettings) { | 632 | if (newGridSettings) { |
621 | const layout = this.dashboard.configuration.states[layoutKeys.state].layouts[layoutKeys.layout]; | 633 | 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