made failure counts red in dashboard stats widget

This commit is contained in:
Jared Tabor
2014-07-08 09:20:06 -04:00
parent 0cfb666548
commit 1a7f3d17d6
5 changed files with 30 additions and 33 deletions

View File

@@ -44,10 +44,6 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, Wait, Dashb
toolbar: true toolbar: true
}); });
String.prototype.capitalize = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
};
e = angular.element(document.getElementById('home-list-actions')); e = angular.element(document.getElementById('home-list-actions'));
e.html(html); e.html(html);
$compile(e)($scope); $compile(e)($scope);
@@ -85,11 +81,14 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, Wait, Dashb
target: 'container2', target: 'container2',
dashboard: data dashboard: data
}); });
HostGraph({
scope: $scope, if ($rootScope.user_is_superuser === true) {
target: 'container3', HostGraph({
dashboard: data scope: $scope,
}); target: 'container3',
dashboard: data
});
}
DashboardJobs({ DashboardJobs({
scope: $scope, scope: $scope,

View File

@@ -48,11 +48,11 @@ angular.module('DashboardCountsWidget', ['RestServices', 'Utilities'])
html = "<div id=\"count-container\" class=\"count-container row\">\n"; html = "<div id=\"count-container\" class=\"count-container row\">\n";
html += "<div class=\"h2 col-xs-4 col-sm-2 text-center\"><a href=/#/home/hosts>" + dashboard.hosts.total+"</a><br><h6>Hosts</h6></div>\n"; html += "<div class=\"h2 col-xs-4 col-sm-2 text-center\"><a href=/#/home/hosts>" + dashboard.hosts.total+"</a><br><h6>Hosts</h6></div>\n";
html += "<div class=\"h2 col-xs-4 col-sm-2 text-center\"><a href=/#/home/hosts>"+dashboard.hosts.failed+"</a><br><h6>Failed Hosts</h6></div>\n"; html += "<div class=\"h2 col-xs-4 col-sm-2 text-center\"><a href=/#/home/hosts id=\"failed-hosts\">"+dashboard.hosts.failed+"</a><br><h6>Failed Hosts</h6></div>\n";
html += "<div class=\"h2 col-xs-4 col-sm-2 text-center\"><a href=/#/inventories>"+dashboard.inventories.total+"</a><br><h6>Inventories</h6></div>\n"; html += "<div class=\"h2 col-xs-4 col-sm-2 text-center\"><a href=/#/inventories>"+dashboard.inventories.total+"</a><br><h6>Inventories</h6></div>\n";
html += "<div class=\"h2 col-xs-4 col-sm-2 text-center\"><a href=/#/inventories/?inventory_sources_with_failures>"+dashboard.inventories.inventory_failed+"</a><br><h6>Inventory Sync Failure</h6></div>\n"; html += "<div class=\"h2 col-xs-4 col-sm-2 text-center\"><a href=/#/inventories/?inventory_sources_with_failures id=\"failed-inventories\">"+dashboard.inventories.inventory_failed+"</a><br><h6>Inventory Sync Failure</h6></div>\n";
html += "<div class=\"h2 col-xs-4 col-sm-2 text-center\"><a href=/#/projects>"+dashboard.projects.total+"</a><br><h6>Projects</h6></div>\n"; html += "<div class=\"h2 col-xs-4 col-sm-2 text-center\"><a href=/#/projects>"+dashboard.projects.total+"</a><br><h6>Projects</h6></div>\n";
html += "<div class=\"h2 col-xs-4 col-sm-2 text-center\"><a href=/#/projects>"+dashboard.projects.failed+"</a><br><h6>Project Sync Failure</h6></div>\n"; html += "<div class=\"h2 col-xs-4 col-sm-2 text-center\"><a href=/#/projects id=\"failed-projects\">"+dashboard.projects.failed+"</a><br><h6>Project Sync Failure</h6></div>\n";
// html += "<div class=\"h2 col-xs-4 col-sm-2 text-center\"><a href=/#/users>"+dashboard.users.total+"</a></div>\n"; // html += "<div class=\"h2 col-xs-4 col-sm-2 text-center\"><a href=/#/users>"+dashboard.users.total+"</a></div>\n";
html += "</div>\n"; html += "</div>\n";
@@ -115,7 +115,15 @@ angular.module('DashboardCountsWidget', ['RestServices', 'Utilities'])
element = angular.element(document.getElementById(target)); element = angular.element(document.getElementById(target));
element.html(html); element.html(html);
$compile(element)(scope); $compile(element)(scope);
if(dashboard.hosts.failed>0 ){
$('#failed-hosts').html("<a style=\"color:red\" href=/#/home/hosts id=\"failed-hosts\">"+dashboard.hosts.failed+"</a>");
}
if(dashboard.inventories.inventory_failed>0 ){
$('#failed-inventories').html("<a style=\"color:red\" href=/#/inventories/?inventory_sources_with_failures id=\"failed-inventories\">"+dashboard.inventories.inventory_failed+"</a>");
}
if(dashboard.projects.failed>0 ){
$('#failed-projects').html("<a style=\"color:red\" href=/#/projects id=\"failed-projects\">"+dashboard.projects.failed+"</a>");
}
scope.$emit('WidgetLoaded'); scope.$emit('WidgetLoaded');

View File

@@ -37,7 +37,7 @@ angular.module('HostGraphWidget', ['RestServices', 'Utilities'])
Rest.setUrl(url); Rest.setUrl(url);
Rest.get() Rest.get()
.success(function (data){ .success(function (data){
license = data.license_info.available_instances; license = data.license_info.instance_count;
scope.$emit('licenseCountReady', license); scope.$emit('licenseCountReady', license);
}) })
.error(function (data, status) { .error(function (data, status) {
@@ -143,9 +143,9 @@ angular.module('HostGraphWidget', ['RestServices', 'Utilities'])
"src": "url(/static/fonts/OpenSans-Regular.ttf)" "src": "url(/static/fonts/OpenSans-Regular.ttf)"
}); });
d3.selectAll(".nv-line").on("click", function () { // d3.selectAll(".nv-line").on("click", function () {
alert("clicked"); // alert("clicked");
}); // });
nv.utils.windowResize(chart.update); nv.utils.windowResize(chart.update);
scope.$emit('WidgetLoaded'); scope.$emit('WidgetLoaded');

View File

@@ -48,7 +48,7 @@ angular.module('JobStatusGraphWidget', ['RestServices', 'Utilities'])
html += "Period<span class=\"caret\"></span>\n"; html += "Period<span class=\"caret\"></span>\n";
html += " </a>\n"; html += " </a>\n";
html += "<ul class=\"dropdown-menu\" role=\"menu\" aria-labelledby=\"dLabel\">\n"; html += "<ul class=\"dropdown-menu period-dropdown\" role=\"menu\" aria-labelledby=\"dLabel\">\n";
html += "<li><div class=\"n\" id=\"day\" >Past 24 Hours </div></li>\n"; html += "<li><div class=\"n\" id=\"day\" >Past 24 Hours </div></li>\n";
html += "<li><div class=\"n\" id=\"week\">Past Week</div></li>\n"; html += "<li><div class=\"n\" id=\"week\">Past Week</div></li>\n";
html += "<li><div class=\"n\" id=\"month\">Past Month</div></li>\n"; html += "<li><div class=\"n\" id=\"month\">Past Month</div></li>\n";

View File

@@ -73,27 +73,17 @@
padding-left: 7px; padding-left: 7px;
} }
} }
.custon-carousel{
width:150px;
height:200px;
min-width:150px;
min-height:100px;
max-width:200px;
max-height:100px;
overflow:hidden;
display:block;
border:1px solid black;
background-color: #A9A9A9;
}
.dropdown-menu {
cursor: pointer; .period-dropdown{
padding-left: 7px;
height: 75px; height: 75px;
width: 100px; width: 100px;
cursor: pointer;
} }
.status-dropdown{ .status-dropdown{
height: 100px; height: 100px;
width: 100px;
cursor:pointer;
} }
.m, .n{ .m, .n{
padding-bottom: 5px; padding-bottom: 5px;