diff --git a/awx/ui/static/js/app.js b/awx/ui/static/js/app.js
index 7cea399b3e..7b6f13293b 100644
--- a/awx/ui/static/js/app.js
+++ b/awx/ui/static/js/app.js
@@ -60,14 +60,9 @@ angular.module('Tower', [
'CompletedJobsDefinition',
'RunningJobsDefinition',
'JobFormDefinition',
- 'JobEventsListDefinition',
- 'JobEventDataDefinition',
- 'JobEventsFormDefinition',
- 'JobHostDefinition',
'JobSummaryDefinition',
'ParseHelper',
'ChildrenHelper',
- 'EventsHelper',
'ProjectPathHelper',
'md5Helper',
'AccessHelper',
@@ -132,21 +127,6 @@ angular.module('Tower', [
controller: 'JobStdoutController'
}).
- when('/job_events/:id', {
- templateUrl: urlPrefix + 'partials/job_events.html',
- controller: 'JobEventsList'
- }).
-
- when('/job_host_summaries/:id', {
- templateUrl: urlPrefix + 'partials/job_host_summaries.html',
- controller: 'JobHostSummaryList'
- }).
-
- when('/jobs/:job_id/job_events/:event_id', {
- templateUrl: urlPrefix + 'partials/jobs.html',
- controller: 'JobEventsEdit'
- }).
-
when('/job_templates', {
templateUrl: urlPrefix + 'partials/job_templates.html',
controller: 'JobTemplatesList'
@@ -197,11 +177,6 @@ angular.module('Tower', [
controller: 'OrganizationsAdd'
}).
- when('/hosts/:id/job_host_summaries', {
- templateUrl: urlPrefix + 'partials/jobs.html',
- controller: 'JobHostSummaryList'
- }).
-
when('/inventories', {
templateUrl: urlPrefix + 'partials/inventories.html',
controller: 'InventoriesList'
diff --git a/awx/ui/static/js/forms/EventsViewer.js b/awx/ui/static/js/forms/EventsViewer.js
new file mode 100644
index 0000000000..78f5c3c066
--- /dev/null
+++ b/awx/ui/static/js/forms/EventsViewer.js
@@ -0,0 +1,73 @@
+/*********************************************
+ * Copyright (c) 2014 AnsibleWorks, Inc.
+ *
+ * JobEventsForm.js
+ *
+ */
+angular.module('EventsViewerFormDefinition', [])
+ .value('EventsViewerForm', {
+
+ fields: {
+ status: {
+ label: 'Status',
+ section: 'Event'
+ },
+ id: {
+ label: 'ID',
+ section: 'Event'
+ },
+ created: {
+ label: 'Created On',
+ section: 'Event'
+ },
+ host_name: {
+ label: 'Host',
+ section: 'Event'
+ },
+ play: {
+ label: 'Play',
+ type: 'text',
+ section: 'Event'
+ },
+ task: {
+ label: 'Task',
+ section: 'Event'
+ },
+ role: {
+ label: 'Role',
+ section: 'Event'
+ },
+ rc: {
+ label: 'Return Code',
+ section: 'Results'
+ },
+ msg: {
+ label: 'Message',
+ section: 'Results'
+ },
+ results: {
+ label: 'Results',
+ section: 'Results'
+ },
+ start: {
+ label: 'Start',
+ section: 'Timing'
+ },
+ end: {
+ label: 'End',
+ section: 'Timing'
+ },
+ delta: {
+ label: 'Elapsed',
+ section: 'Timing'
+ },
+ module_name: {
+ label: 'Name',
+ section: 'Module'
+ },
+ module_args: {
+ label: 'Arguments',
+ section: 'Module'
+ }
+ }
+ });
\ No newline at end of file
diff --git a/awx/ui/static/js/forms/JobEvents.js b/awx/ui/static/js/forms/JobEvents.js
deleted file mode 100644
index b1e21e562f..0000000000
--- a/awx/ui/static/js/forms/JobEvents.js
+++ /dev/null
@@ -1,144 +0,0 @@
-/*********************************************
- * Copyright (c) 2014 AnsibleWorks, Inc.
- *
- * JobEventsForm.js
- *
- */
-angular.module('JobEventsFormDefinition', [])
- .value('JobEventsForm', {
-
- name: 'job_events',
- well: false,
- forceListeners: true,
-
- fields: {
- status: {
- labelClass: 'job-{{ status }}',
- type: 'custom',
- section: 'Event',
- control: "
{{ status }}
"
- },
- id: {
- label: 'ID',
- type: 'text',
- readonly: true,
- section: 'Event',
- 'class': 'span1'
- },
- created: {
- label: 'Created On',
- type: 'text',
- section: 'Event',
- readonly: true
- },
- host: {
- label: 'Host',
- type: 'text',
- readonly: true,
- section: 'Event',
- ngShow: "host !== ''"
- },
- play: {
- label: 'Play',
- type: 'text',
- readonly: true,
- section: 'Event',
- ngShow: "play !== ''"
- },
- task: {
- label: 'Task',
- type: 'text',
- readonly: true,
- section: 'Event',
- ngShow: "task !== ''"
- },
- rc: {
- label: 'Return Code',
- type: 'text',
- readonly: true,
- section: 'Results',
- 'class': 'span1',
- ngShow: "rc !== ''"
- },
- msg: {
- label: 'Msg',
- type: 'textarea',
- readonly: true,
- section: 'Results',
- 'class': 'nowrap',
- ngShow: "msg !== ''",
- rows: 10
- },
- stdout: {
- label: 'Standard Out',
- type: 'textarea',
- readonly: true,
- section: 'Results',
- 'class': 'nowrap',
- ngShow: "stdout !== ''",
- rows: 10
- },
- stderr: {
- label: 'Standard Err',
- type: 'textarea',
- readonly: true,
- section: 'Results',
- 'class': 'nowrap',
- ngShow: "stderr !== ''",
- rows: 10
- },
- results: {
- label: 'Results',
- type: 'textarea',
- section: 'Results',
- readonly: true,
- 'class': 'nowrap',
- ngShow: "results !== ''",
- rows: 10
- },
- start: {
- label: 'Start',
- type: 'text',
- readonly: true,
- section: 'Timing',
- ngShow: "start !== ''"
- },
- traceback: {
- label: false,
- type: 'textarea',
- readonly: true,
- section: 'Traceback',
- 'class': 'nowrap',
- ngShow: "traceback !== ''",
- rows: 10
- },
- end: {
- label: 'End',
- type: 'text',
- readonly: true,
- section: 'Timing',
- ngShow: "end !== ''"
- },
- delta: {
- label: 'Elapsed',
- type: 'text',
- readonly: true,
- section: 'Timing',
- ngShow: "delta !== ''"
- },
- module_name: {
- label: 'Name',
- type: 'text',
- readonly: true,
- section: 'Module',
- ngShow: "module_name !== ''"
- },
- module_args: {
- label: 'Args',
- type: 'text',
- readonly: true,
- section: 'Module',
- ngShow: "module_args !== ''"
- }
- }
- });
\ No newline at end of file
diff --git a/awx/ui/static/js/helpers/EventViewer.js b/awx/ui/static/js/helpers/EventViewer.js
index b263f26fec..f900784e8d 100644
--- a/awx/ui/static/js/helpers/EventViewer.js
+++ b/awx/ui/static/js/helpers/EventViewer.js
@@ -7,7 +7,7 @@
'use strict';
-angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'HostEventsViewerHelper'])
+angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'EventsViewerFormDefinition'])
.factory('EventViewer', ['$compile', 'CreateDialog', 'GetEvent', 'Wait', 'EventAddTable', 'GetBasePath', 'LookUpName', 'Empty', 'EventAddPreFormattedText',
function($compile, CreateDialog, GetEvent, Wait, EventAddTable, GetBasePath, LookUpName, Empty, EventAddPreFormattedText) {
@@ -32,17 +32,29 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'HostEventsView
var elem;
$('#status-form-container').empty();
+ $('#results-form-container').empty();
+ $('#timing-form-container').empty();
$('#stdout-form-container').empty();
$('#stderr-form-container').empty();
$('#traceback-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();
- EventAddTable({ scope: scope, id: 'status-form-container', event: data });
+ EventAddTable({ scope: scope, id: 'status-form-container', event: data, section: 'Event' });
+
+ if (EventAddTable({ scope: scope, id: 'results-form-container', event: data, section: 'Results'})) {
+ $('#eventview-tabs li:eq(1)').show();
+ }
+
+ if (EventAddTable({ scope: scope, id: 'timing-form-container', event: data, section: 'Timing' })) {
+ $('#eventview-tabs li:eq(2)').show();
+ }
if (data.stdout) {
- $('#eventview-tabs li:eq(1)').show();
+ $('#eventview-tabs li:eq(3)').show();
EventAddPreFormattedText({
id: 'stdout-form-container',
val: data.stdout
@@ -50,7 +62,7 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'HostEventsView
}
if (data.stderr) {
- $('#eventview-tabs li:eq(2)').show();
+ $('#eventview-tabs li:eq(4)').show();
EventAddPreFormattedText({
id: 'stderr-form-container',
val: data.stderr
@@ -58,7 +70,7 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'HostEventsView
}
if (data.traceback) {
- $('#eventview-tabs li:eq(3)').show();
+ $('#eventview-tabs li:eq(5)').show();
EventAddPreFormattedText({
id: 'traceback-form-container',
val: data.traceback
@@ -120,6 +132,7 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'HostEventsView
}
if (data.results[0].event_data.res.ansible_facts) {
// don't show fact gathering results
+ data.results[0].event_data.res.task = "Gathering Facts";
delete data.results[0].event_data.res.ansible_facts;
}
data.results[0].event_data.res.status = getStatus(data);
@@ -143,13 +156,17 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'HostEventsView
}
delete event_data.invocation;
}
- event_data.parent = data.results[0].parent;
event_data.play = data.results[0].play;
- event_data.task = data.results[0].task;
+ if (data.results[0].task) {
+ event_data.task = data.results[0].task;
+ }
event_data.created = data.results[0].created;
event_data.role = data.results[0].role;
event_data.host_id = data.results[0].host;
event_data.host_name = data.results[0].host_name;
+ if (event_data.host) {
+ delete event_data.host;
+ }
event_data.id = data.results[0].id;
event_data.parent = data.results[0].parent;
event_data.event = (data.results[0].event_display) ? data.results[0].event_display : data.results[0].event;
@@ -162,61 +179,47 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'HostEventsView
};
}])
- .factory('EventAddTable', ['$compile', '$filter', 'Empty', function($compile, $filter, Empty) {
+ .factory('EventAddTable', ['$compile', '$filter', 'Empty', 'EventsViewerForm', function($compile, $filter, Empty, EventsViewerForm) {
return function(params) {
var scope = params.scope,
id = params.id,
event = params.event,
+ section = params.section,
html = '', e;
- function keyToLabel(key) {
- var label = '';
- switch(key) {
- case "id":
- label = "Event ID";
- break;
- case "parent":
- label = "Parent Event ID";
- break;
- case "rc":
- label = "Return Code";
- break;
- default:
- label = key.charAt(0).toUpperCase() + key.slice(1);
- label = label.replace(/(\_.)/g, function(match) {
- var res;
- res = match.replace(/\_/,'');
- res = ' ' + res.toUpperCase();
- return res;
- });
- }
- return label;
- }
-
function parseJSON(obj) {
- var html = '', keys;
+ var html = '', keys, found = false;
if (typeof obj === "object") {
html += "\n";
html += "\n";
keys = Object.keys(obj).sort();
keys.forEach(function(key) {
var label;
- if (key !== "stdout" && key !== "stderr" && key !== "traceback" && key !== "host_id" && key !== "host") {
- label = keyToLabel(key);
+ if (EventsViewerForm.fields[key] && EventsViewerForm.fields[key].section === section) {
+ 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") {
+ found = true;
html += "| " + label + ": | ";
if (key === "status") {
html += " " + obj[key];
}
else if (key === "start" || key === "end" || key === "created") {
- html += $filter('date')(obj[key], 'MM/dd/yy HH:mm:ss');
+ 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") {
html += "Opens in new tab or window.\" data-placement=\"right\" " +
+ "aw-tool-tip=\"Click to edit host.\" data-placement=\"right\" " +
"ng-click=\"modalOK()\">" + obj[key] + "";
}
else {
@@ -226,6 +229,7 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'HostEventsView
html += " |
\n";
}
else if (typeof obj[key] === "object" && Array.isArray(obj[key])) {
+ found = true;
html += "| " + label + ": | ";
obj[key].forEach(function(row) {
html += "[" + row + "],";
@@ -234,6 +238,7 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'HostEventsView
html += " |
\n";
}
else if (typeof obj[key] === "object") {
+ found = true;
html += "| " + label + ": | \n" + parseJSON(obj[key]) + " |
\n";
}
}
@@ -241,12 +246,16 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'HostEventsView
html += "\n";
html += "
\n";
}
- return html;
+ return (found) ? html : '';
}
html = parseJSON(event);
e = angular.element(document.getElementById(id));
- e.empty().html(html);
- $compile(e)(scope);
+ e.empty();
+ if (html) {
+ e.html(html);
+ $compile(e)(scope);
+ }
+ return (html) ? true : false;
};
}])
diff --git a/awx/ui/static/less/event-viewer.less b/awx/ui/static/less/event-viewer.less
index 566510f87c..ef980ce2f5 100644
--- a/awx/ui/static/less/event-viewer.less
+++ b/awx/ui/static/less/event-viewer.less
@@ -24,6 +24,7 @@ table.eventviewer-status {
margin-top: 20px;
.key {
+ width: 20%;
font-weight: bold;
}
.value i {
diff --git a/awx/ui/static/partials/eventviewer.html b/awx/ui/static/partials/eventviewer.html
index 04ff6bbb1d..7c63be6d19 100644
--- a/awx/ui/static/partials/eventviewer.html
+++ b/awx/ui/static/partials/eventviewer.html
@@ -1,6 +1,8 @@
- - Status
+ - Event
+ - Results
+ - Timing
- Standard Out
- Standard Error
- Traceback
@@ -9,6 +11,12 @@
+
+
diff --git a/awx/ui/templates/ui/index.html b/awx/ui/templates/ui/index.html
index 082bcb774a..f2164bc9c4 100644
--- a/awx/ui/templates/ui/index.html
+++ b/awx/ui/templates/ui/index.html
@@ -78,8 +78,6 @@
-
-
@@ -98,8 +96,7 @@
-
-
+
@@ -122,8 +119,6 @@
-
-
@@ -142,7 +137,6 @@
-