diff --git a/awx/ui/static/js/helpers/LogViewer.js b/awx/ui/static/js/helpers/LogViewer.js index 2219000d37..7c1c7352fa 100644 --- a/awx/ui/static/js/helpers/LogViewer.js +++ b/awx/ui/static/js/helpers/LogViewer.js @@ -56,9 +56,19 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator', for (key in data) { scope[key] = data[key]; } - + 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); + LookUpName({ + scope: scope, + scope_var: 'created_by', + url: GetBasePath('users') + scope.created_by + '/' + }); + } + // For jobs link the name to the job parent if (base === 'jobs') { if (data.type === 'job') { @@ -281,7 +291,8 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator', { "variable": "inventory", "url": "/#/inventories/" }, { "variable": "cloud_credential", "url": "/#/credentials/" }, { "variable": "inventory_source", "url": "/#/home/groups/?id={{ group }}" }, - { "variable": "job_template", "url": "/#/job_templates/" } + { "variable": "job_template", "url": "/#/job_templates/" }, + { "variable": "created_by", "url": "/#/users/" } ]; html = "\n"; diff --git a/awx/ui/static/js/helpers/Lookup.js b/awx/ui/static/js/helpers/Lookup.js index 5c50ed3a0f..8dd8c7b048 100644 --- a/awx/ui/static/js/helpers/Lookup.js +++ b/awx/ui/static/js/helpers/Lookup.js @@ -101,6 +101,7 @@ angular.module('LookUpHelper', ['RestServices', 'Utilities', 'SearchHelper', 'Pa scope.removeModalReady(); } scope.removeModalReady = scope.$on('ModalReady', function() { + $('#lookup-save-button').attr('disabled','disabled'); $('#lookup-modal-dialog').dialog('open'); }); @@ -193,10 +194,7 @@ angular.module('LookUpHelper', ['RestServices', 'Utilities', 'SearchHelper', 'Pa } } } - if (found === false) { - Alert('Missing Selection', 'Oops, you failed to make a selection. Click on a row to make your selection, ' + - 'and then click the Select button. Or, click Cancel to quit.'); - } else { + if (found) { // Selection made $('#lookup-modal-dialog').dialog('close'); if (postAction) { @@ -210,15 +208,33 @@ angular.module('LookUpHelper', ['RestServices', 'Utilities', 'SearchHelper', 'Pa scope['toggle_' + list.iterator] = function (id) { - var i; - for (i = 0; i < scope[list.name].length; i++) { - if (scope[list.name][i].id === id) { - scope[list.name][i].checked = '1'; - scope[list.name][i].success_class = 'success'; + var count = 0; + scope[list.name].forEach( function(row, i) { + if (row.id === id) { + if (row.checked === '0') { + scope[list.name][i].checked = '1'; + scope[list.name][i].success_class = 'success'; + } + else { + scope[list.name][i].checked = '0'; + scope[list.name][i].success_class = ''; + } } else { scope[list.name][i].checked = '0'; scope[list.name][i].success_class = ''; } + }); + // Check if any rows are checked + scope[list.name].forEach(function(row) { + if (row.checked === '1') { + count++; + } + }); + if (count === 0) { + $('#lookup-save-button').attr('disabled','disabled'); + } + else { + $('#lookup-save-button').removeAttr('disabled'); } }; }; diff --git a/awx/ui/static/js/helpers/Selection.js b/awx/ui/static/js/helpers/Selection.js index 1e57a53741..2f1b9de643 100644 --- a/awx/ui/static/js/helpers/Selection.js +++ b/awx/ui/static/js/helpers/Selection.js @@ -38,7 +38,7 @@ angular.module('SelectionHelper', ['Utilities', 'RestServices']) var i, j, found; for (i = 0; i < scope[list.name].length; i++) { if (scope[list.name][i].id === id) { - if ((scope[list.name][i].checked === "0" && !ischeckbox) || (scope[list.name][i].checked === "1" && ischeckbox)) { + if ((scope[list.name][i].checked === "0" && !ischeckbox) || (scope[list.name][i].checked === "0" && ischeckbox)) { // select the row scope[list.name][i].checked = '1'; scope[list.name][i].success_class = 'success'; diff --git a/awx/ui/static/lib/ansible/license.js b/awx/ui/static/lib/ansible/license.js index 12c5caafbf..0b48acf07f 100644 --- a/awx/ui/static/lib/ansible/license.js +++ b/awx/ui/static/lib/ansible/license.js @@ -74,12 +74,7 @@ angular.module('License', ['RestServices', 'Utilities', 'FormGenerator', 'Prompt } if (scope.license_date) { - dt = new Date(parseInt(scope.license_date)); - if (dt.getFullYear() === '1970') { - // date was passed in seconds rather than milliseconds - dt = new Date(parseInt(scope.license_date,10) * 1000); - scope.time_remaining = scope.time_remaining + '000'; - } + dt = new Date(parseInt(scope.license_date, 10) * 1000); scope.license_date = FormatDate(dt); days = parseInt(scope.time_remaining / 86400000, 10);