diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-19 11:50:12 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-19 11:50:12 +0000 |
commit | 6cd5b7dbfaa4ff630ecbbfe351a1faac5fc71a8d (patch) | |
tree | d3563b9f60936c18a02185e2e53b424bb1b83539 /app/assets/javascripts | |
parent | b3e0658cb1fbc7c8e7dd381467c656f2e675ee46 (diff) | |
download | gitlab-ce-6cd5b7dbfaa4ff630ecbbfe351a1faac5fc71a8d.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts')
7 files changed, 5 insertions, 44 deletions
diff --git a/app/assets/javascripts/boards/index.js b/app/assets/javascripts/boards/index.js index 3bded4a3258..da2669e7cde 100644 --- a/app/assets/javascripts/boards/index.js +++ b/app/assets/javascripts/boards/index.js @@ -22,7 +22,6 @@ import Board from 'ee_else_ce/boards/components/board'; import BoardSidebar from 'ee_else_ce/boards/components/board_sidebar'; import initNewListDropdown from 'ee_else_ce/boards/components/new_list_dropdown'; import BoardAddIssuesModal from '~/boards/components/modal/index.vue'; -import '~/vue_shared/vue_resource_interceptor'; import { NavigationType, convertObjectPropsToCamelCase, diff --git a/app/assets/javascripts/commons/vue.js b/app/assets/javascripts/commons/vue.js index 798623b94fb..8b62d78c043 100644 --- a/app/assets/javascripts/commons/vue.js +++ b/app/assets/javascripts/commons/vue.js @@ -1,5 +1,4 @@ import Vue from 'vue'; -import '../vue_shared/vue_resource_interceptor'; if (process.env.NODE_ENV !== 'production') { Vue.config.productionTip = false; diff --git a/app/assets/javascripts/diff_notes/services/resolve.js b/app/assets/javascripts/diff_notes/services/resolve.js index 0687028ca54..27990b0a45e 100644 --- a/app/assets/javascripts/diff_notes/services/resolve.js +++ b/app/assets/javascripts/diff_notes/services/resolve.js @@ -2,7 +2,6 @@ import Vue from 'vue'; import Flash from '../../flash'; -import '../../vue_shared/vue_resource_interceptor'; import { __ } from '~/locale'; window.gl = window.gl || {}; diff --git a/app/assets/javascripts/issue_show/index.js b/app/assets/javascripts/issue_show/index.js index 5a9dd91817e..4bcba72bc23 100644 --- a/app/assets/javascripts/issue_show/index.js +++ b/app/assets/javascripts/issue_show/index.js @@ -2,7 +2,6 @@ import Vue from 'vue'; import { initSidebarTracking } from 'ee_else_ce/event_tracking/issue_sidebar'; import issuableApp from './components/app.vue'; import { parseIssuableData } from './utils/parse_data'; -import '../vue_shared/vue_resource_interceptor'; export default function initIssueableApp() { return new Vue({ diff --git a/app/assets/javascripts/lib/utils/axios_utils.js b/app/assets/javascripts/lib/utils/axios_utils.js index 37721cd030c..c17f62c671c 100644 --- a/app/assets/javascripts/lib/utils/axios_utils.js +++ b/app/assets/javascripts/lib/utils/axios_utils.js @@ -8,19 +8,19 @@ axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; // Maintain a global counter for active requests // see: spec/support/wait_for_requests.rb axios.interceptors.request.use(config => { - window.activeVueResources = window.activeVueResources || 0; - window.activeVueResources += 1; + window.pendingRequests = window.pendingRequests || 0; + window.pendingRequests += 1; return config; }); // Remove the global counter axios.interceptors.response.use( response => { - window.activeVueResources -= 1; + window.pendingRequests -= 1; return response; }, err => { - window.activeVueResources -= 1; + window.pendingRequests -= 1; return Promise.reject(err); }, ); diff --git a/app/assets/javascripts/vue_shared/components/pagination/table_pagination.vue b/app/assets/javascripts/vue_shared/components/pagination/table_pagination.vue index 1e2d4ffa7e3..e89638130f5 100644 --- a/app/assets/javascripts/vue_shared/components/pagination/table_pagination.vue +++ b/app/assets/javascripts/vue_shared/components/pagination/table_pagination.vue @@ -27,8 +27,7 @@ export default { /** pageInfo will come from the headers of the API call - in the `.then` clause of the VueResource API call - there should be a function that contructs the pageInfo for this component + there should be a function that constructs the pageInfo for this component This is an example: diff --git a/app/assets/javascripts/vue_shared/vue_resource_interceptor.js b/app/assets/javascripts/vue_shared/vue_resource_interceptor.js deleted file mode 100644 index 754025207c8..00000000000 --- a/app/assets/javascripts/vue_shared/vue_resource_interceptor.js +++ /dev/null @@ -1,34 +0,0 @@ -import Vue from 'vue'; -import VueResource from 'vue-resource'; -import csrf from '../lib/utils/csrf'; - -Vue.use(VueResource); - -// Maintain a global counter for active requests -// see: spec/support/wait_for_requests.rb -Vue.http.interceptors.push((request, next) => { - window.activeVueResources = window.activeVueResources || 0; - window.activeVueResources += 1; - - next(() => { - window.activeVueResources -= 1; - }); -}); - -// Inject CSRF token and parse headers. -// New Vue Resource version uses Headers, we are expecting a plain object to render pagination -// and polling. -Vue.http.interceptors.push((request, next) => { - request.headers.set(csrf.headerKey, csrf.token); - - next(response => { - // Headers object has a `forEach` property that iterates through all values. - const headers = {}; - - response.headers.forEach((value, key) => { - headers[key] = value; - }); - // eslint-disable-next-line no-param-reassign - response.headers = headers; - }); -}); |