diff --git a/front/src/components/common/ActionFeedback.vue b/front/src/components/common/ActionFeedback.vue new file mode 100644 index 000000000..5f53e989d --- /dev/null +++ b/front/src/components/common/ActionFeedback.vue @@ -0,0 +1,45 @@ + + + diff --git a/front/src/components/globals.js b/front/src/components/globals.js index e22a67a8c..01e33b00f 100644 --- a/front/src/components/globals.js +++ b/front/src/components/globals.js @@ -56,4 +56,8 @@ import CollapseLink from '@/components/common/CollapseLink' Vue.component('collapse-link', CollapseLink) +import ActionFeedback from '@/components/common/ActionFeedback' + +Vue.component('action-feedback', ActionFeedback) + export default {} diff --git a/front/src/components/manage/moderation/ReportCard.vue b/front/src/components/manage/moderation/ReportCard.vue index 99c571291..700f38275 100644 --- a/front/src/components/manage/moderation/ReportCard.vue +++ b/front/src/components/manage/moderation/ReportCard.vue @@ -32,9 +32,11 @@ + @input="update({type: $event})"> + + + @@ -225,6 +227,7 @@ import NoteForm from '@/components/manage/moderation/NoteForm' import NotesThread from '@/components/manage/moderation/NotesThread' import ReportCategoryDropdown from '@/components/moderation/ReportCategoryDropdown' import entities from '@/entities' +import {setUpdate} from '@/utils' import showdown from 'showdown' @@ -250,6 +253,9 @@ export default { markdown: new showdown.Converter(), isLoading: false, isCollapsed: false, + updating: { + type: false, + } } }, computed: { @@ -343,11 +349,15 @@ export default { let url = `manage/moderation/reports/${this.obj.uuid}/` let self = this this.isLoading = true + setUpdate(payload, this.updating, true) axios.patch(url, payload).then((response) => { self.$emit('updated', payload) + Object.assign(self.obj, payload) self.isLoading = false + setUpdate(payload, self.updating, false) }, error => { self.isLoading = false + setUpdate(payload, self.updating, false) }) }, resolve (v) { diff --git a/front/src/components/moderation/ReportCategoryDropdown.vue b/front/src/components/moderation/ReportCategoryDropdown.vue index af812f53c..473fe0adb 100644 --- a/front/src/components/moderation/ReportCategoryDropdown.vue +++ b/front/src/components/moderation/ReportCategoryDropdown.vue @@ -4,6 +4,7 @@ + diff --git a/front/src/utils.js b/front/src/utils.js new file mode 100644 index 000000000..eee36f8e6 --- /dev/null +++ b/front/src/utils.js @@ -0,0 +1,8 @@ +import lodash from '@/lodash' + +export function setUpdate(obj, statuses, value) { + let updatedKeys = lodash.keys(obj) + updatedKeys.forEach((k) => { + statuses[k] = value + }) +} diff --git a/front/src/views/admin/moderation/AccountsDetail.vue b/front/src/views/admin/moderation/AccountsDetail.vue index 09b5bb824..7825bfe0f 100644 --- a/front/src/views/admin/moderation/AccountsDetail.vue +++ b/front/src/views/admin/moderation/AccountsDetail.vue @@ -174,6 +174,7 @@ class="ui search selection dropdown"> + @@ -308,8 +309,9 @@ name="quota" type="number" />
- MB + MB
+ @@ -403,6 +405,10 @@ export default { stats: null, showPolicyForm: false, permissions: [], + updating: { + permissions: false, + upload_quota: false, + } } }, created() { @@ -457,6 +463,8 @@ export default { if (toNull && !newValue) { newValue = null } + let self = this + this.updating[attr] = true let params = {} if (attr === "permissions") { params["permissions"] = {} @@ -471,12 +479,14 @@ export default { logger.default.info( `${attr} was updated succcessfully to ${newValue}` ) + self.updating[attr] = false }, error => { logger.default.error( `Error while setting ${attr} to ${newValue}`, error ) + self.updating[attr] = false } ) },