From b81e7ad9678fdcb3554515ade20aa11fd9afa871 Mon Sep 17 00:00:00 2001 From: Chris Houseknecht Date: Mon, 13 Jan 2014 22:25:05 +0000 Subject: [PATCH] Inventory refactor: save changes to a host now updates the enabled flag and tool tip on the host list. --- awx/ui/static/js/helpers/Hosts.js | 8 ++++++-- awx/ui/static/js/lists/InventoryHosts.js | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/awx/ui/static/js/helpers/Hosts.js b/awx/ui/static/js/helpers/Hosts.js index 921257b4ba..b39377f3af 100644 --- a/awx/ui/static/js/helpers/Hosts.js +++ b/awx/ui/static/js/helpers/Hosts.js @@ -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'); diff --git a/awx/ui/static/js/lists/InventoryHosts.js b/awx/ui/static/js/lists/InventoryHosts.js index 0809886692..c879acc24e 100644 --- a/awx/ui/static/js/lists/InventoryHosts.js +++ b/awx/ui/static/js/lists/InventoryHosts.js @@ -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',