Started mergint 1.4.11 inventory refactor changes. In the middle of applying 51a11fcb6e4706b853bdcead978284b8c8eaeaf4 to helpers/hosts.js.

This commit is contained in:
Chris Houseknecht
2014-05-30 16:42:02 -04:00
parent fe925f1925
commit 998b47fbf6
8 changed files with 162 additions and 145 deletions

View File

@@ -175,19 +175,20 @@ function($routeParams, Empty, InventoryHosts, GetBasePath, SearchInit, PaginateI
scope.search_place_holder='Search ' + scope.selected_group_name; scope.search_place_holder='Search ' + scope.selected_group_name;
if (scope.removePostRefresh) { //if (scope.removePostRefresh) {
scope.removePostRefresh(); // scope.removePostRefresh();
} //}
scope.removePostRefresh = scope.$on('PostRefresh', function() { scope.removePostRefresh = scope.$on('PostRefresh', function(e, set) {
for (var i=0; i < scope.hosts.length; i++) { if (set === 'hosts') {
//Set tooltip for host enabled flag for (var i=0; i < scope.hosts.length; i++) {
scope.hosts[i].enabled_flag = scope.hosts[i].enabled; //Set tooltip for host enabled flag
//SetHostStatus(scope.hosts[i]); scope.hosts[i].enabled_flag = scope.hosts[i].enabled;
}
SetStatus({ scope: scope });
setTimeout(function() { ApplyEllipsis('#hosts_table .host-name a'); }, 2500);
Wait('stop');
scope.$emit('HostReloadComplete');
} }
SetStatus({ scope: scope });
setTimeout(function() { ApplyEllipsis('#hosts_table .host-name a'); }, 2500);
Wait('stop');
scope.$emit('HostReloadComplete');
}); });
// Size containers based on viewport // Size containers based on viewport
@@ -222,14 +223,13 @@ function(GenerateList, InventoryHosts, HostsReload) {
var scope = params.scope, var scope = params.scope,
inventory_id = params.inventory_id, inventory_id = params.inventory_id,
group_id = params.group_id, group_id = params.group_id,
tree_id = params.tree_id,
generator = GenerateList; generator = GenerateList;
// Inject the list html // Inject the list html
generator.inject(InventoryHosts, { scope: scope, mode: 'edit', id: 'hosts-container', breadCrumbs: false, searchSize: 'col-lg-6 col-md-6 col-sm-6' }); generator.inject(InventoryHosts, { scope: scope, mode: 'edit', id: 'hosts-container', breadCrumbs: false, searchSize: 'col-lg-6 col-md-6 col-sm-6' });
// Load data // Load data
HostsReload({ scope: scope, group_id: group_id, tree_id: tree_id, inventory_id: inventory_id }); HostsReload({ scope: scope, group_id: group_id, inventory_id: inventory_id });
}; };
}]) }])
@@ -239,7 +239,8 @@ function(GetBasePath, Rest, Wait, ProcessErrors, Alert, Find, SetEnabledMsg) {
var id = params.host_id, var id = params.host_id,
external_source = params.external_source, external_source = params.external_source,
scope = params.scope, parent_scope = params.parent_scope,
host_scope = params.host_scope,
host; host;
function setMsg(host) { function setMsg(host) {
@@ -251,7 +252,7 @@ function(GetBasePath, Rest, Wait, ProcessErrors, Alert, Find, SetEnabledMsg) {
if (!external_source) { if (!external_source) {
// Host is not managed by an external source // Host is not managed by an external source
Wait('start'); Wait('start');
host = Find({ list: scope.hosts, key: 'id', val: id }); host = Find({ list: host_scope.hosts, key: 'id', val: id });
setMsg(host); setMsg(host);
Rest.setUrl(GetBasePath('hosts') + id + '/'); Rest.setUrl(GetBasePath('hosts') + id + '/');
@@ -262,8 +263,7 @@ function(GetBasePath, Rest, Wait, ProcessErrors, Alert, Find, SetEnabledMsg) {
.error( function(data, status) { .error( function(data, status) {
// Flip the enabled flag back // Flip the enabled flag back
setMsg(host); setMsg(host);
Wait('stop'); ProcessErrors(parent_scope, data, status, null,
ProcessErrors(scope, data, status, null,
{ hdr: 'Error!', msg: 'Failed to update host. PUT returned status: ' + status }); { hdr: 'Error!', msg: 'Failed to update host. PUT returned status: ' + status });
}); });
} }

View File

@@ -14,69 +14,88 @@ angular.module('InventoryHelper', ['RestServices', 'Utilities', 'OrganizationLis
'InventoryHelper', 'InventoryFormDefinition', 'ParseHelper', 'SearchHelper', 'VariablesHelper', 'InventoryHelper', 'InventoryFormDefinition', 'ParseHelper', 'SearchHelper', 'VariablesHelper',
]) ])
.factory('GetGroupContainerHeight', [ function() { .factory('GetGroupContainerHeight', [ function() {
return function() { return function() {
return $(window).height() - $('.main-menu').outerHeight() - $('#main_tabs').outerHeight() - $('#breadcrumbs').outerHeight() - return $(window).height() - $('.main-menu').outerHeight() - $('#main_tabs').outerHeight() - $('#breadcrumbs').outerHeight() -
$('.site-footer').outerHeight() - $('#groups-container .list-actions').outerHeight() - $('#groups-table-header').height() - 15; $('.site-footer').outerHeight() - $('.group-breadcrumbs').outerHeight() - $('#groups-container #search-widget-container').outerHeight() - $('#groups_table thead').height() - 70;
}; };
}]) }])
.factory('GetHostContainerRows', [ function() { .factory('GetHostContainerRows', [ function() {
return function() { return function() {
var height = $('#hosts-container .well').height() - $('#hosts-constainer .well .row').height() - $('#hosts_table thead').height(); var height = $('#hosts-container .well').height() - $('#hosts-constainer .well .row').height() - $('#hosts_table thead').height();
return Math.floor(height / 27) - 1; return Math.floor(height / 30) - 2;
};
}])
.factory('GetGroupContainerRows', [ function() {
return function() {
var height = $('#groups-container .list-table-container').height();
return Math.floor(height / 31) - 2;
}; };
}]) }])
.factory('SetContainerHeights', [ 'GetGroupContainerHeight', 'GetHostContainerRows', function(GetGroupContainerHeight, GetHostContainerRows) { .factory('SetContainerHeights', [ 'GetGroupContainerHeight', 'GetHostContainerRows', function(GetGroupContainerHeight, GetHostContainerRows) {
return function(params) { return function(params) {
var scope = (params && params.scope) ? params.scope : null, var group_scope = params.group_scope,
host_scope = params.host_scope,
reloadHosts = (params && params.reloadHosts) ? true : false, reloadHosts = (params && params.reloadHosts) ? true : false,
height, rows; height, rows;
if ($(window).width() > 1210) { if ($(window).width() > 1210) {
height = GetGroupContainerHeight(); height = GetGroupContainerHeight();
$('#groups-container .list-table-container').height(height); $('#groups-container .list-table-container').height(height);
$('#hosts-container .well').height( $('#groups-container').height() - 49 ); $('#hosts-container .well').height( $('#groups-container .well').height());
} }
else { else {
$('#groups-container .list-table-container').height('auto'); $('#groups-container .list-table-container').height('auto');
$('#hosts-container .well').height('auto'); $('#hosts-container .well').height('auto');
} }
$('#groups-container .list-table-container').mCustomScrollbar("update"); //$('#groups-container .list-table-container').mCustomScrollbar("update");
if (reloadHosts) { if (reloadHosts) {
// we need ro recalc the the page size // we need ro recalc the the page size
if ($(window).width() > 1210) { if ($(window).width() > 1210) {
rows = GetHostContainerRows(); rows = GetHostContainerRows();
scope.host_page_size = rows; host_scope.host_page_size = rows;
group_scope.group_page_size = rows;
} }
else { else {
// on small screens we go back to the default // on small screens we go back to the default
scope.host_page_size = 20; host_scope.host_page_size = 20;
group_scope.group_page_size = 20;
} }
scope.changePageSize('hosts', 'host'); host_scope.changePageSize('hosts', 'host');
group_scope.changePageSize('groups', 'group');
} }
}; };
}]) }])
.factory('WatchInventoryWindowResize', ['ApplyEllipsis', 'SetContainerHeights', .factory('WatchInventoryWindowResize', ['ApplyEllipsis', 'SetContainerHeights',
function (ApplyEllipsis, SetContainerHeights) { function (ApplyEllipsis, SetContainerHeights) {
return function (params) { return function (params) {
// Call to set or restore window resize // Call to set or restore window resize
var scope = params.scope; var group_scope = params.group_scope,
host_scope = params.host_scope;
$(window).off("resize");
$(window).resize(_.debounce(function() { $(window).resize(_.debounce(function() {
// Hack to stop group-name div slipping to a new line // Hack to stop group-name div slipping to a new line
$('#groups_table .name-column').each(function () { //$('#groups_table .name-column').each(function () {
var td_width = $(this).width(), // var td_width = $(this).width(),
level_width = $(this).find('.level').width(), // level_width = $(this).find('.level').width(),
level_padding = parseInt($(this).find('.level').css('padding-left').replace(/px/, '')), // level_padding = parseInt($(this).find('.level').css('padding-left').replace(/px/, '')),
level = level_width + level_padding, // level = level_width + level_padding,
pct = (100 - Math.ceil((level / td_width) * 100)) + '%'; // pct = (100 - Math.ceil((level / td_width) * 100)) + '%';
$(this).find('.group-name').css({ width: pct }); // $(this).find('.group-name').css({ width: pct });
}); //});
ApplyEllipsis('#groups_table .group-name a'); ApplyEllipsis('#groups_table .group-name a');
ApplyEllipsis('#hosts_table .host-name a'); ApplyEllipsis('#hosts_table .host-name a');
SetContainerHeights({ scope: scope, reloadHosts: true }); SetContainerHeights({
group_scope: group_scope,
host_scope: host_scope,
reloadHosts: true
});
}, 500)); }, 500));
}; };
} }

View File

@@ -24,11 +24,9 @@ angular.module('RefreshHelper', ['RestServices', 'Utilities', 'PaginationHelpers
var scope = params.scope, var scope = params.scope,
set = params.set, set = params.set,
iterator = params.iterator, iterator = params.iterator,
url = params.url; url = params.url,
deferWaitStop = params.deferWaitStop;
//scope[iterator + "HidePaginator"] = true;
//scope[iterator + 'Loading'] = true;
scope.current_url = url; scope.current_url = url;
Rest.setUrl(url); Rest.setUrl(url);
Rest.get() Rest.get()
@@ -48,8 +46,10 @@ angular.module('RefreshHelper', ['RestServices', 'Utilities', 'PaginationHelpers
scope[set] = data.results; scope[set] = data.results;
scope[iterator + 'Loading'] = false; scope[iterator + 'Loading'] = false;
scope[iterator + 'HidePaginator'] = false; scope[iterator + 'HidePaginator'] = false;
Wait('stop'); if (!deferWaitStop) {
scope.$emit('PostRefresh'); Wait('stop');
}
scope.$emit('PostRefresh', set);scope.$emit('PostRefresh');
}) })
.error(function (data, status) { .error(function (data, status) {
scope[iterator + 'HoldInput'] = false; scope[iterator + 'HoldInput'] = false;

View File

@@ -30,7 +30,7 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
iterator = (params.iterator) ? params.iterator : list.iterator, iterator = (params.iterator) ? params.iterator : list.iterator,
setWidgets = (params.setWidgets === false) ? false : true, setWidgets = (params.setWidgets === false) ? false : true,
sort_order = params.sort_order || '', sort_order = params.sort_order || '',
widgets, i, modifier, current_params; widgets, i, modifier;
function setDefaults(widget) { function setDefaults(widget) {
// Set default values // Set default values
@@ -139,7 +139,7 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
} }
} }
current_params = { scope[iterator + '_current_search_params'] = {
set: set, set: set,
defaultUrl: defaultUrl, defaultUrl: defaultUrl,
list: list, list: list,
@@ -147,7 +147,8 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
sort_order: sort_order sort_order: sort_order
}; };
Store('CurrentSearchParams', current_params); // Save in case Activity Stream widget needs to restore Store(iterator + '_current_search_params', scope[iterator + '_current_search_params']);
Store('CurrentSearchParams', scope[iterator + '_current_search_params']); // Keeping this around for activity stream
// Functions to handle search widget changes // Functions to handle search widget changes
@@ -247,7 +248,7 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
if (scope.removeDoSearch) { if (scope.removeDoSearch) {
scope.removeDoSearch(); scope.removeDoSearch();
} }
scope.removeDoSearch = scope.$on('doSearch', function (e, iterator, page, load, calcOnly) { scope.removeDoSearch = scope.$on('doSearch', function (e, iterator, page, load, calcOnly, deferWaitStop) {
// //
// Execute the search // Execute the search
// //
@@ -287,7 +288,8 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
scope: scope, scope: scope,
set: set, set: set,
iterator: iterator, iterator: iterator,
url: url url: url,
deferWaitStop: deferWaitStop
}); });
} }
}); });
@@ -296,7 +298,7 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
if (scope.removePrepareSearch) { if (scope.removePrepareSearch) {
scope.removePrepareSearch(); scope.removePrepareSearch();
} }
scope.removePrepareSearch = scope.$on('prepareSearch', function (e, iterator, page, load, calcOnly) { scope.removePrepareSearch = scope.$on('prepareSearch', function (e, iterator, page, load, calcOnly, deferWaitStop) {
// //
// Start building the search key/value pairs. This will process each search widget, if the // Start building the search key/value pairs. This will process each search widget, if the
// selected field is an object type (used on activity stream). // selected field is an object type (used on activity stream).
@@ -342,13 +344,13 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
} }
} }
} }
scope.$emit('prepareSearch2', iterator, page, load, calcOnly); scope.$emit('prepareSearch2', iterator, page, load, calcOnly, deferWaitStop);
}); });
if (scope.removePrepareSearch2) { if (scope.removePrepareSearch2) {
scope.removePrepareSearch2(); scope.removePrepareSearch2();
} }
scope.removePrepareSearch2 = scope.$on('prepareSearch2', function (e, iterator, page, load, calcOnly) { scope.removePrepareSearch2 = scope.$on('prepareSearch2', function (e, iterator, page, load, calcOnly, deferWaitStop) {
// Continue building the search by examining the remaining search widgets. If we're looking at activity_stream, // Continue building the search by examining the remaining search widgets. If we're looking at activity_stream,
// there's more than one. // there's more than one.
var i, modifier, var i, modifier,
@@ -397,8 +399,10 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
list.fields[scope[iterator + 'SearchField' + modifier]].searchType === 'gtzero') { list.fields[scope[iterator + 'SearchField' + modifier]].searchType === 'gtzero') {
scope[iterator + 'SearchParams'] += 'gt=0'; scope[iterator + 'SearchParams'] += 'gt=0';
} else if ( (list.fields[scope[iterator + 'SearchField' + modifier]].searchType === 'select') && } else if ( (list.fields[scope[iterator + 'SearchField' + modifier]].searchType === 'select') &&
Empty(scope[iterator + 'SearchSelectValue' + modifier].value) ) { Empty(scope[iterator + 'SearchSelectValue' + modifier].value) && !/\_\_$/.test(scope[iterator + 'SearchParams']) ) {
scope[iterator + 'SearchParams'] += '=iexact='; scope[iterator + 'SearchParams'] += '=iexact=';
} else if (/\_\_$/.test(scope[iterator + 'SearchParams'])) {
scope[iterator + 'SearchParams'] += 'icontains=';
} else { } else {
scope[iterator + 'SearchParams'] += scope[iterator + 'SearchType' + modifier] + '='; scope[iterator + 'SearchParams'] += scope[iterator + 'SearchType' + modifier] + '=';
} }
@@ -431,7 +435,7 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
scope[iterator + 'SearchParams'] += 'order_by=' + encodeURI(sort_order); scope[iterator + 'SearchParams'] += 'order_by=' + encodeURI(sort_order);
} }
scope.$emit('doSearch', iterator, page, load, calcOnly); scope.$emit('doSearch', iterator, page, load, calcOnly, deferWaitStop);
}); });
scope.startSearch = function (e, iterator) { scope.startSearch = function (e, iterator) {
@@ -444,19 +448,22 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
/** /**
* Initiate a searh. * Initiate a searh.
* *
* @iterator: required, list.iterator value * @iterator: required, list.iterator value
* @Page: optional. Added to accomodate back function on Job Events detail. * @Page: optional. Added to accomodate back function on Job Events detail.
* @Load: optional, set to false if 'Loading' message not desired * @Load: optional, set to false if 'Loading' message not desired
* @calcOnly: optiona, set to true when you want to calc or figure out search params without executing the search * @calcOnly: optional, set to true when you want to calc or figure out search params without executing the search
* @deferWaitStop: optional, when true refresh.js will NOT issue Wait('stop'), thus leaving the spinner. Caller is then
* responsible for stopping the spinner post refresh.
*/ */
scope.search = function (iterator, page, load, calcOnly) { scope.search = function (iterator, page, load, calcOnly, deferWaitStop) {
page = page || null; page = page || null;
load = (load || !scope[set] || scope[set].length === 0) ? true : false; load = (load || !scope[set] || scope[set].length === 0) ? true : false;
calcOnly = (calcOnly) ? true : false; calcOnly = (calcOnly) ? true : false;
deferWaitStop = (deferWaitStop) ? true : false;
if (load) { if (load) {
scope[set] = []; //clear the list array to make sure 'Loading' is the only thing visible on the list scope[set] = []; //clear the list array to make sure 'Loading' is the only thing visible on the list
} }
scope.$emit('prepareSearch', iterator, page, load, calcOnly); scope.$emit('prepareSearch', iterator, page, load, calcOnly, deferWaitStop);
}; };
@@ -498,6 +505,10 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
sort_order = direction + fld; sort_order = direction + fld;
} }
} }
scope[list.iterator + '_current_search_params'].sort_order = sort_order;
Store(iterator + '_current_search_params', scope[iterator + '_current_search_params']);
scope.search(list.iterator); scope.search(list.iterator);
}; };

