From 4f9eec6951c4eda6451576330b18f9d9d9517fd0 Mon Sep 17 00:00:00 2001 From: Anthony Miyaguchi Date: Mon, 8 Aug 2016 17:20:49 -0700 Subject: [PATCH] Bug 1286979 - Add a way to trigger a hook from web interface (#126) * Bug 1286979 - Add a button to trigger a hook * Bump taskcluster-client to 1.1.0 * Fix style issues in hookeditor --- hooks/hookeditor.jsx | 16 ++++++++++++++-- package.json | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/hooks/hookeditor.jsx b/hooks/hookeditor.jsx index 6c202c7..bbe2f82 100644 --- a/hooks/hookeditor.jsx +++ b/hooks/hookeditor.jsx @@ -185,6 +185,9 @@ var HookDisplay = React.createClass({ onClick={this.props.startEditing}>  Edit Hook + + Trigger Hook + } @@ -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() { @@ -602,7 +606,8 @@ var HookEditView = React.createClass({ return + startEditing={this.startEditing} + triggerHook={this.triggerHook} /> } }, @@ -610,6 +615,13 @@ var HookEditView = React.createClass({ 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 @@ -633,7 +645,7 @@ var HookEditView = React.createClass({ this.props.currentHookGroupId, this.props.currentHookId, hook - ) + ); this.setState({ hook: stripHookIds(hook), editing: false, diff --git a/package.json b/package.json index acefff9..09f46dc 100644 --- a/package.json +++ b/package.json @@ -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",