X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=afm-client%2Fapp%2FFrontend%2Fwidgets%2FActionButtons%2FAppliButton.js;h=b7acb6b6c0ccded451d2a1cdf42b3f99f9e39a95;hb=d47fd84a6a16b1c9c4b4ce5a3279b9ecaea54c1b;hp=f7172253db611cef2641f64ac1a151b24e26e82f;hpb=9966df615382815fb6169c9ecd9e3e696f8fa615;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 f717225..b7acb6b 100644 --- a/afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js +++ b/afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js @@ -50,10 +50,11 @@ ''; angular.module('AppliButton', []) - .directive('appliButton', function (AppConfig, AppCall, ModalFactory, Notification, $timeout, $window, $location) { + .directive('appliButton', function (AppConfig, AppCall, ModalFactory, Notification, $timeout, $window, $location, urlquery) { function mymethods(scope, elem, attrs) { scope.runstatus = "stop"; + scope.runmode = urlquery.runmode || "auto"; scope.clicked = function () { var notifyError = function(action, response) { @@ -81,7 +82,7 @@ case "start": if (scope.runstatus !== "stop") return; - AppCall.get ("afm-main", "start", {id: scope.appID, mode: "remote"}, function(response) { + AppCall.get ("afm-main", "start", {id: scope.appID, mode: scope.runmode}, function(response) { if (response.status !== 200 || response.data.jtype !== "AJB_reply") { notifyError ("start", response); return; @@ -89,7 +90,7 @@ scope.runstatus="start"; notifySuccess (action, response); if(response.data.response.uri) - $window.open(response.data.response.uri.replace("%h", $location.host())); + scope.winapp= $window.open(response.data.response.uri.replace("%h", $location.host())); }); break; @@ -102,6 +103,13 @@ return; } scope.runstatus="stop"; + + // if a remote window app was open let's close it + if (scope.winapp) { + console.log ("Closing Application Window label=%s id=%s", scope.label, scope.appID); + scope.winapp.close(); + scope.winapp=false; + } notifySuccess (action, response); }); break;