mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-30 04:28:11 +08:00
Improve label picking (#1179)
* add simple error message helper * port all label name pickers to use the new LabelInput component * use pure components where possible * cleanup * more cleanup * lint * change new label prompt
This commit is contained in:
@@ -55,46 +55,40 @@ const Annotations = (
|
||||
}
|
||||
|
||||
/* CATEGORY */
|
||||
case "annotation: activate add new label mode":
|
||||
case "annotation: activate add new label mode": {
|
||||
return {
|
||||
...state,
|
||||
isAddingNewLabel: true,
|
||||
categoryAddingNewLabel: action.data
|
||||
};
|
||||
case "annotation: activate add new ontology label mode":
|
||||
return {
|
||||
...state,
|
||||
isAddingNewLabelFromOntology: true,
|
||||
categoryAddingNewLabelFromOntology: action.data
|
||||
};
|
||||
case "annotation: disable add new ontology label mode":
|
||||
return {
|
||||
...state,
|
||||
isAddingNewLabelFromOntology: false,
|
||||
categoryAddingNewLabelFromOntology: null
|
||||
};
|
||||
}
|
||||
|
||||
case "annotation: disable add new label mode":
|
||||
case "annotation: disable add new label mode": {
|
||||
return {
|
||||
...state,
|
||||
isAddingNewLabel: false,
|
||||
categoryAddingNewLabel: null
|
||||
};
|
||||
case "annotation: activate category edit mode":
|
||||
}
|
||||
|
||||
case "annotation: activate category edit mode": {
|
||||
return {
|
||||
...state,
|
||||
isEditingCategoryName: true,
|
||||
categoryBeingEdited: action.data
|
||||
};
|
||||
case "annotation: disable category edit mode":
|
||||
}
|
||||
|
||||
case "annotation: disable category edit mode": {
|
||||
return {
|
||||
...state,
|
||||
isEditingCategoryName: false,
|
||||
categoryBeingEdited: null
|
||||
};
|
||||
}
|
||||
|
||||
/* LABEL */
|
||||
case "annotation: activate edit label mode":
|
||||
case "annotation: activate edit label mode": {
|
||||
return {
|
||||
...state,
|
||||
isEditingLabelName: true,
|
||||
@@ -103,12 +97,16 @@ const Annotations = (
|
||||
label: action.categoryIndex
|
||||
}
|
||||
};
|
||||
case "annotation: cancel edit label mode":
|
||||
}
|
||||
|
||||
case "annotation: cancel edit label mode": {
|
||||
return {
|
||||
...state,
|
||||
isEditingLabelName: false,
|
||||
labelEditable: { category: null, label: null }
|
||||
};
|
||||
}
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ControlsHelpers as CH } from "../util/stateManager";
|
||||
import * as globals from "../globals";
|
||||
|
||||
const CategoricalSelection = (
|
||||
state,
|
||||
|
||||
@@ -24,9 +24,8 @@ const CrossfilterReducerBase = (
|
||||
) => {
|
||||
switch (action.type) {
|
||||
case "universe: column load success": {
|
||||
const { schema, world, layoutChoice } = nextSharedState;
|
||||
const { world, layoutChoice } = nextSharedState;
|
||||
const { obsAnnotations, obsLayout } = world;
|
||||
const { dim, dataframe } = action;
|
||||
|
||||
// ignore var dimension loads as these are not currently selectable
|
||||
if (action.dim === "varAnnotations") return state;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// jshint esversion: 6
|
||||
const Ontology = (
|
||||
state = {
|
||||
enabled: false, // are ontology terms enabled?
|
||||
@@ -9,10 +8,12 @@ const Ontology = (
|
||||
action
|
||||
) => {
|
||||
switch (action.type) {
|
||||
case "configuration load complete":
|
||||
case "configuration load complete": {
|
||||
/* eslint-disable camelcase */
|
||||
const enabled =
|
||||
action.config?.parameters?.annotations_cell_ontology_enabled ?? false;
|
||||
const terms = action.config?.parameters?.annotations_cell_ontology_terms;
|
||||
/* eslint-enable camelcase */
|
||||
const termSet = new Set(terms);
|
||||
return {
|
||||
...state,
|
||||
@@ -21,8 +22,10 @@ const Ontology = (
|
||||
terms,
|
||||
termSet
|
||||
};
|
||||
default:
|
||||
}
|
||||
default: {
|
||||
return state;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -44,8 +44,6 @@ const skipOnActions = new Set([
|
||||
|
||||
/* annotation component action */
|
||||
"annotation: activate add new label mode",
|
||||
"annotation: activate add new ontology label mode",
|
||||
"annotation: disable add new ontology label mode",
|
||||
"annotation: disable add new label mode",
|
||||
"annotation: activate category edit mode",
|
||||
"annotation: disable category edit mode",
|
||||
|
||||
Reference in New Issue
Block a user