mirror of
https://github.com/ansible/awx.git
synced 2026-03-24 20:35:02 -02:30
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:
@@ -63,6 +63,11 @@ angular.module('LogViewerOptionsDefinition', [])
|
|||||||
type: "text",
|
type: "text",
|
||||||
readonly: true
|
readonly: true
|
||||||
},
|
},
|
||||||
|
"inventory_source": {
|
||||||
|
label: "Group",
|
||||||
|
type: "text",
|
||||||
|
readonly: true
|
||||||
|
},
|
||||||
"source": {
|
"source": {
|
||||||
label: "Source",
|
label: "Source",
|
||||||
type: "text",
|
type: "text",
|
||||||
@@ -79,12 +84,12 @@ angular.module('LogViewerOptionsDefinition', [])
|
|||||||
readonly: true
|
readonly: true
|
||||||
},
|
},
|
||||||
"overwrite": {
|
"overwrite": {
|
||||||
label: "Overwrite Vars",
|
label: "Overwrite",
|
||||||
type: "text",
|
type: "text",
|
||||||
readonly: true
|
readonly: true
|
||||||
},
|
},
|
||||||
"inventory_source": {
|
"overwrite_vars": {
|
||||||
label: "Inv Source",
|
label: "Overwrite Vars",
|
||||||
type: "text",
|
type: "text",
|
||||||
readonly: true
|
readonly: true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,9 @@
|
|||||||
angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator', 'VariablesHelper'])
|
angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator', 'VariablesHelper'])
|
||||||
|
|
||||||
.factory('LogViewer', ['$compile', 'CreateDialog', 'GetJob', 'Wait', 'GenerateForm', 'LogViewerStatusForm', 'AddTable', 'AddTextarea',
|
.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,
|
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) {
|
return function(params) {
|
||||||
var parent_scope = params.scope,
|
var parent_scope = params.scope,
|
||||||
url = params.url,
|
url = params.url,
|
||||||
@@ -70,6 +70,7 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
if (data.extra_vars) {
|
if (data.extra_vars) {
|
||||||
|
$('#logview-tabs li:eq(4)').show();
|
||||||
AddTextarea({
|
AddTextarea({
|
||||||
container_id: 'variables-container',
|
container_id: 'variables-container',
|
||||||
fld_id: 'variables',
|
fld_id: 'variables',
|
||||||
@@ -81,6 +82,7 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data.source_vars) {
|
if (data.source_vars) {
|
||||||
|
$('#logview-tabs li:eq(5)').show();
|
||||||
AddTextarea({
|
AddTextarea({
|
||||||
container_id: 'source-container',
|
container_id: 'source-container',
|
||||||
fld_id: 'source-variables',
|
fld_id: 'source-variables',
|
||||||
@@ -91,6 +93,29 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
|||||||
$('#logview-tabs li:eq(5)').hide();
|
$('#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)) {
|
if (!Empty(scope.credential)) {
|
||||||
LookUpName({
|
LookUpName({
|
||||||
scope: scope,
|
scope: scope,
|
||||||
@@ -194,7 +219,10 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
|||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
.success(function(data) {
|
.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;
|
scope[scope_var + '_name'] = data.name;
|
||||||
}
|
}
|
||||||
if (!Empty(data.group)) {
|
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) {
|
return function(params) {
|
||||||
var form = params.form,
|
var form = params.form,
|
||||||
id = params.id,
|
id = params.id,
|
||||||
scope = params.scope,
|
scope = params.scope,
|
||||||
getIcon = params.getIcon,
|
getIcon = params.getIcon,
|
||||||
fld, html, url,
|
fld, html, url, e,
|
||||||
urls = [
|
urls = [
|
||||||
{ "variable": "credential", "url": "/#/credentials/" },
|
{ "variable": "credential", "url": "/#/credentials/" },
|
||||||
{ "variable": "project", "url": "/#/projects/" },
|
{ "variable": "project", "url": "/#/projects/" },
|
||||||
@@ -250,13 +278,15 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
html += scope[fld];
|
html += "{{ " + fld + " }}";
|
||||||
}
|
}
|
||||||
html += "</td></tr>\n";
|
html += "</td></tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
html += "</table>\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,
|
searchable: false,
|
||||||
columnClass: "col-md-2 hidden-xs",
|
columnClass: "col-md-2 hidden-xs",
|
||||||
filter: "date:'MM/dd/yy HH:mm:ss'",
|
filter: "date:'MM/dd/yy HH:mm:ss'",
|
||||||
key: true,
|
key: true
|
||||||
desc: true
|
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
label: 'Type',
|
label: 'Type',
|
||||||
|
|||||||
Reference in New Issue
Block a user