Add loading bar to Sensors page

Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com>
Change-Id: I6d44e1326b2cf697bf1f20e4e10ccd68e4681c66
diff --git a/src/views/Health/Sensors/Sensors.vue b/src/views/Health/Sensors/Sensors.vue
index 6de5c9e..6cd70be 100644
--- a/src/views/Health/Sensors/Sensors.vue
+++ b/src/views/Health/Sensors/Sensors.vue
@@ -83,6 +83,7 @@
 
 import TableFilterMixin from '../../../components/Mixins/TableFilterMixin';
 import BVTableSelectableMixin from '@/components/Mixins/BVTableSelectableMixin';
+import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin';
 
 const SENSOR_STATUS = ['OK', 'Warning', 'Critical'];
 
@@ -102,7 +103,7 @@
     TableToolbar,
     TableToolbarExport
   },
-  mixins: [TableFilterMixin, BVTableSelectableMixin],
+  mixins: [TableFilterMixin, BVTableSelectableMixin, LoadingBarMixin],
   data() {
     return {
       fields: [
@@ -171,7 +172,14 @@
     }
   },
   created() {
-    this.$store.dispatch('sensors/getAllSensors');
+    this.startLoader();
+    this.$store
+      .dispatch('sensors/getAllSensors')
+      .finally(() => this.endLoader());
+  },
+  beforeRouteLeave(to, from, next) {
+    this.hideLoader();
+    next();
   },
   methods: {
     statusIcon(status) {