summaryrefslogtreecommitdiff
path: root/src/views/Settings/PowerRestorePolicy/PowerRestorePolicy.vue
diff options
context:
space:
mode:
authorSandeepa Singh <sandeepa.singh@ibm.com>2021-07-19 15:34:18 +0300
committerDerick Montague <derick.montague@ibm.com>2021-08-10 22:20:42 +0300
commitf67f769f2304bca64d2b9758e22c21203960eef9 (patch)
tree167d6ac96a90b098887f9cf1dc4e96a895e2754c /src/views/Settings/PowerRestorePolicy/PowerRestorePolicy.vue
parent68cbbe9014cbdcf7229a878f564d38f6d6199f25 (diff)
downloadwebui-vue-f67f769f2304bca64d2b9758e22c21203960eef9.tar.xz
IA update: Update configuration to settings
This is the fourth update to information architecture changes and has the following changes: - The configuration section is updated to settings - The date and time settings page is updated to date and time - The network settings page is updated to network - The power restore policy page in operations section is moved to settings section Signed-off-by: Sandeepa Singh <sandeepa.singh@ibm.com> Change-Id: I6f5ab25f5227530be430bd39a4d9629b3bf09d8b
Diffstat (limited to 'src/views/Settings/PowerRestorePolicy/PowerRestorePolicy.vue')
-rw-r--r--src/views/Settings/PowerRestorePolicy/PowerRestorePolicy.vue80
1 files changed, 80 insertions, 0 deletions
diff --git a/src/views/Settings/PowerRestorePolicy/PowerRestorePolicy.vue b/src/views/Settings/PowerRestorePolicy/PowerRestorePolicy.vue
new file mode 100644
index 00000000..8589aed3
--- /dev/null
+++ b/src/views/Settings/PowerRestorePolicy/PowerRestorePolicy.vue
@@ -0,0 +1,80 @@
+<template>
+ <b-container fluid="xl">
+ <page-title :description="$t('pagePowerRestorePolicy.description')" />
+
+ <b-row>
+ <b-col sm="8" md="6" xl="12">
+ <b-form-group :label="$t('pagePowerRestorePolicy.powerPoliciesLabel')">
+ <b-form-radio
+ v-for="policy in powerRestorePolicies"
+ :key="policy.state"
+ v-model="currentPowerRestorePolicy"
+ :value="policy.state"
+ name="power-restore-policy"
+ >
+ {{ policy.desc }}
+ </b-form-radio>
+ </b-form-group>
+ </b-col>
+ </b-row>
+
+ <b-button variant="primary" type="submit" @click="submitForm">
+ {{ $t('global.action.saveSettings') }}
+ </b-button>
+ </b-container>
+</template>
+
+<script>
+import PageTitle from '@/components/Global/PageTitle';
+import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin';
+import VuelidateMixin from '@/components/Mixins/VuelidateMixin.js';
+import BVToastMixin from '@/components/Mixins/BVToastMixin';
+
+export default {
+ name: 'PowerRestorePolicy',
+ components: { PageTitle },
+ mixins: [VuelidateMixin, BVToastMixin, LoadingBarMixin],
+ beforeRouteLeave(to, from, next) {
+ this.hideLoader();
+ next();
+ },
+ data() {
+ return {
+ policyValue: null,
+ };
+ },
+ computed: {
+ powerRestorePolicies() {
+ return this.$store.getters['powerPolicy/powerRestorePolicies'];
+ },
+ currentPowerRestorePolicy: {
+ get() {
+ return this.$store.getters['powerPolicy/powerRestoreCurrentPolicy'];
+ },
+ set(policy) {
+ this.policyValue = policy;
+ },
+ },
+ },
+ created() {
+ this.startLoader();
+ Promise.all([
+ this.$store.dispatch('powerPolicy/getPowerRestorePolicies'),
+ this.$store.dispatch('powerPolicy/getPowerRestoreCurrentPolicy'),
+ ]).finally(() => this.endLoader());
+ },
+ methods: {
+ submitForm() {
+ this.startLoader();
+ this.$store
+ .dispatch(
+ 'powerPolicy/setPowerRestorePolicy',
+ this.policyValue || this.currentPowerRestorePolicy
+ )
+ .then((message) => this.successToast(message))
+ .catch(({ message }) => this.errorToast(message))
+ .finally(() => this.endLoader());
+ },
+ },
+};
+</script>