From c2ededfc62eab66f214df331051cfe543c0053db Mon Sep 17 00:00:00 2001 From: Colin Megill Date: Thu, 21 Nov 2019 19:08:29 -0500 Subject: [PATCH] Anno editing label/category error states (#1048) * anno error states * label validation should not treat empty string as error * disable Submit if no label or category entered * edit category name error states * flex start * pr cleanup * label name validation fixes * PR comment responses --- .../src/components/categorical/categorical.js | 19 ++- client/src/components/categorical/category.js | 141 ++++++++++++++---- client/src/components/categorical/value.js | 134 +++++++++++++---- 3 files changed, 227 insertions(+), 67 deletions(-) diff --git a/client/src/components/categorical/categorical.js b/client/src/components/categorical/categorical.js index 37574027..53ff7f3b 100644 --- a/client/src/components/categorical/categorical.js +++ b/client/src/components/categorical/categorical.js @@ -64,9 +64,11 @@ class Categories extends React.Component { categoryNameError = name => { /* - return false if this is a LEGAL/acceptable category name, + return false if this is a LEGAL/acceptable category name or NULL/empty string, or return an error type. */ + if (!name) return false; + const { categoricalSelection } = this.props; const allCategoryNames = Object.keys(categoricalSelection); @@ -83,6 +85,7 @@ class Categories extends React.Component { categoryNameErrorMessage = name => { const err = this.categoryNameError(name); + if (err === false) return null; if (err === "duplicate") { return ( @@ -167,7 +170,6 @@ class Categories extends React.Component { autoFocus value={newCategoryText} intent={ - newCategoryText && this.categoryNameError(newCategoryText) ? "warning" : "none" @@ -180,11 +182,9 @@ class Categories extends React.Component {

@@ -227,7 +227,10 @@ class Categories extends React.Component {