From 2b7923b4f41ec6f8d08c17b2c4a4930e95387e1c Mon Sep 17 00:00:00 2001
From: Jason <jason.daurus@gmail.com>
Date: Sat, 25 Jun 2016 02:18:52 +0800
Subject: [web] fix actions

---
 web/src/js/components/Header/FlowMenu.jsx | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

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

diff --git a/web/src/js/components/Header/FlowMenu.jsx b/web/src/js/components/Header/FlowMenu.jsx
index 1fa7037f..ba1dcbcb 100644
--- a/web/src/js/components/Header/FlowMenu.jsx
+++ b/web/src/js/components/Header/FlowMenu.jsx
@@ -1,8 +1,8 @@
 import React, { PropTypes } from 'react'
+import { connect } from 'react-redux'
 import Button from '../common/Button'
-import { FlowActions } from '../../actions.js'
 import { MessageUtils } from '../../flow/utils.js'
-import { connect } from 'react-redux'
+import * as flowsActions from '../../ducks/flows'
 
 FlowMenu.title = 'Flow'
 
@@ -10,16 +10,16 @@ FlowMenu.propTypes = {
     flow: PropTypes.object.isRequired,
 }
 
-function FlowMenu({ flow }) {
+function FlowMenu({ flow, onAccept, onReplay, onDuplicate, onRemove, onRevert }) {
 
     return (
         <div>
             <div className="menu-row">
-                <Button disabled={!flow.intercepted} title="[a]ccept intercepted flow" text="Accept" icon="fa-play" onClick={() => FlowActions.accept(flow)} />
-                <Button title="[r]eplay flow" text="Replay" icon="fa-repeat" onClick={FlowActions.replay.bind(null, flow)} />
-                <Button title="[D]uplicate flow" text="Duplicate" icon="fa-copy" onClick={FlowActions.duplicate.bind(null, flow)} />
-                <Button title="[d]elete flow" text="Delete" icon="fa-trash" onClick={FlowActions.delete.bind(null, flow)}/>
-                <Button disabled={!flow.modified} title="revert changes to flow [V]" text="Revert" icon="fa-history" onClick={() => FlowActions.revert(flow)} />
+                <Button disabled={!flow.intercepted} title="[a]ccept intercepted flow" text="Accept" icon="fa-play" onClick={() => onAccept(flow)} />
+                <Button title="[r]eplay flow" text="Replay" icon="fa-repeat" onClick={() => onReplay(flow)} />
+                <Button title="[D]uplicate flow" text="Duplicate" icon="fa-copy" onClick={() => onDuplicate(flow)} />
+                <Button title="[d]elete flow" text="Delete" icon="fa-trash" onClick={() => onRemove(flow)}/>
+                <Button disabled={!flow.modified} title="revert changes to flow [V]" text="Revert" icon="fa-history" onClick={() => onRevert(flow)} />
                 <Button title="download" text="Download" icon="fa-download" onClick={() => window.location = MessageUtils.getContentURL(flow, flow.response)}/>
             </div>
             <div className="clearfix"/>
@@ -30,5 +30,12 @@ function FlowMenu({ flow }) {
 export default connect(
     state => ({
         flow: state.flows.list.byId[state.flows.views.main.selected[0]],
-    })
+    }),
+    {
+        onAccept: flowsActions.accept,
+        onReplay: flowsActions.replay,
+        onDuplicate: flowsActions.duplicate,
+        onRemove: flowsActions.remove,
+        onRevert: flowsActions.revert,
+    }
 )(FlowMenu)
-- 
cgit v1.2.3

