mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-01 09:18:12 +08:00
categorical UI improvements (#1649)
* return undefined for unknown fields * memoize fetch response * handle rename of user annotation * performance and cleanup * fix snapshots * fix comment * lint
This commit is contained in:
@@ -18,13 +18,24 @@ categorical annotations to be writable.
|
||||
*/
|
||||
|
||||
export function isCategoricalAnnotation(schema, name) {
|
||||
/* we treat any string, categorical or boolean as a categorical */
|
||||
const { type } = schema.annotations.obsByName[name];
|
||||
/*
|
||||
we treat any string, categorical or boolean as a categorical.
|
||||
Return true/false/undefined (for unkonwn fields)
|
||||
*/
|
||||
const colSchema = schema.annotations.obsByName[name];
|
||||
if (colSchema === undefined) return undefined;
|
||||
const { type } = colSchema;
|
||||
return type === "string" || type === "boolean" || type === "categorical";
|
||||
}
|
||||
|
||||
export function isContinuousAnnotation(schema, name) {
|
||||
return !isCategoricalAnnotation(schema, name);
|
||||
/*
|
||||
Return true/false/undefined
|
||||
*/
|
||||
const colSchema = schema.annotations.obsByName[name];
|
||||
if (colSchema === undefined) return undefined;
|
||||
const { type } = colSchema;
|
||||
return !(type === "string" || type === "boolean" || type === "categorical");
|
||||
}
|
||||
|
||||
function _isUserAnnotation(schema, name) {
|
||||
|
||||
Reference in New Issue
Block a user