From c2401e35f4483e68116b8e90bb58b70659ace682 Mon Sep 17 00:00:00 2001
From: Maximilian Hils <git@maximilianhils.com>
Date: Wed, 25 Oct 2017 15:57:16 +0200
Subject: [web] move options editor from file menu to options menu

ultimately we probably want to open the options editor immediately if someone presses "Options".
This still requires us to

  1. have a nicer editors for common settings.
  2. Add a "view event log" button somewhere else,
     for example in the footer.

For now, the options editor is marked as beta, as there are some options you
clearly do not want to edit (e.g. wfile).
---
 web/src/js/components/Header/OptionMenu.jsx | 84 ++++++++++++-----------------
 1 file changed, 33 insertions(+), 51 deletions(-)

(limited to 'web/src/js/components/Header/OptionMenu.jsx')

diff --git a/web/src/js/components/Header/OptionMenu.jsx b/web/src/js/components/Header/OptionMenu.jsx
index c41c9d99..765129ed 100644
--- a/web/src/js/components/Header/OptionMenu.jsx
+++ b/web/src/js/components/Header/OptionMenu.jsx
@@ -1,74 +1,56 @@
-import React  from "react"
-import PropTypes from 'prop-types'
+import React from "react"
 import { connect } from "react-redux"
-import { SettingsToggle, EventlogToggle } from "./MenuToggle"
+import { EventlogToggle, SettingsToggle } from "./MenuToggle"
+import Button from "../common/Button"
 import DocsLink from "../common/DocsLink"
 import HideInStatic from "../common/HideInStatic";
+import * as modalActions from "../../ducks/ui/modal"
 
 OptionMenu.title = 'Options'
 
-export default function OptionMenu() {
+function OptionMenu({ openOptions }) {
     return (
         <div>
             <HideInStatic>
-            <div className="menu-group">
-                <div className="menu-content">
-                    <SettingsToggle setting="http2">HTTP/2.0</SettingsToggle>
-                    <SettingsToggle setting="websocket">WebSockets</SettingsToggle>
-                    <SettingsToggle setting="rawtcp">Raw TCP</SettingsToggle>
+                <div className="menu-group">
+                    <div className="menu-content">
+                        <Button title="Open Options" icon="fa-cogs text-primary"
+                                onClick={openOptions}>
+                            Edit Options <sup>alpha</sup>
+                        </Button>
+                    </div>
+                    <div className="menu-legend">Options Editor</div>
                 </div>
-                <div className="menu-legend">Protocol Support</div>
-            </div>
 
-            <div className="menu-group">
-                <div className="menu-content">
-                    <SettingsToggle setting="anticache">
-                        Disable Caching <DocsLink resource="features/anticache.html"/>
-                    </SettingsToggle>
-                    <SettingsToggle setting="anticomp">
-                        Disable Compression <i className="fa fa-question-circle"
-                                               title="Do not forward Accept-Encoding headers to the server to force an uncompressed response."></i>
-                    </SettingsToggle>
+                <div className="menu-group">
+                    <div className="menu-content">
+                        <SettingsToggle setting="anticache">
+                            Strip cache headers <DocsLink resource="features/anticache.html"/>
+                        </SettingsToggle>
+                        <SettingsToggle setting="showhost">
+                            Use host header for display
+                        </SettingsToggle>
+                        <SettingsToggle setting="ssl_insecure">
+                            Verify server certificates
+                        </SettingsToggle>
+                    </div>
+                    <div className="menu-legend">Quick Options</div>
                 </div>
-                <div className="menu-legend">HTTP Options</div>
-            </div>
             </HideInStatic>
 
             <div className="menu-group">
                 <div className="menu-content">
-                    <HideInStatic>
-                    <SettingsToggle setting="showhost">
-                        Use Host Header <i className="fa fa-question-circle"
-                                           title="Use the Host header to construct URLs for display."></i>
-                    </SettingsToggle>
-                    </HideInStatic>
-
                     <EventlogToggle/>
                 </div>
                 <div className="menu-legend">View Options</div>
             </div>
-            { /*
-             <ToggleButton text="no_upstream_cert"
-             checked={settings.no_upstream_cert}
-             onToggle={() => updateSettings({ no_upstream_cert: !settings.no_upstream_cert })}
-             />
-             <ToggleInputButton name="stickyauth" placeholder="Sticky auth filter"
-             checked={!!settings.stickyauth}
-             txt={settings.stickyauth}
-             onToggleChanged={txt => updateSettings({ stickyauth: !settings.stickyauth ? txt : null })}
-             />
-             <ToggleInputButton name="stickycookie" placeholder="Sticky cookie filter"
-             checked={!!settings.stickycookie}
-             txt={settings.stickycookie}
-             onToggleChanged={txt => updateSettings({ stickycookie: !settings.stickycookie ? txt : null })}
-             />
-             <ToggleInputButton name="stream_large_bodies" placeholder="stream..."
-             checked={!!settings.stream_large_bodies}
-             txt={settings.stream_large_bodies}
-             inputType="number"
-             onToggleChanged={txt => updateSettings({ stream_large_bodies: !settings.stream_large_bodies ? txt : null })}
-             />
-             */}
         </div>
     )
 }
+
+export default connect(
+    null,
+    {
+        openOptions: () => modalActions.setActiveModal('OptionModal')
+    }
+)(OptionMenu)
-- 
cgit v1.2.3

