mirror of
https://github.com/ansible/awx.git
synced 2026-05-23 08:37:48 -02:30
Use responsive helper in host count graph
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
angular.module('DashboardGraphs').
|
||||
directive('hostCountGraph', ['GetBasePath', 'Rest', function(getBasePath, Rest) {
|
||||
directive('hostCountGraph', ['GetBasePath', 'Rest', 'adjustGraphSize', '$window', function(getBasePath, Rest, adjustGraphSize, $window) {
|
||||
|
||||
return {
|
||||
restrict: 'E',
|
||||
@@ -12,19 +12,8 @@ angular.module('DashboardGraphs').
|
||||
|
||||
url = getBasePath('config');
|
||||
|
||||
if (scope.removeResizeHostGraph) {
|
||||
scope.removeResizeHostGraph();
|
||||
}
|
||||
scope.removeResizeHostGraph= scope.$on('ResizeHostGraph', function () {
|
||||
if($(window).width()<500){
|
||||
$('.graph-container').height(300);
|
||||
}
|
||||
else{
|
||||
var winHeight = $(window).height(),
|
||||
available_height = winHeight - $('#main-menu-container .navbar').outerHeight() - $('#count-container').outerHeight() - 120;
|
||||
$('.graph-container').height(available_height/2);
|
||||
license_graph.update();
|
||||
}
|
||||
$window.addEventListener('resize', function() {
|
||||
adjustGraphSize(license_graph, element);
|
||||
});
|
||||
|
||||
Rest.setUrl(url);
|
||||
@@ -96,8 +85,6 @@ angular.module('DashboardGraphs').
|
||||
|
||||
});
|
||||
|
||||
nv.addGraph({
|
||||
generate: function() {
|
||||
var width = $('.graph-container').width(), // nv.utils.windowSize().width/3,
|
||||
height = $('.graph-container').height()*0.6; //nv.utils.windowSize().height/5,
|
||||
license_graph = nv.models.lineChart()
|
||||
@@ -139,10 +126,11 @@ angular.module('DashboardGraphs').
|
||||
|
||||
// nv.utils.windowResize(license_graph.update);
|
||||
scope.$emit('WidgetLoaded');
|
||||
|
||||
adjustGraphSize(license_graph, element);
|
||||
|
||||
return license_graph;
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}]);
|
||||
|
||||
Reference in New Issue
Block a user