Inventory refactor: save changes to a host now updates the enabled flag and tool tip on the host list.

This commit is contained in:
Chris Houseknecht 2014-01-13 22:25:05 +00:00
parent 6caa3cfec9
commit b81e7ad967
2 changed files with 9 additions and 5 deletions

View File

@ -47,6 +47,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
scope.removePostRefresh = scope.$on('PostRefresh', function(e) {
for (var i=0; i < scope.hosts.length; i++) {
//Set tooltip for host enabled flag
scope.hosts[i].enabled_flag = scope.hosts[i].enabled;
SetEnabledMsg(scope.hosts[i]);
}
Wait('stop');
@ -336,9 +337,9 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
.factory('HostsEdit', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'HostForm', 'GenerateForm',
'Prompt', 'ProcessErrors', 'GetBasePath', 'HostsReload', 'ParseTypeChange', 'Wait', 'Find',
'Prompt', 'ProcessErrors', 'GetBasePath', 'HostsReload', 'ParseTypeChange', 'Wait', 'Find', 'SetEnabledMsg',
function($rootScope, $location, $log, $routeParams, Rest, Alert, HostForm, GenerateForm, Prompt, ProcessErrors,
GetBasePath, HostsReload, ParseTypeChange, Wait, Find) {
GetBasePath, HostsReload, ParseTypeChange, Wait, Find, SetEnabledMsg) {
return function(params) {
var parent_scope = params.scope;
@ -428,6 +429,9 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H
// Update the name on the list
var host = Find({ list: parent_scope.hosts, key: 'id', val: host_id });
host.name = scope.name;
host.enabled = scope.enabled;
host.enabled_flag = scope.enabled;
SetEnabledMsg(host);
// Close modal
Wait('stop');
$('#form-modal').modal('hide');

View File

@ -61,7 +61,7 @@ angular.module('InventoryHostsDefinition', [])
},
fieldActions: {
enabled_flag: {
enabled_flag: {
//label: 'Enabled',
iconClass: "\{\{ 'fa icon-enabled-' + host.enabled \}\}",
dataPlacement: 'top',
@ -69,13 +69,13 @@ angular.module('InventoryHostsDefinition', [])
dataTipWatch: "host.enabledToolTip",
ngClick: "toggleHostEnabled(\{\{ host.id \}\}, \{\{ host.has_inventory_sources \}\})"
},
active_failures: {
active_failures: {
//label: 'Job Status',
awToolTip: "\{\{ host.badgeToolTip \}\}",
dataPlacement: 'top',
iconClass: "\{\{ 'fa icon-failures-' + host.has_active_failures \}\}"
},
edit: {
edit: {
//label: 'Edit',
ngClick: "editHost(\{\{ host.id \}\})",
icon: 'icon-edit',