diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2018-03-23 16:07:04 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2018-03-23 16:07:04 +0000 |
commit | 757da4dd337278c4eba9d9820b1e11d1b3a2fd9d (patch) | |
tree | 05a95538b700106978baf199f878c04906780b13 | |
parent | 457a99c612acf59ec9cc4d0793c53465f914e696 (diff) | |
parent | 27cd947489a8afb0ae533f39dafb15140b54d7c8 (diff) | |
download | gitlab-ce-757da4dd337278c4eba9d9820b1e11d1b3a2fd9d.tar.gz |
Merge branch 'performance-bar-vue-resource' into 'master'
Add Vue resource interceptor to performance bar
See merge request gitlab-org/gitlab-ce!17915
-rw-r--r-- | app/assets/javascripts/performance_bar/services/performance_bar_service.js | 21 | ||||
-rw-r--r-- | app/assets/stylesheets/performance_bar.scss | 4 |
2 files changed, 25 insertions, 0 deletions
diff --git a/app/assets/javascripts/performance_bar/services/performance_bar_service.js b/app/assets/javascripts/performance_bar/services/performance_bar_service.js index d8e792446c3..3ebfaa87a4e 100644 --- a/app/assets/javascripts/performance_bar/services/performance_bar_service.js +++ b/app/assets/javascripts/performance_bar/services/performance_bar_service.js @@ -1,11 +1,28 @@ +import Vue from 'vue'; +import _ from 'underscore'; import axios from '../../lib/utils/axios_utils'; +let vueResourceInterceptor; + export default class PerformanceBarService { static fetchRequestDetails(peekUrl, requestId) { return axios.get(peekUrl, { params: { request_id: requestId } }); } static registerInterceptor(peekUrl, callback) { + vueResourceInterceptor = (request, next) => { + next(response => { + const requestId = response.headers['x-request-id']; + const requestUrl = response.url; + + if (requestUrl !== peekUrl && requestId) { + callback(requestId, requestUrl); + } + }); + }; + + Vue.http.interceptors.push(vueResourceInterceptor); + return axios.interceptors.response.use(response => { const requestId = response.headers['x-request-id']; const requestUrl = response.config.url; @@ -20,5 +37,9 @@ export default class PerformanceBarService { static removeInterceptor(interceptor) { axios.interceptors.response.eject(interceptor); + Vue.http.interceptors = _.without( + Vue.http.interceptors, + vueResourceInterceptor, + ); } } diff --git a/app/assets/stylesheets/performance_bar.scss b/app/assets/stylesheets/performance_bar.scss index d69b390ac27..45ae94abaff 100644 --- a/app/assets/stylesheets/performance_bar.scss +++ b/app/assets/stylesheets/performance_bar.scss @@ -15,6 +15,10 @@ line-height: $performance-bar-height; color: $perf-bar-text; + select { + width: 200px; + } + &.disabled { display: none; } |