summaryrefslogtreecommitdiffstats
path: root/afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2016-05-29 15:50:40 +0200
committerFulup Ar Foll <fulup@iot.bzh>2016-05-29 15:50:40 +0200
commit96190f9cd583d9182c692c88d3342109bad81157 (patch)
tree5d5b098e64c14b7be1da47961ed6600ce355020b /afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js
parent922b183f441a6e68b55592596fa62cc6e1814f74 (diff)
Clean up to prepare new version of API
Diffstat (limited to 'afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js')
-rw-r--r--afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js40
1 files changed, 20 insertions, 20 deletions
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;