From 68cbbe9014cbdcf7229a878f564d38f6d6199f25 Mon Sep 17 00:00:00 2001
From: Sandeepa Singh <sandeepa.singh@ibm.com>
Date: Wed, 14 Jul 2021 16:02:22 +0530
Subject: IA update: Update control section to operations

This is the third update to the information architecture changes and
has the following changes:

- The control section has been updated to operations
- The server led page has been removed
- The firmware page is moved to operations section

Signed-off-by: Sandeepa Singh <sandeepa.singh@ibm.com>
Change-Id: I2e23da447890d7bee51892e1f782d5f2db6dded4
---
 src/views/Operations/RebootBmc/RebootBmc.vue | 83 ++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)
 create mode 100644 src/views/Operations/RebootBmc/RebootBmc.vue

(limited to 'src/views/Operations/RebootBmc/RebootBmc.vue')

diff --git a/src/views/Operations/RebootBmc/RebootBmc.vue b/src/views/Operations/RebootBmc/RebootBmc.vue
new file mode 100644
index 00000000..900619cd
--- /dev/null
+++ b/src/views/Operations/RebootBmc/RebootBmc.vue
@@ -0,0 +1,83 @@
+<template>
+  <b-container fluid="xl">
+    <page-title />
+    <b-row>
+      <b-col md="8" lg="8" xl="6">
+        <page-section>
+          <b-row>
+            <b-col>
+              <dl>
+                <dt>
+                  {{ $t('pageRebootBmc.lastReboot') }}
+                </dt>
+                <dd v-if="lastBmcRebootTime">
+                  {{ lastBmcRebootTime | formatDate }}
+                  {{ lastBmcRebootTime | formatTime }}
+                </dd>
+                <dd v-else>--</dd>
+              </dl>
+            </b-col>
+          </b-row>
+          {{ $t('pageRebootBmc.rebootInformation') }}
+          <b-button
+            variant="primary"
+            class="d-block mt-5"
+            data-test-id="rebootBmc-button-reboot"
+            @click="onClick"
+          >
+            {{ $t('pageRebootBmc.rebootBmc') }}
+          </b-button>
+        </page-section>
+      </b-col>
+    </b-row>
+  </b-container>
+</template>
+
+<script>
+import PageTitle from '@/components/Global/PageTitle';
+import PageSection from '@/components/Global/PageSection';
+import BVToastMixin from '@/components/Mixins/BVToastMixin';
+import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin';
+
+export default {
+  name: 'RebootBmc',
+  components: { PageTitle, PageSection },
+  mixins: [BVToastMixin, LoadingBarMixin],
+  beforeRouteLeave(to, from, next) {
+    this.hideLoader();
+    next();
+  },
+  computed: {
+    lastBmcRebootTime() {
+      return this.$store.getters['controls/lastBmcRebootTime'];
+    },
+  },
+  created() {
+    this.startLoader();
+    this.$store
+      .dispatch('controls/getLastBmcRebootTime')
+      .finally(() => this.endLoader());
+  },
+  methods: {
+    onClick() {
+      this.$bvModal
+        .msgBoxConfirm(this.$t('pageRebootBmc.modal.confirmMessage'), {
+          title: this.$t('pageRebootBmc.modal.confirmTitle'),
+          okTitle: this.$t('global.action.confirm'),
+          cancelTitle: this.$t('global.action.cancel'),
+        })
+        .then((confirmed) => {
+          if (confirmed) this.rebootBmc();
+        });
+    },
+    rebootBmc() {
+      this.$store
+        .dispatch('controls/rebootBmc')
+        .then((message) => this.successToast(message))
+        .catch(({ message }) => this.errorToast(message));
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped></style>
-- 
cgit v1.2.3

