diff --git a/app/assets/javascripts/commit/pipelines/pipelines_table.js b/app/assets/javascripts/commit/pipelines/pipelines_table.js index 9028e9b52b9..7b6f7caf4c7 100644 --- a/app/assets/javascripts/commit/pipelines/pipelines_table.js +++ b/app/assets/javascripts/commit/pipelines/pipelines_table.js @@ -44,7 +44,7 @@ export default Vue.component('pipelines-table', { state: store.state, isLoading: false, hasError: false, - setIsMakingRequest: false, + isMakingRequest: false, }; }, diff --git a/app/assets/javascripts/vue_pipelines_index/pipelines.js b/app/assets/javascripts/vue_pipelines_index/pipelines.js index f7536b6625b..5575aa72d5e 100644 --- a/app/assets/javascripts/vue_pipelines_index/pipelines.js +++ b/app/assets/javascripts/vue_pipelines_index/pipelines.js @@ -123,18 +123,23 @@ export default { tagsPath: this.tagsPath, }; }, + + pageParameter() { + return gl.utils.getParameterByName('page') || this.pagenum; + }, + + scopeParameter() { + return gl.utils.getParameterByName('scope') || this.apiScope; + }, }, created() { - const pageNumber = gl.utils.getParameterByName('page') || this.pagenum; - const scope = gl.utils.getParameterByName('scope') || this.apiScope; - this.service = new PipelinesService(this.endpoint); const poll = new Poll({ resource: this.service, method: 'getPipelines', - data: { page: pageNumber, scope }, + data: { page: this.pageParameter, scope: this.scopeParameter }, successCallback: this.successCallback, errorCallback: this.errorCallback, notificationCallback: this.setIsMakingRequest, @@ -183,13 +188,10 @@ export default { }, fetchPipelines() { - const pageNumber = gl.utils.getParameterByName('page') || this.pagenum; - const scope = gl.utils.getParameterByName('scope') || this.apiScope; - if (!this.isMakingRequest) { this.isLoading = true; - this.service.getPipelines({ scope, page: pageNumber }) + this.service.getPipelines({ scope: this.scopeParameter, page: this.pageParameter }) .then(response => this.successCallback(response)) .catch(() => this.errorCallback()); }