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