Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-24 15:10:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-24 15:10:17 +0300
commit4b9bde7848d9538c1635ffe7a5385ba013487b4a (patch)
tree5aad1d5d94ea233a36c8ac2850e099236e1c2cdc /app/assets/javascripts/performance_bar
parent2f752481c2e727834216a93dee82df9f8e2acb2e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/performance_bar')
-rw-r--r--app/assets/javascripts/performance_bar/index.js7
-rw-r--r--app/assets/javascripts/performance_bar/services/performance_bar_service.js15
-rw-r--r--app/assets/javascripts/performance_bar/stores/performance_bar_store.js5
3 files changed, 14 insertions, 13 deletions
diff --git a/app/assets/javascripts/performance_bar/index.js b/app/assets/javascripts/performance_bar/index.js
index a294f3f36a6..ac10d99612c 100644
--- a/app/assets/javascripts/performance_bar/index.js
+++ b/app/assets/javascripts/performance_bar/index.js
@@ -24,15 +24,12 @@ export default ({ container }) =>
};
},
mounted() {
- this.interceptor = PerformanceBarService.registerInterceptor(
- this.peekUrl,
- this.loadRequestDetails,
- );
+ PerformanceBarService.registerInterceptor(this.peekUrl, this.loadRequestDetails);
this.loadRequestDetails(this.requestId, window.location.href);
},
beforeDestroy() {
- PerformanceBarService.removeInterceptor(this.interceptor);
+ PerformanceBarService.removeInterceptor();
},
methods: {
addRequestManually(urlOrRequestId) {
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 164f1f8dff7..3c8303d102e 100644
--- a/app/assets/javascripts/performance_bar/services/performance_bar_service.js
+++ b/app/assets/javascripts/performance_bar/services/performance_bar_service.js
@@ -2,12 +2,14 @@ import axios from '../../lib/utils/axios_utils';
import { parseBoolean } from '~/lib/utils/common_utils';
export default class PerformanceBarService {
+ static interceptor = null;
+
static fetchRequestDetails(peekUrl, requestId) {
return axios.get(peekUrl, { params: { request_id: requestId } });
}
static registerInterceptor(peekUrl, callback) {
- const interceptor = response => {
+ PerformanceBarService.interceptor = response => {
const [fireCallback, requestId, requestUrl] = PerformanceBarService.callbackParams(
response,
peekUrl,
@@ -20,18 +22,17 @@ export default class PerformanceBarService {
return response;
};
- return axios.interceptors.response.use(interceptor);
+ return axios.interceptors.response.use(PerformanceBarService.interceptor);
}
- static removeInterceptor(interceptor) {
- axios.interceptors.response.eject(interceptor);
+ static removeInterceptor() {
+ axios.interceptors.response.eject(PerformanceBarService.interceptor);
+ PerformanceBarService.interceptor = null;
}
static callbackParams(response, peekUrl) {
const requestId = response.headers && response.headers['x-request-id'];
- // Get the request URL from response.config for Axios, and response for
- // Vue Resource.
- const requestUrl = (response.config || response).url;
+ const requestUrl = response.config?.url;
const cachedResponse =
response.headers && parseBoolean(response.headers['x-gitlab-from-cache']);
const fireCallback = requestUrl !== peekUrl && Boolean(requestId) && !cachedResponse;
diff --git a/app/assets/javascripts/performance_bar/stores/performance_bar_store.js b/app/assets/javascripts/performance_bar/stores/performance_bar_store.js
index 6f443db47ed..8c88851f039 100644
--- a/app/assets/javascripts/performance_bar/stores/performance_bar_store.js
+++ b/app/assets/javascripts/performance_bar/stores/performance_bar_store.js
@@ -47,7 +47,10 @@ export default class PerformanceBarStore {
}
canTrackRequest(requestUrl) {
- return this.requests.filter(request => request.url === requestUrl).length < 2;
+ return (
+ requestUrl.endsWith('/api/graphql') ||
+ this.requests.filter(request => request.url === requestUrl).length < 2
+ );
}
static truncateUrl(requestUrl) {