diff --git a/awx/ui/static/js/helpers/EventViewer.js b/awx/ui/static/js/helpers/EventViewer.js
index 0df07f7cb5..98c6abb980 100644
--- a/awx/ui/static/js/helpers/EventViewer.js
+++ b/awx/ui/static/js/helpers/EventViewer.js
@@ -65,11 +65,13 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'EventsViewerFo
$('#stdout-form-container').empty();
$('#stderr-form-container').empty();
$('#traceback-form-container').empty();
+ $('#json-form-container').empty();
$('#eventview-tabs li:eq(1)').hide();
$('#eventview-tabs li:eq(2)').hide();
$('#eventview-tabs li:eq(3)').hide();
$('#eventview-tabs li:eq(4)').hide();
$('#eventview-tabs li:eq(5)').hide();
+ $('#eventview-tabs li:eq(6)').hide();
EventAddTable({ scope: scope, id: 'status-form-container', event: data, section: 'Event' });
@@ -110,6 +112,13 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'EventsViewerFo
});
}
+ show_tabs = true;
+ $('#eventview-tabs li:eq(6)').show();
+ EventAddPreFormattedText({
+ id: 'json-form-container',
+ val: JSON.stringify(data, null, 2)
+ });
+
if (!show_tabs) {
$('#eventview-tabs').hide();
}
@@ -370,8 +379,52 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'EventsViewerFo
return html;
}
+ function parseItem(itm, key, label) {
+ var i, html = '';
+ if (Empty(itm)) {
+ // exclude empty items
+ }
+ else if (typeof itm === "boolean" || typeof itm === "number" || typeof itm === "string") {
+ html += "
| " + label + ": | ";
+ if (key === "status") {
+ html += " " + itm;
+ }
+ else if (key === "start" || key === "end" || key === "created") {
+ if (!/Z$/.test(itm)) {
+ itm = itm.replace(/\ /,'T') + 'Z';
+ html += $filter('date')(itm, 'MM/dd/yy HH:mm:ss.sss');
+ }
+ else {
+ html += $filter('date')(itm, 'MM/dd/yy HH:mm:ss');
+ }
+ }
+ else if (key === "host_name" && event.host_id) {
+ html += "" + itm + "";
+ }
+ else {
+ html += "" + itm + "";
+ }
+
+ html += " |
\n";
+ }
+ else if (typeof itm === "object" && Array.isArray(itm)) {
+ html += "| " + label + ": | [";
+ for (i = 0; i < itm.length; i++) {
+ html += itm[i] + ",";
+ }
+ html = html.replace(/,$/,'');
+ html += "] |
\n";
+ }
+ else if (typeof itm === "object") {
+ html += "| " + label + ": | \n\n" + parseObject(itm) + "\n \n |
\n";
+ }
+ return html;
+ }
+
function parseJSON(obj) {
- var html = '', key, keys, found = false;
+ var h, html = '', key, keys, found = false;
if (typeof obj === "object") {
html += "\n";
html += "\n";
@@ -382,54 +435,30 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'EventsViewerFo
}
}
keys.forEach(function(key) {
- var i, label;
- //if (EventsViewerForm.fields[key] && EventsViewerForm.fields[key].section === section) {
+ var h, label;
label = EventsViewerForm.fields[key].label;
- if (Empty(obj[key])) {
- // exclude empty items
- }
- else if (typeof obj[key] === "boolean" || typeof obj[key] === "number" || typeof obj[key] === "string") {
+ h = parseItem(obj[key], key, label);
+ if (h) {
+ html += h;
found = true;
- html += "| " + label + ": | ";
- if (key === "status") {
- html += " " + obj[key];
- }
- else if (key === "start" || key === "end" || key === "created") {
- if (!/Z$/.test(obj[key])) {
- //sec = parseInt(obj[key].substr(obj[key].length - 6, 6),10) / 1000);
- //obj[key] = obj[key].replace(/\d{6}$/,sec) + 'Z';
- obj[key] = obj[key].replace(/\ /,'T') + 'Z';
- html += $filter('date')(obj[key], 'MM/dd/yy HH:mm:ss.sss');
- }
- else {
- html += $filter('date')(obj[key], 'MM/dd/yy HH:mm:ss');
- }
- }
- else if (key === "host_name" && obj.host_id) {
- html += "" + obj[key] + "";
- }
- else {
- html += "" + obj[key] + "";
- }
-
- html += " |
\n";
- }
- else if (typeof obj[key] === "object" && Array.isArray(obj[key])) {
- found = true;
- html += "| " + label + ": | [";
- for (i = 0; i < obj[key].length; i++) {
- html += obj[key][i] + ",";
- }
- html = html.replace(/,$/,'');
- html += "] |
\n";
- }
- else if (typeof obj[key] === "object") {
- found = true;
- html += "| " + label + ": | \n\n" + parseObject(obj[key]) + "\n \n |
\n";
}
});
+ if (section === 'Results') {
+ // Add result fields that might be not be found the form object
+ // to results.
+ for (key in obj) {
+ h = '';
+ if (key !== 'host_id' && key !== 'parent' && key !== 'event' && key !== 'src' && key !== 'md5sum') {
+ if (!EventsViewerForm.fields[key]) {
+ h = parseItem(obj[key], key, key);
+ if (h) {
+ html += h;
+ found = true;
+ }
+ }
+ }
+ }
+ }
html += "\n";
html += "
\n";
}
diff --git a/awx/ui/static/partials/eventviewer.html b/awx/ui/static/partials/eventviewer.html
index 7c63be6d19..54302fc9d1 100644
--- a/awx/ui/static/partials/eventviewer.html
+++ b/awx/ui/static/partials/eventviewer.html
@@ -6,6 +6,7 @@
Standard Out
Standard Error
Traceback
+ JSON
\ No newline at end of file