mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 01:21:21 +03:00
AC-1120. Fixed log viewer issues. Display 'Group' and group name rather than 'Inv Source'. Always display variables/source variables tabs when data present. Translate source value to a proper label using an OPTIONS request.
This commit is contained in:
parent
feb1bb6e8a
commit
61c0355f77
@ -63,6 +63,11 @@ angular.module('LogViewerOptionsDefinition', [])
|
||||
type: "text",
|
||||
readonly: true
|
||||
},
|
||||
"inventory_source": {
|
||||
label: "Group",
|
||||
type: "text",
|
||||
readonly: true
|
||||
},
|
||||
"source": {
|
||||
label: "Source",
|
||||
type: "text",
|
||||
@ -79,12 +84,12 @@ angular.module('LogViewerOptionsDefinition', [])
|
||||
readonly: true
|
||||
},
|
||||
"overwrite": {
|
||||
label: "Overwrite Vars",
|
||||
label: "Overwrite",
|
||||
type: "text",
|
||||
readonly: true
|
||||
},
|
||||
"inventory_source": {
|
||||
label: "Inv Source",
|
||||
"overwrite_vars": {
|
||||
label: "Overwrite Vars",
|
||||
type: "text",
|
||||
readonly: true
|
||||
}
|
||||
|
@ -10,9 +10,9 @@
|
||||
angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator', 'VariablesHelper'])
|
||||
|
||||
.factory('LogViewer', ['$compile', 'CreateDialog', 'GetJob', 'Wait', 'GenerateForm', 'LogViewerStatusForm', 'AddTable', 'AddTextarea',
|
||||
'LogViewerOptionsForm', 'EnvTable', 'GetBasePath', 'LookUpName', 'Empty', 'AddPreFormattedText', 'ParseVariableString',
|
||||
'LogViewerOptionsForm', 'EnvTable', 'GetBasePath', 'LookUpName', 'Empty', 'AddPreFormattedText', 'ParseVariableString', 'GetChoices',
|
||||
function($compile, CreateDialog, GetJob, Wait, GenerateForm, LogViewerStatusForm, AddTable, AddTextarea, LogViewerOptionsForm, EnvTable,
|
||||
GetBasePath, LookUpName, Empty, AddPreFormattedText, ParseVariableString) {
|
||||
GetBasePath, LookUpName, Empty, AddPreFormattedText, ParseVariableString, GetChoices) {
|
||||
return function(params) {
|
||||
var parent_scope = params.scope,
|
||||
url = params.url,
|
||||
@ -70,6 +70,7 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
||||
}*/
|
||||
|
||||
if (data.extra_vars) {
|
||||
$('#logview-tabs li:eq(4)').show();
|
||||
AddTextarea({
|
||||
container_id: 'variables-container',
|
||||
fld_id: 'variables',
|
||||
@ -81,6 +82,7 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
||||
}
|
||||
|
||||
if (data.source_vars) {
|
||||
$('#logview-tabs li:eq(5)').show();
|
||||
AddTextarea({
|
||||
container_id: 'source-container',
|
||||
fld_id: 'source-variables',
|
||||
@ -91,6 +93,29 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
||||
$('#logview-tabs li:eq(5)').hide();
|
||||
}
|
||||
|
||||
if (!Empty(scope.source)) {
|
||||
if (scope.removeChoicesReady) {
|
||||
scope.removeChoicesReady();
|
||||
}
|
||||
scope.removeChoicesReady = scope.$on('ChoicesReady', function() {
|
||||
scope.source_choices.every(function(e) {
|
||||
if (e.value === scope.source) {
|
||||
scope.source = e.label;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
});
|
||||
GetChoices({
|
||||
scope: scope,
|
||||
url: GetBasePath('inventory_sources'),
|
||||
field: 'source',
|
||||
variable: 'source_choices',
|
||||
choice_name: 'choices',
|
||||
callback: 'ChoicesReady'
|
||||
});
|
||||
}
|
||||
|
||||
if (!Empty(scope.credential)) {
|
||||
LookUpName({
|
||||
scope: scope,
|
||||
@ -194,7 +219,10 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
||||
Rest.setUrl(url);
|
||||
Rest.get()
|
||||
.success(function(data) {
|
||||
if (!Empty(data.name)) {
|
||||
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)) {
|
||||
@ -209,13 +237,13 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
||||
};
|
||||
}])
|
||||
|
||||
.factory('AddTable', ['Empty', 'Find', function(Empty, Find) {
|
||||
.factory('AddTable', ['$compile', 'Empty', 'Find', function($compile, Empty, Find) {
|
||||
return function(params) {
|
||||
var form = params.form,
|
||||
id = params.id,
|
||||
scope = params.scope,
|
||||
getIcon = params.getIcon,
|
||||
fld, html, url,
|
||||
fld, html, url, e,
|
||||
urls = [
|
||||
{ "variable": "credential", "url": "/#/credentials/" },
|
||||
{ "variable": "project", "url": "/#/projects/" },
|
||||
@ -250,13 +278,15 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
||||
}
|
||||
}
|
||||
else {
|
||||
html += scope[fld];
|
||||
html += "{{ " + fld + " }}";
|
||||
}
|
||||
html += "</td></tr>\n";
|
||||
}
|
||||
}
|
||||
html += "</table>\n";
|
||||
$('#' + id).empty().html(html);
|
||||
e = angular.element(document.getElementById(id));
|
||||
e.empty().html(html);
|
||||
$compile(e)(scope);
|
||||
};
|
||||
}])
|
||||
|
||||
|
@ -37,8 +37,7 @@ angular.module('ScheduledJobsDefinition', [])
|
||||
searchable: false,
|
||||
columnClass: "col-md-2 hidden-xs",
|
||||
filter: "date:'MM/dd/yy HH:mm:ss'",
|
||||
key: true,
|
||||
desc: true
|
||||
key: true
|
||||
},
|
||||
type: {
|
||||
label: 'Type',
|
||||
|
Loading…
Reference in New Issue
Block a user