From 2a6ccfe4f6a925179414ea98969633cf2d5fff95 Mon Sep 17 00:00:00 2001 From: Kyle Knight Date: Thu, 19 Jan 2017 13:44:35 -0600 Subject: [PATCH] Remove Add Hosts page (#1035) --- frontend/components/modals/Modal/_styles.scss | 2 +- .../side_panels/SiteNavSidePanel/navItems.js | 19 +-- .../pages/hosts/NewHostPage/NewHostPage.jsx | 131 ------------------ .../hosts/NewHostPage/NewHostPage.tests.jsx | 29 ---- frontend/pages/hosts/NewHostPage/_styles.scss | 111 --------------- frontend/pages/hosts/NewHostPage/helpers.js | 23 --- frontend/pages/hosts/NewHostPage/index.js | 1 - frontend/router/index.jsx | 3 - 8 files changed, 2 insertions(+), 317 deletions(-) delete mode 100644 frontend/pages/hosts/NewHostPage/NewHostPage.jsx delete mode 100644 frontend/pages/hosts/NewHostPage/NewHostPage.tests.jsx delete mode 100644 frontend/pages/hosts/NewHostPage/_styles.scss delete mode 100644 frontend/pages/hosts/NewHostPage/helpers.js delete mode 100644 frontend/pages/hosts/NewHostPage/index.js diff --git a/frontend/components/modals/Modal/_styles.scss b/frontend/components/modals/Modal/_styles.scss index dedd9f309c..6fc4f05dc3 100644 --- a/frontend/components/modals/Modal/_styles.scss +++ b/frontend/components/modals/Modal/_styles.scss @@ -44,7 +44,7 @@ width: 600px; z-index: 3; padding: 30px; - box-shadow: 0 3px 3px rgba(0,0,0,0.07), 0 16px 24px rgba(50,50,93,0.14), inset 0 0 0 1px rgba(74,144,226,0.1); + box-shadow: 0 3px 3px rgba(0, 0, 0, 0.07), 0 16px 24px rgba(50, 50, 93, 0.14), inset 0 0 0 1px rgba(74, 144, 226, 0.1); border-radius: 2px; } } diff --git a/frontend/components/side_panels/SiteNavSidePanel/navItems.js b/frontend/components/side_panels/SiteNavSidePanel/navItems.js index f891c8add5..aaaf27f3e7 100644 --- a/frontend/components/side_panels/SiteNavSidePanel/navItems.js +++ b/frontend/components/side_panels/SiteNavSidePanel/navItems.js @@ -36,24 +36,7 @@ export default (admin) => { regex: /^\/hosts/, pathname: '/hosts/manage', }, - subItems: [ - { - icon: 'hosts', - name: 'Manage Hosts', - location: { - regex: /\/hosts\/manage/, - pathname: '/hosts/manage', - }, - }, - { - icon: 'add-plus', - name: 'Add Hosts', - location: { - regex: /\/hosts\/new/, - pathname: '/hosts/new', - }, - }, - ], + subItems: [], }, { icon: 'query', diff --git a/frontend/pages/hosts/NewHostPage/NewHostPage.jsx b/frontend/pages/hosts/NewHostPage/NewHostPage.jsx deleted file mode 100644 index de50605995..0000000000 --- a/frontend/pages/hosts/NewHostPage/NewHostPage.jsx +++ /dev/null @@ -1,131 +0,0 @@ -import React, { Component, PropTypes } from 'react'; -import { connect } from 'react-redux'; -import { noop } from 'lodash'; -import classnames from 'classnames'; - -import { renderFlash } from 'redux/nodes/notifications/actions'; -import Icon from 'components/icons/Icon'; -import { copyText } from './helpers'; -import AnsibleImage from '../../../../assets/images/Ansible.png'; -import ChefImage from '../../../../assets/images/Chef.png'; -import PuppetImage from '../../../../assets/images/Puppet.png'; - -const HOST_TABS = { - FIRST: 'What Does This Script Do?', - SECOND: 'Additional Script Options', -}; - -const baseClass = 'new-host'; - -export class NewHostPage extends Component { - static propTypes = { - dispatch: PropTypes.func, - }; - - static defaultProps = { - dispatch: noop, - }; - - constructor (props) { - super(props); - - this.state = { - method1Text: 'curl https://kolide.acme.com/install/osquery.sh | sudo sh', - method1TextCopied: false, - selectedTab: HOST_TABS.FIRST, - }; - } - - onCopyText = (text, elementId) => { - return (evt) => { - evt.preventDefault(); - - const { dispatch } = this.props; - const { method1Text } = this.state; - - if (copyText(elementId)) { - dispatch(renderFlash('success', 'Text copied to clipboard')); - } else { - dispatch(renderFlash('error', 'Text not copied. Use CMD + C to copy text')); - } - - if (text === method1Text) { - this.setState({ - method1TextCopied: true, - }); - } - - setTimeout(() => { - this.setState({ - method1TextCopied: false, - }); - - return false; - }, 1500); - - return false; - }; - } - - render () { - const { method1Text, method1TextCopied } = this.state; - const { onCopyText } = this; - - const method1IconClasses = classnames( - `${baseClass}__clipboard-icon`, - { - [`${baseClass}__clipboard-icon--copied`]: method1TextCopied, - } - ); - - return ( -
-
-

Kolide Installation Instructions

-
- - {method1TextCopied && copied!} - -
- -
-

This script does the following:

-
    -
  1. Detects operating system.
  2. -
  3. Checks for any existing osqueryd installation.
  4. -
  5. Installs osqueryd and ships your config to communicate with Kolide.
  6. -
-
- -

-
- -
-

Need More Methods?

- -

Many IT automation frameworks offer direct recipes and scripts for deploying osquery.
Choose a method below to learn more.

- -
    -
  • - -
  • -
  • - -
  • -
  • - -
  • -
-
-
- ); - } -} - -export default connect()(NewHostPage); diff --git a/frontend/pages/hosts/NewHostPage/NewHostPage.tests.jsx b/frontend/pages/hosts/NewHostPage/NewHostPage.tests.jsx deleted file mode 100644 index 3271465d6f..0000000000 --- a/frontend/pages/hosts/NewHostPage/NewHostPage.tests.jsx +++ /dev/null @@ -1,29 +0,0 @@ -import React from 'react'; -import expect from 'expect'; -import { mount } from 'enzyme'; - -import { connectedComponent, reduxMockStore } from '../../../test/helpers'; -import ConnectedNewHostPage, { NewHostPage } from './NewHostPage'; - -describe('New Host Page - component', () => { - it('saves text to the clipboard when clipboard icons are clicked', () => { - const mockStore = reduxMockStore(); - const page = mount( - connectedComponent(ConnectedNewHostPage, { mockStore }) - ); - const icon = page.find('.kolidecon-clipboard').first(); - icon.simulate('click'); - - const dispatchedActionMessages = mockStore.getActions().map((action) => { return action.payload.message; }); - expect(dispatchedActionMessages).toInclude('Text copied to clipboard'); - }); - - it('saves the copied text in state', () => { - const page = mount(); - const method1Icon = page.find('.kolidecon-clipboard').first(); - - method1Icon.simulate('click'); - - expect(page.state().method1TextCopied).toEqual(true); - }); -}); diff --git a/frontend/pages/hosts/NewHostPage/_styles.scss b/frontend/pages/hosts/NewHostPage/_styles.scss deleted file mode 100644 index 0e7b59a788..0000000000 --- a/frontend/pages/hosts/NewHostPage/_styles.scss +++ /dev/null @@ -1,111 +0,0 @@ -.new-host { - &__section-wrap { - margin-bottom: $pad-base; - padding: 30px; - } - - &__title { - margin: 0 0 32px; - } - - &__input-wrap { - position: relative; - margin: 0 0 23px; - } - - &__input { - color: $text-ultradark; - border-radius: 3px; - background-color: $white; - border: solid 1px $accent-dark; - box-shadow: inset 0 0 8px 0 rgba($black, 0.12); - box-sizing: border-box; - font-family: SourceCodePro, Oxygen; - font-size: $medium; - height: 60px; - letter-spacing: 1.2px; - opacity: 0.8; - padding-left: 28px; - width: 100%; - } - - &__clipboard-text { - color: $brand; - font-size: $xsmall; - position: absolute; - right: 10px; - top: 0; - } - - &__clipboard-icon { - position: absolute; - right: 10px; - cursor: pointer; - top: 18px; - font-size: $large; - color: $text-medium; - - &--copied { - color: $brand-light; - } - } - - &__text { - color: $text-ultradark; - font-size: 16px; - line-height: 32px; - margin: 0 0 $large; - max-width: 860px; - - p { - margin: 0; - } - - .kolide-ol { - margin: 0; - } - } - - &__view-script { - @include clearfix; - margin: 0; - - .button { - float: right; - color: $link; - font-weight: $normal; - text-transform: none; - } - } - - &__more-methods { - @include display(flex); - @include justify-content(space-between); - @include align-content(center); - @include align-items(center); - margin: 0; - padding: 42px 0; - list-style: none; - border-radius: 3px; - background-color: $white; - box-shadow: inset 0 0 8px 0 rgba(0, 0, 0, 0.08); - border: solid 1px $accent-medium; - - li { - &:first-child, - &:last-child { - @include flex-grow(1); - text-align: center; - } - } - - img { - max-width: 130px; - } - } - - code { - color: $brand; - font-family: SourceCodePro, Oxygen; - } -} diff --git a/frontend/pages/hosts/NewHostPage/helpers.js b/frontend/pages/hosts/NewHostPage/helpers.js deleted file mode 100644 index 3d61badf92..0000000000 --- a/frontend/pages/hosts/NewHostPage/helpers.js +++ /dev/null @@ -1,23 +0,0 @@ -import select from 'select'; - -const removeSelectedText = () => { - return global.window.getSelection().removeAllRanges(); -}; - -export const copyText = (elementId) => { - const element = global.document.querySelector(elementId); - - select(element); - - const canCopy = global.document.queryCommandEnabled('copy'); - - if (!canCopy) { - return false; - } - - global.document.execCommand('copy'); - removeSelectedText(); - return true; -}; - -export default { copyText }; diff --git a/frontend/pages/hosts/NewHostPage/index.js b/frontend/pages/hosts/NewHostPage/index.js deleted file mode 100644 index c2a352b4cd..0000000000 --- a/frontend/pages/hosts/NewHostPage/index.js +++ /dev/null @@ -1 +0,0 @@ -export default from './NewHostPage'; diff --git a/frontend/router/index.jsx b/frontend/router/index.jsx index 088d793e5e..7df532a906 100644 --- a/frontend/router/index.jsx +++ b/frontend/router/index.jsx @@ -17,7 +17,6 @@ import LoginRoutes from 'components/LoginRoutes'; import LogoutPage from 'pages/LogoutPage'; import ManageHostsPage from 'pages/hosts/ManageHostsPage'; import ManageQueriesPage from 'pages/queries/ManageQueriesPage'; -import NewHostPage from 'pages/hosts/NewHostPage'; import PackPageWrapper from 'components/packs/PackPageWrapper'; import PackComposerPage from 'pages/packs/PackComposerPage'; import QueryPage from 'pages/queries/QueryPage'; @@ -52,7 +51,6 @@ const routes = ( - @@ -64,7 +62,6 @@ const routes = ( -