From 4ba3ad51f03112d1df36ded257be4c4ae4bbf48b Mon Sep 17 00:00:00 2001 From: Mike Stone Date: Tue, 3 Jan 2017 15:56:50 -0500 Subject: [PATCH] All packs page (#709) * 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 --- .../components/ClickableTableRow/index.jsx | 15 + frontend/components/NumberPill/NumberPill.jsx | 11 + frontend/components/NumberPill/_styles.scss | 13 + frontend/components/NumberPill/index.js | 1 + .../components/buttons/Button/_styles.scss | 2 + .../forms/fields/Checkbox/Checkbox.jsx | 5 +- .../components/packs/PacksList/PacksList.jsx | 78 +++++ .../packs/PacksList/PacksList.tests.jsx | 33 ++ .../components/packs/PacksList/Row/Row.jsx | 91 ++++++ .../packs/PacksList/Row/Row.tests.jsx | 24 ++ .../packs/PacksList/Row/_styles.scss | 57 ++++ .../components/packs/PacksList/Row/index.js | 1 + .../components/packs/PacksList/_styles.scss | 37 +++ frontend/components/packs/PacksList/index.js | 1 + .../QueriesListWrapper/QueriesListWrapper.jsx | 3 +- .../queries/QueriesListWrapper/_styles.scss | 14 - .../PackDetailsSidePanel.jsx | 62 ++++ .../ScheduledQueriesSection.jsx | 72 +++++ .../PackDetailsSidePanel/_styles.scss | 61 ++++ .../side_panels/PackDetailsSidePanel/index.js | 1 + .../side_panels/SiteNavSidePanel/navItems.js | 6 +- frontend/kolide/index.js | 15 + frontend/kolide/index.tests.js | 44 ++- .../pages/packs/AllPacksPage/AllPacksPage.jsx | 292 +++++++++++++++--- .../packs/AllPacksPage/AllPacksPage.tests.jsx | 178 +++++++++++ .../pages/packs/AllPacksPage/_styles.scss | 46 +++ frontend/redux/nodes/entities/packs/config.js | 8 +- frontend/router/index.jsx | 2 +- frontend/test/mocks.js | 22 ++ 29 files changed, 1120 insertions(+), 75 deletions(-) create mode 100644 frontend/components/ClickableTableRow/index.jsx create mode 100644 frontend/components/NumberPill/NumberPill.jsx create mode 100644 frontend/components/NumberPill/_styles.scss create mode 100644 frontend/components/NumberPill/index.js create mode 100644 frontend/components/packs/PacksList/PacksList.jsx create mode 100644 frontend/components/packs/PacksList/PacksList.tests.jsx create mode 100644 frontend/components/packs/PacksList/Row/Row.jsx create mode 100644 frontend/components/packs/PacksList/Row/Row.tests.jsx create mode 100644 frontend/components/packs/PacksList/Row/_styles.scss create mode 100644 frontend/components/packs/PacksList/Row/index.js create mode 100644 frontend/components/packs/PacksList/_styles.scss create mode 100644 frontend/components/packs/PacksList/index.js create mode 100644 frontend/components/side_panels/PackDetailsSidePanel/PackDetailsSidePanel.jsx create mode 100644 frontend/components/side_panels/PackDetailsSidePanel/ScheduledQueriesSection.jsx create mode 100644 frontend/components/side_panels/PackDetailsSidePanel/_styles.scss create mode 100644 frontend/components/side_panels/PackDetailsSidePanel/index.js create mode 100644 frontend/pages/packs/AllPacksPage/AllPacksPage.tests.jsx diff --git a/frontend/components/ClickableTableRow/index.jsx b/frontend/components/ClickableTableRow/index.jsx new file mode 100644 index 0000000000..cf2fe2f47b --- /dev/null +++ b/frontend/components/ClickableTableRow/index.jsx @@ -0,0 +1,15 @@ +import React, { PropTypes } from 'react'; + +const ClickableTableRow = ({ children, className, onClick }) => { + /* eslint-disable jsx-a11y/no-static-element-interactions */ + return {children}; + /* eslint-enable jsx-a11y/no-static-element-interactions */ +}; + +ClickableTableRow.propTypes = { + children: PropTypes.node, + className: PropTypes.string, + onClick: PropTypes.func.isRequired, +}; + +export default ClickableTableRow; diff --git a/frontend/components/NumberPill/NumberPill.jsx b/frontend/components/NumberPill/NumberPill.jsx new file mode 100644 index 0000000000..957ba4000c --- /dev/null +++ b/frontend/components/NumberPill/NumberPill.jsx @@ -0,0 +1,11 @@ +import React, { PropTypes } from 'react'; + +const NumberPill = ({ number }) => { + return {number}; +}; + +NumberPill.propTypes = { + number: PropTypes.number, +}; + +export default NumberPill; diff --git a/frontend/components/NumberPill/_styles.scss b/frontend/components/NumberPill/_styles.scss new file mode 100644 index 0000000000..15cb4f130f --- /dev/null +++ b/frontend/components/NumberPill/_styles.scss @@ -0,0 +1,13 @@ +.number-pill { + background-color: $brand; + border-radius: 14px; + color: $white; + display: inline-block; + line-height: 26px; + height: 26px; + text-align: center; + width: 44px; + font-size: 15px; + font-weight: 600; + letter-spacing: -0.5px; +} diff --git a/frontend/components/NumberPill/index.js b/frontend/components/NumberPill/index.js new file mode 100644 index 0000000000..eb79653518 --- /dev/null +++ b/frontend/components/NumberPill/index.js @@ -0,0 +1 @@ +export default from './NumberPill'; diff --git a/frontend/components/buttons/Button/_styles.scss b/frontend/components/buttons/Button/_styles.scss index d76bd262e6..5feba67a0b 100644 --- a/frontend/components/buttons/Button/_styles.scss +++ b/frontend/components/buttons/Button/_styles.scss @@ -35,6 +35,7 @@ $base-class: 'button'; text-align: center; color: $white; line-height: 36px; + text-decoration: none; text-transform: uppercase; letter-spacing: 1px; border-radius: 2px; @@ -121,6 +122,7 @@ $base-class: 'button'; background-color: transparent; border: 0; box-shadow: none; + color: $text-dark; cursor: pointer; margin: 0; padding: 0; diff --git a/frontend/components/forms/fields/Checkbox/Checkbox.jsx b/frontend/components/forms/fields/Checkbox/Checkbox.jsx index 9e86b097af..0ca0793dac 100644 --- a/frontend/components/forms/fields/Checkbox/Checkbox.jsx +++ b/frontend/components/forms/fields/Checkbox/Checkbox.jsx @@ -14,6 +14,7 @@ class Checkbox extends Component { name: PropTypes.string, onChange: PropTypes.func, value: PropTypes.bool, + wrapperClassName: PropTypes.string, }; static defaultProps = { @@ -29,7 +30,7 @@ class Checkbox extends Component { render () { const { handleChange } = this; - const { children, className, disabled, name, value } = this.props; + const { children, className, disabled, name, value, wrapperClassName } = this.props; const checkBoxClass = classnames(baseClass, className); const formFieldProps = pick(this.props, ['hint', 'label', 'error', 'name']); @@ -39,7 +40,7 @@ class Checkbox extends Component { }); return ( - +