Commit 6ecfbb88 authored by Angelina Filippova's avatar Angelina Filippova
Browse files

No commit message

No commit message
parent 4566725a
......@@ -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'
......
......@@ -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')
}
......
......@@ -25,7 +25,7 @@
<status
:status="status"
:show-checkbox="isDesktop"
:statuses-args="{ instance: selectedInstance, page, pageSize }"
:fetch-statuses-by-instance="true"
@status-selection="handleStatusSelection" />
</div>
<div v-if="statuses.length > 0" class="statuses-pagination">
......
Supports Markdown
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