diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-04 21:08:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-04 21:08:35 +0300 |
commit | e15501a5e1f54249434167c0198dab775bdc4a1f (patch) | |
tree | 15615908225f23633fa269c063de38d38f88c38a /app/assets/javascripts/pipelines | |
parent | 856e2c64ee69b055b31a8ebbeee616f13a46505e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/pipelines')
7 files changed, 35 insertions, 8 deletions
diff --git a/app/assets/javascripts/pipelines/components/test_reports/test_suite_table.vue b/app/assets/javascripts/pipelines/components/test_reports/test_suite_table.vue index 51373e712ff..9b0e6560c53 100644 --- a/app/assets/javascripts/pipelines/components/test_reports/test_suite_table.vue +++ b/app/assets/javascripts/pipelines/components/test_reports/test_suite_table.vue @@ -35,7 +35,7 @@ export default { }, computed: { ...mapState(['pageInfo']), - ...mapGetters(['getSuiteTests', 'getSuiteTestCount']), + ...mapGetters(['getSuiteTests', 'getSuiteTestCount', 'getSuiteArtifactsExpired']), hasSuites() { return this.getSuiteTests.length > 0; }, @@ -80,7 +80,8 @@ export default { <div v-for="(testCase, index) in getSuiteTests" :key="index" - class="gl-responsive-table-row rounded align-items-md-start mt-xs-3 js-case-row" + class="gl-responsive-table-row rounded align-items-md-start" + data-testid="test-case-row" > <div class="table-section section-20 section-wrap"> <div role="rowheader" class="table-mobile-header">{{ __('Suite') }}</div> @@ -157,7 +158,16 @@ export default { </div> <div v-else> - <p class="js-no-test-cases">{{ s__('TestReports|There are no test cases to display.') }}</p> + <p data-testid="no-test-cases"> + {{ s__('TestReports|There are no test cases to display.') }} + </p> + <p v-if="getSuiteArtifactsExpired" data-testid="artifacts-expired"> + {{ + s__( + 'TestReports|Test details are populated by job artifacts. The job artifacts from this pipeline are expired.', + ) + }} + </p> </div> </div> </template> diff --git a/app/assets/javascripts/pipelines/stores/test_reports/actions.js b/app/assets/javascripts/pipelines/stores/test_reports/actions.js index b7f590a7b3c..f0556f3d12e 100644 --- a/app/assets/javascripts/pipelines/stores/test_reports/actions.js +++ b/app/assets/javascripts/pipelines/stores/test_reports/actions.js @@ -38,11 +38,7 @@ export const fetchTestSuite = ({ state, commit, dispatch }, index) => { return axios .get(state.suiteEndpoint, { params: { build_ids } }) .then(({ data }) => commit(types.SET_SUITE, { suite: data, index })) - .catch(() => { - createFlash({ - message: s__('TestReports|There was an error fetching the test suite.'), - }); - }) + .catch((error) => commit(types.SET_SUITE_ERROR, error)) .finally(() => { dispatch('toggleLoading'); }); diff --git a/app/assets/javascripts/pipelines/stores/test_reports/constants.js b/app/assets/javascripts/pipelines/stores/test_reports/constants.js new file mode 100644 index 00000000000..8eebfb6b208 --- /dev/null +++ b/app/assets/javascripts/pipelines/stores/test_reports/constants.js @@ -0,0 +1 @@ +export const ARTIFACTS_EXPIRED_ERROR_MESSAGE = 'Test report artifacts have expired'; diff --git a/app/assets/javascripts/pipelines/stores/test_reports/getters.js b/app/assets/javascripts/pipelines/stores/test_reports/getters.js index 03680de0fa9..e6a88bb4175 100644 --- a/app/assets/javascripts/pipelines/stores/test_reports/getters.js +++ b/app/assets/javascripts/pipelines/stores/test_reports/getters.js @@ -1,4 +1,5 @@ import { addIconStatus, formatFilePath, formattedTime } from './utils'; +import { ARTIFACTS_EXPIRED_ERROR_MESSAGE } from './constants'; export const getTestSuites = (state) => { const { test_suites: testSuites = [] } = state.testReports; @@ -29,3 +30,6 @@ export const getSuiteTests = (state) => { }; export const getSuiteTestCount = (state) => getSelectedSuite(state)?.test_cases?.length || 0; + +export const getSuiteArtifactsExpired = (state) => + state.errorMessage === ARTIFACTS_EXPIRED_ERROR_MESSAGE; diff --git a/app/assets/javascripts/pipelines/stores/test_reports/mutation_types.js b/app/assets/javascripts/pipelines/stores/test_reports/mutation_types.js index 803f6bf60b1..7651a2f4327 100644 --- a/app/assets/javascripts/pipelines/stores/test_reports/mutation_types.js +++ b/app/assets/javascripts/pipelines/stores/test_reports/mutation_types.js @@ -2,4 +2,5 @@ export const SET_PAGE = 'SET_PAGE'; export const SET_SELECTED_SUITE_INDEX = 'SET_SELECTED_SUITE_INDEX'; export const SET_SUMMARY = 'SET_SUMMARY'; export const SET_SUITE = 'SET_SUITE'; +export const SET_SUITE_ERROR = 'SET_SUITE_ERROR'; export const TOGGLE_LOADING = 'TOGGLE_LOADING'; diff --git a/app/assets/javascripts/pipelines/stores/test_reports/mutations.js b/app/assets/javascripts/pipelines/stores/test_reports/mutations.js index cf0bf8483dd..68ee063dda7 100644 --- a/app/assets/javascripts/pipelines/stores/test_reports/mutations.js +++ b/app/assets/javascripts/pipelines/stores/test_reports/mutations.js @@ -1,3 +1,5 @@ +import createFlash from '~/flash'; +import { s__ } from '~/locale'; import * as types from './mutation_types'; export default { @@ -13,6 +15,18 @@ export default { state.testReports.test_suites[index] = { ...suite, hasFullSuite: true }; }, + [types.SET_SUITE_ERROR](state, error) { + const errorMessage = error.response?.data?.errors; + + if (errorMessage) { + state.errorMessage = errorMessage; + } else { + createFlash({ + message: s__('TestReports|There was an error fetching the test suite.'), + }); + } + }, + [types.SET_SELECTED_SUITE_INDEX](state, selectedSuiteIndex) { Object.assign(state, { selectedSuiteIndex }); }, diff --git a/app/assets/javascripts/pipelines/stores/test_reports/state.js b/app/assets/javascripts/pipelines/stores/test_reports/state.js index 0ee6f53fa58..3ec9418c14e 100644 --- a/app/assets/javascripts/pipelines/stores/test_reports/state.js +++ b/app/assets/javascripts/pipelines/stores/test_reports/state.js @@ -5,6 +5,7 @@ export default ({ blobPath = '', summaryEndpoint = '', suiteEndpoint = '' }) => testReports: {}, selectedSuiteIndex: null, isLoading: false, + errorMessage: null, pageInfo: { page: 1, perPage: 20, |