diff options
author | Fulup Ar Foll <fulup@iot.bzh> | 2016-05-29 15:50:40 +0200 |
---|---|---|
committer | Fulup Ar Foll <fulup@iot.bzh> | 2016-05-29 15:50:40 +0200 |
commit | 96190f9cd583d9182c692c88d3342109bad81157 (patch) | |
tree | 5d5b098e64c14b7be1da47961ed6600ce355020b /afm-client/app/Frontend/pages | |
parent | 922b183f441a6e68b55592596fa62cc6e1814f74 (diff) |
Clean up to prepare new version of API
Diffstat (limited to 'afm-client/app/Frontend/pages')
-rw-r--r-- | afm-client/app/Frontend/pages/Dashboard/DashboardModule.js | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/afm-client/app/Frontend/pages/Dashboard/DashboardModule.js b/afm-client/app/Frontend/pages/Dashboard/DashboardModule.js index dff21ed..3bde5a9 100644 --- a/afm-client/app/Frontend/pages/Dashboard/DashboardModule.js +++ b/afm-client/app/Frontend/pages/Dashboard/DashboardModule.js @@ -29,27 +29,29 @@ angular.module('DashboardModule', ['SubmitButton', 'TokenRefresh', 'AppliButton' scope.GetRunnables = function() { console.log ("Dashboard GetRunnables"); - AppCall.get ("afm-main", "runnables", {/*query*/}, function(response) { + AppCall.get ("afm-main", "runnables", {/*query*/}, function(jresp, errcode) { // update debug UI zone scope.request = "/api/afm-main/runnable"; - scope.response = response.data; - scope.errcode = response.status; - - if (response.status !== 200) { - console.log ("Hoop GetRunnable failed"); - return; - } - - // Check this is a valid response from Binder - if (response.data.jtype != "afb-reply") { + scope.response = jresp.response; + scope.errcode = jresp.request.status; + + // Check if this is a response from AGL application framework binder + if (jresp.jtype !== "afb-reply") { Notification.error ({message: "Invalid Respond to /opa/afm-main/runnable response.data="+response.data, delay: 5000}); return; } + + // Check for success + if (jresp.request.status !== "success") { + Notification.error ({message: "afm-main/runnable" + jresp.request.info, delay: 5000}); + return; + } + // loop on runnable application to prepare for display var appliIDs=[]; - var runnables = response.data.response.runnables; + var runnables = jresp.response.runnables; for (var idx=0; idx < runnables.length; idx ++) { appliIDs[idx] = runnables [idx].id; scope.appliStore [runnables [idx].id] = runnables [idx]; |