From 8e20ae5ac26a6f6154e38a4be0ca144aed52fe47 Mon Sep 17 00:00:00 2001 From: jpellizzari Date: Mon, 27 Mar 2017 12:52:03 -0700 Subject: [PATCH] Added logic to default to noneLabel when no options are selected --- client/app/scripts/components/topology-options.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client/app/scripts/components/topology-options.js b/client/app/scripts/components/topology-options.js index bc7a153c0..f16c8f923 100644 --- a/client/app/scripts/components/topology-options.js +++ b/client/app/scripts/components/topology-options.js @@ -36,8 +36,13 @@ class TopologyOptions extends React.Component { // Add it to the array if it's not selected nextOptions = opts[selected].concat(value); } - // Since the user is clicking an option, remove the highlighting from the 'none' option. - nextOptions = nextOptions.filter(o => o !== 'none'); + // Since the user is clicking an option, remove the highlighting from the 'none' option, + // unless they are removing the last option. In that case, default to the 'none' label. + if (nextOptions.length === 0) { + nextOptions = ['none']; + } else { + nextOptions = nextOptions.filter(o => o !== 'none'); + } } this.props.changeTopologyOption(optionId, nextOptions, topologyId); }