mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
Merge pull request #223 from jaredevantabor/tower-resize
Removing resize behavior on inventory-manage page
This commit is contained in:
commit
b4da12099f
@ -848,8 +848,7 @@ export function InventoriesManage ($log, $scope, $rootScope, $location,
|
||||
GetHostsStatusMsg, GroupsEdit, InventoryUpdate, GroupsCancelUpdate,
|
||||
ViewUpdateStatus, GroupsDelete, Store, HostsEdit, HostsDelete,
|
||||
EditInventoryProperties, ToggleHostEnabled, Stream, ShowJobSummary,
|
||||
InventoryGroupsHelp, HelpDialog, ViewJob, WatchInventoryWindowResize,
|
||||
GetHostContainerRows, GetGroupContainerRows, GetGroupContainerHeight,
|
||||
InventoryGroupsHelp, HelpDialog, ViewJob,
|
||||
GroupsCopy, HostsCopy, Socket) {
|
||||
|
||||
var PreviousSearchParams,
|
||||
@ -1000,14 +999,7 @@ export function InventoriesManage ($log, $scope, $rootScope, $location,
|
||||
scope: $scope
|
||||
});
|
||||
|
||||
if ($(window).width() > 1210) {
|
||||
$scope.initial_height = GetGroupContainerHeight();
|
||||
$('#groups-container .list-table-container').height($scope.initial_height);
|
||||
rows = GetGroupContainerRows();
|
||||
}
|
||||
else {
|
||||
rows = 20;
|
||||
}
|
||||
rows = 20;
|
||||
hostScope.host_page_size = rows;
|
||||
$scope.group_page_size = rows;
|
||||
|
||||
@ -1022,8 +1014,20 @@ export function InventoriesManage ($log, $scope, $rootScope, $location,
|
||||
});
|
||||
|
||||
// Load data
|
||||
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 });
|
||||
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);
|
||||
|
||||
$scope.$emit('WatchUpdateStatus'); // init socket io conneciton and start watching for status updates
|
||||
@ -1071,12 +1075,6 @@ export function InventoriesManage ($log, $scope, $rootScope, $location,
|
||||
else {
|
||||
Wait('stop');
|
||||
}
|
||||
|
||||
WatchInventoryWindowResize({
|
||||
group_scope: $scope,
|
||||
host_scope: hostScope
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@ -1454,8 +1452,6 @@ InventoriesManage.$inject = ['$log', '$scope', '$rootScope', '$location',
|
||||
'GroupsEdit', 'InventoryUpdate', 'GroupsCancelUpdate', 'ViewUpdateStatus',
|
||||
'GroupsDelete', 'Store', 'HostsEdit', 'HostsDelete',
|
||||
'EditInventoryProperties', 'ToggleHostEnabled', 'Stream', 'ShowJobSummary',
|
||||
'InventoryGroupsHelp', 'HelpDialog', 'ViewJob',
|
||||
'WatchInventoryWindowResize', 'GetHostContainerRows',
|
||||
'GetGroupContainerRows', 'GetGroupContainerHeight', 'GroupsCopy',
|
||||
'InventoryGroupsHelp', 'HelpDialog', 'ViewJob', 'GroupsCopy',
|
||||
'HostsCopy', 'Socket'
|
||||
];
|
||||
|
||||
@ -707,11 +707,11 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
|
||||
*/
|
||||
.factory('GroupsEdit', ['$rootScope', '$location', '$log', '$routeParams', '$compile', 'Rest', 'Alert', 'GroupForm', 'GenerateForm',
|
||||
'Prompt', 'ProcessErrors', 'GetBasePath', 'SetNodeName', 'ParseTypeChange', 'GetSourceTypeOptions', 'InventoryUpdate',
|
||||
'LookUpInit', 'Empty', 'Wait', 'GetChoices', 'UpdateGroup', 'SourceChange', 'Find', 'WatchInventoryWindowResize',
|
||||
'LookUpInit', 'Empty', 'Wait', 'GetChoices', 'UpdateGroup', 'SourceChange', 'Find',
|
||||
'ParseVariableString', 'ToJSON', 'GroupsScheduleListInit', 'SourceForm', 'SetSchedulesInnerDialogSize', 'CreateSelect2',
|
||||
function ($rootScope, $location, $log, $routeParams, $compile, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors,
|
||||
GetBasePath, SetNodeName, ParseTypeChange, GetSourceTypeOptions, InventoryUpdate, LookUpInit, Empty, Wait,
|
||||
GetChoices, UpdateGroup, SourceChange, Find, WatchInventoryWindowResize, ParseVariableString, ToJSON, GroupsScheduleListInit,
|
||||
GetChoices, UpdateGroup, SourceChange, Find, ParseVariableString, ToJSON, GroupsScheduleListInit,
|
||||
SourceForm, SetSchedulesInnerDialogSize, CreateSelect2) {
|
||||
return function (params) {
|
||||
|
||||
@ -1230,7 +1230,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
|
||||
parent_scope.removeAddTreeRefreshed = parent_scope.$on('GroupTreeRefreshed', function() {
|
||||
// Clean up
|
||||
Wait('stop');
|
||||
WatchInventoryWindowResize();
|
||||
|
||||
if (modal_scope.searchCleanUp) {
|
||||
modal_scope.searchCleanup();
|
||||
}
|
||||
@ -2124,7 +2124,6 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
|
||||
});
|
||||
$('#status-modal-dialog').dialog('destroy');
|
||||
$('#inventory-modal-container').empty();
|
||||
//WatchInventoryWindowResize();
|
||||
},
|
||||
open: function () {
|
||||
Wait('stop');
|
||||
|
||||
@ -173,9 +173,9 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', listGenerator.name,
|
||||
}])
|
||||
|
||||
.factory('HostsReload', [ '$routeParams', 'Empty', 'InventoryHosts', 'GetBasePath', 'SearchInit', 'PaginateInit', 'Wait',
|
||||
'SetHostStatus', 'SetStatus', 'ApplyEllipsis', 'SetContainerHeights', 'GetHostContainerRows',
|
||||
'SetHostStatus', 'SetStatus', 'ApplyEllipsis',
|
||||
function($routeParams, Empty, InventoryHosts, GetBasePath, SearchInit, PaginateInit, Wait, SetHostStatus, SetStatus,
|
||||
ApplyEllipsis, SetContainerHeights) {
|
||||
ApplyEllipsis) {
|
||||
return function(params) {
|
||||
|
||||
var scope = params.scope,
|
||||
@ -208,9 +208,6 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', listGenerator.name,
|
||||
}
|
||||
});
|
||||
|
||||
// Size containers based on viewport
|
||||
SetContainerHeights({ scope: scope, reloadHosts: false });
|
||||
|
||||
SearchInit({ scope: scope, set: 'hosts', list: list, url: url });
|
||||
PaginateInit({ scope: scope, list: list, url: url, pageSize: pageSize });
|
||||
|
||||
@ -408,7 +405,6 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', listGenerator.name,
|
||||
inventory_id: parent_scope.inventory_id
|
||||
});
|
||||
|
||||
//WatchInventoryWindowResize();
|
||||
});
|
||||
|
||||
// Save
|
||||
@ -446,7 +442,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', listGenerator.name,
|
||||
};
|
||||
|
||||
scope.cancelModal = function() {
|
||||
// WatchInventoryWindowResize();
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
@ -181,8 +181,7 @@ export default
|
||||
])
|
||||
|
||||
.factory('ShowJobSummary', ['Rest', 'Wait', 'GetBasePath', 'FormatDate', 'ProcessErrors', 'GenerateForm', 'JobSummary',
|
||||
'WatchInventoryWindowResize',
|
||||
function (Rest, Wait, GetBasePath, FormatDate, ProcessErrors, GenerateForm, JobSummary, WatchInventoryWindowResize) {
|
||||
function (Rest, Wait, GetBasePath, FormatDate, ProcessErrors, GenerateForm, JobSummary) {
|
||||
return function (params) {
|
||||
// Display status info in a modal dialog- called from inventory edit page
|
||||
|
||||
@ -261,7 +260,6 @@ export default
|
||||
});
|
||||
$('#status-modal-dialog').dialog('destroy');
|
||||
$('#inventory-modal-container').empty();
|
||||
WatchInventoryWindowResize();
|
||||
},
|
||||
open: function () {
|
||||
Wait('stop');
|
||||
|
||||
@ -17,109 +17,7 @@ export default
|
||||
angular.module('InventoryHelper', ['RestServices', 'Utilities', 'OrganizationListDefinition', listGenerator.name, 'AuthService',
|
||||
'InventoryHelper', 'InventoryFormDefinition', 'ParseHelper', 'SearchHelper', 'VariablesHelper',
|
||||
])
|
||||
|
||||
.factory('GetGroupContainerHeight', [ 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() ));
|
||||
*/
|
||||
var height = $(window).height() - $('#main-menu-container .navbar').outerHeight() - $('#breadcrumbs').outerHeight() -
|
||||
$('.site-footer').outerHeight() - $('.group-breadcrumbs').outerHeight() - $('#groups-container #search-widget-container').outerHeight() -
|
||||
$('#groups_table thead').height() - 90;
|
||||
height = (height < 600) ? 600 : height;
|
||||
return height;
|
||||
};
|
||||
}])
|
||||
|
||||
.factory('GetHostContainerRows', [ function() {
|
||||
return function() {
|
||||
var height, rows;
|
||||
height = $('#hosts-container .list-well').height() - $('#hosts-constainer .list-well .row').height() - $('#hosts_table thead').height();
|
||||
rows = Math.floor(height / 44) - 2;
|
||||
// rows = (rows < 20) ? 20 : rows;
|
||||
return rows;
|
||||
};
|
||||
}])
|
||||
|
||||
.factory('GetGroupContainerRows', [ function() {
|
||||
return function() {
|
||||
var height, rows;
|
||||
height = $('#groups-container .list-table-container').height();
|
||||
rows = Math.floor(height / 44) - 2;
|
||||
// rows = (rows < 20) ? 20 : rows;
|
||||
return rows;
|
||||
};
|
||||
}])
|
||||
|
||||
.factory('SetContainerHeights', [ 'GetGroupContainerHeight', 'GetHostContainerRows', function(GetGroupContainerHeight, GetHostContainerRows) {
|
||||
return function(params) {
|
||||
var group_scope = params.group_scope,
|
||||
host_scope = params.host_scope,
|
||||
reloadHosts = (params.reloadHosts) ? true : false,
|
||||
height, rows;
|
||||
|
||||
$('#groups-container .list-table-container').height('auto');
|
||||
$('#hosts-container .list-well').height('auto');
|
||||
$('#hosts-container .list-table-container').height('auto');
|
||||
|
||||
setTimeout(function() {
|
||||
if ($(window).width() > 1210) {
|
||||
height = GetGroupContainerHeight();
|
||||
$('#groups-container .list-table-container').height(height);
|
||||
$('#hosts-container .list-table-container').height(height);
|
||||
setTimeout(function() { $('#hosts-container .list-well').height( $('#groups-container .list-well').outerHeight()); }, 500);
|
||||
}
|
||||
|
||||
if (reloadHosts) {
|
||||
// we need ro recalc the the page size
|
||||
if ($(window).width() > 1210) {
|
||||
rows = GetHostContainerRows();
|
||||
host_scope.host_page_size = rows;
|
||||
group_scope.group_page_size = rows;
|
||||
}
|
||||
else {
|
||||
// on small screens we go back to the default
|
||||
host_scope.host_page_size = 20;
|
||||
group_scope.group_page_size = 20;
|
||||
}
|
||||
host_scope.changePageSize('hosts', 'host');
|
||||
group_scope.changePageSize('groups', 'group');
|
||||
}
|
||||
}, 100);
|
||||
|
||||
};
|
||||
}])
|
||||
|
||||
.factory('WatchInventoryWindowResize', ['ApplyEllipsis', 'SetContainerHeights',
|
||||
function (ApplyEllipsis, SetContainerHeights) {
|
||||
return function (params) {
|
||||
// Call to set or restore window resize
|
||||
var group_scope = params.group_scope,
|
||||
host_scope = params.host_scope;
|
||||
$(window).off("resize");
|
||||
$(window).resize(_.debounce(function() {
|
||||
ApplyEllipsis('#groups_table .group-name a');
|
||||
ApplyEllipsis('#hosts_table .host-name a');
|
||||
SetContainerHeights({
|
||||
group_scope: group_scope,
|
||||
host_scope: host_scope,
|
||||
reloadHosts: true
|
||||
});
|
||||
}, 500));
|
||||
};
|
||||
}
|
||||
])
|
||||
|
||||
|
||||
.factory('SaveInventory', ['InventoryForm', 'Rest', 'Alert', 'ProcessErrors', 'LookUpInit', 'OrganizationList',
|
||||
'GetBasePath', 'ParseTypeChange', 'Wait', 'ToJSON',
|
||||
function (InventoryForm, Rest, Alert, ProcessErrors, LookUpInit, OrganizationList, GetBasePath, ParseTypeChange, Wait,
|
||||
|
||||
@ -30,7 +30,7 @@ export default
|
||||
label: 'Hosts',
|
||||
ngClick: "editHost(host.id)",
|
||||
ngClass: "{ 'host-disabled-label': !host.enabled }",
|
||||
columnClass: 'col-lg-6 col-md-9 col-sm-9 col-xs-7',
|
||||
columnClass: 'col-lg-6 col-md-8 col-sm-8 col-xs-7',
|
||||
dataHostId: "{{ host.id }}",
|
||||
dataType: "host"
|
||||
},
|
||||
@ -52,7 +52,7 @@ export default
|
||||
|
||||
fieldActions: {
|
||||
|
||||
columnClass: 'col-lg-6 col-md-3 col-sm-3 col-xs-5 text-right',
|
||||
columnClass: 'col-lg-6 col-md-4 col-sm-4 col-xs-5 text-right',
|
||||
label: false,
|
||||
|
||||
active_failures: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user