diff --git a/package.json b/package.json index 6a93ea5547f..cd3a67e2fde 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "license": "AGPL-3.0", "dependencies": { "@babel/polyfill": "^7.12.1", - "@kube-design/components": "^1.27.1", + "@kube-design/components": "^1.32.0", "ace-builds": "^1.4.7", "ansi_up": "^5.0.0", "async-validator": "^1.8.5", diff --git a/src/components/Forms/Notification/BaseForm/ConditionSelect/index.jsx b/src/components/Forms/Notification/BaseForm/ConditionSelect/index.jsx index c6475c0c56c..7ff5355aa1d 100644 --- a/src/components/Forms/Notification/BaseForm/ConditionSelect/index.jsx +++ b/src/components/Forms/Notification/BaseForm/ConditionSelect/index.jsx @@ -134,7 +134,13 @@ export default class ConditionSelect extends React.Component { } handleOperatorChange = operator => { - this.setState({ operator }, () => this.handleChange()) + let values = this.state.values + + if (['Exists', 'DoesNotExist'].includes(operator)) { + values = undefined + } + + this.setState({ operator, values }, () => this.handleChange()) } handleValueChange = values => { @@ -143,12 +149,20 @@ export default class ConditionSelect extends React.Component { handleChange = () => { const { key, operator, values } = this.state + const _values = ['Exists', 'DoesNotExist'].includes(operator) + ? undefined + : values || [] - this.props.onChange({ + const data = { key, operator, - values: ['Exists', 'DoesNotExist'].includes(operator) ? [] : values, - }) + } + + if (_values) { + data.values = _values + } + + this.props.onChange(data) } dorpdownRender = options => { @@ -173,9 +187,11 @@ export default class ConditionSelect extends React.Component { renderValues() { const { key, operator, values } = this.state + if (operator === 'Exists' || operator === 'DoesNotExist') { return null } + if (key === 'severity') { return (