View File

@@ -12,8 +12,8 @@
angular.module('GroupListDefinition', []) angular.module('GroupListDefinition', [])
.value('GroupList', { .value('GroupList', {
name: 'groups', name: 'copy_groups',
iterator: 'group', iterator: 'copy_group',
selectTitle: 'Copy Groups', selectTitle: 'Copy Groups',
editTitle: 'Groups', editTitle: 'Groups',
index: true, index: true,
@@ -23,22 +23,10 @@ angular.module('GroupListDefinition', [])
name: { name: {
key: true, key: true,
label: 'Name' label: 'Name'
},
description: {
label: 'Description'
} }
}, },
actions: { actions: { },
help: {
awPopOver: "Choose groups by clicking on each group you wish to add. Click the <em>Select</em> button to add the groups to " +
"the selected inventory group.",
dataContainer: '#form-modal .modal-content',
mode: 'all',
awToolTip: 'Click for help',
dataTitle: 'Adding Groups'
}
},
fieldActions: { fieldActions: {
edit: { edit: {

View File

@@ -2,7 +2,7 @@
* Copyright (c) 2014 AnsibleWorks, Inc. * Copyright (c) 2014 AnsibleWorks, Inc.
* *
* Hosts.js * Hosts.js
* List view object for Users data model. * List view object for Hosts data model.
* *
* *
*/ */
@@ -12,8 +12,8 @@
angular.module('HostListDefinition', []) angular.module('HostListDefinition', [])
.value('HostList', { .value('HostList', {
name: 'hosts', name: 'copy_hosts',
iterator: 'host', iterator: 'copy_host',
selectTitle: 'Add Existing Hosts', selectTitle: 'Add Existing Hosts',
editTitle: 'Hosts', editTitle: 'Hosts',
index: true, index: true,
@@ -22,41 +22,11 @@ angular.module('HostListDefinition', [])
fields: { fields: {
name: { name: {
key: true, key: true,
label: 'Host Name', label: 'Host Name'
linkTo: "/inventories/{{ inventory_id }}/hosts/{{ host.id }}"
},
description: {
label: 'Description'
} }
}, },
actions: { actions: { },
help: {
awPopOver: "Select hosts by clicking on each host you wish to add. Add the selected hosts to the group by clicking the <em>Select</em> button.",
dataContainer: '#form-modal .modal-content',
mode: 'all',
awToolTip: 'Click for help',
dataTitle: 'Selecting Hosts'
}
},
fieldActions: { fieldActions: { }
edit: {
label: 'Edit',
ngClick: "editHost({{ host.id }})",
icon: 'icon-edit',
"class": 'btn-xs',
awToolTip: 'Edit host',
dataPlacement: 'top'
},
"delete": {
label: 'Delete',
ngClick: "deleteHost(host.id, host.name)",
icon: 'icon-trash',
"class": 'btn-xs',
awToolTip: 'Delete host',
dataPlacement: 'top'
}
}
}); });

View File

@@ -13,28 +13,57 @@ angular.module('InventoryGroupsDefinition', [])
showTitle: false, showTitle: false,
well: true, well: true,
index: false, index: false,
hover: false, hover: true,
hasChildren: true,
filterBy: '{ show: true }',
'class': 'table-no-border', 'class': 'table-no-border',
awCustomScroll: true,
fields: { fields: {
name: { name: {
label: 'Groups', label: 'Groups',
key: true, key: true,
ngClick: "showHosts(group.id,group.group_id, false)", ngClick: "groupSelect(group.id)",
columnClick: "showHosts(group.id,group.group_id, false)", columnClick: "groupSelect(group.id)",
ngClass: "group.selected_class", columnClass: 'col-lg-10 col-md-10 col-sm-10 col-xs-7'
hasChildren: true, },
columnClass: 'col-lg-10 col-md-10 col-sm-10 col-xs-9', source: {
nosort: true, label: 'Source',
awDroppable: "{{ group.isDroppable }}", searchType: 'select',
awDraggable: "{{ group.isDraggable }}", searchOptions: [{
dataContainment: "#groups_table", name: "ec2",
dataTreeId: "{{ group.id }}", value: "ec2"
dataGroupId: "{{ group.group_id }}", }, {
dataType: "group" name: "none",
value: ""
}, {
name: "rax",
value: "rax"
}],
sourceModel: 'inventory_source',
sourceField: 'source',
searchOnly: true
},
has_external_source: {
label: 'Has external source?',
searchType: 'in',
searchValue: 'ec2,rax',
searchOnly: true,
sourceModel: 'inventory_source',
sourceField: 'source'
},
has_active_failures: {
label: 'Has failed hosts?',
searchSingleValue: true,
searchType: 'boolean',
searchValue: 'true',
searchOnly: true
},
last_update_failed: {
label: 'Update failed?',
searchType: 'select',
searchSingleValue: true,
searchValue: 'failed',
searchOnly: true,
sourceModel: 'inventory_source',
sourceField: 'status'
} }
}, },
@@ -64,13 +93,12 @@ angular.module('InventoryGroupsDefinition', [])
fieldActions: { fieldActions: {
columnClass: 'col-lg-2 col-md-2 col-sm-2 col-xs-3', columnClass: 'col-lg-2 col-md-2 col-sm-2 col-xs-5',
label: false, label: false,
sync_status: { sync_status: {
mode: 'all', mode: 'all',
ngClick: "viewUpdateStatus(group.id, group.group_id)", ngClick: "viewUpdateStatus(group.id, group.group_id)",
ngShow: "group.id > 1", // hide for all hosts
awToolTip: "{{ group.status_tooltip }}", awToolTip: "{{ group.status_tooltip }}",
dataTipWatch: "group.status_tooltip", dataTipWatch: "group.status_tooltip",
iconClass: "{{ 'fa icon-cloud-' + group.status_class }}", iconClass: "{{ 'fa icon-cloud-' + group.status_class }}",
@@ -80,7 +108,6 @@ angular.module('InventoryGroupsDefinition', [])
failed_hosts: { failed_hosts: {
mode: 'all', mode: 'all',
awToolTip: "{{ group.hosts_status_tip }}", awToolTip: "{{ group.hosts_status_tip }}",
ngShow: "group.id > 1", // hide for all hosts
dataPlacement: "top", dataPlacement: "top",
ngClick: "showHosts(group.id, group.group_id, group.show_failures)", ngClick: "showHosts(group.id, group.group_id, group.show_failures)",
iconClass: "{{ 'fa icon-job-' + group.hosts_status_class }}" iconClass: "{{ 'fa icon-job-' + group.hosts_status_class }}"
@@ -91,7 +118,7 @@ angular.module('InventoryGroupsDefinition', [])
ngClick: 'updateGroup(group.id)', ngClick: 'updateGroup(group.id)',
awToolTip: "{{ group.launch_tooltip }}", awToolTip: "{{ group.launch_tooltip }}",
dataTipWatch: "group.launch_tooltip", dataTipWatch: "group.launch_tooltip",
ngShow: "group.id > 1 && (group.status !== 'running' && group.status !== 'pending' && group.status !== 'updating')", ngShow: "group.status !== 'running' && group.status !== 'pending' && group.status !== 'updating'",
ngClass: "group.launch_class", ngClass: "group.launch_class",
dataPlacement: "top" dataPlacement: "top"
}, },
@@ -101,7 +128,7 @@ angular.module('InventoryGroupsDefinition', [])
ngClick: "cancelUpdate(group.id)", ngClick: "cancelUpdate(group.id)",
awToolTip: "Cancel sync process", awToolTip: "Cancel sync process",
'class': 'red-txt', 'class': 'red-txt',
ngShow: "group.id > 1 && (group.status == 'running' || group.status == 'pending' || group.status == 'updating')", ngShow: "group.status == 'running' || group.status == 'pending' || group.status == 'updating'",
dataPlacement: "top" dataPlacement: "top"
}, },
edit: { edit: {
@@ -109,7 +136,12 @@ angular.module('InventoryGroupsDefinition', [])
mode: 'all', mode: 'all',
ngClick: "editGroup(group.group_id, group.id)", ngClick: "editGroup(group.group_id, group.id)",
awToolTip: 'Edit group', awToolTip: 'Edit group',
ngShow: "group.id > 1", // hide for all hosts dataPlacement: "top"
},
copy: {
mode: 'all',
ngClick: "copyGroup(group.id)",
awToolTip: 'Copy or move group',
dataPlacement: "top" dataPlacement: "top"
}, },
"delete": { "delete": {
@@ -117,9 +149,7 @@ angular.module('InventoryGroupsDefinition', [])
mode: 'all', mode: 'all',
ngClick: "deleteGroup(group.id, group.group_id)", ngClick: "deleteGroup(group.id, group.group_id)",
awToolTip: 'Delete group', awToolTip: 'Delete group',
ngShow: "group.id != 1", // hide for all hosts
dataPlacement: "top" dataPlacement: "top"
} }
} }
}); });

View File

@@ -18,9 +18,9 @@ angular.module('InventoryHostsDefinition', [])
showTitle: false, showTitle: false,
well: true, well: true,
index: false, index: false,
hover: false, hover: true,
hasChildren: true, hasChildren: true,
'class': 'table-condensed table-no-border', 'class': 'table-no-border',
fields: { fields: {
name: { name: {
@@ -28,10 +28,9 @@ angular.module('InventoryHostsDefinition', [])
label: 'Hosts', label: 'Hosts',
ngClick: "editHost(host.id)", ngClick: "editHost(host.id)",
searchPlaceholder: "search_place_holder", searchPlaceholder: "search_place_holder",
columnClass: 'col-lg-10 col-md-10 col-sm-10 col-xs-9', columnClass: 'col-lg-10 col-md-10 col-sm-10 col-xs-7',
dataHostId: "{{ host.id }}", dataHostId: "{{ host.id }}",
dataType: "host", dataType: "host"
awDraggable: "true"
}, },
enabled: { enabled: {
label: 'Disabled?', label: 'Disabled?',
@@ -51,7 +50,7 @@ angular.module('InventoryHostsDefinition', [])
fieldActions: { fieldActions: {
columnClass: 'col-lg-2 col-md-2 col-sm-2 col-xs-3', columnClass: 'col-lg-2 col-md-2 col-sm-2 col-xs-5',
label: false, label: false,
enabled_flag: { enabled_flag: {