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

---
 .../_sila/Memory/Dynamic/MemoryDynamicPage.vue     | 37 +++++++++++++++++++---
 1 file changed, 32 insertions(+), 5 deletions(-)

(limited to 'src/views/_sila/Memory/Dynamic/MemoryDynamicPage.vue')

diff --git a/src/views/_sila/Memory/Dynamic/MemoryDynamicPage.vue b/src/views/_sila/Memory/Dynamic/MemoryDynamicPage.vue
index 78dbc98f..4c1a3dc8 100644
--- a/src/views/_sila/Memory/Dynamic/MemoryDynamicPage.vue
+++ b/src/views/_sila/Memory/Dynamic/MemoryDynamicPage.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"
@@ -111,9 +115,15 @@ export default {
   data() {
     return {
       activeFilters: [],
+      timeScale: 'hour',
       temperatureWarning: 72,
+      temperatureWarningInput: 72,
       temperatureNonNormal: 44,
+      temperatureNonNormalInput: 44,
       temperatureCriticalStart: 55,
+      temperatureCritical: 55,
+      temperatureCriticalInput: 55,
+      notificationInput: 42,
       fields: [
         {
           key: 'name',
@@ -174,10 +184,27 @@ export default {
   },
 
   created() {
-    this.startLoader();
-    this.$store.dispatch('memory/getMemoryDynamic').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('memory/getMemoryDynamic').finally(() => {
+        this.endLoader();
+      });
+    },
   },
 };
 </script>
-- 
cgit v1.2.3

