Adds task status on the device

* Show task status on device for now

This shows the status of the last few tasks run on a device as a
green/red circle on the device icon.  This data live updates
from data emitted over the websocket.
This commit is contained in:
Ben Thomasson 2017-08-27 14:45:14 +00:00
parent 3f84ef69eb
commit 56991552d2
No known key found for this signature in database
GPG Key ID: 5818EF4CC895D5F5
4 changed files with 20 additions and 4 deletions

View File

@ -173,7 +173,6 @@ var NetworkUIController = function($scope, $document, $location, $window, $http)
$scope.rack_toolbox_controller = new fsm.FSMController($scope, toolbox_fsm.Start, $scope.inventory_toolbox_controller);
//Rack Toolbox Setup
$scope.rack_toolbox = new models.ToolBox(0, 'Rack', 'rack', 10, 200, 150, $scope.graph.height - 200 - 100);
$scope.rack_toolbox.items.push(new models.Group(0, 'Rack3', 'rack', 0, 0, 200, 1000, 'false'));
$scope.rack_toolbox.spacing = 200;
$scope.rack_toolbox.enabled = false;
$scope.rack_toolbox_controller.remove_on_drop = false;
@ -189,7 +188,6 @@ var NetworkUIController = function($scope, $document, $location, $window, $http)
$scope.site_toolbox_controller = new fsm.FSMController($scope, toolbox_fsm.Start, $scope.rack_toolbox_controller);
//Site Toolbox Setup
$scope.site_toolbox = new models.ToolBox(0, 'Sites', 'sites', 10, 200, 150, $scope.graph.height - 200 - 100);
$scope.site_toolbox.items.push(new models.Group(0, 'Site3', 'site', 0, 0, 1000, 1000, 'false'));
$scope.site_toolbox.spacing = 200;
$scope.site_toolbox.enabled = false;
$scope.site_toolbox_controller.remove_on_drop = false;
@ -623,6 +621,7 @@ var NetworkUIController = function($scope, $document, $location, $window, $http)
$scope.all_buttons.extend($scope.layers);
$scope.onTaskStatus = function(data) {
console.log(['onTaskStatus', data]);
var i = 0;
var j = 0;
var found = false;
@ -648,11 +647,18 @@ var NetworkUIController = function($scope, $document, $location, $window, $http)
}
}
}
if (data.status !== null) {
$scope.devices[i].status = data.status === "pass";
}
if (data.working !== null) {
$scope.devices[i].working = data.working;
}
}
}
};
$scope.onDeviceStatus = function(data) {
console.log(['onDeviceStatus', data]);
var i = 0;
for (i = 0; i < $scope.devices.length; i++) {
if ($scope.devices[i].name === data.name) {

View File

@ -91,6 +91,7 @@ _Ready.prototype.onPasteSite = function (controller, msg_type, message) {
var device_map = {};
var inner_group = null;
var c_messages = [];
var membership_old_new = null;
scope.hide_groups = false;
scope.pressedX = scope.mouseX;
@ -218,9 +219,17 @@ _Ready.prototype.onPasteSite = function (controller, msg_type, message) {
inner_group.type));
}
for(i=0; i< group.groups.length; i++) {
group.groups[i].update_membership(scope.devices, scope.groups);
membership_old_new = group.groups[i].update_membership(scope.devices, scope.groups);
c_messages.push(new messages.GroupMembership(controller.scope.client_id,
group.groups[i].id,
membership_old_new[2]));
}
membership_old_new = group.update_membership(scope.devices, scope.groups);
c_messages.push(new messages.GroupMembership(controller.scope.client_id,
group.id,
membership_old_new[2]));
scope.send_control_message(new messages.MultipleMessage(controller.scope.client_id, c_messages));
};

View File

@ -1,4 +1,5 @@
<g ng-if="!hide_groups || item.type == 'site'">
<g ng-if="current_scale < 5">
<g ng-if="current_scale > 0.5 || item.type == 'site' || (item.type == 'rack' && current_scale > 0.1)" >
<g ng-if="item.moving">
@ -129,3 +130,4 @@
</g>
</g>
</g>

View File

@ -70,7 +70,6 @@
<g awx-net-default></g>
</g> <!-- end default -->
<g awx-net-status-light></g>
<g awx-net-task-status></g>
</g> <!-- end devices -->
</g>