Commit a456f23a authored by mfluharty's avatar mfluharty

Display status reason as subheading

Backend returns a reason for the status
Why not put it underneath the error message in the widget
parent 802a8df3
...@@ -44,7 +44,7 @@ export default { ...@@ -44,7 +44,7 @@ export default {
}, },
componentNames, componentNames,
computed: { computed: {
...mapState(['newIssues', 'resolvedIssues']), ...mapState(['newIssues', 'resolvedIssues', 'hasError', 'statusReason']),
...mapGetters([ ...mapGetters([
'hasCodequalityIssues', 'hasCodequalityIssues',
'codequalityStatus', 'codequalityStatus',
...@@ -88,5 +88,7 @@ export default { ...@@ -88,5 +88,7 @@ export default {
:popover-options="codequalityPopover" :popover-options="codequalityPopover"
:show-report-section-status-icon="false" :show-report-section-status-icon="false"
class="js-codequality-widget mr-widget-border-top mr-report" class="js-codequality-widget mr-widget-border-top mr-report"
/> >
<template v-if="hasError" #sub-heading>{{ statusReason }}</template>
</report-section>
</template> </template>
...@@ -16,7 +16,7 @@ export const fetchReports = ({ state, dispatch, commit }, diffFeatureFlagEnabled ...@@ -16,7 +16,7 @@ export const fetchReports = ({ state, dispatch, commit }, diffFeatureFlagEnabled
resolvedIssues: parseCodeclimateMetrics(data.resolved_errors, state.baseBlobPath), resolvedIssues: parseCodeclimateMetrics(data.resolved_errors, state.baseBlobPath),
}); });
}) })
.catch(() => dispatch('receiveReportsError')); .catch((error) => dispatch('receiveReportsError', error));
} }
if (!state.basePath) { if (!state.basePath) {
return dispatch('receiveReportsError'); return dispatch('receiveReportsError');
...@@ -36,6 +36,6 @@ export const receiveReportsSuccess = ({ commit }, data) => { ...@@ -36,6 +36,6 @@ export const receiveReportsSuccess = ({ commit }, data) => {
commit(types.RECEIVE_REPORTS_SUCCESS, data); commit(types.RECEIVE_REPORTS_SUCCESS, data);
}; };
export const receiveReportsError = ({ commit }) => { export const receiveReportsError = ({ commit }, error) => {
commit(types.RECEIVE_REPORTS_ERROR); commit(types.RECEIVE_REPORTS_ERROR, error);
}; };
...@@ -14,12 +14,14 @@ export default { ...@@ -14,12 +14,14 @@ export default {
}, },
[types.RECEIVE_REPORTS_SUCCESS](state, data) { [types.RECEIVE_REPORTS_SUCCESS](state, data) {
state.hasError = false; state.hasError = false;
state.statusReason = '';
state.isLoading = false; state.isLoading = false;
state.newIssues = data.newIssues; state.newIssues = data.newIssues;
state.resolvedIssues = data.resolvedIssues; state.resolvedIssues = data.resolvedIssues;
}, },
[types.RECEIVE_REPORTS_ERROR](state) { [types.RECEIVE_REPORTS_ERROR](state, error) {
state.isLoading = false; state.isLoading = false;
state.hasError = true; state.hasError = true;
state.statusReason = error?.response?.data?.status_reason;
}, },
}; };
...@@ -8,6 +8,7 @@ export default () => ({ ...@@ -8,6 +8,7 @@ export default () => ({
isLoading: false, isLoading: false,
hasError: false, hasError: false,
statusReason: '',
newIssues: [], newIssues: [],
resolvedIssues: [], resolvedIssues: [],
......
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