Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ensembl-web
ensembl-client
Commits
c19fa0da
Unverified
Commit
c19fa0da
authored
Jun 25, 2021
by
Imran Salam
Committed by
GitHub
Jun 25, 2021
Browse files
Save the sidebar state for genomes in Genome browser and Entity viewer (#514)
parent
f5416a16
Pipeline
#169811
passed with stages
in 4 minutes and 34 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
25 deletions
+27
-25
src/ensembl/package-lock.json
src/ensembl/package-lock.json
+1
-1
src/ensembl/src/content/app/browser/track-panel/trackPanelReducer.ts
.../src/content/app/browser/track-panel/trackPanelReducer.ts
+11
-6
src/ensembl/src/content/app/browser/track-panel/trackPanelState.ts
...bl/src/content/app/browser/track-panel/trackPanelState.ts
+12
-7
src/ensembl/src/content/app/entity-viewer/gene-view/GeneView.tsx
...embl/src/content/app/entity-viewer/gene-view/GeneView.tsx
+0
-8
src/ensembl/src/content/app/entity-viewer/state/sidebar/entityViewerSidebarSelectors.ts
...tity-viewer/state/sidebar/entityViewerSidebarSelectors.ts
+1
-1
src/ensembl/src/content/app/entity-viewer/state/sidebar/entityViewerSidebarSlice.ts
...p/entity-viewer/state/sidebar/entityViewerSidebarSlice.ts
+2
-2
No files found.
src/ensembl/package-lock.json
View file @
c19fa0da
...
...
@@ -102,7 +102,7 @@
"dotenv-webpack": "7.0.2",
"eslint": "7.27.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-jest": "
^
24.3.6",
"eslint-plugin-jest": "24.3.6",
"eslint-plugin-prettier": "3.4.0",
"eslint-plugin-react": "7.23.2",
"eslint-plugin-react-hooks": "4.2.0",
src/ensembl/src/content/app/browser/track-panel/trackPanelReducer.ts
View file @
c19fa0da
...
...
@@ -18,7 +18,7 @@ import { ActionType, getType } from 'typesafe-actions';
import
pickBy
from
'
lodash/pickBy
'
;
import
{
get
Initial
TrackPanelState
,
getTrackPanelState
,
getTrackPanelStateForGenome
,
TrackPanelState
}
from
'
./trackPanelState
'
;
...
...
@@ -26,7 +26,7 @@ import * as browserActions from 'src/content/app/browser/browserActions';
import
*
as
trackPanelActions
from
'
./trackPanelActions
'
;
export
default
function
trackPanel
(
state
:
TrackPanelState
=
get
Initial
TrackPanelState
(),
state
:
TrackPanelState
=
getTrackPanelState
(),
action
:
|
ActionType
<
typeof
trackPanelActions
>
|
ActionType
<
typeof
browserActions
>
...
...
@@ -34,10 +34,15 @@ export default function trackPanel(
switch
(
action
.
type
)
{
case
getType
(
browserActions
.
setDataFromUrl
):
const
{
activeGenomeId
}
=
action
.
payload
;
return
{
...
state
,
[
activeGenomeId
]:
getTrackPanelStateForGenome
(
activeGenomeId
)
};
if
(
!
state
[
activeGenomeId
])
{
return
{
...
state
,
[
activeGenomeId
]:
getTrackPanelStateForGenome
(
activeGenomeId
)
};
}
else
{
return
state
;
}
case
getType
(
trackPanelActions
.
updateTrackPanelForGenome
):
return
{
...
state
,
...
...
src/ensembl/src/content/app/browser/track-panel/trackPanelState.ts
View file @
c19fa0da
...
...
@@ -55,7 +55,7 @@ export const defaultTrackPanelStateForGenome: TrackPanelStateForGenome = {
collapsedTrackIds
:
[]
};
export
const
get
Initial
TrackPanelState
=
():
TrackPanelState
=>
{
export
const
getTrackPanelState
=
():
TrackPanelState
=>
{
const
genomeId
=
browserStorageService
.
getActiveGenomeId
();
return
genomeId
?
{
[
genomeId
]:
getTrackPanelStateForGenome
(
genomeId
)
}
:
{};
};
...
...
@@ -63,14 +63,19 @@ export const getInitialTrackPanelState = (): TrackPanelState => {
export
const
getTrackPanelStateForGenome
=
(
genomeId
:
string
):
TrackPanelStateForGenome
=>
{
const
storedTrackPanel
=
browserStorageService
.
getTrackPanels
()[
genomeId
]
||
{};
return
{
...
defaul
tTrackPanelStateForGenome
,
...
storedTrackPanel
}
;
return
genomeId
?
{
...
defaultTrackPanelStateForGenome
,
...
getPersisten
tTrackPanelStateForGenome
(
genomeId
)
}
:
defaultTrackPanelStateForGenome
;
};
export
const
getPersistentTrackPanelStateForGenome
=
(
genomeId
:
string
):
Partial
<
TrackPanelStateForGenome
>
=>
browserStorageService
.
getTrackPanels
()[
genomeId
]
||
{};
export
const
pickPersistentTrackPanelProperties
=
(
trackPanel
:
Partial
<
TrackPanelStateForGenome
>
)
=>
{
...
...
src/ensembl/src/content/app/entity-viewer/gene-view/GeneView.tsx
View file @
c19fa0da
...
...
@@ -33,8 +33,6 @@ import {
GeneViewTabName
}
from
'
src/content/app/entity-viewer/state/gene-view/view/geneViewViewSlice
'
;
import
{
updatePreviouslyViewedEntities
}
from
'
src/content/app/entity-viewer/state/bookmarks/entityViewerBookmarksSlice
'
;
import
{
closeSidebarModal
}
from
'
src/content/app/entity-viewer/state/sidebar/entityViewerSidebarSlice
'
;
import
{
isEntityViewerSidebarOpen
}
from
'
src/content/app/entity-viewer/state/sidebar/entityViewerSidebarSelectors
'
;
import
{
getFilters
,
getSortingRule
...
...
@@ -209,8 +207,6 @@ const GeneViewWithData = (props: GeneViewWithDataProps) => {
const
focusId
=
buildFocusIdForUrl
({
type
:
'
gene
'
,
objectId
:
geneId
});
const
gbUrl
=
urlFor
.
browser
({
genomeId
,
focus
:
focusId
});
const
isSidebarOpen
=
useSelector
(
isEntityViewerSidebarOpen
);
const
shouldShowFilterIndicator
=
sortingRule
!==
SortingRule
.
DEFAULT
||
Object
.
values
(
filters
).
some
(
Boolean
);
...
...
@@ -233,10 +229,6 @@ const GeneViewWithData = (props: GeneViewWithDataProps) => {
return
;
}
if
(
isSidebarOpen
)
{
dispatch
(
closeSidebarModal
());
}
dispatch
(
updatePreviouslyViewedEntities
({
genomeId
,
...
...
src/ensembl/src/content/app/entity-viewer/state/sidebar/entityViewerSidebarSelectors.ts
View file @
c19fa0da
...
...
@@ -35,7 +35,7 @@ export const getEntityViewerGenomeState = (state: RootState) => {
export
const
getEntityViewerSidebarUIState
=
(
state
:
RootState
)
=>
{
const
activeEntityId
=
getEntityViewerActiveEntityId
(
state
);
return
activeEntityId
?
getEntityViewerGenomeState
(
state
)?.
entities
[
activeEntityId
]?.
u
I
State
||
?
getEntityViewerGenomeState
(
state
)?.
entities
[
activeEntityId
]?.
u
i
State
||
null
:
null
;
};
...
...
src/ensembl/src/content/app/entity-viewer/state/sidebar/entityViewerSidebarSlice.ts
View file @
c19fa0da
...
...
@@ -56,7 +56,7 @@ export type EntityViewerSidebarGenomeState = Readonly<{
selectedTabName
:
SidebarTabName
;
entities
:
{
[
entityId
:
string
]:
{
u
I
State
:
EntityViewerSidebarUIState
;
u
i
State
:
EntityViewerSidebarUIState
;
};
};
sidebarModalView
:
SidebarModalView
|
null
;
...
...
@@ -222,7 +222,7 @@ const entityViewerSidebarSlice = createSlice({
};
mergeWith
(
state
[
genomeId
].
entities
[
entityId
].
u
I
State
,
state
[
genomeId
].
entities
[
entityId
].
u
i
State
,
newFragment
,
overwriteArray
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment