From 7f9753363138b3005a8f7e41f8ca569b79da4f5d Mon Sep 17 00:00:00 2001
From: Vitalii Lysak <v.lysak@dunice.net>
Date: Mon, 25 Jul 2022 15:12:46 +0300
Subject: add time tabs

---
 .../Motherboard/Dynamic/MotherboardDynamicPage.vue | 48 ++++++++++++++++------
 1 file changed, 35 insertions(+), 13 deletions(-)

(limited to 'src/views/_sila/Motherboard/Dynamic/MotherboardDynamicPage.vue')

diff --git a/src/views/_sila/Motherboard/Dynamic/MotherboardDynamicPage.vue b/src/views/_sila/Motherboard/Dynamic/MotherboardDynamicPage.vue
index 628cb92f..f4d41901 100644
--- a/src/views/_sila/Motherboard/Dynamic/MotherboardDynamicPage.vue
+++ b/src/views/_sila/Motherboard/Dynamic/MotherboardDynamicPage.vue
@@ -1,7 +1,11 @@
 <template>
   <b-container fluid="xl">
     <page-title :description="$t('appPageTitle.dynamicInformation')" />
-    <table-date-picker style="margin: -2rem 0 0 -2rem" />
+    <table-date-picker
+      :switch-time-scale="switchTimeScale"
+      :time-scale="timeScale"
+      style="margin: -2rem 0 0 -2rem"
+    />
     <div class="custom-divider" style="margin-top: 0">
       <b-button
         variant="collapse"
@@ -13,7 +17,12 @@
       <b-row class="align-items-end p-2">
         <b-col xs="12" md="3" class="pt-2">
           <b-form-group :label="$t('pageMotherboard.labels.warning')">
-            <b-form-input> </b-form-input>
+            <b-form-input
+              v-model="temperatureWarningInput"
+              type="number"
+              :min="0"
+              :max="100"
+            ></b-form-input>
           </b-form-group>
         </b-col>
         <b-col xs="12" md="6" class="pt-2">
@@ -64,13 +73,6 @@
           </span>
         </template>
       </b-table>
-      <chart
-        type="motherboard"
-        :data="filteredSensors"
-        :warning="temperatureWarning"
-        :non-normal="temperatureNonNormal"
-        :critical-start="temperatureCriticalStart"
-      ></chart>
     </div>
   </b-container>
 </template>
@@ -92,8 +94,11 @@ export default {
     return {
       activeFilters: [],
       temperatureWarning: 72,
+      temperatureWarningInput: 72,
       temperatureNonNormal: 44,
+      temperatureNonNormalInput: 44,
       temperatureCriticalStart: 55,
+      temperatureCriticalInput: 55,
       fields: [
         {
           key: 'name',
@@ -154,10 +159,27 @@ export default {
   },
 
   created() {
-    this.startLoader();
-    this.$store.dispatch('motherboard/getMotherboardDynamic').finally(() => {
-      this.endLoader();
-    });
+    this.loadData();
+  },
+
+  methods: {
+    switchTimeScale(period) {
+      this.timeScale = period;
+      this.loadData();
+    },
+
+    updateTemperature() {
+      this.temperatureWarning = +this.temperatureWarningInput;
+      this.temperatureNonNormal = +this.temperatureNonNormalInput;
+      this.temperatureCritical = +this.temperatureCriticalInput;
+    },
+
+    loadData() {
+      this.startLoader();
+      this.$store.dispatch('motherboard/getMotherboardDynamic').finally(() => {
+        this.endLoader();
+      });
+    },
   },
 };
 </script>
-- 
cgit v1.2.3

