diff --git a/src/store/modules/reports.js b/src/store/modules/reports.js
index 8ff3a909..b5321847 100644
--- a/src/store/modules/reports.js
+++ b/src/store/modules/reports.js
@@ -3,8 +3,8 @@ import { changeState, changeStatusScope, deleteStatus, fetchReports, filterRepor
const reports = {
state: {
fetchedReports: [],
+ groupReports: true,
idOfLastReport: '',
- page_limit: 5,
stateFilter: '',
loading: true
},
@@ -20,6 +20,9 @@ const reports = {
},
SET_REPORTS_FILTER: (state, filter) => {
state.stateFilter = filter
+ },
+ SET_REPORTS_GROUPING: (state) => {
+ state.groupReports = !state.groupReports
}
},
actions: {
@@ -42,20 +45,18 @@ const reports = {
},
async FetchReports({ commit, getters, state }) {
commit('SET_LOADING', true)
-
- const response = state.stateFilter.length === 0
+ const { data } = state.stateFilter.length === 0
? await fetchReports(state.page_limit, state.idOfLastReport, getters.authHost, getters.token)
: await filterReports(state.stateFilter, state.page_limit, state.idOfLastReport, getters.authHost, getters.token)
- const reports = state.fetchedReports.concat(response.data.reports)
- const id = reports.length > 0 ? reports[reports.length - 1].id : state.idOfLastReport
-
- commit('SET_REPORTS', reports)
- commit('SET_LAST_REPORT_ID', id)
+ commit('SET_REPORTS', data.reports)
commit('SET_LOADING', false)
},
SetFilter({ commit }, filter) {
commit('SET_REPORTS_FILTER', filter)
+ },
+ ToggleReportsGrouping({ commit }) {
+ commit('SET_REPORTS_GROUPING')
}
}
}
diff --git a/src/views/reports/components/GroupedReport.vue b/src/views/reports/components/GroupedReport.vue
new file mode 100644
index 00000000..ef2dc6ce
--- /dev/null
+++ b/src/views/reports/components/GroupedReport.vue
@@ -0,0 +1,120 @@
+
+ {{ $t('reports.reportsOn') }} {{ group.account.display_name }}
+ {{ report.actor.display_name }}
+