From da2a3aa1f0cf4bc6b028cc856028acf14b823fe1 Mon Sep 17 00:00:00 2001 From: RachelElysia <71795832+RachelElysia@users.noreply.github.com> Date: Wed, 1 Sep 2021 10:57:25 -0400 Subject: [PATCH] App Settings Page: New advance options UI (#1832) --- changes/1832-app-settings-ui | 1 + .../integration/all/app/settingsflow.spec.ts | 10 +-- .../admin/AppConfigForm/AppConfigForm.jsx | 63 +++---------------- .../AppConfigForm/AppConfigForm.tests.jsx | 20 +----- .../forms/admin/AppConfigForm/_styles.scss | 37 ++++------- 5 files changed, 32 insertions(+), 99 deletions(-) create mode 100644 changes/1832-app-settings-ui diff --git a/changes/1832-app-settings-ui b/changes/1832-app-settings-ui new file mode 100644 index 000000000..70e3b1a43 --- /dev/null +++ b/changes/1832-app-settings-ui @@ -0,0 +1 @@ +Cleaner advanced options UI \ No newline at end of file diff --git a/cypress/integration/all/app/settingsflow.spec.ts b/cypress/integration/all/app/settingsflow.spec.ts index 59d25106c..7d7a68026 100644 --- a/cypress/integration/all/app/settingsflow.spec.ts +++ b/cypress/integration/all/app/settingsflow.spec.ts @@ -66,8 +66,6 @@ describe("Settings flow", () => { .click() .type("rachelspassword"); - cy.get("#advanced-options").click(); - cy.findByLabelText(/domain/i) .click() .type("http://www.fleetdm.com"); @@ -75,12 +73,16 @@ describe("Settings flow", () => { // can't grab button from the label because the button is a child element and doesn't have a for attribute // couldn't figure out how to write a for attribute on kolide button // Repeated Error Message: Timed out retrying after 4000ms: Found a label with the text of: /verify ssl certs/i, however no form control was found associated to that label. Make sure you're using the "for" attribute or "aria-labelledby" attribute correctly. - cy.get(".kolide-slider__dot").click({ multiple: true }); + cy.findByLabelText(/verify ssl certs/i).check({ force: true }); + cy.findByLabelText(/enable starttls/i).check({ force: true }); + cy.findByLabelText(/^host expiry$/i).check({ force: true }); cy.findByLabelText(/host expiry window/i) .click() .type("{selectall}{backspace}5"); + cy.findByLabelText(/disable live queries/i).check({ force: true }); + // Update settings cy.findByRole("button", { name: /update settings/i }).click(); @@ -133,8 +135,6 @@ describe("Settings flow", () => { "rachelsusername" ); - cy.get("#advanced-options").click(); - cy.findByLabelText(/host expiry window/i).should("have.value", "5"); cy.getEmails().then((response) => { diff --git a/frontend/components/forms/admin/AppConfigForm/AppConfigForm.jsx b/frontend/components/forms/admin/AppConfigForm/AppConfigForm.jsx index 83c6c7e7e..5c1d197e2 100644 --- a/frontend/components/forms/admin/AppConfigForm/AppConfigForm.jsx +++ b/frontend/components/forms/admin/AppConfigForm/AppConfigForm.jsx @@ -60,25 +60,6 @@ const formFields = [ "agent_options", "enable_analytics", ]; -const Header = ({ showAdvancedOptions }) => { - const CaratIcon = ( - - ); - - return ( - - Advanced Options {CaratIcon}{" "} - Most users do not need to modify these options. - - ); -}; - -Header.propTypes = { showAdvancedOptions: PropTypes.bool.isRequired }; - class AppConfigForm extends Component { static propTypes = { fields: PropTypes.shape({ @@ -120,21 +101,10 @@ class AppConfigForm extends Component { super(props); this.state = { - showAdvancedOptions: false, showUsageStatsPreviewModal: false, }; } - onToggleAdvancedOptions = (evt) => { - evt.preventDefault(); - - const { showAdvancedOptions } = this.state; - - this.setState({ showAdvancedOptions: !showAdvancedOptions }); - - return false; - }; - toggleUsageStatsPreviewModal = () => { const { showUsageStatsPreviewModal } = this.state; this.setState({ @@ -144,29 +114,26 @@ class AppConfigForm extends Component { renderAdvancedOptions = () => { const { fields } = this.props; - const { showAdvancedOptions } = this.state; - - if (!showAdvancedOptions) { - return false; - } return (
+ Most users do not need to modify these options. +