diff options
author | Yoshie Muranaka <yoshiemuranaka@gmail.com> | 2020-04-28 21:12:14 +0300 |
---|---|---|
committer | Derick Montague <derick.montague@ibm.com> | 2020-05-12 21:02:08 +0300 |
commit | 346be2a4245845eaea03035ce85d6e06ec3c1ade (patch) | |
tree | 3b942803d92a8a2030110e23dcf84f0d68d060d0 /src/views | |
parent | 221b3187a521a87611d9dbed2c96e3212d04e590 (diff) | |
download | webui-vue-346be2a4245845eaea03035ce85d6e06ec3c1ade.tar.xz |
Add page loader on Local user management page
Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com>
Change-Id: Ibb681f72bed33a6ca70d8e526668a2ab154111b4
Diffstat (limited to 'src/views')
-rw-r--r-- | src/views/AccessControl/LocalUserManagement/LocalUserManagement.vue | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/src/views/AccessControl/LocalUserManagement/LocalUserManagement.vue b/src/views/AccessControl/LocalUserManagement/LocalUserManagement.vue index 46a02c17..4ae9bb4a 100644 --- a/src/views/AccessControl/LocalUserManagement/LocalUserManagement.vue +++ b/src/views/AccessControl/LocalUserManagement/LocalUserManagement.vue @@ -98,10 +98,11 @@ import ModalSettings from './ModalSettings'; import PageTitle from '../../../components/Global/PageTitle'; import TableRoles from './TableRoles'; import TableToolbar from '../../../components/Global/TableToolbar'; +import TableRowAction from '../../../components/Global/TableRowAction'; import BVTableSelectableMixin from '../../../components/Mixins/BVTableSelectableMixin'; import BVToastMixin from '../../../components/Mixins/BVToastMixin'; -import TableRowAction from '../../../components/Global/TableRowAction'; +import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin'; export default { name: 'LocalUsers', @@ -118,7 +119,7 @@ export default { TableRowAction, TableToolbar }, - mixins: [BVTableSelectableMixin, BVToastMixin], + mixins: [BVTableSelectableMixin, BVToastMixin, LoadingBarMixin], data() { return { activeUser: null, @@ -199,10 +200,15 @@ export default { } }, created() { - this.$store.dispatch('localUsers/getUsers'); + this.startLoader(); + this.$store.dispatch('localUsers/getUsers').finally(() => this.endLoader()); this.$store.dispatch('localUsers/getAccountSettings'); this.$store.dispatch('localUsers/getAccountRoles'); }, + beforeRouteLeave(to, from, next) { + this.hideLoader(); + next(); + }, methods: { initModalUser(user) { this.activeUser = user; @@ -229,25 +235,31 @@ export default { this.$bvModal.show('modal-settings'); }, saveUser({ isNewUser, userData }) { + this.startLoader(); if (isNewUser) { this.$store .dispatch('localUsers/createUser', userData) .then(success => this.successToast(success)) - .catch(({ message }) => this.errorToast(message)); + .catch(({ message }) => this.errorToast(message)) + .finally(() => this.endLoader()); } else { this.$store .dispatch('localUsers/updateUser', userData) .then(success => this.successToast(success)) - .catch(({ message }) => this.errorToast(message)); + .catch(({ message }) => this.errorToast(message)) + .finally(() => this.endLoader()); } }, deleteUser({ username }) { + this.startLoader(); this.$store .dispatch('localUsers/deleteUser', username) .then(success => this.successToast(success)) - .catch(({ message }) => this.errorToast(message)); + .catch(({ message }) => this.errorToast(message)) + .finally(() => this.endLoader()); }, onBatchAction(action) { + this.startLoader(); switch (action) { case 'delete': this.$store @@ -257,7 +269,8 @@ export default { if (type === 'success') this.successToast(message); if (type === 'error') this.errorToast(message); }); - }); + }) + .finally(() => this.endLoader()); break; case 'enable': this.$store @@ -267,7 +280,8 @@ export default { if (type === 'success') this.successToast(message); if (type === 'error') this.errorToast(message); }); - }); + }) + .finally(() => this.endLoader()); break; case 'disable': this.$store @@ -277,10 +291,11 @@ export default { if (type === 'success') this.successToast(message); if (type === 'error') this.errorToast(message); }); - }); + }) + .finally(() => this.endLoader()); break; default: - break; + this.endLoader(); } }, onTableRowAction(action, row) { @@ -296,10 +311,12 @@ export default { } }, saveAccountSettings(settings) { + this.startLoader(); this.$store .dispatch('localUsers/saveAccountSettings', settings) .then(message => this.successToast(message)) - .catch(({ message }) => this.errorToast(message)); + .catch(({ message }) => this.errorToast(message)) + .finally(() => this.endLoader()); } } }; |