diff options
author | Yoshie Muranaka <yoshiemuranaka@gmail.com> | 2020-04-30 19:48:23 +0300 |
---|---|---|
committer | Derick Montague <derick.montague@ibm.com> | 2020-05-06 18:09:47 +0300 |
commit | 5c977976d9450b50faeb33ba5bd1b5deaabcc3b5 (patch) | |
tree | 6851745f9f0a988fd88d3e4001454d1b62262d53 | |
parent | 9a9092dc021b10c26dfaba5c39ea02c4fa563f14 (diff) | |
download | webui-vue-5c977976d9450b50faeb33ba5bd1b5deaabcc3b5.tar.xz |
Add loading bar to Server power operations page
Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com>
Change-Id: I823279c6865fa1ecff2f0443d735477e03fbf417
3 files changed, 21 insertions, 8 deletions
diff --git a/src/store/modules/Control/BootSettingsStore.js b/src/store/modules/Control/BootSettingsStore.js index 8da586aa..655c79e5 100644 --- a/src/store/modules/Control/BootSettingsStore.js +++ b/src/store/modules/Control/BootSettingsStore.js @@ -30,8 +30,8 @@ const BootSettingsStore = { setTpmPolicy: (state, tpmEnabled) => (state.tpmEnabled = tpmEnabled) }, actions: { - getBootSettings({ commit }) { - api + async getBootSettings({ commit }) { + return await api .get('/redfish/v1/Systems/system/') .then(({ data: { Boot } }) => { commit( @@ -70,9 +70,9 @@ const BootSettingsStore = { return error; }); }, - getTpmPolicy({ commit }) { + async getTpmPolicy({ commit }) { // TODO: switch to Redfish when available - api + return await api .get('/xyz/openbmc_project/control/host0/TPMEnable') .then(({ data: { data: { TPMEnable } } }) => commit('setTpmPolicy', TPMEnable) diff --git a/src/views/Control/ServerPowerOperations/BootSettings.vue b/src/views/Control/ServerPowerOperations/BootSettings.vue index 0558a1b4..16d567a7 100644 --- a/src/views/Control/ServerPowerOperations/BootSettings.vue +++ b/src/views/Control/ServerPowerOperations/BootSettings.vue @@ -60,10 +60,11 @@ <script> import { mapState } from 'vuex'; import BVToastMixin from '../../../components/Mixins/BVToastMixin'; +import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin'; export default { name: 'BootSettings', - mixins: [BVToastMixin], + mixins: [BVToastMixin, LoadingBarMixin], data() { return { form: { @@ -102,11 +103,14 @@ export default { } }, created() { - this.$store.dispatch('hostBootSettings/getBootSettings'); - this.$store.dispatch('hostBootSettings/getTpmPolicy'); + Promise.all([ + this.$store.dispatch('hostBootSettings/getBootSettings'), + this.$store.dispatch('hostBootSettings/getTpmPolicy') + ]).finally(() => this.endLoader()); }, methods: { handleSubmit() { + this.startLoader(); const bootSettingsChanged = this.$v.form.bootOption.$dirty || this.$v.form.oneTimeBoot.$dirty; const tpmPolicyChanged = this.$v.form.tpmPolicyOn.$dirty; @@ -130,6 +134,7 @@ export default { .catch(({ message }) => this.errorToast(message)) .finally(() => { this.$v.form.$reset(); + this.endLoader(); }); }, onChangeSelect(selectedOption) { diff --git a/src/views/Control/ServerPowerOperations/ServerPowerOperations.vue b/src/views/Control/ServerPowerOperations/ServerPowerOperations.vue index 01fc661e..441217f2 100644 --- a/src/views/Control/ServerPowerOperations/ServerPowerOperations.vue +++ b/src/views/Control/ServerPowerOperations/ServerPowerOperations.vue @@ -108,11 +108,12 @@ import PageTitle from '../../../components/Global/PageTitle'; import PageSection from '../../../components/Global/PageSection'; import BVToastMixin from '../../../components/Mixins/BVToastMixin'; import BootSettings from './BootSettings'; +import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin'; export default { name: 'ServerPowerOperations', components: { PageTitle, PageSection, BootSettings }, - mixins: [BVToastMixin], + mixins: [BVToastMixin, LoadingBarMixin], data() { return { form: { @@ -132,6 +133,13 @@ export default { return this.$store.getters['hostBootSettings/overrideEnabled']; } }, + created() { + this.startLoader(); + }, + beforeRouteLeave(to, from, next) { + this.hideLoader(); + next(); + }, methods: { powerOn() { this.$store.dispatch('controls/hostPowerOn'); |