@@ -3,6 +3,7 @@ import { ActivatedRoute, ParamMap } from '@angular/router';
33import {
44 assertUnreachable ,
55 NavigationService ,
6+ PreferenceService ,
67 QueryParamObject ,
78 TimeDuration ,
89 TimeDurationService
@@ -53,9 +54,14 @@ import {
5354 (filtersChange)="this.onFiltersUpdated($event)"
5455 ></ht-filter-bar>
5556 <div class="explorer-content">
56- <ht-panel class="visualization-panel" [(expanded)]="this.visualizationExpanded">
57+ <ht-panel
58+ *htLetAsync="this.visualizationExpanded$ as visualizationExpanded"
59+ class="visualization-panel"
60+ [expanded]="visualizationExpanded"
61+ (expandedChange)="this.onVisualizationExpandedChange($event)"
62+ >
5763 <ht-panel-header>
58- <ht-panel-title [expanded]="this. visualizationExpanded"
64+ <ht-panel-title [expanded]="visualizationExpanded"
5965 ><span class="panel-title">Visualization</span></ht-panel-title
6066 >
6167 </ht-panel-header>
@@ -83,9 +89,14 @@ import {
8389 </ht-panel-body>
8490 </ht-panel>
8591
86- <ht-panel class="results-panel" [(expanded)]="this.resultsExpanded">
92+ <ht-panel
93+ *htLetAsync="this.resultsExpanded$ as resultsExpanded"
94+ class="results-panel"
95+ [expanded]="resultsExpanded"
96+ (expandedChange)="this.onResultsExpandedChange($event)"
97+ >
8798 <ht-panel-header>
88- <ht-panel-title [expanded]="this. resultsExpanded"><span class="panel-title">Results</span> </ht-panel-title>
99+ <ht-panel-title [expanded]="resultsExpanded"><span class="panel-title">Results</span> </ht-panel-title>
89100 </ht-panel-header>
90101 <ht-panel-body>
91102 <ht-application-aware-dashboard
@@ -103,6 +114,8 @@ import {
103114 `
104115} )
105116export class ExplorerComponent {
117+ private static readonly VISUALIZATION_EXPANDED_PREFERENCE : string = 'explorer.visualizationExpanded' ;
118+ private static readonly RESULTS_EXPANDED_PREFERENCE : string = 'explorer.resultsExpanded' ;
106119 private readonly explorerDashboardBuilder : ExplorerDashboardBuilder ;
107120 public readonly resultsDashboard$ : Observable < ExplorerGeneratedDashboard > ;
108121 public readonly vizDashboard$ : Observable < ExplorerGeneratedDashboard > ;
@@ -128,20 +141,22 @@ export class ExplorerComponent {
128141 ] ;
129142
130143 public filters : Filter [ ] = [ ] ;
131-
132- public visualizationExpanded : boolean = true ;
133- public resultsExpanded : boolean = true ;
144+ public visualizationExpanded$ : Observable < boolean > ;
145+ public resultsExpanded$ : Observable < boolean > ;
134146
135147 private readonly contextChangeSubject : Subject < ExplorerGeneratedDashboardContext > = new Subject ( ) ;
136148
137149 public constructor (
138150 private readonly metadataService : MetadataService ,
139151 private readonly navigationService : NavigationService ,
140152 private readonly timeDurationService : TimeDurationService ,
153+ private readonly preferenceService : PreferenceService ,
141154 @Inject ( EXPLORER_DASHBOARD_BUILDER_FACTORY ) explorerDashboardBuilderFactory : ExplorerDashboardBuilderFactory ,
142155 activatedRoute : ActivatedRoute
143156 ) {
144157 this . explorerDashboardBuilder = explorerDashboardBuilderFactory . build ( ) ;
158+ this . visualizationExpanded$ = this . preferenceService . get ( ExplorerComponent . VISUALIZATION_EXPANDED_PREFERENCE , true ) ;
159+ this . resultsExpanded$ = this . preferenceService . get ( ExplorerComponent . RESULTS_EXPANDED_PREFERENCE , true ) ;
145160 this . resultsDashboard$ = this . explorerDashboardBuilder . resultsDashboard$ ;
146161 this . vizDashboard$ = this . explorerDashboardBuilder . visualizationDashboard$ ;
147162 this . initialState$ = activatedRoute . queryParamMap . pipe (
@@ -183,6 +198,14 @@ export class ExplorerComponent {
183198 this . contextChangeSubject . next ( contextWrapper . dashboardContext ) ;
184199 }
185200
201+ public onVisualizationExpandedChange ( expanded : boolean ) : void {
202+ this . preferenceService . set ( ExplorerComponent . VISUALIZATION_EXPANDED_PREFERENCE , expanded ) ;
203+ }
204+
205+ public onResultsExpandedChange ( expanded : boolean ) : void {
206+ this . preferenceService . set ( ExplorerComponent . RESULTS_EXPANDED_PREFERENCE , expanded ) ;
207+ }
208+
186209 private updateUrlWithVisualizationData ( request : ExploreRequestState ) : void {
187210 this . navigationService . addQueryParametersToUrl ( {
188211 [ ExplorerQueryParam . Scope ] : this . getQueryParamFromContext ( request . context as ExplorerGeneratedDashboardContext ) ,
0 commit comments