Skip to content

Commit

Permalink
Bug 1286979 - Add a way to trigger a hook from web interface (#126)
Browse files Browse the repository at this point in the history
* Bug 1286979 - Add a button to trigger a hook

* Bump taskcluster-client to 1.1.0

* Fix style issues in hookeditor
  • Loading branch information
acmiyaguchi authored and eliperelman committed Aug 9, 2016
1 parent 867fd8b commit 4f9eec6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions hooks/hookeditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ var HookDisplay = React.createClass({
onClick={this.props.startEditing}>
<bs.Glyphicon glyph="pencil"/>&nbsp;Edit Hook
</bs.Button>
<bs.Button bsStyle="success" onClick={this.props.triggerHook}>
<bs.Glyphicon glyph="repeat" /> Trigger Hook
</bs.Button>
</bs.ButtonToolbar>
</div>
}
Expand Down Expand Up @@ -533,6 +536,7 @@ var HookEditView = React.createClass({
currentHookGroupId: React.PropTypes.string,
refreshHookList: React.PropTypes.func.isRequired,
selectHook: React.PropTypes.func.isRequired,
triggerHook: React.PropTypes.func.isRequired,
},

getInitialState() {
Expand Down Expand Up @@ -602,14 +606,22 @@ var HookEditView = React.createClass({
return <HookDisplay hook={this.state.hook}
currentHookId={this.props.currentHookId}
currentHookGroupId={this.props.currentHookGroupId}
startEditing={this.startEditing} />
startEditing={this.startEditing}
triggerHook={this.triggerHook} />
}
},

startEditing() {
this.setState({editing: true});
},

triggerHook() {
// Payloads are ignored, so we send empty data over
this.hooks
.triggerHook(this.props.currentHookGroupId, this.props.currentHookId, {})
.catch((error) => this.setState({ error }));
},

createHook(hookGroupId, hookId, hook) {
// add hookId and hookGroupId to the hook, since they are required
// by the schema
Expand All @@ -633,7 +645,7 @@ var HookEditView = React.createClass({
this.props.currentHookGroupId,
this.props.currentHookId,
hook
)
);
this.setState({
hook: stripHookIds(hook),
editing: false,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"rison": "^0.1.1",
"shell-escape": "^0.2.0",
"slugid": "^1.1.0",
"taskcluster-client": "^0.23.17",
"taskcluster-client": "^1.1.0",
"term.js": "0.0.4",
"webworkify": "^1.2.1",
"www-authenticate": "^0.6.2",
Expand Down

0 comments on commit 4f9eec6

Please sign in to comment.