[Kimchi-devel] [PATCH] [Kimchi] Add Template listeners to update page according to user interations

Aline Manera aline.manera at gmail.com
Tue Jul 25 15:14:47 UTC 2017


From: Aline Manera <alinefm at linux.vnet.ibm.com>

It makes use of the async websockets notification mechanism provided by
Wok to update the Template tab content when a template is added, removed
or updated without the need to polling requests to server.

Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
---
 ui/js/src/kimchi.template_main.js | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ui/js/src/kimchi.template_main.js b/ui/js/src/kimchi.template_main.js
index 8755167..dd91dd5 100644
--- a/ui/js/src/kimchi.template_main.js
+++ b/ui/js/src/kimchi.template_main.js
@@ -1,7 +1,7 @@
 /*
  * Project Kimchi
  *
- * Copyright IBM Corp, 2013-2016
+ * Copyright IBM Corp, 2013-2017
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -189,5 +189,10 @@ kimchi.template_main = function() {
         });
     }
 
+    // Register listeners to update the page according to user interactions
+    wok.addNotificationListener('POST:/kimchi/templates', kimchi.doListTemplates);
+    wok.addNotificationListener('DELETE:/kimchi/template', kimchi.doListTemplates);
+    wok.addNotificationListener('PUT:/kimchi/template', kimchi.doListTemplates);
+
     kimchi.doListTemplates();
 };
-- 
2.9.4



More information about the Kimchi-devel mailing list