From a79d1fc845f31cda41b55b0ffb9aa807732bbcd0 Mon Sep 17 00:00:00 2001 From: Fulup Ar Foll Date: Fri, 12 Feb 2016 15:35:00 +0100 Subject: Fixed Mutiple AutoStart Call & added Application Menu Context --- .../widgets/ActionButtons/ActionButtons.scss | 13 ++++++++++ .../Frontend/widgets/ActionButtons/AppliButton.js | 28 ++++++++++++++-------- .../widgets/Notifications/TokenRefreshSvc.js | 11 +++++---- 3 files changed, 37 insertions(+), 15 deletions(-) diff --git a/afm-client/app/Frontend/widgets/ActionButtons/ActionButtons.scss b/afm-client/app/Frontend/widgets/ActionButtons/ActionButtons.scss index 16f7bb5..6daba6a 100644 --- a/afm-client/app/Frontend/widgets/ActionButtons/ActionButtons.scss +++ b/afm-client/app/Frontend/widgets/ActionButtons/ActionButtons.scss @@ -24,4 +24,17 @@ appli-button { img { height: 3rem; } + + + .disable>i { + text-decoration:none; // really not needed for the Top Bar, just for general technique + cursor: auto; + color: grey !important; + } +} + +#appliActionMenu { + .start-start, .stop-stop { + i {color: grey;} + } } diff --git a/afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js b/afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js index e51b3b6..69e61b6 100644 --- a/afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js +++ b/afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js @@ -31,10 +31,10 @@ '' + 'Application {{label}}' + '' + ''; @@ -53,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) { @@ -79,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; @@ -109,6 +113,7 @@ // reference http://foundation.zurb.com/apps/docs/#!/angular-modules var config = { + id: 'appliInfoMenu', animationIn: 'slideInFromTop', contentScope: { close : closeModal, @@ -125,6 +130,7 @@ 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); @@ -145,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); diff --git a/afm-client/app/Frontend/widgets/Notifications/TokenRefreshSvc.js b/afm-client/app/Frontend/widgets/Notifications/TokenRefreshSvc.js index 5c5b5ae..a7ee13f 100644 --- a/afm-client/app/Frontend/widgets/Notifications/TokenRefreshSvc.js +++ b/afm-client/app/Frontend/widgets/Notifications/TokenRefreshSvc.js @@ -37,21 +37,22 @@ angular.module('TokenRefresh', ['AppConfig', 'ModalNotification']) .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(); } @@ -59,7 +60,7 @@ angular.module('TokenRefresh', ['AppConfig', 'ModalNotification']) }; 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; -- cgit 1.2.3-korg