mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 23:17:32 -02:30
Inventory refactor bug
Calculating initial container heights and rowsize on the inventory page was not working correctly on first page load. Issue was misalignment of function declaration and injector. Also needed to add e.stopPropagtion() call in the search helper. Without it the group search refresh gets called multiple times whenever the host list is refreshed.
This commit is contained in:
@@ -534,6 +534,26 @@ function InventoriesEdit ($scope, $location, $routeParams, $compile, GenerateLis
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if ($scope.removeRowCountReady) {
|
||||||
|
$scope.removeRowCountReady();
|
||||||
|
}
|
||||||
|
$scope.removeRowCountReady = $scope.$on('RowCountReady', function(e, rows) {
|
||||||
|
// Add hosts view
|
||||||
|
$scope.show_failures = false;
|
||||||
|
InjectHosts({
|
||||||
|
group_scope: $scope,
|
||||||
|
host_scope: hostScope,
|
||||||
|
inventory_id: $scope.inventory.id,
|
||||||
|
tree_id: null,
|
||||||
|
group_id: null,
|
||||||
|
pageSize: rows
|
||||||
|
});
|
||||||
|
|
||||||
|
SearchInit({ scope: $scope, set: 'groups', list: InventoryGroups, url: $scope.inventory.related.root_groups });
|
||||||
|
PaginateInit({ scope: $scope, list: InventoryGroups , url: $scope.inventory.related.root_groups, pageSize: rows });
|
||||||
|
$scope.search(InventoryGroups.iterator, null, true);
|
||||||
|
});
|
||||||
|
|
||||||
if ($scope.removeInventoryLoaded) {
|
if ($scope.removeInventoryLoaded) {
|
||||||
$scope.removeInventoryLoaded();
|
$scope.removeInventoryLoaded();
|
||||||
}
|
}
|
||||||
@@ -570,7 +590,6 @@ function InventoriesEdit ($scope, $location, $routeParams, $compile, GenerateLis
|
|||||||
hostScope.host_page_size = rows;
|
hostScope.host_page_size = rows;
|
||||||
$scope.group_page_size = rows;
|
$scope.group_page_size = rows;
|
||||||
|
|
||||||
// Add hosts view
|
|
||||||
$scope.show_failures = false;
|
$scope.show_failures = false;
|
||||||
InjectHosts({
|
InjectHosts({
|
||||||
group_scope: $scope,
|
group_scope: $scope,
|
||||||
@@ -965,5 +984,5 @@ InventoriesEdit.$inject = ['$scope', '$location', '$routeParams', '$compile', 'G
|
|||||||
'GetBasePath', 'ProcessErrors', 'Breadcrumbs', 'InventoryGroups', 'InjectHosts', 'Find', 'HostsReload', 'SearchInit', 'PaginateInit', 'GetSyncStatusMsg',
|
'GetBasePath', 'ProcessErrors', 'Breadcrumbs', 'InventoryGroups', 'InjectHosts', 'Find', 'HostsReload', 'SearchInit', 'PaginateInit', 'GetSyncStatusMsg',
|
||||||
'GetHostsStatusMsg', 'GroupsEdit', 'InventoryUpdate', 'GroupsCancelUpdate', 'ViewUpdateStatus', 'GroupsDelete', 'Store', 'HostsEdit', 'HostsDelete',
|
'GetHostsStatusMsg', 'GroupsEdit', 'InventoryUpdate', 'GroupsCancelUpdate', 'ViewUpdateStatus', 'GroupsDelete', 'Store', 'HostsEdit', 'HostsDelete',
|
||||||
'EditInventoryProperties', 'ToggleHostEnabled', 'Stream', 'ShowJobSummary', 'InventoryGroupsHelp', 'HelpDialog', 'ViewJob', 'WatchInventoryWindowResize',
|
'EditInventoryProperties', 'ToggleHostEnabled', 'Stream', 'ShowJobSummary', 'InventoryGroupsHelp', 'HelpDialog', 'ViewJob', 'WatchInventoryWindowResize',
|
||||||
'SetContainerHeights', 'GetHostContainerRows', 'GetGroupContainerRows', 'GetGroupContainerHeight', 'GroupsCopy', 'HostsCopy'
|
'GetHostContainerRows', 'GetGroupContainerRows', 'GetGroupContainerHeight', 'GroupsCopy', 'HostsCopy'
|
||||||
];
|
];
|
||||||
@@ -237,7 +237,7 @@ function(GenerateList, InventoryHosts, HostsReload) {
|
|||||||
generator.inject(InventoryHosts, { scope: host_scope, mode: 'edit', id: 'hosts-container', breadCrumbs: false, searchSize: 'col-lg-6 col-md-6 col-sm-6' });
|
generator.inject(InventoryHosts, { scope: host_scope, mode: 'edit', id: 'hosts-container', breadCrumbs: false, searchSize: 'col-lg-6 col-md-6 col-sm-6' });
|
||||||
|
|
||||||
// Load data
|
// Load data
|
||||||
HostsReload({ scope: host_scope, group_id: group_id, inventory_id: inventory_id, parent_scope: group_scope, cpageSize: pageSize });
|
HostsReload({ scope: host_scope, group_id: group_id, inventory_id: inventory_id, parent_scope: group_scope, pageSize: pageSize });
|
||||||
};
|
};
|
||||||
}])
|
}])
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,22 @@ angular.module('InventoryHelper', ['RestServices', 'Utilities', 'OrganizationLis
|
|||||||
|
|
||||||
.factory('GetGroupContainerHeight', [ function() {
|
.factory('GetGroupContainerHeight', [ function() {
|
||||||
return function() {
|
return function() {
|
||||||
|
|
||||||
|
/*console.log('window height: ' + $(window).height());
|
||||||
|
console.log('main-menu: ' + $('.main-menu').outerHeight());
|
||||||
|
console.log('main_tabs: ' + $('#main_tabs').outerHeight());
|
||||||
|
console.log('breadcrumbs: ' + $('#breadcrumbs').outerHeight());
|
||||||
|
console.log('footer: ' + $('.site-footer').outerHeight());
|
||||||
|
console.log('group-breadcrumbs: ' + $('.group-breadcrumbs').outerHeight());
|
||||||
|
console.log('searchwidget: ' + $('#groups-container #search-widget-container').outerHeight());
|
||||||
|
console.log('group table head: ' + $('#groups_table thead').height());
|
||||||
|
console.log('subtotal: ' + ( $(window).height() - $('.main-menu').outerHeight() - $('#main_tabs').outerHeight() - $('#breadcrumbs').outerHeight() -
|
||||||
|
$('.site-footer').outerHeight() - $('.group-breadcrumbs').outerHeight() - $('#groups-container #search-widget-container').outerHeight() -
|
||||||
|
$('#groups_table thead').height() ));
|
||||||
|
*/
|
||||||
return $(window).height() - $('.main-menu').outerHeight() - $('#main_tabs').outerHeight() - $('#breadcrumbs').outerHeight() -
|
return $(window).height() - $('.main-menu').outerHeight() - $('#main_tabs').outerHeight() - $('#breadcrumbs').outerHeight() -
|
||||||
$('.site-footer').outerHeight() - $('.group-breadcrumbs').outerHeight() - $('#groups-container #search-widget-container').outerHeight() - $('#groups_table thead').height() - 70;
|
$('.site-footer').outerHeight() - $('.group-breadcrumbs').outerHeight() - $('#groups-container #search-widget-container').outerHeight() -
|
||||||
|
$('#groups_table thead').height() - 70;
|
||||||
};
|
};
|
||||||
}])
|
}])
|
||||||
|
|
||||||
|
|||||||
@@ -291,6 +291,7 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
|||||||
deferWaitStop: deferWaitStop
|
deferWaitStop: deferWaitStop
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
e.stopPropagation();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -343,7 +344,9 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
e.stopPropagation();
|
||||||
scope.$emit('prepareSearch2', iterator, page, load, calcOnly, deferWaitStop);
|
scope.$emit('prepareSearch2', iterator, page, load, calcOnly, deferWaitStop);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (scope.removePrepareSearch2) {
|
if (scope.removePrepareSearch2) {
|
||||||
@@ -433,7 +436,7 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
|||||||
scope[iterator + 'SearchParams'] += (scope[iterator + 'SearchParams']) ? '&' : '';
|
scope[iterator + 'SearchParams'] += (scope[iterator + 'SearchParams']) ? '&' : '';
|
||||||
scope[iterator + 'SearchParams'] += 'order_by=' + encodeURI(sort_order);
|
scope[iterator + 'SearchParams'] += 'order_by=' + encodeURI(sort_order);
|
||||||
}
|
}
|
||||||
|
e.stopPropagation();
|
||||||
scope.$emit('doSearch', iterator, page, load, calcOnly, deferWaitStop);
|
scope.$emit('doSearch', iterator, page, load, calcOnly, deferWaitStop);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user