Merge pull request #41 from ansible/add_cmd_host_event_list

Adding command and warning displays in Event Detail modals
This commit is contained in:
jlmitch5
2015-01-28 09:45:19 -05:00
2 changed files with 157 additions and 137 deletions

View File

@@ -461,7 +461,7 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'EventsViewerFo
} }
function parseJSON(obj) { function parseJSON(obj) {
var h, html = '', key, keys, found = false; var h, html = '', key, keys, found = false, string_warnings = "", string_cmd = "";
if (typeof obj === "object") { if (typeof obj === "object") {
html += "<table class=\"table eventviewer-status\">\n"; html += "<table class=\"table eventviewer-status\">\n";
html += "<tbody>\n"; html += "<tbody>\n";
@@ -486,7 +486,7 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'EventsViewerFo
h = ''; h = '';
if (key !== 'host_id' && key !== 'parent' && key !== 'event' && key !== 'src' && key !== 'md5sum' && if (key !== 'host_id' && key !== 'parent' && key !== 'event' && key !== 'src' && key !== 'md5sum' &&
key !== 'stdout' && key !== 'traceback' && key !== 'stderr' && key !== 'cmd' && key !=='changed' && key !== "verbose_override" && key !== 'stdout' && key !== 'traceback' && key !== 'stderr' && key !== 'cmd' && key !=='changed' && key !== "verbose_override" &&
key !== 'feature_result') { key !== 'feature_result' && key !== 'warnings') {
if (!EventsViewerForm.fields[key]) { if (!EventsViewerForm.fields[key]) {
h = parseItem(obj[key], key, key); h = parseItem(obj[key], key, key);
if (h) { if (h) {
@@ -494,6 +494,26 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'EventsViewerFo
found = true; found = true;
} }
} }
} else if (key === 'cmd') {
// only show cmd if it's a cmd that was run
if (!EventsViewerForm.fields[key] && obj[key].length > 0) {
// include the label head Shell Command instead of CMD in the modal
string_cmd += obj[key].join(" ");
h = parseItem(string_cmd, key, "Shell Command");
if (h) {
html += h;
found = true;
}
}
} else if (key === 'warnings') {
if (!EventsViewerForm.fields[key] && obj[key].length > 0) {
string_warnings += obj[key].join(" ");
h = parseItem(string_warnings, key, "Warnings");
if (h) {
html += h;
found = true;
}
}
} }
} }
} }