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:
Diffstat (limited to 'app/assets/javascripts/reports/grouped_test_report/store/mutations.js')
-rw-r--r--app/assets/javascripts/reports/grouped_test_report/store/mutations.js70
1 files changed, 70 insertions, 0 deletions
diff --git a/app/assets/javascripts/reports/grouped_test_report/store/mutations.js b/app/assets/javascripts/reports/grouped_test_report/store/mutations.js
new file mode 100644
index 00000000000..3bb31d71d8f
--- /dev/null
+++ b/app/assets/javascripts/reports/grouped_test_report/store/mutations.js
@@ -0,0 +1,70 @@
+import * as types from './mutation_types';
+import { countRecentlyFailedTests } from './utils';
+
+export default {
+ [types.SET_ENDPOINT](state, endpoint) {
+ state.endpoint = endpoint;
+ },
+ [types.REQUEST_REPORTS](state) {
+ state.isLoading = true;
+ },
+ [types.RECEIVE_REPORTS_SUCCESS](state, response) {
+ state.hasError = response.suites.some((suite) => suite.status === 'error');
+
+ state.isLoading = false;
+
+ state.summary.total = response.summary.total;
+ state.summary.resolved = response.summary.resolved;
+ state.summary.failed = response.summary.failed;
+ state.summary.errored = response.summary.errored;
+ state.summary.recentlyFailed = countRecentlyFailedTests(response.suites);
+
+ state.status = response.status;
+ state.reports = response.suites;
+
+ state.reports.forEach((report, i) => {
+ if (!state.reports[i].summary) return;
+ state.reports[i].summary.recentlyFailed = countRecentlyFailedTests(report);
+ });
+ },
+ [types.RECEIVE_REPORTS_ERROR](state) {
+ state.isLoading = false;
+ state.hasError = true;
+
+ state.reports = [];
+ state.summary = {
+ total: 0,
+ resolved: 0,
+ failed: 0,
+ errored: 0,
+ recentlyFailed: 0,
+ };
+ state.status = null;
+ },
+ [types.SET_ISSUE_MODAL_DATA](state, payload) {
+ state.modal.title = payload.issue.name;
+
+ Object.keys(payload.issue).forEach((key) => {
+ if (Object.prototype.hasOwnProperty.call(state.modal.data, key)) {
+ state.modal.data[key] = {
+ ...state.modal.data[key],
+ value: payload.issue[key],
+ };
+ }
+ });
+
+ state.modal.open = true;
+ },
+ [types.RESET_ISSUE_MODAL_DATA](state) {
+ state.modal.open = false;
+
+ // Resetting modal data
+ state.modal.title = null;
+ Object.keys(state.modal.data).forEach((key) => {
+ state.modal.data[key] = {
+ ...state.modal.data[key],
+ value: null,
+ };
+ });
+ },
+};