From 2a9b2a549ab3ca012f98b7a069ca14442ee6a1e8 Mon Sep 17 00:00:00 2001
From: Matthew Shao <me@matshao.com>
Date: Wed, 28 Jun 2017 18:49:11 +0800
Subject: [web] Add Option Modal to FileMenu.

---
 web/src/js/components/Header/FileMenu.jsx | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

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

diff --git a/web/src/js/components/Header/FileMenu.jsx b/web/src/js/components/Header/FileMenu.jsx
index 70fbb2c3..82855c43 100644
--- a/web/src/js/components/Header/FileMenu.jsx
+++ b/web/src/js/components/Header/FileMenu.jsx
@@ -4,11 +4,13 @@ import { connect } from 'react-redux'
 import FileChooser from '../common/FileChooser'
 import Dropdown, {Divider} from '../common/Dropdown'
 import * as flowsActions from '../../ducks/flows'
+import * as modalActions from '../../ducks/ui/modal'
 
 FileMenu.propTypes = {
     clearFlows: PropTypes.func.isRequired,
     loadFlows: PropTypes.func.isRequired,
-    saveFlows: PropTypes.func.isRequired
+    saveFlows: PropTypes.func.isRequired,
+    openModal: PropTypes.func.isRequired,
 }
 
 FileMenu.onNewClick = (e, clearFlows) => {
@@ -17,7 +19,7 @@ FileMenu.onNewClick = (e, clearFlows) => {
         clearFlows()
 }
 
-export function FileMenu ({clearFlows, loadFlows, saveFlows}) {
+export function FileMenu ({clearFlows, loadFlows, saveFlows, openModal}) {
      return (
         <Dropdown className="pull-left" btnClass="special" text="mitmproxy">
             <a href="#" onClick={e => FileMenu.onNewClick(e, clearFlows)}>
@@ -34,6 +36,11 @@ export function FileMenu ({clearFlows, loadFlows, saveFlows}) {
                 &nbsp;Save...
             </a>
 
+            <a href="#" onClick={e => { openModal('OptionModal') }}>
+                <i className="fa fa-fw fa-cog"></i>
+                &nbsp;Options
+            </a>
+
             <Divider/>
 
             <a href="http://mitm.it/" target="_blank">
@@ -50,5 +57,6 @@ export default connect(
         clearFlows: flowsActions.clear,
         loadFlows: flowsActions.upload,
         saveFlows: flowsActions.download,
+        openModal: modalActions.setActiveModal,
     }
 )(FileMenu)
-- 
cgit v1.2.3


From febfeb9ef2bd9c412590c489e12f393f183b9a82 Mon Sep 17 00:00:00 2001
From: Matthew Shao <me@matshao.com>
Date: Wed, 28 Jun 2017 21:48:22 +0800
Subject: [web] Minor update for Modal Component.

---
 web/src/js/components/Header/FileMenu.jsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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

diff --git a/web/src/js/components/Header/FileMenu.jsx b/web/src/js/components/Header/FileMenu.jsx
index 82855c43..62f721cf 100644
--- a/web/src/js/components/Header/FileMenu.jsx
+++ b/web/src/js/components/Header/FileMenu.jsx
@@ -36,7 +36,7 @@ export function FileMenu ({clearFlows, loadFlows, saveFlows, openModal}) {
                 &nbsp;Save...
             </a>
 
-            <a href="#" onClick={e => { openModal('OptionModal') }}>
+            <a href="#" onClick={e => { e.preventDefault(); openModal(); }}>
                 <i className="fa fa-fw fa-cog"></i>
                 &nbsp;Options
             </a>
@@ -57,6 +57,6 @@ export default connect(
         clearFlows: flowsActions.clear,
         loadFlows: flowsActions.upload,
         saveFlows: flowsActions.download,
-        openModal: modalActions.setActiveModal,
+        openModal: () => modalActions.setActiveModal('OptionModal'),
     }
 )(FileMenu)
-- 
cgit v1.2.3

