X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fapp-framework-demo.git;a=blobdiff_plain;f=afm-client%2Fapp%2FFrontend%2Fwidgets%2FActionButtons%2FAppliButton.js;fp=afm-client%2Fapp%2FFrontend%2Fwidgets%2FActionButtons%2FAppliButton.js;h=a10030cbf4d333b96cfff8a2e770ec619c24e52f;hp=269ee81d7f50fa7fc9fda09abffad4cfc5598c9c;hb=96190f9cd583d9182c692c88d3342109bad81157;hpb=922b183f441a6e68b55592596fa62cc6e1814f74 diff --git a/afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js b/afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js index 269ee81..a10030c 100644 --- a/afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js +++ b/afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js @@ -57,17 +57,17 @@ scope.runmode = urlquery.runmode || "auto"; scope.clicked = function () { - var notifyError = function(action, response) { + var notifyError = function(action, jresp) { Notification.error ({message: "Fail /api/afm-main" + action + "=" + scope.label + " RunID="+ scope.appID, delay: 5000}); elem.addClass ("fail"); elem.removeClass ("success"); - scope.callback (scope.appID, action, response); + scope.callback (scope.appID, action, jresp); }; - var notifySuccess = function (action, response) { + var notifySuccess = function (action, jresp) { elem.removeClass ("fail"); - scope.runID = response.data.response.runid; - scope.callback (scope.appID, action, response); + scope.runID = jresp.response.runid; + scope.callback (scope.appID, action, jresp); }; var closeModApp = function() { @@ -86,13 +86,13 @@ case "start": if (scope.runstatus !== "stop") return; - AppCall.get ("afm-main", "start", {id: scope.appID, mode: scope.runmode}, function(response) { - if (response.status !== 200 || response.data.jtype !== "afb-reply") { - notifyError ("start", response); + AppCall.get ("afm-main", "start", {id: scope.appID, mode: scope.runmode}, function(jresp, errcode) { + if (errcode !== 200 || jresp.jtype !== "afb-reply") { + notifyError ("start", jresp); return; } scope.runstatus="start"; - notifySuccess (action, response); + notifySuccess (action, jresp); if(response.data.response.uri) scope.winapp= $window.open(response.data.response.uri.replace("%h", $location.host())); }); @@ -101,9 +101,9 @@ case "stop": if (scope.runstatus !== "start") return; - AppCall.get ("afm-main", "terminate", {runid: scope.runID}, function(response) { - if (response.status !== 200 || response.data.jtype !== "afb-reply") { - notifyError ("stop", response); + AppCall.get ("afm-main", "terminate", {runid: scope.runID}, function(jresp, errcode) { + if (errcode !== 200 || jresp.jtype !== "afb-reply") { + notifyError ("stop", jresp); return; } scope.runstatus="stop"; @@ -114,14 +114,14 @@ scope.winapp.close(); scope.winapp=false; } - notifySuccess (action, response); + notifySuccess (action, jresp); }); break; case "info": - AppCall.get ("afm-main", "detail", {id: scope.appID}, function(response) { - if (response.status !== 200 || response.data.jtype !== "afb-reply") { - notifyError ("detail", response); + AppCall.get ("afm-main", "detail", {id: scope.appID}, function(jresp, errcode) { + if (errcode !== 200 || jresp.jtype !== "afb-reply") { + notifyError ("detail", jresp); return; } @@ -144,13 +144,13 @@ case "uninstall": if (scope.runstatus !== "stop") return; - AppCall.get ("afm-main", "uninstall", {id: scope.appID}, function(response) { - if (response.status !== 200 || response.data.jtype !== "afb-reply") { - notifyError ("uninstall", response); + AppCall.get ("afm-main", "uninstall", {id: scope.appID}, function(jresp, errcode) { + if (errcode !== 200 || jresp.jtype !== "afb-reply") { + notifyError ("uninstall", jresp); return; } - notifySuccess (action, response); + notifySuccess (action, jresp); }); break;