Latet UI changes to Inventory-> Groups page.

This commit is contained in:
chouseknecht 2013-10-07 13:59:42 -04:00
parent 7418b133be
commit 0604718953
8 changed files with 61 additions and 19 deletions

View File

@ -32,6 +32,18 @@ function JobEventsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
scope.parentNode = 'parent-event'; // used in ngClass to dynamicall set row level class and control
scope.childNode = 'child-event'; // link color and cursor
if (scope.removeSetHostLinks) {
scope.removeSetHostLinks();
}
scope.removeSetHostLinks = scope.$on('SetHostLinks', function(e, inventory_id) {
for (var i=0; i < scope.jobevents.length; i++) {
if (scope.jobevents[i].summary_fields.host) {
scope.jobevents[i].hostLink = "/#/inventories/" + inventory_id + "/hosts/?name=" +
escape(scope.jobevents[i].summary_fields.host.name);
}
}
});
function formatJSON(eventData) {
//turn JSON event data into an html form
@ -181,6 +193,7 @@ function JobEventsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
clearInterval($rootScope.timer);
}
}
scope.$emit('SetHostLinks', data.inventory);
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, null,

View File

@ -43,7 +43,7 @@ angular.module('InventoryHostsFormDefinition', [])
},
groups: {
label: 'Groups',
searchable: false,
searchable: true,
sourceModel: 'groups',
sourceField: 'name',
nosort: true

View File

@ -126,9 +126,9 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
.factory('InventoryStatus', [ '$rootScope', 'Rest', 'Alert', 'ProcessErrors', 'GetBasePath', 'FormatDate', 'InventorySummary',
'GenerateList', 'ClearScope', 'SearchInit', 'PaginateInit', 'Refresh', 'InventoryUpdate',
'GenerateList', 'ClearScope', 'SearchInit', 'PaginateInit', 'Refresh', 'InventoryUpdate', 'GroupsEdit',
function($rootScope, Rest, Alert, ProcessErrors, GetBasePath, FormatDate, InventorySummary, GenerateList, ClearScope, SearchInit,
PaginateInit, Refresh, InventoryUpdate) {
PaginateInit, Refresh, InventoryUpdate, GroupsEdit) {
return function(params) {
//Build a summary of a given inventory
@ -205,6 +205,16 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
SearchInit({ scope: scope, set: 'groups', list: list, url: defaultUrl });
PaginateInit({ scope: scope, list: list, url: defaultUrl });
scope.search(list.iterator);
scope.GroupsEdit = function(group_id) {
// On the tree, select the first occurrance of the requested group
var node = $('#tree-view').find("li[group_id='" + group_id + "']").first();
var selected = $('#tree-view').jstree('get_selected');
selected.each(function(idx) {
$('#tree-view').jstree('deselect_node', $(this));
});
$('#tree-view').jstree('select_node', node);
}
scope.refresh = function() {
scope['groupSearchSpin'] = true;

View File

@ -33,7 +33,7 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi
var treeData =
[{
data: {
title: inventory_name
title: inventory_name + ' Inventory'
},
attr: {
type: 'inventory',
@ -160,7 +160,10 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi
$(tree_id).bind("loaded.jstree", function () {
scope['treeLoading'] = false;
Wait('stop');
$(tree_id).prepend('<div class=\"title\"><i class=\"icon-sitemap\"></i> Group Selector</div>');
// Force root node styling changes
$('#inventory-node ins').first().remove();
$('#inventory-node a ins').first().css('background-image', 'none').append('<i class="icon-sitemap"></i>').css('margin-right','10px');
$('#inventory-node a').first().css('margin-bottom', '10px');
scope.$emit('treeLoaded');
});

View File

@ -22,10 +22,10 @@ angular.module('InventorySummaryDefinition', [])
name: {
key: true,
label: 'Group',
noLink: true,
ngBind: "group.summary_fields.group.name",
sourceModel: 'group',
sourceField: 'name'
sourceField: 'name',
ngClick: "\{\{ 'GroupsEdit(' + group.group + ')' \}\}"
},
hosts_with_active_failures: {
label: 'Hosts with<br>Job Failures?',
@ -37,6 +37,22 @@ angular.module('InventorySummaryDefinition', [])
searchable: false,
nosort: true
},
has_active_failures: {
label: 'Hosts have job failures?',
searchSingleValue: true,
searchType: 'boolean',
searchValue: 'true',
searchOnly: true,
sourceModel: 'group',
sourceField: 'has_active_failures'
},
last_update_failed: {
label: 'Update failed?',
searchSingleValue: true,
searchType: 'boolean',
searchValue: 'true',
searchOnly: true
},
status: {
label: 'Update<br>Status',
searchType: 'select',
@ -63,21 +79,12 @@ angular.module('InventorySummaryDefinition', [])
{ name: "Local Script", value: "file" },
{ name: "Manual", value: "" },
{ name: "Rackspace", value: "rackspace" }]
},
has_active_failures: {
label: 'Hosts have job failures?',
searchSingleValue: true,
searchType: 'boolean',
searchValue: 'true',
searchOnly: true,
sourceModel: 'group',
sourceField: 'has_active_failures'
}
},
actions: {
refresh: {
awRefresh: false,
awRefresh: true,
mode: 'all'
},
help: {

View File

@ -75,6 +75,7 @@ angular.module('JobEventsListDefinition', [])
host: {
label: 'Host',
ngBind: 'jobevent.summary_fields.host.name',
ngHref: "\{\{ jobevent.hostLink \}\}",
searchField: 'hosts__name',
nosort: true,
searchOnly: false,

View File

@ -716,20 +716,27 @@ select.field-mini-height {
.icon-cloud-na:before,
.icon-cloud-never:before,
.icon-cloud-updating:before,
.icon-cloud-failed:before,
.icon-cloud-successful:before {
content: "\f0c2";
content: "\f111";
}
.icon-cloud-failed:before {
content: "\f06a";
}
.icon-cloud-na {
color: #888;
}
.icon-cloud-never {
color: #888;
}
.icon-cloud-updating,
.icon-cloud-success {
color: #5bb75b;
}
.icon-cloud-failed {
color: @red;
}

View File

@ -84,3 +84,4 @@
.jstree-ansible .jstree-unchecked a .jstree-checkbox { _background-position:-2px -19px; }
/* IE6 END */