File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed
Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,25 @@ import { clusterState } from './clusterAtom';
88const PREVIOUS_PATHNAME_KEY = 'busola.previous-pathname' ;
99
1010export function savePreviousPath ( ) {
11- const { pathname } = window . location ;
11+ const queryParams = new URLSearchParams ( window . location . search ) ;
1212
13- if ( pathname !== '/' && pathname !== '/clusters' ) {
14- localStorage . setItem ( PREVIOUS_PATHNAME_KEY , pathname ) ;
13+ const layoutParam = queryParams . get ( 'layout' ) ;
14+ const showCreateParam = queryParams . get ( 'showCreate' ) ;
15+
16+ let previousPath = window . location . pathname ;
17+
18+ if ( layoutParam || showCreateParam ) {
19+ previousPath += '?' ;
20+ const params = [ ] ;
21+
22+ if ( layoutParam ) params . push ( `layout=${ layoutParam } ` ) ;
23+ if ( showCreateParam ) params . push ( `showCreate=${ showCreateParam } ` ) ;
24+
25+ previousPath += params . join ( '&' ) ;
26+ }
27+
28+ if ( previousPath !== '/' && previousPath !== '/clusters' ) {
29+ localStorage . setItem ( PREVIOUS_PATHNAME_KEY , previousPath ) ;
1530 }
1631}
1732
You can’t perform that action at this time.
0 commit comments