@@ -19,6 +19,7 @@ import styles from './Databrowser.scss';
19
19
import AggregationPanel from '../../../components/AggregationPanel/AggregationPanel' ;
20
20
21
21
const BROWSER_SHOW_ROW_NUMBER = 'browserShowRowNumber' ;
22
+ const AGGREGATION_PANEL_VISIBLE = 'aggregationPanelVisible' ;
22
23
23
24
function formatValueForCopy ( value , type ) {
24
25
if ( value === undefined ) {
@@ -79,6 +80,12 @@ export default class DataBrowser extends React.Component {
79
80
) ;
80
81
const storedRowNumber =
81
82
window . localStorage ?. getItem ( BROWSER_SHOW_ROW_NUMBER ) === 'true' ;
83
+ const storedPanelVisible =
84
+ window . localStorage ?. getItem ( AGGREGATION_PANEL_VISIBLE ) === 'true' ;
85
+ const hasAggregation =
86
+ props . classwiseCloudFunctions ?. [
87
+ `${ props . app . applicationId } ${ props . appName } `
88
+ ] ?. [ props . className ] ;
82
89
83
90
this . state = {
84
91
order : order ,
@@ -88,7 +95,7 @@ export default class DataBrowser extends React.Component {
88
95
selectedObjectId : undefined ,
89
96
simplifiedSchema : this . getSimplifiedSchema ( props . schema , props . className ) ,
90
97
allClassesSchema : this . getAllClassesSchema ( props . schema , props . classes ) ,
91
- isPanelVisible : false ,
98
+ isPanelVisible : storedPanelVisible && ! ! hasAggregation ,
92
99
selectedCells : { list : new Set ( ) , rowStart : - 1 , rowEnd : - 1 , colStart : - 1 , colEnd : - 1 } ,
93
100
firstSelectedCell : null ,
94
101
selectedData : [ ] ,
@@ -157,13 +164,17 @@ export default class DataBrowser extends React.Component {
157
164
this . setState ( { order, frozenColumnIndex : - 1 } ) ;
158
165
}
159
166
if ( props && props . className ) {
160
- if (
161
- ! props . classwiseCloudFunctions ?. [ `${ props . app . applicationId } ${ props . appName } ` ] ?. [
162
- props . className
163
- ]
164
- ) {
167
+ const storedPanelVisible =
168
+ window . localStorage ?. getItem ( AGGREGATION_PANEL_VISIBLE ) === 'true' ;
169
+ const hasAggregation =
170
+ props . classwiseCloudFunctions ?. [
171
+ `${ props . app . applicationId } ${ props . appName } `
172
+ ] ?. [ props . className ] ;
173
+ if ( ! hasAggregation ) {
165
174
this . setState ( { isPanelVisible : false } ) ;
166
175
this . setState ( { selectedObjectId : undefined } ) ;
176
+ } else {
177
+ this . setState ( { isPanelVisible : storedPanelVisible } ) ;
167
178
}
168
179
} else {
169
180
this . setState ( { isPanelVisible : false } ) ;
@@ -242,17 +253,19 @@ export default class DataBrowser extends React.Component {
242
253
}
243
254
244
255
togglePanelVisibility ( ) {
245
- this . setState ( prevState => ( { isPanelVisible : ! prevState . isPanelVisible } ) ) ;
256
+ const newVisibility = ! this . state . isPanelVisible ;
257
+ this . setState ( { isPanelVisible : newVisibility } ) ;
258
+ window . localStorage ?. setItem ( AGGREGATION_PANEL_VISIBLE , newVisibility ) ;
246
259
247
- if ( ! this . state . isPanelVisible ) {
260
+ if ( ! newVisibility ) {
248
261
this . props . setAggregationPanelData ( { } ) ;
249
262
this . props . setLoadingInfoPanel ( false ) ;
250
263
if ( this . props . errorAggregatedData != { } ) {
251
264
this . props . setErrorAggregatedData ( { } ) ;
252
265
}
253
266
}
254
267
255
- if ( ! this . state . isPanelVisible && this . state . selectedObjectId ) {
268
+ if ( ! newVisibility && this . state . selectedObjectId ) {
256
269
if ( this . props . errorAggregatedData != { } ) {
257
270
this . props . setErrorAggregatedData ( { } ) ;
258
271
}
@@ -285,9 +298,15 @@ export default class DataBrowser extends React.Component {
285
298
286
299
checkClassNameChange ( prevClassName , className ) {
287
300
if ( prevClassName !== className ) {
301
+ const storedPanelVisible =
302
+ window . localStorage ?. getItem ( AGGREGATION_PANEL_VISIBLE ) === 'true' ;
303
+ const hasAggregation =
304
+ this . props . classwiseCloudFunctions ?. [
305
+ `${ this . props . app . applicationId } ${ this . props . appName } `
306
+ ] ?. [ className ] ;
288
307
this . setState ( {
289
308
prevClassName : className ,
290
- isPanelVisible : false ,
309
+ isPanelVisible : storedPanelVisible && ! ! hasAggregation ,
291
310
selectedObjectId : undefined ,
292
311
} ) ;
293
312
this . props . setAggregationPanelData ( { } ) ;
0 commit comments