[Kimchi-devel] [PATCH] [Wok 3/7] Move AJAX API calls to wok.api.js

Aline Manera alinefm at linux.vnet.ibm.com
Mon Feb 13 13:37:31 UTC 2017


All the AJAX calls should be placed on wok.api.js

Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
---
 ui/js/src/wok.api.js  | 40 ++++++++++++++++++++++++++++++++++++++++
 ui/js/wok.user-log.js | 40 ----------------------------------------
 2 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/ui/js/src/wok.api.js b/ui/js/src/wok.api.js
index c465dfb..4af3f88 100644
--- a/ui/js/src/wok.api.js
+++ b/ui/js/src/wok.api.js
@@ -144,5 +144,45 @@ var wok = {
             success : suc,
             error : err
         });
+    },
+
+    getUserLogs : function(suc, err) {
+        wok.requestJSON({
+            url : 'logs',
+            type : 'GET',
+            contentType : 'application/json',
+            dataType : 'json',
+            resend : true,
+            success : suc,
+            error : err || function(data) {
+                wok.message.error(data.responseJSON.reason);
+            }
+        });
+    },
+
+    getFilteredUserLogs : function(suc, err, search) {
+        wok.requestJSON({
+            url : 'logs?' + search,
+            type : 'GET',
+            contentType : 'application/json',
+            dataType : 'json',
+            success : suc,
+            error : err || function(data) {
+                wok.message.error(data.responseJSON.reason);
+            }
+        });
+    },
+
+    downloadLogs : function(suc, err, search) {
+        wok.requestJSON({
+            url : 'logs?'+search+'download=True',
+            type : 'GET',
+            contentType : 'application/json',
+            dataType : 'json',
+            success : suc,
+            error : err || function(data) {
+                wok.message.error(data.responseJSON.reason);
+            }
+        });
     }
 };
diff --git a/ui/js/wok.user-log.js b/ui/js/wok.user-log.js
index fa4945f..160f9a0 100644
--- a/ui/js/wok.user-log.js
+++ b/ui/js/wok.user-log.js
@@ -28,46 +28,6 @@ wok.initUserLogConfig = function() {
   wok.listUserLogConfig();
 }
 
-wok.getUserLogs = function(suc, err) {
-    wok.requestJSON({
-        url : 'logs',
-        type : 'GET',
-        contentType : 'application/json',
-        dataType : 'json',
-        resend : true,
-        success : suc,
-        error : err || function(data) {
-            wok.message.error(data.responseJSON.reason);
-        }
-    });
-};
-
-wok.getFilteredUserLogs = function(suc, err, search) {
-    wok.requestJSON({
-        url : 'logs?' + search,
-        type : 'GET',
-        contentType : 'application/json',
-        dataType : 'json',
-        success : suc,
-        error : err || function(data) {
-            wok.message.error(data.responseJSON.reason);
-        }
-    });
-};
-
-wok.downloadLogs = function(suc, err, search) {
-    wok.requestJSON({
-        url : 'logs?'+search+'download=True',
-        type : 'GET',
-        contentType : 'application/json',
-        dataType : 'json',
-        success : suc,
-        error : err || function(data) {
-            wok.message.error(data.responseJSON.reason);
-        }
-    });
-};
-
 wok.listUserLogConfig = function() {
 
   var ulGrid = [];
-- 
2.9.3



More information about the Kimchi-devel mailing list