mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 09:18:59 +00:00
ff74ba2233
* Moves LabelForm outside of the QueryForm component * Render LabelForm in ManageHostsPage * API client to update labels * Edit button styles
20 lines
426 B
JavaScript
20 lines
426 B
JavaScript
import { size } from 'lodash';
|
|
import validateQuery from 'components/forms/validators/validate_query';
|
|
|
|
export default ({ name, query }) => {
|
|
const errors = {};
|
|
const { error: queryError, valid: queryValid } = validateQuery(query);
|
|
|
|
if (!queryValid) {
|
|
errors.query = queryError;
|
|
}
|
|
|
|
if (!name) {
|
|
errors.name = 'Label title must be present';
|
|
}
|
|
|
|
const valid = !size(errors);
|
|
|
|
return { valid, errors };
|
|
};
|