forked from AkkomaGang/admin-fe
This commit is contained in:
parent
4566725a4e
commit
6ecfbb8892
3 changed files with 28 additions and 5 deletions
|
@ -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">
|
||||
|
|
Loading…
Reference in a new issue