mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-05 03:01:11 +00:00
Added logic to default to noneLabel when no options are selected
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user