Code Review
/
src
/
app-framework-demo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Implement closing windows of remote launchs
[src/app-framework-demo.git]
/
afm-client
/
app
/
Frontend
/
widgets
/
ActionButtons
/
AppliButton.js
diff --git
a/afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js
b/afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js
index
7a32873
..
b7acb6b
100644
(file)
--- a/
afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js
+++ b/
afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js
@@
-50,23
+50,24
@@
'';
angular.module('AppliButton', [])
'';
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";
function mymethods(scope, elem, attrs) {
scope.runstatus = "stop";
+ scope.runmode = urlquery.runmode || "auto";
scope.clicked = function () {
scope.clicked = function () {
- var notifyError = function(a
pi
, response) {
- Notification.error ({message: "Fail /api/afm-main" + a
pi
+ "=" + scope.label + " RunID="+ scope.appID, delay: 5000});
+ var notifyError = function(a
ction
, response) {
+ Notification.error ({message: "Fail /api/afm-main" + a
ction
+ "=" + scope.label + " RunID="+ scope.appID, delay: 5000});
elem.addClass ("fail");
elem.removeClass ("success");
elem.addClass ("fail");
elem.removeClass ("success");
- scope.callback (scope.appID, a
pi
, response);
+ scope.callback (scope.appID, a
ction
, response);
};
};
- var notifySuccess = function (a
pi
, response) {
+ var notifySuccess = function (a
ction
, response) {
elem.removeClass ("fail");
scope.runID = response.data.response.runid;
elem.removeClass ("fail");
scope.runID = response.data.response.runid;
- scope.callback (scope.appID,
"/api/afm-main/start"
, response);
+ scope.callback (scope.appID,
action
, response);
};
var closeModal = function() {
};
var closeModal = function() {
@@
-81,15
+82,15
@@
case "start":
if (scope.runstatus !== "stop") return;
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";
if (response.status !== 200 || response.data.jtype !== "AJB_reply") {
notifyError ("start", response);
return;
}
scope.runstatus="start";
- notifySuccess (
"start"
, response);
+ notifySuccess (
action
, response);
if(response.data.response.uri)
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;
});
break;
@@
-102,7
+103,14
@@
return;
}
scope.runstatus="stop";
return;
}
scope.runstatus="stop";
- notifySuccess ("stop", response);
+
+ // 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;
});
break;
@@
-139,7
+147,7
@@
return;
}
return;
}
- notifySuccess (
"uninstall"
, response);
+ notifySuccess (
action
, response);
});
break;
});
break;