mirror of
https://github.com/fleetdm/fleet
synced 2026-05-06 06:48:54 +00:00
* Moves LabelForm outside of the QueryForm component * Render LabelForm in ManageHostsPage * API client to update labels * Edit button styles
19 lines
426 B
JavaScript
19 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 };
|
|
};
|