aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/components/ContentView
diff options
context:
space:
mode:
authorClemens <cle1000.cb@gmail.com>2016-08-05 12:47:34 +0200
committerClemens <cle1000.cb@gmail.com>2016-08-05 12:47:34 +0200
commit9b0b007a5da75d70ec25b141c2a47b1b0010f5a3 (patch)
tree373d864b95f8adfff875a24c3c2284363a607994 /web/src/js/components/ContentView
parenta8aa1f2d1c8fe19313ca8abe07f9d6aa431fc3c3 (diff)
downloadmitmproxy-9b0b007a5da75d70ec25b141c2a47b1b0010f5a3.tar.gz
mitmproxy-9b0b007a5da75d70ec25b141c2a47b1b0010f5a3.tar.bz2
mitmproxy-9b0b007a5da75d70ec25b141c2a47b1b0010f5a3.zip
change some style
Diffstat (limited to 'web/src/js/components/ContentView')
-rw-r--r--web/src/js/components/ContentView/ContentViewOptions.jsx31
-rw-r--r--web/src/js/components/ContentView/ContentViews.jsx13
2 files changed, 36 insertions, 8 deletions
diff --git a/web/src/js/components/ContentView/ContentViewOptions.jsx b/web/src/js/components/ContentView/ContentViewOptions.jsx
new file mode 100644
index 00000000..fed3a088
--- /dev/null
+++ b/web/src/js/components/ContentView/ContentViewOptions.jsx
@@ -0,0 +1,31 @@
+import React, { PropTypes } from 'react'
+import { connect } from 'react-redux'
+import ViewSelector from './ViewSelector'
+import UploadContentButton from './UploadContentButton'
+import DownloadContentButton from './DownloadContentButton'
+
+ContentViewOptions.propTypes = {
+ flow: React.PropTypes.object.isRequired,
+ message: React.PropTypes.object.isRequired,
+}
+
+function ContentViewOptions(props) {
+ const { flow, message, uploadContent, readonly, contentViewDescription } = props
+ return (
+ <div className="view-options">
+ <ViewSelector message={message}/>
+ &nbsp;
+ <DownloadContentButton flow={flow} message={message}/>
+ &nbsp;
+ <UploadContentButton uploadContent={uploadContent}/>
+ &nbsp;
+ <span>{contentViewDescription}</span>
+ </div>
+ )
+}
+
+export default connect(
+ state => ({
+ contentViewDescription: state.ui.flow.viewDescription
+ })
+)(ContentViewOptions)
diff --git a/web/src/js/components/ContentView/ContentViews.jsx b/web/src/js/components/ContentView/ContentViews.jsx
index 43aece46..3db77af4 100644
--- a/web/src/js/components/ContentView/ContentViews.jsx
+++ b/web/src/js/components/ContentView/ContentViews.jsx
@@ -30,9 +30,8 @@ function Edit({ content, onChange }) {
Edit = ContentLoader(Edit)
class ViewServer extends Component {
- constructor(props){
- super(props)
- this.maxLines = 80
+ static defaultProps = {
+ maxLines: 80,
}
componentWillMount(){
@@ -50,14 +49,12 @@ class ViewServer extends Component {
props.setContentViewDescription(props.contentView != this.data.description ? this.data.description : '')
- let isFullContentShown = this.data.lines.length < this.maxLines
+ let isFullContentShown = this.data.lines.length < props.maxLines
if (isFullContentShown) props.setShowFullContent(true)
}
render() {
- const {content, contentView, message} = this.props
-
- let lines = this.props.showFullContent ? this.data.lines : this.data.lines.slice(0, this.maxLines)
-
+ const {content, contentView, message, maxLines} = this.props
+ let lines = this.props.showFullContent ? this.data.lines : this.data.lines.slice(0, maxLines)
return <div>
<pre>
{lines.map((line, i) =>