X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=afm-client%2Fapp%2FFrontend%2Fwidgets%2FActionButtons%2FAppliButton.js;h=0ed0415e36c1a62921f3042805f9367ec7159496;hb=cbe6ebb3e4a75269660caa6c2c9e8a97d384b4e2;hp=a17ebc9b10e9841b61174eb1260f5f3f538513a0;hpb=be83a8f382cf2fea98161bfd6d51719aacbf9aa9;p=src%2Fapp-framework-demo.git diff --git a/afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js b/afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js index a17ebc9..0ed0415 100644 --- a/afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js +++ b/afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js @@ -29,11 +29,23 @@ var tmplModal = '×' + '' + - 'Application {{name}}' + + 'Application {{label}}' + '' + + ''; + + var tmplDetail = + '×' + + '' + + 'Application {{label}}' + + '' + ''; @@ -47,13 +59,13 @@ Notification.error ({message: "Fail /api/afm-main" + api + "=" + scope.label + " RunID="+ scope.appID, delay: 5000}); elem.addClass ("fail"); elem.removeClass ("success"); - scope.callback (scope.appliID, api, response); + scope.callback (scope.appID, api, response); }; var notifySuccess = function (api, response) { elem.removeClass ("fail"); scope.runID = response.data.response.runid; - scope.callback (scope.appliID, "/api/afm-main/start", response); + scope.callback (scope.appID, "/api/afm-main/start", response); }; var closeModal = function() { @@ -67,8 +79,8 @@ switch (action) { case "start": - AppCall.get ("afm-main", "start", {id: scope.appliID}, function(response) { - if (response.status !== 200 || response.data.request.jtype !== "AJB_reply") { + AppCall.get ("afm-main", "start", {id: scope.appID}, function(response) { + if (response.status !== 200 || response.data.jtype !== "AJB_reply") { notifyError ("start", response); return; } @@ -78,8 +90,8 @@ break; case "stop": - AppCall.get ("afm-main", "stop", {id: scope.runID}, function(response) { - if (response.status !== 200 || response.data.request.jtype !== "AJB_reply") { + AppCall.get ("afm-main", "terminate", {runid: scope.runID}, function(response) { + if (response.status !== 200 || response.data.jtype !== "AJB_reply") { notifyError ("stop", response); return; } @@ -90,16 +102,39 @@ case "info": AppCall.get ("afm-main", "detail", {id: scope.appID}, function(response) { - if (response.status !== 200 || response.data.request.jtype !== "AJB_reply") { + if (response.status !== 200 || response.data.jtype !== "AJB_reply") { notifyError ("detail", response); return; } - - notifySuccess ("detail", response); + + // reference http://foundation.zurb.com/apps/docs/#!/angular-modules + var config = { + animationIn: 'slideInFromTop', + contentScope: { + close : closeModal, + icon : scope.icon, + label : scope.appID, + detail : response.data.response + }, template : tmplDetail + }; + // Popup Modal to render application data + scope.modal = new ModalFactory(config); + scope.modal.activate (); + }); break; + + case "uninstall": + AppCall.get ("afm-main", "uninstall", {id: scope.appID}, function(response) { + if (response.status !== 200 || response.data.jtype !== "AJB_reply") { + notifyError ("uninstall", response); + return; + } - + notifySuccess ("uninstall", response); + }); + break; + default: console.log ("ActionModal unknown action=[%s]", action); break; @@ -127,7 +162,7 @@ if (attrs.handle && scope.store [attrs.handle].name) { scope.icon = AppConfig.paths.icons + scope.store [attrs.handle].name.toLowerCase() + '-ico.png'; scope.label = scope.store [attrs.handle].name; - scope.appliID= attrs.handle; + scope.appID= attrs.handle; } else { scope.icon = AppConfig.paths.icons + 'w3c-ico.png'; scope.label = attrs.handle;