Merge pull request #15115 from influxdata/fix/save-variable
fix(variables/components/VariableForm): check to see if form is validpull/15123/head
commit
0a24d3bd85
|
@ -161,9 +161,24 @@ export default class VariableForm extends PureComponent<Props, State> {
|
|||
}
|
||||
|
||||
private get isFormValid(): boolean {
|
||||
const {hasValidArgs, isNameValid} = this.state
|
||||
const {isNameValid} = this.state
|
||||
|
||||
return hasValidArgs && isNameValid
|
||||
return this.validArgs && isNameValid
|
||||
}
|
||||
|
||||
private get validArgs(): boolean {
|
||||
const {args} = this.state
|
||||
switch (args.type) {
|
||||
case 'query':
|
||||
const {query} = args.values
|
||||
return !!query
|
||||
case 'constant':
|
||||
return args.values.length !== 0
|
||||
case 'map':
|
||||
return Object.keys(args.values).length !== 0
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
private handleSubmit = (): void => {
|
||||
|
|
Loading…
Reference in New Issue