mirror of
https://github.com/fleetdm/fleet
synced 2026-05-16 21:48:48 +00:00
* Creates new PackComposerPage at /packs/new * Creates PackForm component * Adds PackForm to PackComposerPage * Creates QueriesListItem * Creates QueriesList * Creates QueriesListWrapper * Get all queries when the Packs Composer Page loads * Form HOC handles updates to formData prop * Creates form to configure scheduled queries * QueriesListWrapper renders ConfigurePackQueryForm * search queries input filters queries list * Empty state text * create pack when user submits the new pack form * Adds Edit pack page to /packs/:pack_id/edit * API client - get scheduled queries for a pack * API client - create scheduled query * Redux config for scheduled queries * Remove scheduled queries from packs * Add labels to pack on create * Add disabled state to the select targets dropdown * Adds edit route and pushes to new route on edit click * Adds cancel button to edit pack form * Adds Checkbox that selects all scheduled queries in table
61 lines
1.6 KiB
JavaScript
61 lines
1.6 KiB
JavaScript
import React, { Component, PropTypes } from 'react';
|
|
import classnames from 'classnames';
|
|
import { noop, pick } from 'lodash';
|
|
|
|
import FormField from 'components/forms/FormField';
|
|
|
|
const baseClass = 'kolide-checkbox';
|
|
|
|
class Checkbox extends Component {
|
|
static propTypes = {
|
|
children: PropTypes.node,
|
|
className: PropTypes.string,
|
|
disabled: PropTypes.bool,
|
|
name: PropTypes.string,
|
|
onChange: PropTypes.func,
|
|
value: PropTypes.bool,
|
|
};
|
|
|
|
static defaultProps = {
|
|
disabled: false,
|
|
onChange: noop,
|
|
};
|
|
|
|
handleChange = () => {
|
|
const { onChange, value } = this.props;
|
|
|
|
return onChange(!value);
|
|
};
|
|
|
|
render () {
|
|
const { handleChange } = this;
|
|
const { children, className, disabled, name, value } = this.props;
|
|
const checkBoxClass = classnames(baseClass, className);
|
|
|
|
const formFieldProps = pick(this.props, ['hint', 'label', 'error', 'name']);
|
|
|
|
const checkBoxTickClass = classnames(`${checkBoxClass}__tick`, {
|
|
[`${checkBoxClass}__tick--disabled`]: disabled,
|
|
});
|
|
|
|
return (
|
|
<FormField {...formFieldProps} type="checkbox">
|
|
<label htmlFor={name} className={checkBoxClass}>
|
|
<input
|
|
checked={value}
|
|
className={`${checkBoxClass}__input`}
|
|
disabled={disabled}
|
|
id={name}
|
|
name={name}
|
|
onChange={handleChange}
|
|
type="checkbox"
|
|
/>
|
|
<span className={checkBoxTickClass} />
|
|
<div className={`${checkBoxClass}__label`}>{children}</div>
|
|
</label>
|
|
</FormField>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default Checkbox;
|