AC-503 Latest dashboard progress.

This commit is contained in:
chouseknecht
2013-10-11 21:41:20 +00:00
parent f2ac4b2749
commit 5ccdcb3b15
8 changed files with 374 additions and 25 deletions

View File

@@ -18,13 +18,24 @@ angular.module('JobStatusWidget', ['RestServices', 'Utilities'])
var expectedCounts = 8;
var target = params.target;
scope.$on('CountReceived', function() {
if (scope.removeCountReceived) {
scope.removeCountReceived();
}
scope.removeCountReceived = scope.$on('CountReceived', function() {
var rowcount = 0;
function makeRow(label, count, fail) {
return "<tr><td><a href=\"/#/" + label.toLowerCase() + "\">" + label +
"</a></td><td class=\"failed-column text-right\"><a href=\"/blah/blah\">" +
fail + "</a></td><td class=\"text-right\"><a href=\"/blah/blah\">" +
count + "</a></td></tr>";
var html = '';
html += "<tr>\n";
html += "<td><a href=\"/#/" + label.toLowerCase() + "\">" + label + "</a></td>\n";
html += "<td class=\"failed-column text-right\">";
html += (fail > 0) ? "<a href=\"/blah/blah\">" + fail + "</a>" : "";
html += "</td>\n";
html += "<td class=\"text-right\">"
html += (count > 0) ? "<a href=\"/blah/blah\">" + count + "</a>" : "";
html += "</td></tr>\n";
return html;
}
counts++;
@@ -36,27 +47,45 @@ angular.module('JobStatusWidget', ['RestServices', 'Utilities'])
html += "<table class=\"table table-condensed table-hover\">\n";
html += "<thead>\n";
html += "<tr>\n";
html += "<th></th>\n";
html += "<th class=\"text-right\">Failed</th>\n";
html += "<th class=\"text-right\">Total</th>\n";
html += "<th class=\"col-md-4 col-lg-3\"></th>\n";
html += "<th class=\"col-md-2 col-lg-1 text-right\">Failed</th>\n";
html += "<th class=\"col-md-2 col-lg-1 text-right\">Total</th>\n";
html += "</tr>\n";
html += "</thead>\n";
html += "<tbody>\n";
html += makeRow('Jobs', jobCount, jobFails);
html += makeRow('Inventories', inventoryCount, inventoryFails);
html += makeRow('Groups', groupCount, groupFails);
html += makeRow('Hosts', hostCount, hostFails);
if (jobCount > 0) {
html += makeRow('Jobs', jobCount, jobFails);
rowcount++;
}
if (inventoryCount > 0) {
html += makeRow('Inventories', inventoryCount, inventoryFails);
rowcount++;
}
if (groupCount > 0) {
html += makeRow('Groups', groupCount, groupFails);
rowcount++;
}
if (hostCount > 0) {
html += makeRow('Hosts', hostCount, hostFails);
rowcount++;
}
if (rowcount == 0) {
html += "<tr><td colspan=\"3\">No job data found</td></tr>\n";
}
html += "</tbody>\n";
html += "</table>\n";
html += "</div>\n";
html += "</div>\n";
html += "</div>\n";
}
var element = angular.element(document.getElementById(target));
element.html(html);
$compile(element)(scope);
$rootScope.$emit('WidgetLoaded');
var element = angular.element(document.getElementById(target));
element.html(html);
$compile(element)(scope);
$rootScope.$emit('WidgetLoaded');
}
});
var url = GetBasePath('jobs') + '?page=1';