diff --git a/awx/ui/client/legacy-styles/ansible-ui.less b/awx/ui/client/legacy-styles/ansible-ui.less
index ad3cff4442..a3679b2142 100644
--- a/awx/ui/client/legacy-styles/ansible-ui.less
+++ b/awx/ui/client/legacy-styles/ansible-ui.less
@@ -1032,12 +1032,6 @@ input[type="checkbox"].checkbox-no-label {
border-top: none;
}
-/* Less padding on .table-condensed */
-.table-condensed>tbody>tr>td,
-.table-condensed>thead>tr>th {
- padding: 0.5em 0.6em;
-}
-
.table > tbody > tr > td{
padding: 0.5em 0.6em;
&.actions{
@@ -1049,6 +1043,17 @@ input[type="checkbox"].checkbox-no-label {
}
}
+/* Less padding on .table-condensed */
+.table-condensed>tbody>tr>td:not(:last-child),
+.table-condensed>thead>tr>th:not(:last-child) {
+ padding: 0.5em 20px 0.5em 0px;
+}
+
+.table-condensed>tbody>tr>td:last-child,
+.table-condensed>thead>tr>th:last-child {
+ padding: 0.5em 0px;
+}
+
.table.table-condensed.flyout {
thead>tr>th {
padding-left: 0;
diff --git a/awx/ui/client/src/inventories/copy-move/copy-move-groups.controller.js b/awx/ui/client/src/inventories/copy-move/copy-move-groups.controller.js
index d982560725..3dc0bc0a27 100644
--- a/awx/ui/client/src/inventories/copy-move/copy-move-groups.controller.js
+++ b/awx/ui/client/src/inventories/copy-move/copy-move-groups.controller.js
@@ -7,20 +7,34 @@
export default
['$scope', '$state', '$stateParams', 'GroupManageService', 'CopyMoveGroupList', 'group', 'Dataset', '$rootScope',
function($scope, $state, $stateParams, GroupManageService, CopyMoveGroupList, group, Dataset, $rootScope){
- var list = CopyMoveGroupList;
+ let list = CopyMoveGroupList;
+
+ function init(){
+ $scope.atRootLevel = $stateParams.group ? false : true;
+
+ // search init
+ $scope.list = list;
+ $scope[`${list.iterator}_dataset`] = Dataset.data;
+ $scope[list.name] = $scope[`${list.iterator}_dataset`].results;
+
+ $scope.item = group;
+ $rootScope.breadcrumb.copyMoveName = group.name;
+ $scope.submitMode = $stateParams.groups === undefined ? 'move' : 'copy';
+ }
+
+ init();
- $scope.item = group;
- $rootScope.breadcrumb.copyMoveName = group.name;
- $scope.submitMode = $stateParams.groups === undefined ? 'move' : 'copy';
$scope.toggle_row = function(id){
// toggle off anything else currently selected
_.forEach($scope.groups, (item) => {return item.id === id ? item.checked = 1 : item.checked = null;});
// yoink the currently selected thing
$scope.selected = _.find($scope.groups, (item) => {return item.id === id;});
};
+
$scope.formCancel = function(){
$state.go('^');
};
+
$scope.formSave = function(){
switch($scope.submitMode) {
case 'copy':
@@ -48,6 +62,7 @@
}
}
};
+
$scope.toggleTargetRootGroup = function(){
$scope.selected = !$scope.selected;
// cannot perform copy operations to root group level
@@ -60,14 +75,4 @@
});
};
- function init(){
- $scope.atRootLevel = $stateParams.group ? false : true;
-
- // search init
- $scope.list = list;
- $scope[`${list.iterator}_dataset`] = Dataset.data;
- $scope[list.name] = $scope[`${list.iterator}_dataset`].results;
- }
-
- init();
}];
diff --git a/awx/ui/client/src/inventories/copy-move/copy-move-hosts.controller.js b/awx/ui/client/src/inventories/copy-move/copy-move-hosts.controller.js
index 47120e472a..a31f51676a 100644
--- a/awx/ui/client/src/inventories/copy-move/copy-move-hosts.controller.js
+++ b/awx/ui/client/src/inventories/copy-move/copy-move-hosts.controller.js
@@ -7,11 +7,21 @@
export default
['$scope', '$state', '$stateParams', 'HostManageService', 'CopyMoveGroupList', 'host', 'Dataset', '$rootScope',
function($scope, $state, $stateParams, HostManageService, CopyMoveGroupList, host, Dataset, $rootScope){
- var list = CopyMoveGroupList;
+ let list = CopyMoveGroupList;
+
+ let init = function(){
+ // search init
+ $scope.list = list;
+ $scope[`${list.iterator}_dataset`] = Dataset.data;
+ $scope[list.name] = $scope[`${list.iterator}_dataset`].results;
+
+ $scope.item = host;
+ $rootScope.breadcrumb.copyMoveName = host.name;
+ $scope.submitMode = 'copy';
+ };
+
+ init();
- $scope.item = host;
- $rootScope.breadcrumb.copyMoveName = host.name;
- $scope.submitMode = 'copy';
$scope.toggle_row = function(id){
// toggle off anything else currently selected
_.forEach($scope.groups, (item) => {return item.id === id ? item.checked = 1 : item.checked = null;});
@@ -40,12 +50,4 @@
break;
}
};
- var init = function(){
- // search init
- $scope.list = list;
- $scope[`${list.iterator}_dataset`] = Dataset.data;
- $scope[list.name] = $scope[`${list.iterator}_dataset`].results;
-
- };
- init();
}];
diff --git a/awx/ui/client/src/inventories/groups/list/groups-list.controller.js b/awx/ui/client/src/inventories/groups/list/groups-list.controller.js
index 35a6549289..c641419a98 100644
--- a/awx/ui/client/src/inventories/groups/list/groups-list.controller.js
+++ b/awx/ui/client/src/inventories/groups/list/groups-list.controller.js
@@ -6,10 +6,10 @@
export default
['$scope', '$rootScope', '$state', '$stateParams', 'GroupList', 'InventoryUpdate',
'GroupManageService', 'CancelSourceUpdate', 'rbacUiControlService', 'GetBasePath',
- 'GetHostsStatusMsg', 'Dataset', 'Find', 'QuerySet', 'inventoryData',
+ 'GetHostsStatusMsg', 'Dataset', 'Find', 'QuerySet', 'inventoryData', 'canAdd',
function($scope, $rootScope, $state, $stateParams, GroupList, InventoryUpdate,
GroupManageService, CancelSourceUpdate, rbacUiControlService, GetBasePath,
- GetHostsStatusMsg, Dataset, Find, qs, inventoryData){
+ GetHostsStatusMsg, Dataset, Find, qs, inventoryData, canAdd){
let list = GroupList;
@@ -18,12 +18,7 @@
function init(){
$scope.inventory_id = $stateParams.inventory_id;
$scope.canAdhoc = inventoryData.summary_fields.user_capabilities.adhoc;
- $scope.canAdd = false;
-
- rbacUiControlService.canAdd(GetBasePath('inventory') + $scope.inventory_id + "/groups")
- .then(function(canAdd) {
- $scope.canAdd = canAdd;
- });
+ $scope.canAdd = canAdd;
// Search init
$scope.list = list;
@@ -36,7 +31,7 @@
}
$scope.inventory_id = $stateParams.inventory_id;
-
+
$scope.$watchCollection(list.name, function(){
_.forEach($scope[list.name], buildStatusIndicators);
});
diff --git a/awx/ui/client/src/inventories/groups/list/groups-list.route.js b/awx/ui/client/src/inventories/groups/list/groups-list.route.js
index fb9ef19167..e03af1c325 100644
--- a/awx/ui/client/src/inventories/groups/list/groups-list.route.js
+++ b/awx/ui/client/src/inventories/groups/list/groups-list.route.js
@@ -20,6 +20,15 @@ export default {
],
inventoryData: ['InventoryManageService', '$stateParams', function(InventoryManageService, $stateParams) {
return InventoryManageService.getInventory($stateParams.inventory_id).then(res => res.data);
+ }],
+ canAdd: ['rbacUiControlService', '$state', 'GetBasePath', '$stateParams', function(rbacUiControlService, $state, GetBasePath, $stateParams) {
+ return rbacUiControlService.canAdd(GetBasePath('inventory') + $stateParams.inventory_id + "/groups")
+ .then(function(res) {
+ return res.canAdd;
+ })
+ .catch(function() {
+ return false;
+ });
}]
},
params: {
diff --git a/awx/ui/client/src/inventories/groups/nested-groups/nested-groups-add.controller.js b/awx/ui/client/src/inventories/groups/nested-groups/nested-groups-add.controller.js
index 76e6d1329f..1d97263e82 100644
--- a/awx/ui/client/src/inventories/groups/nested-groups/nested-groups-add.controller.js
+++ b/awx/ui/client/src/inventories/groups/nested-groups/nested-groups-add.controller.js
@@ -7,11 +7,11 @@
export default ['$state', '$stateParams', '$scope', 'NestedGroupForm',
'ParseTypeChange', 'GenerateForm', 'inventoryData', 'GroupManageService',
'GetChoices', 'GetBasePath', 'CreateSelect2',
- 'rbacUiControlService', 'ToJSON',
+ 'rbacUiControlService', 'ToJSON', 'canAdd',
function($state, $stateParams, $scope, NestedGroupForm, ParseTypeChange,
GenerateForm, inventoryData, GroupManageService, GetChoices,
GetBasePath, CreateSelect2, rbacUiControlService,
- ToJSON) {
+ ToJSON, canAdd) {
let form = NestedGroupForm;
init();
@@ -19,11 +19,7 @@ export default ['$state', '$stateParams', '$scope', 'NestedGroupForm',
function init() {
// apply form definition's default field values
GenerateForm.applyDefaults(form, $scope);
-
- rbacUiControlService.canAdd(GetBasePath('inventory') + $stateParams.inventory_id + "/groups")
- .then(function(canAdd) {
- $scope.canAdd = canAdd;
- });
+ $scope.canAdd = canAdd;
$scope.parseType = 'yaml';
$scope.envParseType = 'yaml';
ParseTypeChange({
diff --git a/awx/ui/client/src/inventories/groups/nested-groups/nested-groups-add.route.js b/awx/ui/client/src/inventories/groups/nested-groups/nested-groups-add.route.js
index 78f866e2b9..90fe46817f 100644
--- a/awx/ui/client/src/inventories/groups/nested-groups/nested-groups-add.route.js
+++ b/awx/ui/client/src/inventories/groups/nested-groups/nested-groups-add.route.js
@@ -18,5 +18,16 @@ export default {
},
controller: 'NestedGroupsAddController'
}
+ },
+ resolve: {
+ canAdd: ['rbacUiControlService', '$state', 'GetBasePath', '$stateParams', function(rbacUiControlService, $state, GetBasePath, $stateParams) {
+ return rbacUiControlService.canAdd(GetBasePath('inventory') + $stateParams.inventory_id + "/groups")
+ .then(function(res) {
+ return res.canAdd;
+ })
+ .catch(function() {
+ return false;
+ });
+ }]
}
};
diff --git a/awx/ui/client/src/inventories/groups/nested-groups/nested-groups-list.controller.js b/awx/ui/client/src/inventories/groups/nested-groups/nested-groups-list.controller.js
index e5a72b9c2f..ee1a0cc2d3 100644
--- a/awx/ui/client/src/inventories/groups/nested-groups/nested-groups-list.controller.js
+++ b/awx/ui/client/src/inventories/groups/nested-groups/nested-groups-list.controller.js
@@ -6,10 +6,10 @@
export default
['$scope', '$rootScope', '$state', '$stateParams', 'NestedGroupListDefinition', 'InventoryUpdate',
'GroupManageService', 'CancelSourceUpdate', 'rbacUiControlService', 'GetBasePath',
- 'GetHostsStatusMsg', 'Dataset', 'Find', 'QuerySet', 'inventoryData',
+ 'GetHostsStatusMsg', 'Dataset', 'Find', 'QuerySet', 'inventoryData', 'canAdd',
function($scope, $rootScope, $state, $stateParams, NestedGroupListDefinition, InventoryUpdate,
GroupManageService, CancelSourceUpdate, rbacUiControlService, GetBasePath,
- GetHostsStatusMsg, Dataset, Find, qs, inventoryData){
+ GetHostsStatusMsg, Dataset, Find, qs, inventoryData, canAdd){
let list = NestedGroupListDefinition;
@@ -18,12 +18,7 @@
function init(){
$scope.inventory_id = $stateParams.inventory_id;
$scope.canAdhoc = inventoryData.summary_fields.user_capabilities.adhoc;
- $scope.canAdd = false;
-
- rbacUiControlService.canAdd(GetBasePath('inventory') + $scope.inventory_id + "/groups")
- .then(function(canAdd) {
- $scope.canAdd = canAdd;
- });
+ $scope.canAdd = canAdd;
// Search init
$scope.list = list;
diff --git a/awx/ui/client/src/inventories/groups/nested-groups/nested-groups.route.js b/awx/ui/client/src/inventories/groups/nested-groups/nested-groups.route.js
index 433cabf0e9..a01c311f9c 100644
--- a/awx/ui/client/src/inventories/groups/nested-groups/nested-groups.route.js
+++ b/awx/ui/client/src/inventories/groups/nested-groups/nested-groups.route.js
@@ -59,6 +59,15 @@ export default {
inventoryData: ['InventoryManageService', '$stateParams', 'host', function(InventoryManageService, $stateParams, host) {
var id = ($stateParams.inventory_id) ? $stateParams.inventory_id : host.summary_fields.inventory.id;
return InventoryManageService.getInventory(id).then(res => res.data);
+ }],
+ canAdd: ['rbacUiControlService', '$state', 'GetBasePath', '$stateParams', function(rbacUiControlService, $state, GetBasePath, $stateParams) {
+ return rbacUiControlService.canAdd(GetBasePath('inventory') + $stateParams.inventory_id + "/groups")
+ .then(function(res) {
+ return res.canAdd;
+ })
+ .catch(function() {
+ return false;
+ });
}]
}
};
diff --git a/awx/ui/client/src/inventories/groups/nested-hosts/nested-hosts-add.route.js b/awx/ui/client/src/inventories/groups/nested-hosts/nested-hosts-add.route.js
index 2006735dde..3559192274 100644
--- a/awx/ui/client/src/inventories/groups/nested-hosts/nested-hosts-add.route.js
+++ b/awx/ui/client/src/inventories/groups/nested-hosts/nested-hosts-add.route.js
@@ -18,5 +18,16 @@ export default {
},
controller: 'RelatedHostAddController'
}
+ },
+ resolve: {
+ canAdd: ['rbacUiControlService', 'GetBasePath', '$stateParams', function(rbacUiControlService, GetBasePath, $stateParams) {
+ return rbacUiControlService.canAdd(GetBasePath('inventory') + $stateParams.inventory_id + "/hosts")
+ .then(function(res) {
+ return res.canAdd;
+ })
+ .catch(function() {
+ return false;
+ });
+ }]
}
};
diff --git a/awx/ui/client/src/inventories/groups/nested-hosts/nested-hosts-list.controller.js b/awx/ui/client/src/inventories/groups/nested-hosts/nested-hosts-list.controller.js
index ad3bc20b2b..813b99fee2 100644
--- a/awx/ui/client/src/inventories/groups/nested-hosts/nested-hosts-list.controller.js
+++ b/awx/ui/client/src/inventories/groups/nested-hosts/nested-hosts-list.controller.js
@@ -6,24 +6,19 @@
export default ['$scope', 'NestedHostsListDefinition', '$rootScope', 'GetBasePath',
'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait',
- 'HostManageService', 'SetStatus',
+ 'HostManageService', 'SetStatus', 'canAdd',
function($scope, NestedHostsListDefinition, $rootScope, GetBasePath,
rbacUiControlService, Dataset, $state, $filter, Prompt, Wait,
- HostManageService, SetStatus) {
+ HostManageService, SetStatus, canAdd) {
let list = NestedHostsListDefinition;
init();
function init(){
- $scope.canAdd = false;
+ $scope.canAdd = canAdd;
$scope.enableSmartInventoryButton = false;
- rbacUiControlService.canAdd('hosts')
- .then(function(canAdd) {
- $scope.canAdd = canAdd;
- });
-
// Search init
$scope.list = list;
$scope[`${list.iterator}_dataset`] = Dataset.data;
diff --git a/awx/ui/client/src/inventories/groups/nested-hosts/nested-hosts.route.js b/awx/ui/client/src/inventories/groups/nested-hosts/nested-hosts.route.js
index bbfa7d8a79..2182a522cf 100644
--- a/awx/ui/client/src/inventories/groups/nested-hosts/nested-hosts.route.js
+++ b/awx/ui/client/src/inventories/groups/nested-hosts/nested-hosts.route.js
@@ -53,6 +53,15 @@ export default {
],
inventoryData: ['InventoryManageService', '$stateParams', function(InventoryManageService, $stateParams) {
return InventoryManageService.getInventory($stateParams.inventory_id).then(res => res.data);
+ }],
+ canAdd: ['rbacUiControlService', function(rbacUiControlService) {
+ return rbacUiControlService.canAdd('hosts')
+ .then(function(res) {
+ return res.canAdd;
+ })
+ .catch(function() {
+ return false;
+ });
}]
}
};
diff --git a/awx/ui/client/src/inventories/hosts/list/host-list.controller.js b/awx/ui/client/src/inventories/hosts/list/host-list.controller.js
index 47c41f508d..e906052a79 100644
--- a/awx/ui/client/src/inventories/hosts/list/host-list.controller.js
+++ b/awx/ui/client/src/inventories/hosts/list/host-list.controller.js
@@ -7,21 +7,16 @@
function HostsList($scope, HostsList, $rootScope, GetBasePath,
rbacUiControlService, Dataset, $state, $filter, Prompt, Wait,
- HostManageService, SetStatus) {
+ HostManageService, SetStatus, canAdd) {
let list = HostsList;
init();
function init(){
- $scope.canAdd = false;
+ $scope.canAdd = canAdd;
$scope.enableSmartInventoryButton = false;
- rbacUiControlService.canAdd('hosts')
- .then(function(canAdd) {
- $scope.canAdd = canAdd;
- });
-
// Search init
$scope.list = list;
$scope[`${list.iterator}_dataset`] = Dataset.data;
@@ -141,5 +136,5 @@ function HostsList($scope, HostsList, $rootScope, GetBasePath,
export default ['$scope', 'HostsList', '$rootScope', 'GetBasePath',
'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait',
- 'HostManageService', 'SetStatus', HostsList
+ 'HostManageService', 'SetStatus', 'canAdd', HostsList
];
diff --git a/awx/ui/client/src/inventories/inventories.route.js b/awx/ui/client/src/inventories/inventories.route.js
index 694f68e274..8b982100e7 100644
--- a/awx/ui/client/src/inventories/inventories.route.js
+++ b/awx/ui/client/src/inventories/inventories.route.js
@@ -29,6 +29,15 @@ export default {
let path = GetBasePath(list.basePath) || GetBasePath(list.name);
return qs.search(path, $stateParams[`${list.iterator}_search`]);
}
- ]
+ ],
+ canAdd: ['rbacUiControlService', function(rbacUiControlService) {
+ return rbacUiControlService.canAdd('inventory')
+ .then(function(res) {
+ return res.canAdd;
+ })
+ .catch(function() {
+ return false;
+ });
+ }]
}
};
diff --git a/awx/ui/client/src/inventories/inventory.list.js b/awx/ui/client/src/inventories/inventory.list.js
index 9dfaa20a78..c729768188 100644
--- a/awx/ui/client/src/inventories/inventory.list.js
+++ b/awx/ui/client/src/inventories/inventory.list.js
@@ -27,6 +27,7 @@ export default ['i18n', function(i18n) {
ngClick: "null",
iconOnly: true,
excludeModal: true,
+ template: `
| Status | "; + html += "Finished | "; + html += "Name | "; + html += "
|---|---|---|
| \n"; + html += " | " + ($filter('longDate')(row.finished)) + " | "; + html += "" + $filter('sanitize')(ellipsis(row.name)) + " | "; + html += "
No recent job data available for this inventory.
\n"; + } + attachElem(event, html, title); + }; + + scope.showHostSummary = function(event) { + try{ + var elem = $(event.target).parent(); + // if the popover is visible already, then exit the function here + if(elem.data()['bs.popover'].tip().hasClass('in')){ + return; + } + } + catch(err){ + scope.gatherRecentJobs(event); + } + }; + + } + }; + } +]; diff --git a/awx/ui/client/src/inventories/list/host-summary-popover/host-summary-popover.partial.html b/awx/ui/client/src/inventories/list/host-summary-popover/host-summary-popover.partial.html new file mode 100644 index 0000000000..d990230dcb --- /dev/null +++ b/awx/ui/client/src/inventories/list/host-summary-popover/host-summary-popover.partial.html @@ -0,0 +1,3 @@ + + + diff --git a/awx/ui/client/src/inventories/list/host-summary-popover/main.js b/awx/ui/client/src/inventories/list/host-summary-popover/main.js new file mode 100644 index 0000000000..e2b88a1d06 --- /dev/null +++ b/awx/ui/client/src/inventories/list/host-summary-popover/main.js @@ -0,0 +1,7 @@ +import directive from './host-summary-popover.directive'; +import controller from './host-summary-popover.controller'; + +export default +angular.module('HostSummaryPopoverModule', []) + .directive('hostSummaryPopover', directive) + .controller('HostSummaryPopoverController', controller); diff --git a/awx/ui/client/src/inventories/list/inventory-list.controller.js b/awx/ui/client/src/inventories/list/inventory-list.controller.js index e853f13336..3bcfbb83a7 100644 --- a/awx/ui/client/src/inventories/list/inventory-list.controller.js +++ b/awx/ui/client/src/inventories/list/inventory-list.controller.js @@ -10,10 +10,10 @@ * @description This controller's for the Inventory page */ -function InventoriesList($scope, $rootScope, $location, - $compile, $filter, Rest, InventoryList, Prompt, - ProcessErrors, GetBasePath, Wait, Find, Empty, $state, - rbacUiControlService, Dataset, InventoryUpdate) { +function InventoriesList($scope, + $filter, Rest, InventoryList, Prompt, + ProcessErrors, GetBasePath, Wait, $state, + Dataset, InventoryUpdate, canAdd) { let list = InventoryList, defaultUrl = GetBasePath('inventory'); @@ -21,12 +21,7 @@ function InventoriesList($scope, $rootScope, $location, init(); function init(){ - $scope.canAdd = false; - - rbacUiControlService.canAdd('inventory') - .then(function(canAdd) { - $scope.canAddInventory = canAdd; - }); + $scope.canAddInventory = canAdd; $scope.$watchCollection(list.name, function(){ _.forEach($scope[list.name], processInventoryRow); @@ -36,230 +31,43 @@ function InventoriesList($scope, $rootScope, $location, $scope.list = list; $scope[`${list.iterator}_dataset`] = Dataset.data; $scope[list.name] = $scope[`${list.iterator}_dataset`].results; - - $rootScope.flashMessage = null; } function processInventoryRow(inventory) { - buildStatusIndicators(inventory); - buildInventoryTypeLabel(inventory); - } + inventory.launch_class = ""; + inventory.host_status_class = "Inventories-hostStatus"; - function buildStatusIndicators(inventory){ - inventory.launch_class = ""; - inventory.host_status_class = "Inventories-hostStatus"; - - if (inventory.has_inventory_sources) { - if (inventory.inventory_sources_with_failures > 0) { - inventory.syncStatus = 'error'; - inventory.syncTip = inventory.inventory_sources_with_failures + ' sources with sync failures. Click for details'; - } - else { - inventory.syncStatus = 'successful'; - inventory.syncTip = 'No inventory sync failures. Click for details.'; - } + if (inventory.has_inventory_sources) { + if (inventory.inventory_sources_with_failures > 0) { + inventory.syncStatus = 'error'; + inventory.syncTip = inventory.inventory_sources_with_failures + ' sources with sync failures. Click for details'; } else { - inventory.syncStatus = 'na'; - inventory.syncTip = 'Not configured for inventory sync.'; - inventory.launch_class = "btn-disabled"; + inventory.syncStatus = 'successful'; + inventory.syncTip = 'No inventory sync failures. Click for details.'; } - - if (inventory.has_active_failures) { - inventory.hostsStatus = 'error'; - inventory.hostsTip = inventory.hosts_with_active_failures + ' hosts with failures. Click for details.'; - } - else if (inventory.total_hosts) { - inventory.hostsStatus = 'successful'; - inventory.hostsTip = 'No hosts with failures. Click for details.'; - } - else { - inventory.hostsStatus = 'none'; - inventory.hostsTip = 'Inventory contains 0 hosts.'; - } - } - - function buildInventoryTypeLabel(inventory) { - inventory.kind_label = inventory.kind === '' ? 'Inventory' : (inventory.kind === 'smart' ? 'Smart Inventory': 'Inventory'); - } - - function ellipsis(a) { - if (a.length > 20) { - return a.substr(0,20) + '...'; - } - return a; - } - - function attachElem(event, html, title) { - var elem = $(event.target).parent(); - try { - elem.tooltip('hide'); - elem.popover('destroy'); - } - catch(err) { - //ignore - } - $('.popover').each(function() { - // remove lingering popover| Status | "; - html += "Finished | "; - html += "Name | "; - html += "
|---|---|---|
| \n"; - html += " | " + ($filter('longDate')(row.finished)).replace(/ /,' ') + " | ";
- html += "" + $filter('sanitize')(ellipsis(row.name)) + " | "; - html += "
No recent job data available for this inventory.
\n"; + inventory.syncStatus = 'na'; + inventory.syncTip = 'Not configured for inventory sync.'; + inventory.launch_class = "btn-disabled"; } - attachElem(event, html, title); - }); - if ($scope.removeSourceSummaryReady) { - $scope.removeSourceSummaryReady(); + if (inventory.has_active_failures) { + inventory.hostsStatus = 'error'; + inventory.hostsTip = inventory.hosts_with_active_failures + ' hosts with failures. Click for details.'; + } + else if (inventory.total_hosts) { + inventory.hostsStatus = 'successful'; + inventory.hostsTip = 'No hosts with failures. Click for details.'; + } + else { + inventory.hostsStatus = 'none'; + inventory.hostsTip = 'Inventory contains 0 hosts.'; + } + + inventory.kind_label = inventory.kind === '' ? 'Inventory' : (inventory.kind === 'smart' ? 'Smart Inventory': 'Inventory'); } - $scope.removeSourceSummaryReady = $scope.$on('SourceSummaryReady', function(e, event, inventory, data) { - var html, title; - - Wait('stop'); - - // Build the html for our popover - html = "| Status | "; - html += "Last Sync | "; - html += "Source | "; - html += "
|---|---|---|
| `; - html += " | " + ($filter('longDate')(row.last_updated)).replace(/ /,' ') + " | ";
- html += "" + $filter('sanitize')(ellipsis(row.name)) + " | "; - html += "
| "; - html += " | NA | "; - html += "" + $filter('sanitize')(ellipsis(row.name)) + " | "; - html += "
| Status | "; + html += "Last Sync | "; + html += "Source | "; + html += "
|---|---|---|
| `; + html += " | " + ($filter('longDate')(row.last_updated)) + " | "; + html += "" + $filter('sanitize')(ellipsis(row.name)) + " | "; + html += "
| "; + html += " | NA | "; + html += "" + $filter('sanitize')(ellipsis(row.name)) + " | "; + html += "