adjustments to host list

adding Inventory column and disabling host toggle for external sources
This commit is contained in:
jaredevantabor 2017-04-05 16:46:12 -07:00 committed by Jared Tabor
parent f9b46b7c3d
commit 3bcb4b0496
2 changed files with 33 additions and 6 deletions

View File

@ -21,7 +21,7 @@ export default ['i18n', function(i18n) {
fields: {
toggleHost: {
ngDisabled: "!host.summary_fields.user_capabilities.edit",
ngDisabled: 'host.has_inventory_sources',
label: '',
columnClass: 'List-staticColumn--toggle',
type: "toggle",
@ -54,13 +54,20 @@ export default ['i18n', function(i18n) {
},
name: {
key: true,
label: 'Name',
label: i18n._('Name'),
ngClick: "editHost(host.id)",
columnClass: 'col-lg-6 col-md-8 col-sm-8 col-xs-7',
dataHostId: "{{ host.id }}",
dataType: "host",
class: 'InventoryManage-breakWord'
}
},
inventory_name: {
label: i18n._('Inventory'),
sourceModel: 'inventory',
sourceField: 'name',
columnClass: 'col-lg-5 col-md-4 col-sm-4 hidden-xs elllipsis',
linkTo: "{{ '/#/inventories/' + host.inventory_id }}"
},
},
fieldActions: {

View File

@ -5,7 +5,8 @@
*************************************************/
function HostsList($scope, HostsNewList, $rootScope, GetBasePath,
rbacUiControlService, Dataset, $state, $filter, Prompt, Wait, HostManageService) {
rbacUiControlService, Dataset, $state, $filter, Prompt, Wait,
HostManageService, SetStatus) {
let list = HostsNewList;
@ -26,6 +27,24 @@ function HostsList($scope, HostsNewList, $rootScope, GetBasePath,
$rootScope.flashMessage = null;
$scope.$watchCollection(list.name, function() {
$scope[list.name] = _.map($scope.hosts, function(value) {
value.inventory_name = value.summary_fields.inventory.name;
value.inventory_id = value.summary_fields.inventory.id;
return value;
});
setJobStatus();
});
}
function setJobStatus(){
_.forEach($scope.hosts, function(value) {
SetStatus({
scope: $scope,
host: value
});
});
}
$scope.createHost = function(){
@ -58,7 +77,7 @@ function HostsList($scope, HostsNewList, $rootScope, GetBasePath,
});
$rootScope.promptActionBtnClass = 'Modal-errorButton';
};
$scope.toggleHost = function(event, host) {
try {
$(event.target).tooltip('hide');
@ -76,5 +95,6 @@ function HostsList($scope, HostsNewList, $rootScope, GetBasePath,
}
export default ['$scope', 'HostsNewList', '$rootScope', 'GetBasePath',
'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait', 'HostManageService', HostsList
'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait',
'HostManageService', 'SetStatus', HostsList
];