mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 03:10:42 -03:30
Event viewer
Fixed name collision between EventViewer and LogViewer, which caused things to now show up on the log viewer dialog.
This commit is contained in:
parent
2398e17206
commit
e9115c5ca2
@ -9,8 +9,8 @@
|
||||
|
||||
angular.module('EventViewerHelper', ['ModalDialog', 'Utilities'])
|
||||
|
||||
.factory('EventViewer', ['$compile', 'CreateDialog', 'GetEvent', 'Wait', 'AddTable', 'GetBasePath', 'LookUpName', 'Empty', 'AddPreFormattedText',
|
||||
function($compile, CreateDialog, GetEvent, Wait, AddTable, GetBasePath, LookUpName, Empty, AddPreFormattedText) {
|
||||
.factory('EventViewer', ['$compile', 'CreateDialog', 'GetEvent', 'Wait', 'EventAddTable', 'GetBasePath', 'LookUpName', 'Empty', 'EventAddPreFormattedText',
|
||||
function($compile, CreateDialog, GetEvent, Wait, EventAddTable, GetBasePath, LookUpName, Empty, EventAddPreFormattedText) {
|
||||
return function(params) {
|
||||
var parent_scope = params.scope,
|
||||
url = params.url,
|
||||
@ -39,11 +39,11 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities'])
|
||||
$('#eventview-tabs li:eq(2)').hide();
|
||||
$('#eventview-tabs li:eq(3)').hide();
|
||||
|
||||
AddTable({ scope: scope, id: 'status-form-container', event: data });
|
||||
EventAddTable({ scope: scope, id: 'status-form-container', event: data });
|
||||
|
||||
if (data.stdout) {
|
||||
$('#eventview-tabs li:eq(1)').show();
|
||||
AddPreFormattedText({
|
||||
EventAddPreFormattedText({
|
||||
id: 'stdout-form-container',
|
||||
val: data.stdout
|
||||
});
|
||||
@ -51,7 +51,7 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities'])
|
||||
|
||||
if (data.stderr) {
|
||||
$('#eventview-tabs li:eq(2)').show();
|
||||
AddPreFormattedText({
|
||||
EventAddPreFormattedText({
|
||||
id: 'stderr-form-container',
|
||||
val: data.stderr
|
||||
});
|
||||
@ -59,7 +59,7 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities'])
|
||||
|
||||
if (data.traceback) {
|
||||
$('#eventview-tabs li:eq(3)').show();
|
||||
AddPreFormattedText({
|
||||
EventAddPreFormattedText({
|
||||
id: 'traceback-form-container',
|
||||
val: data.traceback
|
||||
});
|
||||
@ -160,33 +160,7 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities'])
|
||||
};
|
||||
}])
|
||||
|
||||
.factory('LookUpName', ['Rest', 'ProcessErrors', 'Empty', function(Rest, ProcessErrors, Empty) {
|
||||
return function(params) {
|
||||
var url = params.url,
|
||||
scope_var = params.scope_var,
|
||||
scope = params.scope;
|
||||
Rest.setUrl(url);
|
||||
Rest.get()
|
||||
.success(function(data) {
|
||||
if (scope_var === 'inventory_source') {
|
||||
scope[scope_var + '_name'] = data.summary_fields.group.name;
|
||||
}
|
||||
else if (!Empty(data.name)) {
|
||||
scope[scope_var + '_name'] = data.name;
|
||||
}
|
||||
if (!Empty(data.group)) {
|
||||
// Used for inventory_source
|
||||
scope.group = data.group;
|
||||
}
|
||||
})
|
||||
.error(function(data, status) {
|
||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||
msg: 'Failed to retrieve ' + url + '. GET returned: ' + status });
|
||||
});
|
||||
};
|
||||
}])
|
||||
|
||||
.factory('AddTable', ['$compile', '$filter', 'Empty', function($compile, $filter, Empty) {
|
||||
.factory('EventAddTable', ['$compile', '$filter', 'Empty', function($compile, $filter, Empty) {
|
||||
return function(params) {
|
||||
var scope = params.scope,
|
||||
id = params.id,
|
||||
@ -274,7 +248,7 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities'])
|
||||
};
|
||||
}])
|
||||
|
||||
.factory('AddTextarea', [ function() {
|
||||
.factory('EventAddTextarea', [ function() {
|
||||
return function(params) {
|
||||
var container_id = params.container_id,
|
||||
val = params.val,
|
||||
@ -287,7 +261,7 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities'])
|
||||
};
|
||||
}])
|
||||
|
||||
.factory('AddPreFormattedText', [function() {
|
||||
.factory('EventAddPreFormattedText', [function() {
|
||||
return function(params) {
|
||||
var id = params.id,
|
||||
val = params.val,
|
||||
|
||||
@ -20,7 +20,7 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
||||
scope = parent_scope.$new(true),
|
||||
base = $location.path().replace(/^\//, '').split('/')[0],
|
||||
pieces;
|
||||
|
||||
|
||||
if (scope.removeModalReady) {
|
||||
scope.removeModalReady();
|
||||
}
|
||||
@ -34,7 +34,6 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
||||
}
|
||||
scope.removeJobReady = scope.$on('JobReady', function(e, data) {
|
||||
var key, resizeText, elem;
|
||||
|
||||
$('#status-form-container').empty();
|
||||
$('#options-form-container').empty();
|
||||
$('#stdout-form-container').empty();
|
||||
@ -45,7 +44,7 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
||||
$('#logview-tabs li:eq(2)').hide();
|
||||
$('#logview-tabs li:eq(4)').hide();
|
||||
$('#logview-tabs li:eq(5)').hide();
|
||||
|
||||
|
||||
// Make sure subsequenct scope references don't bubble up to the parent
|
||||
for (key in LogViewerStatusForm.fields) {
|
||||
scope[key] = '';
|
||||
@ -59,7 +58,7 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
||||
}
|
||||
scope.created_by = '';
|
||||
scope.job_template = '';
|
||||
|
||||
|
||||
if (data.related.created_by) {
|
||||
pieces = data.related.created_by.replace(/^\//,'').replace(/\/$/,'').split('/');
|
||||
scope.created_by = parseInt(pieces[pieces.length - 1],10);
|
||||
@ -69,7 +68,7 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
||||
url: GetBasePath('users') + scope.created_by + '/'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// For jobs link the name to the job parent
|
||||
if (base === 'jobs') {
|
||||
if (data.type === 'job') {
|
||||
@ -90,7 +89,7 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
||||
|
||||
AddTable({ scope: scope, form: LogViewerStatusForm, id: 'status-form-container', getIcon: getIcon });
|
||||
AddTable({ scope: scope, form: LogViewerOptionsForm, id: 'options-form-container', getIcon: getIcon });
|
||||
|
||||
|
||||
if (data.result_stdout) {
|
||||
$('#logview-tabs li:eq(1)').show();
|
||||
AddPreFormattedText({
|
||||
@ -98,7 +97,7 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
||||
val: data.result_stdout
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (data.result_traceback) {
|
||||
$('#logview-tabs li:eq(2)').show();
|
||||
AddPreFormattedText({
|
||||
@ -106,14 +105,14 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
||||
val: data.result_traceback
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/*if (data.job_env) {
|
||||
EnvTable({
|
||||
id: 'env-form-container',
|
||||
vars: data.job_env
|
||||
});
|
||||
}*/
|
||||
|
||||
|
||||
if (data.extra_vars) {
|
||||
$('#logview-tabs li:eq(4)').show();
|
||||
AddTextarea({
|
||||
@ -122,7 +121,7 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
||||
val: ParseVariableString(data.extra_vars)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (data.source_vars) {
|
||||
$('#logview-tabs li:eq(5)').show();
|
||||
AddTextarea({
|
||||
@ -131,7 +130,7 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
||||
val: ParseVariableString(data.source_vars)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (!Empty(scope.source)) {
|
||||
if (scope.removeChoicesReady) {
|
||||
scope.removeChoicesReady();
|
||||
@ -295,7 +294,6 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
||||
{ "variable": "job_template", "url": "/#/job_templates/" },
|
||||
{ "variable": "created_by", "url": "/#/users/" }
|
||||
];
|
||||
|
||||
html = "<table class=\"table logviewer-status\">\n";
|
||||
for (fld in form.fields) {
|
||||
if (!Empty(scope[fld])) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user