X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=afm-client%2Fapp%2FFrontend%2Fwidgets%2FActionButtons%2FAppliButton.js;h=69e61b6fea3aac750f7b9076e9c2c006ab1c9838;hb=a79d1fc845f31cda41b55b0ffb9aa807732bbcd0;hp=b2d42b00815367f1d6f730ca60a6bb62308745b3;hpb=ba3ec968e550e6db1f9753c000b4a81306d271f0;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 b2d42b0..69e61b6 100644 --- a/afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js +++ b/afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js @@ -31,9 +31,10 @@ '' + 'Application {{label}}' + '' + ''; @@ -52,6 +53,7 @@ .directive('appliButton', function (AppConfig, AppCall, ModalFactory, Notification, $timeout) { function mymethods(scope, elem, attrs) { + scope.runstatus = "stop" scope.clicked = function () { var notifyError = function(api, response) { @@ -78,23 +80,26 @@ switch (action) { case "start": + if (scope.runstatus !== "stop") return; AppCall.get ("afm-main", "start", {id: scope.appID}, function(response) { if (response.status !== 200 || response.data.jtype !== "AJB_reply") { notifyError ("start", response); return; } - + scope.runstatus="start"; notifySuccess ("start", response); }); break; case "stop": + if (scope.runstatus !== "start") return; + AppCall.get ("afm-main", "terminate", {runid: scope.runID}, function(response) { if (response.status !== 200 || response.data.jtype !== "AJB_reply") { notifyError ("stop", response); return; } - + scope.runstatus="stop"; notifySuccess ("stop", response); }); break; @@ -108,6 +113,7 @@ // reference http://foundation.zurb.com/apps/docs/#!/angular-modules var config = { + id: 'appliInfoMenu', animationIn: 'slideInFromTop', contentScope: { close : closeModal, @@ -122,8 +128,19 @@ }); break; + + case "uninstall": + if (scope.runstatus !== "stop") return; + 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; @@ -134,13 +151,15 @@ // reference http://foundation.zurb.com/apps/docs/#!/angular-modules var config = { + id: 'appliActionMenu', animationIn: 'slideInFromTop', contentScope: { - action : actionModal, - close : closeModal, - icon : scope.icon, - label : scope.label - }, template : tmplModal + action : actionModal, + runstatus: scope.runstatus, + close : closeModal, + icon : scope.icon, + label : scope.label + }, template : tmplModal }; // Popup Modal to render application data scope.modal = new ModalFactory(config); @@ -149,7 +168,7 @@ // extract application information from AppID+Store if (attrs.handle && scope.store [attrs.handle].name) { - scope.icon = AppConfig.paths.icons + scope.store [attrs.handle].name.toLowerCase() + '-ico.png'; + scope.icon = AppConfig.paths.icons + attrs.handle; //scope.store [attrs.handle].name.toLowerCase() + '-ico.png'; scope.label = scope.store [attrs.handle].name; scope.appID= attrs.handle; } else {