From 9a9b7027d2af9beb767b252126548f2d88bb6ece Mon Sep 17 00:00:00 2001
From: David Schmitz <schmitz@lrz.de>
Date: Thu, 25 Aug 2022 10:20:18 +0000
Subject: [PATCH] live status: fix broken messages on adding of inactive rules
 (via REST API) as well as on rules in PENDING state

---
 flowspec/viewsets.py    | 3 +++
 templates/pollerdash.js | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/flowspec/viewsets.py b/flowspec/viewsets.py
index b9fe1005..9a9ba33f 100644
--- a/flowspec/viewsets.py
+++ b/flowspec/viewsets.py
@@ -125,8 +125,11 @@ class RouteViewSet(viewsets.ModelViewSet):
                     elif requested_status == "INACTIVE":
                         route.status = "INACTIVE"
                         route.save()
+                        announce("[%s] new inactive Rule added: %s" % (route.applier_username_nice, route.name_visible), route.applier, route)
                     else:
                         route.save()
+                        announce("[%s] new non-active Rule added: %s" % (route.applier_username_nice, route.name_visible), route.applier, route)
+
                     obj.data["status"] = route.status
                     logger.info("RouteViewSet::create(): => route="+str(route))
                     logger.info("RouteViewSet::create(): => route.status="+str(route.status))
diff --git a/templates/pollerdash.js b/templates/pollerdash.js
index 94ca00a8..19902f40 100644
--- a/templates/pollerdash.js
+++ b/templates/pollerdash.js
@@ -178,7 +178,7 @@ var updater = {
             updater.showMessage(messages[i], peerid);
             try {
               body = messages[i].body 
-              if (body.match(/Successfully committed$/) || body.match(/Deleting inactive/) || body.match(/NETCONF/) || body.match(/non-flowspec-params updated/)) {
+              if (body.match(/Successfully committed$/) || body.match(/Deleting inactive/) || body.match(/NETCONF/) || body.match(/non-flowspec-params updated/) || body.match(/Rule/) || body.match(/Please wait/)) {
                 reloadContent = true;
               }
             } catch (e) {
-- 
GitLab