forked from SpecterOps/BloodHound-Legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix cancel upload, add Enabled property to nodes
- Loading branch information
Showing
3 changed files
with
83 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,80 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types' | ||
import PropTypes from 'prop-types'; | ||
|
||
export default class ProgressBarMenuButton extends Component { | ||
constructor(){ | ||
super() | ||
constructor(){ | ||
super(); | ||
|
||
this.state = { | ||
expanded: false | ||
} | ||
} | ||
this.state = { | ||
expanded: false | ||
}; | ||
} | ||
|
||
_leave(e){ | ||
this.setState({expanded: false}) | ||
var target = $(e.target) | ||
var oldWidth = target.width() | ||
target.html('{}%'.format(this.props.progress)) | ||
target.animate({ | ||
width: '41px' | ||
}, 100) | ||
} | ||
componentDidMount(){ | ||
$(this.refs.btn).html('{}%'.format(this.props.progress)); | ||
$(this.refs.btn).css('padding','6px 0px 6px 0px'); | ||
$(this.refs.btn).css('width','41px'); | ||
} | ||
|
||
_enter(e){ | ||
this.setState({expanded: true}) | ||
var target = $(e.target) | ||
var oldWidth = target.width() | ||
var template = ` | ||
<div class="progress" style="margin-bottom:0px"> | ||
<div class="progress-bar progress-bar-striped active" role="progressbar" aria-value-now={} aria-value-max="100" style="width:{}%"> | ||
</div> | ||
<span> | ||
{}% | ||
</span> | ||
</div> | ||
`.formatAll(this.props.progress) | ||
|
||
target.html(template) | ||
target.animate({ | ||
width: '150px' | ||
}, 100) | ||
} | ||
componentWillReceiveProps(nextProps){ | ||
if (this.state.expanded){ | ||
var template = `<div class="progress" style="margin-bottom:0px"> | ||
<div class="progress-bar progress-bar-striped active" role="progressbar" aria-value-now={} aria-value-max="100" style="width:{}%"> | ||
</div> | ||
<span> | ||
{}% | ||
</span> | ||
</div>`.formatAll(nextProps.progress); | ||
$(this.refs.btn).html(template); | ||
}else{ | ||
$(this.refs.btn).html('{}%'.format(nextProps.progress)); | ||
} | ||
|
||
componentWillReceiveProps(nextProps){ | ||
if (this.state.expanded){ | ||
var template = `<div class="progress" style="margin-bottom:0px"> | ||
<div class="progress-bar progress-bar-striped active" role="progressbar" aria-value-now={} aria-value-max="100" style="width:{}%"> | ||
</div> | ||
<span> | ||
{}% | ||
</span> | ||
</div>`.formatAll(nextProps.progress) | ||
$(this.refs.btn).html(template) | ||
}else{ | ||
$(this.refs.btn).html('{}%'.format(nextProps.progress)) | ||
} | ||
this.forceUpdate(); | ||
} | ||
|
||
this.forceUpdate() | ||
} | ||
shouldComponentUpdate(nextProps, nextState){ | ||
return true; | ||
} | ||
|
||
shouldComponentUpdate(nextProps, nextState){ | ||
return true | ||
} | ||
_leave(e){ | ||
this.setState({expanded: false}); | ||
var target = $(e.target); | ||
var oldWidth = target.width(); | ||
target.html('{}%'.format(this.props.progress)); | ||
target.animate({ | ||
width: '41px' | ||
}, 100); | ||
} | ||
|
||
componentDidMount(){ | ||
$(this.refs.btn).html('{}%'.format(this.props.progress)) | ||
$(this.refs.btn).css('padding','6px 0px 6px 0px') | ||
$(this.refs.btn).css('width','41px') | ||
} | ||
_enter(e){ | ||
this.setState({expanded: true}); | ||
var target = $(e.target); | ||
var oldWidth = target.width(); | ||
var template = ` | ||
<div class="progress" style="margin-bottom:0px"> | ||
<div class="progress-bar progress-bar-striped active" role="progressbar" aria-value-now={} aria-value-max="100" style="width:{}%"> | ||
</div> | ||
<span> | ||
{}% | ||
</span> | ||
</div> | ||
`.formatAll(this.props.progress); | ||
|
||
target.html(template); | ||
target.animate({ | ||
width: '150px' | ||
}, 100); | ||
} | ||
|
||
render() { | ||
return ( | ||
<button ref="btn" onClick={this.props.click} onMouseLeave={this._leave.bind(this)} onMouseEnter={this._enter.bind(this)} className="btn" /> | ||
); | ||
} | ||
render() { | ||
return ( | ||
<button ref="btn" onClick={this.props.click} onMouseLeave={this._leave.bind(this)} onMouseEnter={this._enter.bind(this)} className="btn" /> | ||
); | ||
} | ||
} | ||
|
||
ProgressBarMenuButton.propTypes = { | ||
progress : React.PropTypes.number.isRequired, | ||
click : React.PropTypes.func.isRequired | ||
} | ||
progress : React.PropTypes.number.isRequired, | ||
click : React.PropTypes.func.isRequired | ||
}; |