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