fleet/frontend/components/forms/LabelForm/validate.js
Mike Stone ff74ba2233 Edit labels (#1207)
* Moves LabelForm outside of the QueryForm component

* Render LabelForm in ManageHostsPage

* API client to update labels

* Edit button styles
2017-02-15 09:51:19 -05:00

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 };
};