mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-30 15:08:12 +08:00
annotations CLI and file UX rework (#1049)
* rename config param label-file * annotations rework - CLI params, file naming and backups * lint * improve cli option error checks * enable session cookies * enable session cookies * add session id * name annotations file in multi-dataset and multi-user safe manner * pass data user hash to front-end * add annotation collection name support to front-end * add constant for annotation data collection name * parameterize annotation collection name; make it sticky in the session * clarify comments * hard wire a temporary data collection name for testing * prettier * test comment * package command * set annotations filename dialog * name and hash are visible * wire up data collection capture
This commit is contained in:
@@ -3,6 +3,24 @@ Reducers for annotation UI-state.
|
||||
*/
|
||||
const Annotations = (
|
||||
state = {
|
||||
/*
|
||||
Annotations collection name - which will be used to save the named set of annotations
|
||||
in some persistent store (database, file system, etc).
|
||||
|
||||
The backend may expect this to be a legal file name, which is typically alpha-numeric, plus [_-,.].
|
||||
Keep it simple or the server may return an error.
|
||||
|
||||
If `dataCollectionNameIsReadOnly` is true, you may NOT change the data collection name.
|
||||
If false, you may change `dataCollectionName` and it will be used at the time the annotations are
|
||||
written to the back-end.
|
||||
|
||||
*/
|
||||
dataCollectionNameIsReadOnly: true,
|
||||
dataCollectionName: null,
|
||||
|
||||
/*
|
||||
Annotations UI component state
|
||||
*/
|
||||
isEditingCategoryName: false,
|
||||
isEditingLabelName: false,
|
||||
categoryBeingEdited: null,
|
||||
@@ -12,6 +30,31 @@ const Annotations = (
|
||||
action
|
||||
) => {
|
||||
switch (action.type) {
|
||||
case "configuration load complete": {
|
||||
const DefaultDataCollectionName = null;
|
||||
const dataCollectionName =
|
||||
action.config.parameters?.["annotations-data-collection-name"] ?? null;
|
||||
const dataCollectionNameIsReadOnly =
|
||||
action.config.parameters?.[
|
||||
"annotations-data-collection-name-is-read-only"
|
||||
] ?? false;
|
||||
return {
|
||||
...state,
|
||||
dataCollectionNameIsReadOnly,
|
||||
dataCollectionName
|
||||
};
|
||||
}
|
||||
|
||||
case "set annotations collection name": {
|
||||
if (state.dataCollectionNameIsReadOnly) {
|
||||
throw new Error("data collection name is read only");
|
||||
}
|
||||
return {
|
||||
...state,
|
||||
dataCollectionName: action.data
|
||||
};
|
||||
}
|
||||
|
||||
/* CATEGORY */
|
||||
case "annotation: activate add new label mode":
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user