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:
Chris Houseknecht
2014-07-01 23:37:36 -04:00
parent 2398e17206
commit e9115c5ca2
2 changed files with 19 additions and 47 deletions
+9 -35
View File
@@ -9,8 +9,8 @@
angular.module('EventViewerHelper', ['ModalDialog', 'Utilities']) angular.module('EventViewerHelper', ['ModalDialog', 'Utilities'])
.factory('EventViewer', ['$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, AddTable, GetBasePath, LookUpName, Empty, AddPreFormattedText) { function($compile, CreateDialog, GetEvent, Wait, EventAddTable, GetBasePath, LookUpName, Empty, EventAddPreFormattedText) {
return function(params) { return function(params) {
var parent_scope = params.scope, var parent_scope = params.scope,
url = params.url, url = params.url,
@@ -39,11 +39,11 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities'])
$('#eventview-tabs li:eq(2)').hide(); $('#eventview-tabs li:eq(2)').hide();
$('#eventview-tabs li:eq(3)').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) { if (data.stdout) {
$('#eventview-tabs li:eq(1)').show(); $('#eventview-tabs li:eq(1)').show();
AddPreFormattedText({ EventAddPreFormattedText({
id: 'stdout-form-container', id: 'stdout-form-container',
val: data.stdout val: data.stdout
}); });
@@ -51,7 +51,7 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities'])
if (data.stderr) { if (data.stderr) {
$('#eventview-tabs li:eq(2)').show(); $('#eventview-tabs li:eq(2)').show();
AddPreFormattedText({ EventAddPreFormattedText({
id: 'stderr-form-container', id: 'stderr-form-container',
val: data.stderr val: data.stderr
}); });
@@ -59,7 +59,7 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities'])
if (data.traceback) { if (data.traceback) {
$('#eventview-tabs li:eq(3)').show(); $('#eventview-tabs li:eq(3)').show();
AddPreFormattedText({ EventAddPreFormattedText({
id: 'traceback-form-container', id: 'traceback-form-container',
val: data.traceback val: data.traceback
}); });
@@ -160,33 +160,7 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities'])
}; };
}]) }])
.factory('LookUpName', ['Rest', 'ProcessErrors', 'Empty', function(Rest, ProcessErrors, Empty) { .factory('EventAddTable', ['$compile', '$filter', 'Empty', function($compile, $filter, 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) {
return function(params) { return function(params) {
var scope = params.scope, var scope = params.scope,
id = params.id, id = params.id,
@@ -274,7 +248,7 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities'])
}; };
}]) }])
.factory('AddTextarea', [ function() { .factory('EventAddTextarea', [ function() {
return function(params) { return function(params) {
var container_id = params.container_id, var container_id = params.container_id,
val = params.val, val = params.val,
@@ -287,7 +261,7 @@ angular.module('EventViewerHelper', ['ModalDialog', 'Utilities'])
}; };
}]) }])
.factory('AddPreFormattedText', [function() { .factory('EventAddPreFormattedText', [function() {
return function(params) { return function(params) {
var id = params.id, var id = params.id,
val = params.val, val = params.val,
-2
View File
@@ -34,7 +34,6 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
} }
scope.removeJobReady = scope.$on('JobReady', function(e, data) { scope.removeJobReady = scope.$on('JobReady', function(e, data) {
var key, resizeText, elem; var key, resizeText, elem;
$('#status-form-container').empty(); $('#status-form-container').empty();
$('#options-form-container').empty(); $('#options-form-container').empty();
$('#stdout-form-container').empty(); $('#stdout-form-container').empty();
@@ -295,7 +294,6 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
{ "variable": "job_template", "url": "/#/job_templates/" }, { "variable": "job_template", "url": "/#/job_templates/" },
{ "variable": "created_by", "url": "/#/users/" } { "variable": "created_by", "url": "/#/users/" }
]; ];
html = "<table class=\"table logviewer-status\">\n"; html = "<table class=\"table logviewer-status\">\n";
for (fld in form.fields) { for (fld in form.fields) {
if (!Empty(scope[fld])) { if (!Empty(scope[fld])) {