From 1a7f3d17d65c54e922d9b413718624651e96ad50 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Tue, 8 Jul 2014 09:20:06 -0400 Subject: [PATCH] made failure counts red in dashboard stats widget --- awx/ui/static/js/controllers/Home.js | 17 ++++++++--------- awx/ui/static/js/widgets/DashboardCounts.js | 16 ++++++++++++---- awx/ui/static/js/widgets/HostGraph.js | 8 ++++---- awx/ui/static/js/widgets/JobStatusGraph.js | 2 +- awx/ui/static/less/new-dashboard.less | 20 +++++--------------- 5 files changed, 30 insertions(+), 33 deletions(-) diff --git a/awx/ui/static/js/controllers/Home.js b/awx/ui/static/js/controllers/Home.js index 8004f7b42b..37953c4efe 100644 --- a/awx/ui/static/js/controllers/Home.js +++ b/awx/ui/static/js/controllers/Home.js @@ -44,10 +44,6 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, Wait, Dashb toolbar: true }); - String.prototype.capitalize = function() { - return this.charAt(0).toUpperCase() + this.slice(1); - }; - e = angular.element(document.getElementById('home-list-actions')); e.html(html); $compile(e)($scope); @@ -85,11 +81,14 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, Wait, Dashb target: 'container2', dashboard: data }); - HostGraph({ - scope: $scope, - target: 'container3', - dashboard: data - }); + + if ($rootScope.user_is_superuser === true) { + HostGraph({ + scope: $scope, + target: 'container3', + dashboard: data + }); + } DashboardJobs({ scope: $scope, diff --git a/awx/ui/static/js/widgets/DashboardCounts.js b/awx/ui/static/js/widgets/DashboardCounts.js index 9a7a1f8671..a151d32e06 100644 --- a/awx/ui/static/js/widgets/DashboardCounts.js +++ b/awx/ui/static/js/widgets/DashboardCounts.js @@ -48,11 +48,11 @@ angular.module('DashboardCountsWidget', ['RestServices', 'Utilities']) html = "
\n"; html += "\n"; - html += "\n"; + html += "\n"; html += "\n"; - html += "\n"; + html += "\n"; html += "\n"; - html += "
"+dashboard.projects.failed+"
Project Sync Failure
\n"; + html += "
"+dashboard.projects.failed+"
Project Sync Failure
\n"; // html += "\n"; html += "
\n"; @@ -115,7 +115,15 @@ angular.module('DashboardCountsWidget', ['RestServices', 'Utilities']) element = angular.element(document.getElementById(target)); element.html(html); $compile(element)(scope); - + if(dashboard.hosts.failed>0 ){ + $('#failed-hosts').html(""+dashboard.hosts.failed+""); + } + if(dashboard.inventories.inventory_failed>0 ){ + $('#failed-inventories').html(""+dashboard.inventories.inventory_failed+""); + } + if(dashboard.projects.failed>0 ){ + $('#failed-projects').html(""+dashboard.projects.failed+""); + } scope.$emit('WidgetLoaded'); diff --git a/awx/ui/static/js/widgets/HostGraph.js b/awx/ui/static/js/widgets/HostGraph.js index 116549b90b..24296c623e 100644 --- a/awx/ui/static/js/widgets/HostGraph.js +++ b/awx/ui/static/js/widgets/HostGraph.js @@ -37,7 +37,7 @@ angular.module('HostGraphWidget', ['RestServices', 'Utilities']) Rest.setUrl(url); Rest.get() .success(function (data){ - license = data.license_info.available_instances; + license = data.license_info.instance_count; scope.$emit('licenseCountReady', license); }) .error(function (data, status) { @@ -143,9 +143,9 @@ angular.module('HostGraphWidget', ['RestServices', 'Utilities']) "src": "url(/static/fonts/OpenSans-Regular.ttf)" }); - d3.selectAll(".nv-line").on("click", function () { - alert("clicked"); - }); + // d3.selectAll(".nv-line").on("click", function () { + // alert("clicked"); + // }); nv.utils.windowResize(chart.update); scope.$emit('WidgetLoaded'); diff --git a/awx/ui/static/js/widgets/JobStatusGraph.js b/awx/ui/static/js/widgets/JobStatusGraph.js index c73184663b..52e7b16a27 100644 --- a/awx/ui/static/js/widgets/JobStatusGraph.js +++ b/awx/ui/static/js/widgets/JobStatusGraph.js @@ -48,7 +48,7 @@ angular.module('JobStatusGraphWidget', ['RestServices', 'Utilities']) html += "Period\n"; html += " \n"; - html += "