Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ var RequestInterface = React.createClass({
};
},

isPartial() {
// We assume we only have a partial interface is we're missing
// an HTTP method. This means we don't have enough information
// to reliably construct a full HTTP request.
return !this.props.data.method;
},

toggleView(value) {
this.setState({
view: value
Expand All @@ -50,27 +57,36 @@ var RequestInterface = React.createClass({
var parsedUrl = document.createElement("a");
parsedUrl.href = fullUrl;

var title = (
<div>
var children = [];

if (!this.isPartial()) {
children.push(
<div className="pull-right">
{!this.props.isShare &&
<RequestActions organization={this.context.organization}
project={this.context.project}
group={group}
event={evt} />
}
</div>
</div>,
<div className="btn-group">
<a className={(view === "rich" ? "active" : "") + " btn btn-default btn-sm"}
onClick={this.toggleView.bind(this, "rich")}>Rich</a>
<a className={(view === "curl" ? "active" : "") + " btn btn-default btn-sm"}
onClick={this.toggleView.bind(this, "curl")}><code>curl</code></a>
</div>
<h3>
<strong>{data.method || 'GET'} <a href={fullUrl}>{parsedUrl.pathname}</a></strong>
<small style={{marginLeft: 20}}>{parsedUrl.hostname}</small>
</h3>
</div>
);
}

children.push(
<h3>
<strong>{data.method || 'GET'} <a href={fullUrl}>{parsedUrl.pathname}</a></strong>
<small style={{marginLeft: 20}}>{parsedUrl.hostname}</small>
</h3>
);

var title = (
<div>{children}</div>
);

return (
Expand Down