diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-13 09:08:52 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-13 09:08:52 +0000 |
commit | f0707f413ce49b5712fca236b950acbec029be1e (patch) | |
tree | e28b49d89d4cf2422ee0066600c0ea045dcf7669 /app/assets/javascripts/pipelines | |
parent | 31a49d924418aa9983ae30be28e6e304a30939e1 (diff) | |
download | gitlab-ce-f0707f413ce49b5712fca236b950acbec029be1e.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/pipelines')
-rw-r--r-- | app/assets/javascripts/pipelines/pipeline_details_bundle.js | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/app/assets/javascripts/pipelines/pipeline_details_bundle.js b/app/assets/javascripts/pipelines/pipeline_details_bundle.js index 71bdf279861..7e14b810c13 100644 --- a/app/assets/javascripts/pipelines/pipeline_details_bundle.js +++ b/app/assets/javascripts/pipelines/pipeline_details_bundle.js @@ -99,8 +99,26 @@ export default () => { window.gon && window.gon.features && window.gon.features.junitPipelineView; if (testReportsEnabled) { + const fetchReportsAction = 'fetchReports'; testReportsStore.dispatch('setEndpoint', dataset.testReportEndpoint); - testReportsStore.dispatch('fetchReports'); + + const tabsElmement = document.querySelector('.pipelines-tabs'); + const isTestTabActive = Boolean( + document.querySelector('.pipelines-tabs > li > a.test-tab.active'), + ); + + if (isTestTabActive) { + testReportsStore.dispatch(fetchReportsAction); + } else { + const tabClickHandler = e => { + if (e.target.className === 'test-tab') { + testReportsStore.dispatch(fetchReportsAction); + tabsElmement.removeEventListener('click', tabClickHandler); + } + }; + + tabsElmement.addEventListener('click', tabClickHandler); + } // eslint-disable-next-line no-new new Vue({ |