From fd87391383b1249e2108cd590a1a2aefbd70b438 Mon Sep 17 00:00:00 2001
From: Dmitry <b4tm4n@mail.ru>
Date: Thu, 17 Jun 2021 12:50:43 +0300
Subject: [PATCH] fix apache restart monitor

---
 src/store/modules/apache_restart.js | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/src/store/modules/apache_restart.js b/src/store/modules/apache_restart.js
index dd57ad3..23bc32a 100644
--- a/src/store/modules/apache_restart.js
+++ b/src/store/modules/apache_restart.js
@@ -10,18 +10,17 @@ export default {
   state: {
     apache_need_restart: false,
     restart_flag: false,
-    flag_sent: false,
   },
   mutations: {
     setApacheNeedRestart(state) {
       state.apache_need_restart = true;
     },
     setApacheRestartFlag(state, flag) {
+      if (state.restart_flag && !flag) {
+        state.apache_need_restart = false;
+      }
       state.restart_flag = flag;
     },
-    setApacheRestartFlagSent(state, flag) {
-      state.flag_sent = flag;
-    },
   },
   actions: {
     async fetchApacheRestartFlag(ctx) {
@@ -30,10 +29,6 @@ export default {
         ctx.commit("setApacheRestartFlag", true);
       } catch (err) {
         ctx.commit("setApacheRestartFlag", false);
-        if (ctx.getters.isApacheRestartFlagSent) {
-          ctx.commit("setApacheNeedRestart", false);
-          ctx.commit("setApacheRestartFlagSent", false);
-        }
       }
     },
     async updateApacheRestartFlag(ctx) {
@@ -46,7 +41,6 @@ export default {
       try {
         await axios.put(`${api_base}/apache-restart`);
         ctx.commit("setApacheRestartFlag", true);
-        ctx.commit("setApacheRestartFlagSent", true);
       } catch (err) {
         pass();
       }
@@ -59,8 +53,5 @@ export default {
     isApacheRestartPending(state) {
       return state.restart_flag;
     },
-    isApacheRestartFlagSent(state) {
-      return state.flag_sent;
-    },
   },
 };