diff --git a/awx/ui/static/js/forms/LogViewerOptions.js b/awx/ui/static/js/forms/LogViewerOptions.js index 680168e73b..430259f3c1 100644 --- a/awx/ui/static/js/forms/LogViewerOptions.js +++ b/awx/ui/static/js/forms/LogViewerOptions.js @@ -13,8 +13,8 @@ angular.module('LogViewerOptionsDefinition', []) well: false, fields: { - "job_type": { - label: "Job Type", + "job_template": { + label: "Job Template", type: "text", readonly: true }, diff --git a/awx/ui/static/js/helpers/Jobs.js b/awx/ui/static/js/helpers/Jobs.js index 4f06d1e506..e3eb38eadd 100644 --- a/awx/ui/static/js/helpers/Jobs.js +++ b/awx/ui/static/js/helpers/Jobs.js @@ -273,13 +273,17 @@ angular.module('JobsHelper', ['Utilities', 'RestServices', 'FormGenerator', 'Job .factory('JobsListUpdate', ['Rest', function(Rest) { return function(params) { var scope = params.scope, - parent_scope = params.scope, + parent_scope = params.parent_scope, list = params.list; scope[list.name].forEach(function(item, item_idx) { var fld, field, itm = scope[list.name][item_idx]; + //if (item.type === 'inventory_update') { + // itm.name = itm.name.replace(/^.*?:/,'').replace(/^: /,''); + //} + // Set the item type label if (list.fields.type) { parent_scope.type_choices.every(function(choice) { diff --git a/awx/ui/static/js/helpers/LogViewer.js b/awx/ui/static/js/helpers/LogViewer.js index f72931b363..4e7700bc68 100644 --- a/awx/ui/static/js/helpers/LogViewer.js +++ b/awx/ui/static/js/helpers/LogViewer.js @@ -9,15 +9,16 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator', 'VariablesHelper']) - .factory('LogViewer', ['$compile', 'CreateDialog', 'GetJob', 'Wait', 'GenerateForm', 'LogViewerStatusForm', 'AddTable', 'AddTextarea', + .factory('LogViewer', ['$location', '$compile', 'CreateDialog', 'GetJob', 'Wait', 'GenerateForm', 'LogViewerStatusForm', 'AddTable', 'AddTextarea', 'LogViewerOptionsForm', 'EnvTable', 'GetBasePath', 'LookUpName', 'Empty', 'AddPreFormattedText', 'ParseVariableString', 'GetChoices', - function($compile, CreateDialog, GetJob, Wait, GenerateForm, LogViewerStatusForm, AddTable, AddTextarea, LogViewerOptionsForm, EnvTable, + function($location, $compile, CreateDialog, GetJob, Wait, GenerateForm, LogViewerStatusForm, AddTable, AddTextarea, LogViewerOptionsForm, EnvTable, GetBasePath, LookUpName, Empty, AddPreFormattedText, ParseVariableString, GetChoices) { return function(params) { var parent_scope = params.scope, url = params.url, getIcon = params.getIcon, - scope = parent_scope.$new(); + scope = parent_scope.$new(true), + base = $location.path().replace(/^\//, '').split('/')[0]; if (scope.removeModalReady) { scope.removeModalReady(); @@ -56,6 +57,26 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator', scope[key] = data[key]; } + scope.job_template = ''; + + // For jobs link the name to the job parent + if (base === 'jobs') { + if (data.type === 'job') { + scope.name_link = "job_template"; + scope.job_template = data.unified_job_template; + scope.job_template_name = data.summary_fields.job_template.name; + scope.name_id = data.unified_job_template; + } + if (data.type === 'project_update') { + scope.name_link = "project"; + scope.name_id = data.unified_job_template; + } + if (data.type === 'inventory_update') { + scope.name_link = "inventory_source"; + scope.name_id = scope.group; + } + } + AddTable({ scope: scope, form: LogViewerStatusForm, id: 'status-form-container', getIcon: getIcon }); AddTable({ scope: scope, form: LogViewerOptionsForm, id: 'options-form-container', getIcon: getIcon }); @@ -200,6 +221,7 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator', scope.modalOK = function() { $('#logviewer-modal-dialog').dialog('close'); + scope.$destroy(); }; }; }]) @@ -258,7 +280,8 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator', { "variable": "project", "url": "/#/projects/" }, { "variable": "inventory", "url": "/#/inventories/" }, { "variable": "cloud_credential", "url": "/#/credentials/" }, - { "variable": "inventory_source", "url": "/#/home/groups/?id=" } + { "variable": "inventory_source", "url": "/#/home/groups/?id={{ group }}" }, + { "variable": "job_template", "url": "/#/job_templates/" } ]; html = "