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
25f12055
Unverified
Commit
25f12055
authored
Mar 04, 2021
by
Manoj Pandian Sakthivel
Committed by
GitHub
Mar 04, 2021
Browse files
Species do not get removed from Entity Viewer (#470)
parent
52bee27d
Pipeline
#135067
passed with stages
in 6 minutes and 44 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
21 deletions
+63
-21
src/ensembl/src/content/app/entity-viewer/services/entity-viewer-storage-service.ts
...p/entity-viewer/services/entity-viewer-storage-service.ts
+14
-0
src/ensembl/src/content/app/entity-viewer/state/general/entityViewerGeneralActions.ts
...entity-viewer/state/general/entityViewerGeneralActions.ts
+29
-21
src/ensembl/src/content/app/entity-viewer/state/general/entityViewerGeneralReducer.ts
...entity-viewer/state/general/entityViewerGeneralReducer.ts
+18
-0
src/ensembl/src/content/app/species-selector/state/speciesSelectorActions.ts
...tent/app/species-selector/state/speciesSelectorActions.ts
+2
-0
No files found.
src/ensembl/src/content/app/entity-viewer/services/entity-viewer-storage-service.ts
View file @
25f12055
...
...
@@ -49,6 +49,20 @@ export class EntityViewerStorageService {
localStorageOptions
);
}
public
deleteGenome
(
genomeIdToDelete
:
string
):
void
{
const
activeGenomeId
=
this
.
getGeneralState
().
activeGenomeId
;
if
(
activeGenomeId
===
genomeIdToDelete
)
{
this
.
updateGeneralState
({
activeGenomeId
:
undefined
});
}
this
.
storageService
.
removeAt
(
StorageKeys
.
GENERAL_STATE
,
[
'
activeEntityIds
'
,
genomeIdToDelete
],
localStorageOptions
);
}
}
export
default
new
EntityViewerStorageService
(
storageService
);
src/ensembl/src/content/app/entity-viewer/state/general/entityViewerGeneralActions.ts
View file @
25f12055
...
...
@@ -15,7 +15,7 @@
*/
import
{
createAction
}
from
'
typesafe-actions
'
;
import
{
ActionCreator
,
Action
}
from
'
redux
'
;
import
{
Action
}
from
'
redux
'
;
import
{
batch
}
from
'
react-redux
'
;
import
{
push
,
replace
}
from
'
connected-react-router
'
;
import
{
ThunkAction
}
from
'
redux-thunk
'
;
...
...
@@ -45,12 +45,12 @@ export const setActiveGenomeId = createAction(
'
entity-viewer/set-active-genome-id
'
)
<
string
>
();
export
const
setDataFromUrl
:
ActionCreator
<
ThunkAction
<
void
,
any
,
null
,
Action
<
string
>
>>
=
(
params
:
EntityViewerParams
)
=>
(
dispatch
,
getState
:
()
=>
RootState
)
=>
{
export
const
setDataFromUrl
=
(
params
:
EntityViewerParams
):
ThunkAction
<
void
,
any
,
null
,
Action
<
string
>>
=>
(
dispatch
,
getState
:
()
=>
RootState
)
=>
{
const
state
=
getState
();
const
{
genomeId
:
genomeIdFromUrl
}
=
params
;
...
...
@@ -100,18 +100,19 @@ export const setDataFromUrl: ActionCreator<ThunkAction<
entityViewerStorageService
.
updateGeneralState
({
activeGenomeId
:
genomeIdFromUrl
});
entityViewerStorageService
.
updateGeneralState
({
activeEntityIds
:
{
[
genomeIdFromUrl
]:
entityId
}
});
}
};
export
const
setDefaultActiveGenomeId
:
ActionCreator
<
ThunkAction
<
export
const
setDefaultActiveGenomeId
=
():
ThunkAction
<
void
,
any
,
null
,
Action
<
string
>
>
>
=
()
=>
(
dispatch
,
getState
:
()
=>
RootState
)
=>
{
>
=>
(
dispatch
,
getState
:
()
=>
RootState
)
=>
{
const
state
=
getState
();
const
[
firstCommittedSpecies
]
=
getCommittedSpecies
(
state
);
const
activeGenomeId
=
firstCommittedSpecies
.
genome_id
;
...
...
@@ -122,12 +123,9 @@ export const setDefaultActiveGenomeId: ActionCreator<ThunkAction<
});
};
export
const
changeActiveGenomeId
:
ActionCreator
<
ThunkAction
<
void
,
any
,
null
,
Action
<
string
>
>>
=
(
genomeId
:
string
)
=>
(
dispatch
)
=>
{
export
const
changeActiveGenomeId
=
(
genomeId
:
string
):
ThunkAction
<
void
,
any
,
null
,
Action
<
string
>>
=>
(
dispatch
)
=>
{
const
newUrl
=
urlHelper
.
entityViewer
({
genomeId
});
batch
(()
=>
{
dispatch
(
setActiveGenomeId
(
genomeId
));
...
...
@@ -139,12 +137,9 @@ export const updateActiveEntityForGenome = createAction(
'
entity-viewer/update-active-entity-ids
'
)
<
{
[
objectId
:
string
]:
string
}
>
();
export
const
updateEntityId
:
ActionCreator
<
ThunkAction
<
void
,
any
,
null
,
Action
<
string
>
>>
=
(
activeEntityId
:
string
)
=>
{
export
const
updateEntityId
=
(
activeEntityId
:
string
):
ThunkAction
<
void
,
any
,
null
,
Action
<
string
>>
=>
{
return
(
dispatch
,
getState
:
()
=>
RootState
)
=>
{
const
state
=
getState
();
const
activeGenomeId
=
getEntityViewerActiveGenomeId
(
state
);
...
...
@@ -160,3 +155,16 @@ export const updateEntityId: ActionCreator<ThunkAction<
dispatch
(
updateActiveEntityForGenome
(
updatedActiveEntityIds
));
};
};
export
const
deleteGenome
=
createAction
(
'
entity-viewer/delete-genome
'
)
<
string
>
();
export
const
deleteSpeciesInEntityViewer
=
(
genomeIdToRemove
:
string
):
ThunkAction
<
void
,
any
,
null
,
Action
<
string
>>
=>
{
return
(
dispatch
)
=>
{
dispatch
(
deleteGenome
(
genomeIdToRemove
));
entityViewerStorageService
.
deleteGenome
(
genomeIdToRemove
);
};
};
src/ensembl/src/content/app/entity-viewer/state/general/entityViewerGeneralReducer.ts
View file @
25f12055
...
...
@@ -15,6 +15,7 @@
*/
import
{
ActionType
,
getType
}
from
'
typesafe-actions
'
;
import
pickBy
from
'
lodash/pickBy
'
;
import
{
buildInitialState
,
...
...
@@ -35,6 +36,23 @@ export default function entityViewerReducer(
}
case
getType
(
actions
.
updateActiveEntityForGenome
):
return
{
...
state
,
activeEntityIds
:
action
.
payload
};
case
getType
(
actions
.
deleteGenome
):
{
const
genomeIdToRemove
=
action
.
payload
;
const
activeGenomeId
=
state
.
activeGenomeId
;
const
newState
=
{
...
state
,
activeGenomeId
:
activeGenomeId
===
genomeIdToRemove
?
null
:
activeGenomeId
,
activeEntityIds
:
pickBy
(
state
.
activeEntityIds
,
(
value
,
key
)
=>
key
!==
genomeIdToRemove
)
};
return
newState
;
}
default
:
return
state
;
}
...
...
src/ensembl/src/content/app/species-selector/state/speciesSelectorActions.ts
View file @
25f12055
...
...
@@ -26,6 +26,7 @@ import speciesSelectorStorageService from 'src/content/app/species-selector/serv
import
analyticsTracking
from
'
src/services/analytics-service
'
;
import
buildAnalyticsObject
from
'
src/analyticsHelper
'
;
import
{
deleteSpeciesInGenomeBrowser
}
from
'
src/content/app/browser/browserActions
'
;
import
{
deleteSpeciesInEntityViewer
}
from
'
src/content/app/entity-viewer/state/general/entityViewerGeneralActions
'
;
import
{
getCommittedSpecies
,
...
...
@@ -352,6 +353,7 @@ export const deleteSpeciesAndSave = (
dispatch
(
updateCommittedSpecies
(
updatedCommittedSpecies
));
dispatch
(
deleteSpeciesInGenomeBrowser
(
genomeId
));
dispatch
(
deleteSpeciesInEntityViewer
(
genomeId
));
speciesSelectorStorageService
.
saveSelectedSpecies
(
updatedCommittedSpecies
);
};
...
...
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