[web] update HideInStatic and some components.

This commit is contained in:
Matthew Shao 2017-08-08 21:57:42 +08:00
parent 07b3900ac5
commit 756b734ae2
5 changed files with 20 additions and 8 deletions

View File

@ -2,6 +2,7 @@ import React from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { formatSize } from '../utils.js'
import HideInStatic from '../components/common/HideInStatic'
Footer.propTypes = {
settings: PropTypes.object.isRequired,
@ -49,13 +50,14 @@ function Footer({ settings }) {
<span className="label label-success">stream: {formatSize(stream_large_bodies)}</span>
)}
<div className="pull-right">
{ MITMWEB_STATIC ?
(<span className="label label-primary" title="static">Static</span>):
<HideInStatic>
{
server && (
<span className="label label-primary" title="HTTP Proxy Server Address">
{listen_host||"*"}:{listen_port}
</span>)
}
</HideInStatic>
<span className="label label-info" title="Mitmproxy Version">
v{version}
</span>

View File

@ -37,6 +37,7 @@ export function FileMenu ({clearFlows, loadFlows, saveFlows, openModal}) {
&nbsp;Save...
</a>
<HideInStatic>
<a href="#" onClick={e => { e.preventDefault(); openModal(); }}>
<i className="fa fa-fw fa-cog"></i>
&nbsp;Options
@ -47,6 +48,7 @@ export function FileMenu ({clearFlows, loadFlows, saveFlows, openModal}) {
<i className="fa fa-fw fa-external-link"></i>
&nbsp;Install Certificates...
</a>
</HideInStatic>
</Dropdown>
)
}

View File

@ -23,7 +23,8 @@ export function FlowMenu({ flow, resumeFlow, killFlow, replayFlow, duplicateFlow
return <div/>
return (
<div>
<HideInStatic className="menu-group">
<HideInStatic>
<div className="menu-group">
<div className="menu-content">
<Button title="[r]eplay flow" icon="fa-repeat text-primary"
onClick={() => replayFlow(flow)}>
@ -43,6 +44,7 @@ export function FlowMenu({ flow, resumeFlow, killFlow, replayFlow, duplicateFlow
</Button>
</div>
<div className="menu-legend">Flow Modification</div>
</div>
</HideInStatic>
<div className="menu-group">
@ -55,7 +57,8 @@ export function FlowMenu({ flow, resumeFlow, killFlow, replayFlow, duplicateFlow
<div className="menu-legend">Export</div>
</div>
<HideInStatic className="menu-group">
<HideInStatic>
<div className="menu-group">
<div className="menu-content">
<Button disabled={!flow || !flow.intercepted} title="[a]ccept intercepted flow"
icon="fa-play text-success" onClick={() => resumeFlow(flow)}>
@ -67,6 +70,7 @@ export function FlowMenu({ flow, resumeFlow, killFlow, replayFlow, duplicateFlow
</Button>
</div>
<div className="menu-legend">Interception</div>
</div>
</HideInStatic>

View File

@ -10,16 +10,19 @@ OptionMenu.title = 'Options'
export default function OptionMenu() {
return (
<div>
<HideInStatic className="menu-group">
<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>
<div className="menu-legend">Protocol Support</div>
</div>
</HideInStatic>
<HideInStatic className="menu-group">
<HideInStatic>
<div className="menu-group">
<div className="menu-content">
<SettingsToggle setting="anticache">
Disable Caching <DocsLink resource="features/anticache.html"/>
@ -30,6 +33,7 @@ export default function OptionMenu() {
</SettingsToggle>
</div>
<div className="menu-legend">HTTP Options</div>
</div>
</HideInStatic>
<div className="menu-group">

View File

@ -1,5 +1,5 @@
import React from 'react'
export default function HideInStatic({className, children }) {
return MITMWEB_STATIC ? null : ( <div className={className}>{children}</div> )
export default function HideInStatic({ children }) {
return global.MITMWEB_STATIC ? null : [children]
}