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.parentNode = 'parent-event'; // used in ngClass to dynamicall set row level class and control
scope.childNode = 'child-event'; // link color and cursor 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) { function formatJSON(eventData) {
//turn JSON event data into an html form //turn JSON event data into an html form
@@ -181,6 +193,7 @@ function JobEventsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
clearInterval($rootScope.timer); clearInterval($rootScope.timer);
} }
} }
scope.$emit('SetHostLinks', data.inventory);
}) })
.error( function(data, status, headers, config) { .error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, null, ProcessErrors(scope, data, status, null,

View File

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

View File

@@ -126,9 +126,9 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
.factory('InventoryStatus', [ '$rootScope', 'Rest', 'Alert', 'ProcessErrors', 'GetBasePath', 'FormatDate', 'InventorySummary', .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, function($rootScope, Rest, Alert, ProcessErrors, GetBasePath, FormatDate, InventorySummary, GenerateList, ClearScope, SearchInit,
PaginateInit, Refresh, InventoryUpdate) { PaginateInit, Refresh, InventoryUpdate, GroupsEdit) {
return function(params) { return function(params) {
//Build a summary of a given inventory //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 }); SearchInit({ scope: scope, set: 'groups', list: list, url: defaultUrl });
PaginateInit({ scope: scope, list: list, url: defaultUrl }); PaginateInit({ scope: scope, list: list, url: defaultUrl });
scope.search(list.iterator); 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.refresh = function() {
scope['groupSearchSpin'] = true; scope['groupSearchSpin'] = true;

View File

@@ -33,7 +33,7 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi
var treeData = var treeData =
[{ [{
data: { data: {
title: inventory_name title: inventory_name + ' Inventory'
}, },
attr: { attr: {
type: 'inventory', type: 'inventory',
@@ -160,7 +160,10 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi
$(tree_id).bind("loaded.jstree", function () { $(tree_id).bind("loaded.jstree", function () {
scope['treeLoading'] = false; scope['treeLoading'] = false;
Wait('stop'); 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'); scope.$emit('treeLoaded');
}); });

View File

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

View File

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

View File

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

View File

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