'<img ng-src="{{icon}}">' +
'<span class="modal-text">Application <b>{{label}}</b></span>' +
'<ul class="vertical icon-left primary menu-bar">' +
- '<li><a ng-click=action("start")><i class="fi-check"> Start</i></a></li>' +
- '<li><a ng-click=action("stop")><i class="fi-x"> Stop</i></a></li>' +
+ '<li class=start-{{runstatus}}><a ng-click=action("start")><i class="fi-check"> Start</i></a></li>' +
+ '<li class=stop-{{runstatus}}><a ng-click=action("stop")><i class="fi-x"> Stop</i></a></li>' +
'<li><a ng-click=action("info")><i class="fi-info"> Info</i></a></li>' +
- '<li><a ng-click=action("uninstall")><i class="fi-x"> Uninstall</i></a></li>' +
+ '<li class=start-{{runstatus}}><a ng-click=action("uninstall")><i class="fi-x"> Uninstall</i></a></li>' +
'</ul>' +
'';
.directive('appliButton', function (AppConfig, AppCall, ModalFactory, Notification, $timeout) {
function mymethods(scope, elem, attrs) {
+ scope.runstatus = "stop"
scope.clicked = function () {
var notifyError = function(api, response) {
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;
// reference http://foundation.zurb.com/apps/docs/#!/angular-modules
var config = {
+ id: 'appliInfoMenu',
animationIn: 'slideInFromTop',
contentScope: {
close : closeModal,
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);
// 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);
.directive ('tokenRefresh', function($timeout, $http, $location, Notification, AppConfig) {
function mymethods(scope, elem, attrs) {
- scope.status=undefined; // neither thu neither false
-
-
+ scope.logged=undefined; // neither thu neither false
+
scope.online = function () {
elem.addClass ("online");
elem.removeClass ("offline");
+ scope.logged=true;
};
scope.offline = function(){
elem.addClass ("offline");
elem.removeClass ("online");
+ scope.logged=false;
};
scope.onerror = function(data, errcode, headers) {
- if (scope.status !== false) {
+ if (scope.logged !== false) {
Notification.warning ({message: "AppFramework Binder Lost", delay: 5000});
scope.offline();
}
};
scope.onsuccess = function(data, errcode, headers, config) {
- if (scope.status !== true) {
+ if (scope.logged !== true) {
if (data.request.token) AppConfig.session.token = data.request.token;
if (data.request.uuid) AppConfig.session.uuid = data.request.uuid;
if (data.request.timeout) AppConfig.session.timeout = data.request.timeout;