Client side query validation (#335)
* validate query text * Update structure of submitted SaveQueryForm data * form calls correct prop function when invalid query text * Lowercase directory names
This commit is contained in:
@@ -81,7 +81,7 @@ class SaveQueryForm extends Component {
|
||||
const { validate } = this;
|
||||
|
||||
if (validate(runType)) {
|
||||
return onSubmit({ formData, runType });
|
||||
return onSubmit({ ...formData, runType });
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -55,16 +55,14 @@ describe('SaveQueryForm - component', () => {
|
||||
form.simulate('submit');
|
||||
|
||||
expect(onSubmit).toHaveBeenCalledWith({
|
||||
description: null,
|
||||
duration: 'short',
|
||||
hosts: 'all',
|
||||
hostsPercentage: null,
|
||||
name: queryName,
|
||||
platforms: 'all',
|
||||
runType: 'RUN_AND_SAVE',
|
||||
formData: {
|
||||
description: null,
|
||||
duration: 'short',
|
||||
hosts: 'all',
|
||||
hostsPercentage: null,
|
||||
name: queryName,
|
||||
platforms: 'all',
|
||||
scanInterval: 0,
|
||||
},
|
||||
scanInterval: 0,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -77,16 +75,14 @@ describe('SaveQueryForm - component', () => {
|
||||
form.simulate('submit');
|
||||
|
||||
expect(onSubmit).toHaveBeenCalledWith({
|
||||
description: null,
|
||||
duration: 'short',
|
||||
hosts: 'all',
|
||||
hostsPercentage: null,
|
||||
name: null,
|
||||
platforms: 'all',
|
||||
runType: 'RUN',
|
||||
formData: {
|
||||
description: null,
|
||||
duration: 'short',
|
||||
hosts: 'all',
|
||||
hostsPercentage: null,
|
||||
name: null,
|
||||
platforms: 'all',
|
||||
scanInterval: 0,
|
||||
},
|
||||
scanInterval: 0,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user