From 84900bad0e7467fd77bf576ee1571c00b4995a63 Mon Sep 17 00:00:00 2001 From: Colin Megill Date: Thu, 7 Nov 2019 18:57:15 -0500 Subject: [PATCH 01/16] Warnings on anno textfields (#1023) * Warning for creating new label with an existing name * category dup * italics --- .../src/components/categorical/categorical.js | 73 ++++++++++++++----- client/src/components/categorical/category.js | 32 +++++++- client/src/reducers/annotations.js | 4 +- 3 files changed, 85 insertions(+), 24 deletions(-) diff --git a/client/src/components/categorical/categorical.js b/client/src/components/categorical/categorical.js index 98bb8785..660f3f51 100644 --- a/client/src/components/categorical/categorical.js +++ b/client/src/components/categorical/categorical.js @@ -7,7 +7,8 @@ import { InputGroup, Dialog, Classes, - MenuItem + MenuItem, + Colors } from "@blueprintjs/core"; import { Select } from "@blueprintjs/select"; import { connect } from "react-redux"; @@ -57,7 +58,11 @@ class Categories extends React.Component { }; render() { - const { createAnnoModeActive, categoryToDuplicate } = this.state; + const { + createAnnoModeActive, + categoryToDuplicate, + newCategoryText + } = this.state; const { categoricalSelection, writableCategoriesEnabled, @@ -76,26 +81,30 @@ class Categories extends React.Component { > {/* READ ONLY CATEGORICAL FIELDS */} {/* this is duplicative but flat, could be abstracted */} - {_.map(allCategoryNames, catName => - !schema.annotations.obsByName[catName].writable ? ( - - ) : null + {_.map( + allCategoryNames, + catName => + !schema.annotations.obsByName[catName].writable ? ( + + ) : null )} {/* WRITEABLE FIELDS */} - {_.map(allCategoryNames, catName => - schema.annotations.obsByName[catName].writable ? ( - - ) : null + {_.map( + allCategoryNames, + catName => + schema.annotations.obsByName[catName].writable ? ( + + ) : null )} {writableCategoriesEnabled ? (
@@ -116,12 +125,33 @@ class Categories extends React.Component {

New, unique category name:

this.setState({ newCategoryText: e.target.value }) } leftIcon="tag" /> +

+ + {newCategoryText} + {" "} + already exists +

+

Optionally duplicate all labels & cell assignments from existing category into new category: @@ -157,6 +187,9 @@ class Categories extends React.Component {