summaryrefslogtreecommitdiffstats
path: root/afm-client/app/Frontend/widgets/ActionButtons
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2016-02-12 15:35:00 +0100
committerFulup Ar Foll <fulup@iot.bzh>2016-02-12 15:35:00 +0100
commita79d1fc845f31cda41b55b0ffb9aa807732bbcd0 (patch)
tree7a4bea13eeae768530e74ff5f4b849c2e7562802 /afm-client/app/Frontend/widgets/ActionButtons
parenteac68b18429b5e8bfb2aa8823d4f9a93f4e2ef5d (diff)
Fixed Mutiple AutoStart Call & added Application Menu Context
Diffstat (limited to 'afm-client/app/Frontend/widgets/ActionButtons')
-rw-r--r--afm-client/app/Frontend/widgets/ActionButtons/ActionButtons.scss13
-rw-r--r--afm-client/app/Frontend/widgets/ActionButtons/AppliButton.js28
2 files changed, 31 insertions, 10 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 @@
'<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>' +
'';
@@ -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);