Commit 351d1321 authored by Marius Bobin's avatar Marius Bobin

Use ETag header received from backend

parent a7dac970
......@@ -23,6 +23,9 @@ export default {
pipelineProjectPath: {
default: '',
},
graphqlResourceEtag: {
default: '',
},
},
data() {
return {
......@@ -45,7 +48,7 @@ export default {
},
headers: {
'X-GITLAB-GRAPHQL-FEATURE-CORRELATION': 'verify/ci/pipeline-graph',
'X-GITLAB-GRAPHQL-RESOURCE-ETAG': `pipelines/id/${this.pipelineIid}`,
'X-GITLAB-GRAPHQL-RESOURCE-ETAG': this.graphqlResourceEtag,
'X-REQUESTED_WITH': 'XMLHttpRequest',
},
};
......
......@@ -72,14 +72,17 @@ export default {
this.$apollo.addSmartQuery('currentPipeline', {
query: getPipelineDetails,
pollInterval: 10000,
context: {
fetchOptions: {
method: 'GET',
},
headers: {
'X-GITLAB-GRAPHQL-FEATURE-CORRELATION': 'verify/ci/pipeline-graph',
'X-GITLAB-GRAPHQL-RESOURCE-ETAG': 'pipelines/id/123',
},
context() {
return {
fetchOptions: {
method: 'GET',
},
headers: {
'X-GITLAB-GRAPHQL-FEATURE-CORRELATION': 'verify/ci/pipeline-graph',
'X-GITLAB-GRAPHQL-RESOURCE-ETAG': this.graphqlResourceEtag,
'X-REQUESTED_WITH': 'XMLHttpRequest',
},
}
},
variables() {
return {
......
......@@ -99,6 +99,7 @@ export default async function initPipelineDetailsBundle() {
pipelineProjectPath,
pipelineIid,
metricsPath,
graphqlResourceEtag,
);
} catch {
Flash(__('An error occurred while loading the pipeline.'));
......
......@@ -16,7 +16,7 @@ const apolloProvider = new VueApollo({
),
});
const createPipelinesDetailApp = (selector, pipelineProjectPath, pipelineIid, metricsPath) => {
const createPipelinesDetailApp = (selector, pipelineProjectPath, pipelineIid, metricsPath, graphqlResourceEtag) => {
// eslint-disable-next-line no-new
new Vue({
el: selector,
......@@ -28,6 +28,7 @@ const createPipelinesDetailApp = (selector, pipelineProjectPath, pipelineIid, me
metricsPath,
pipelineProjectPath,
pipelineIid,
graphqlResourceEtag,
dataMethod: GRAPHQL,
},
errorCaptured(err, _vm, info) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment