diff --git a/src/components/Status/index.vue b/src/components/Status/index.vue index 16d247f1..99d4df0f 100644 --- a/src/components/Status/index.vue +++ b/src/components/Status/index.vue @@ -121,6 +121,11 @@ import moment from 'moment' export default { name: 'Status', props: { + fetchStatusesByInstance: { + type: Boolean, + required: false, + default: false + }, showCheckbox: { type: Boolean, required: true, @@ -156,7 +161,15 @@ export default { return str.charAt(0).toUpperCase() + str.slice(1) }, changeStatus(statusId, isSensitive, visibility) { - this.$store.dispatch('ChangeStatusScope', { statusId, isSensitive, visibility, reportCurrentPage: this.page, userId: this.userId, godmode: this.godmode }) + this.$store.dispatch('ChangeStatusScope', { + statusId, + isSensitive, + visibility, + reportCurrentPage: this.page, + userId: this.userId, + godmode: this.godmode, + fetchStatusesByInstance: this.fetchStatusesByInstance + }) }, deleteStatus(statusId) { this.$confirm('Are you sure you want to delete this status?', 'Warning', { @@ -164,7 +177,13 @@ export default { cancelButtonText: 'Cancel', type: 'warning' }).then(() => { - this.$store.dispatch('DeleteStatus', { statusId, reportCurrentPage: this.page, userId: this.userId, godmode: this.godmode }) + this.$store.dispatch('DeleteStatus', { + statusId, + reportCurrentPage: this.page, + userId: this.userId, + godmode: this.godmode, + fetchStatusesByInstance: this.fetchStatusesByInstance + }) this.$message({ type: 'success', message: 'Delete completed' diff --git a/src/store/modules/status.js b/src/store/modules/status.js index a05b69f2..b433e4b0 100644 --- a/src/store/modules/status.js +++ b/src/store/modules/status.js @@ -28,22 +28,26 @@ const status = { } }, actions: { - async ChangeStatusScope({ dispatch, getters }, { statusId, isSensitive, visibility, reportCurrentPage, userId, godmode }) { + async ChangeStatusScope({ dispatch, getters }, { statusId, isSensitive, visibility, reportCurrentPage, userId, godmode, fetchStatusesByInstance }) { await changeStatusScope(statusId, isSensitive, visibility, getters.authHost, getters.token) if (reportCurrentPage !== 0) { // called from Reports dispatch('FetchReports', reportCurrentPage) } else if (userId.length > 0) { // called from User profile dispatch('FetchUserStatuses', { userId, godmode }) + } else if (fetchStatusesByInstance) { // called from Statuses by Instance + dispatch('FetchStatusesByInstance') } else { // called from GroupedReports dispatch('FetchGroupedReports') } }, - async DeleteStatus({ dispatch, getters }, { statusId, reportCurrentPage, userId, godmode }) { + async DeleteStatus({ dispatch, getters }, { statusId, reportCurrentPage, userId, godmode, fetchStatusesByInstance }) { await deleteStatus(statusId, getters.authHost, getters.token) if (reportCurrentPage !== 0) { // called from Reports dispatch('FetchReports', reportCurrentPage) } else if (userId.length > 0) { // called from User profile dispatch('FetchUserStatuses', { userId, godmode }) + } else if (fetchStatusesByInstance) { // called from Statuses by Instance + dispatch('FetchStatusesByInstance') } else { // called from GroupedReports dispatch('FetchGroupedReports') } diff --git a/src/views/statuses/index.vue b/src/views/statuses/index.vue index 3789d6a9..9639db41 100644 --- a/src/views/statuses/index.vue +++ b/src/views/statuses/index.vue @@ -25,7 +25,7 @@