mirror of
https://github.com/fleetdm/fleet
synced 2026-05-16 05:28:38 +00:00
* Display packs page at /packs/manage * Adds NumberPill component * Filter packs list * Render the pack info side panel when no packs are selected * Adds packs list * Moves state management to page component * Display selected pack count * Render bulk action buttons * API client - update pack * API client - destroy pack * Adds update/destroy functions to packs redux config * Bulk actions (enable, disable, delete) * Selecting a pack updates state * PackDetailsSidePanel updates pack status * Link to edit pack on side panel * sets selected pack in URL * Sets color for unsettled buttons * Loads scheduled queries for selected pack in All Packs Page * PackDetailsSidePanel component * PackDetailsSidePanel styles * styles PacksList component * Stop rendering flash when pack status is updated * Makes full row clickable * highlight selected pack
62 lines
1.7 KiB
JavaScript
62 lines
1.7 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,
|
|
wrapperClassName: PropTypes.string,
|
|
};
|
|
|
|
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, wrapperClassName } = 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} className={wrapperClassName} 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} />
|
|
<span className={`${checkBoxClass}__label`}>{children}</span>
|
|
</label>
|
|
</FormField>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default Checkbox;
|