diff options
Diffstat (limited to 'app/assets/javascripts/mini_pipeline_graph_dropdown.js.es6')
-rw-r--r-- | app/assets/javascripts/mini_pipeline_graph_dropdown.js.es6 | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/app/assets/javascripts/mini_pipeline_graph_dropdown.js.es6 b/app/assets/javascripts/mini_pipeline_graph_dropdown.js.es6 index 31b65a22723..90b3366f14b 100644 --- a/app/assets/javascripts/mini_pipeline_graph_dropdown.js.es6 +++ b/app/assets/javascripts/mini_pipeline_graph_dropdown.js.es6 @@ -1,3 +1,4 @@ +/* eslint-disable no-new */ /* global Flash */ /** @@ -30,8 +31,8 @@ bindEvents() { const dropdownButtonSelector = 'button.js-builds-dropdown-button'; - $(this.container).off('click', dropdownButtonSelector, this.getBuildsList); - $(this.container).on('click', dropdownButtonSelector, this.getBuildsList); + $(this.container).off('click', dropdownButtonSelector, this.getBuildsList) + .on('click', dropdownButtonSelector, this.getBuildsList); } /** @@ -55,21 +56,25 @@ * @return {Promise} */ getBuildsList(e) { - const endpoint = e.currentTarget.dataset.stageEndpoint; + const button = e.currentTarget; + const endpoint = button.dataset.stageEndpoint; return $.ajax({ dataType: 'json', type: 'GET', url: endpoint, beforeSend: () => { - this.renderBuildsList(e.currentTarget, ''); - this.toggleLoading(e.currentTarget); + this.renderBuildsList(button, ''); + this.toggleLoading(button); }, success: (data) => { - this.toggleLoading(e.currentTarget); - this.renderBuildsList(e.currentTarget, data.html); + this.toggleLoading(button); + this.renderBuildsList(button, data.html); + }, + error: () => { + this.toggleLoading(button); + new Flash('An error occurred while fetching the builds.', 'alert'); }, - error: () => new Flash('An error occurred while fetching the builds.', 'alert'), }); } |