'';
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) {
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;
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;
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;