From 8955dbf59462ee128a481624eb1b6341c59d58e6 Mon Sep 17 00:00:00 2001 From: chouseknecht Date: Tue, 8 Oct 2013 12:46:14 -0400 Subject: [PATCH] Latest UI changes --- awx/ui/static/js/controllers/Inventories.js | 13 ++++++++--- awx/ui/static/js/helpers/Groups.js | 2 +- awx/ui/static/js/lists/Inventories.js | 24 ++++++++++++++++++--- awx/ui/static/js/lists/InventorySummary.js | 2 +- awx/ui/static/less/ansible-ui.less | 17 ++++++++++++++- awx/ui/static/lib/ansible/RestServices.js | 12 +++++++++++ 6 files changed, 61 insertions(+), 9 deletions(-) diff --git a/awx/ui/static/js/controllers/Inventories.js b/awx/ui/static/js/controllers/Inventories.js index 91b5450d8c..f7672ee4bf 100644 --- a/awx/ui/static/js/controllers/Inventories.js +++ b/awx/ui/static/js/controllers/Inventories.js @@ -39,9 +39,16 @@ function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Res if (scope.inventories[i].hosts_with_active_failures > 0) { scope.inventories[i].active_failures_params = "/?has_active_failures=true"; } - //if (scope.inventories[i].hosts_with_active_failures < 99) { - // scope.inventories[i].hosts_with_active_failures = ('00' + scope.inventories[i].hosts_with_active_failures).substr(-2); - //} + if (scope.inventories[i].has_inventory_sources) { + //scope.inventories[i].inventory_source = 'external'; + scope.inventories[i].has_inventory_tip = 'Has one or more external sources. Click to view details.'; + scope.inventories[i].has_inventory_link = '/#/inventories/' + scope.inventories[i].id + '/groups'; + } + else { + //scope.inventories[i].inventory_source = 'manual'; + scope.inventories[i].has_inventory_tip = 'Has no external sources. Click to view details'; + scope.inventories[i].has_inventory_link = '/#/inventories/' + scope.inventories[i].id + '/groups'; + } } }); diff --git a/awx/ui/static/js/helpers/Groups.js b/awx/ui/static/js/helpers/Groups.js index a4890730bb..4db3bb2c27 100644 --- a/awx/ui/static/js/helpers/Groups.js +++ b/awx/ui/static/js/helpers/Groups.js @@ -17,7 +17,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' return [ { label: 'Manual', value: null }, { label: 'Amazon EC2', value: 'ec2' }, - { label: 'Rackspace', value: 'rackspace' }, + { label: 'Rackspace', value: 'rackspace' } ]; } }]) diff --git a/awx/ui/static/js/lists/Inventories.js b/awx/ui/static/js/lists/Inventories.js index b217d1df8b..bd7c3a0c88 100644 --- a/awx/ui/static/js/lists/Inventories.js +++ b/awx/ui/static/js/lists/Inventories.js @@ -32,12 +32,23 @@ angular.module('InventoriesListDefinition', []) ngHref: '/#/inventories/{{ inventory.id }}/hosts{{ inventory.active_failures_params }}', type: 'badgeCount', "class": "{{ 'failures-' + inventory.has_active_failures }}", - //badgeIcon: "\{\{ 'icon-failures-' + inventory.has_active_failures \}\}", - //badgePlacement: 'left', awToolTip: '# of hosts with failed jobs. Click to view hosts.', dataPlacement: 'bottom', searchable: false }, + inventory_source: { + label: 'Source?', + //ngHref: "\{\{ inventory.has_inventory_link \}\}", + //awToolTip: "\{\{ inventory.has_inventory_tip \}\}", + //dataPlacement: 'top', + badgeNgHref: '\{\{ inventory.has_inventory_link \}\}', + badgeIcon: "\{\{ 'icon-cloud-' + inventory.has_inventory_sources \}\}", + badgePlacement: 'left', + badgeToolTip: "\{\{ inventory.has_inventory_tip \}\}", + badgeTipPlacement: 'top', + searchable: false, + nosort: true + }, organization: { label: 'Organization', ngBind: 'inventory.summary_fields.organization.name', @@ -46,8 +57,15 @@ angular.module('InventoriesListDefinition', []) sourceField: 'name', excludeModal: true }, + has_inventory_sources: { + label: 'Has external sources?', + searchSingleValue: true, + searchType: 'boolean', + searchValue: 'true', + searchOnly: true + }, has_active_failures: { - label: 'Hosts with failed jobs?', + label: 'Has hosts with failed jobs?', searchSingleValue: true, searchType: 'boolean', searchValue: 'true', diff --git a/awx/ui/static/js/lists/InventorySummary.js b/awx/ui/static/js/lists/InventorySummary.js index 44903f0ec9..17858d9b20 100644 --- a/awx/ui/static/js/lists/InventorySummary.js +++ b/awx/ui/static/js/lists/InventorySummary.js @@ -33,7 +33,7 @@ angular.module('InventorySummaryDefinition', []) type: 'badgeCount', "class": "{{ 'failures-' + group.has_active_failures }}", awToolTip: '# of hosts with job failures. Click to view hosts.', - dataPlacement: 'bottom', + dataPlacement: 'top', searchable: false, nosort: true }, diff --git a/awx/ui/static/less/ansible-ui.less b/awx/ui/static/less/ansible-ui.less index 5d16d03a4e..1964871b57 100644 --- a/awx/ui/static/less/ansible-ui.less +++ b/awx/ui/static/less/ansible-ui.less @@ -740,7 +740,22 @@ select.field-mini-height { .icon-cloud-failed { color: @red; } - + +/* Inventory cloud sourced? indicator */ + .icon-cloud-true:before, + .icon-cloud-false:before { + content: "\f0c2"; + } + + .icon-cloud-true { + color: @blue-link; + } + + .icon-cloud-false { + color: @grey; + } +/* end */ + .field-success { color: #5bb75b; } diff --git a/awx/ui/static/lib/ansible/RestServices.js b/awx/ui/static/lib/ansible/RestServices.js index 8aa7fcf854..f2ea985d0a 100644 --- a/awx/ui/static/lib/ansible/RestServices.js +++ b/awx/ui/static/lib/ansible/RestServices.js @@ -76,6 +76,18 @@ angular.module('RestServices',['ngCookies','AuthService']) else { return false; } + }, + options: function() { + var token = Authorization.getToken(); + if (token) { + return $http({method: 'OPTIONS', + url: this.url, + headers: { 'Authorization': 'Token ' + token } + }); + } + else { + return false; + } } } }]);