From 5ea4a688200a9baed6d35544612f4afcc5d85178 Mon Sep 17 00:00:00 2001 From: Chris Houseknecht Date: Tue, 1 Apr 2014 17:44:35 -0400 Subject: [PATCH] Fixed jobs list on Job Templates page. All the buttons and links now work. --- awx/ui/static/js/app.js | 2 +- awx/ui/static/js/controllers/JobEvents.js | 4 +- awx/ui/static/js/controllers/JobTemplates.js | 221 +++++++++++-------- awx/ui/static/js/controllers/Jobs.js | 4 +- awx/ui/static/js/forms/JobTemplates.js | 6 +- awx/ui/static/js/helpers/JobSubmission.js | 17 +- awx/ui/static/js/helpers/Jobs.js | 144 ++++++------ awx/ui/static/js/helpers/LogViewer.js | 3 + awx/ui/static/js/helpers/Projects.js | 2 +- awx/ui/static/js/helpers/Schedules.js | 2 +- awx/ui/static/js/helpers/related-search.js | 20 +- awx/ui/static/js/lists/CompletedJobs.js | 1 + awx/ui/static/js/lists/ScheduledJobs.js | 5 +- awx/ui/static/js/lists/Schedules.js | 4 +- awx/ui/static/partials/job_templates.html | 1 + 15 files changed, 256 insertions(+), 180 deletions(-) diff --git a/awx/ui/static/js/app.js b/awx/ui/static/js/app.js index ea3a3da4d5..1e1bed981d 100644 --- a/awx/ui/static/js/app.js +++ b/awx/ui/static/js/app.js @@ -143,7 +143,7 @@ angular.module('ansible', [ controller: 'JobTemplatesAdd' }). - when('/job_templates/:id', { + when('/job_templates/:template_id', { templateUrl: urlPrefix + 'partials/job_templates.html', controller: 'JobTemplatesEdit' }). diff --git a/awx/ui/static/js/controllers/JobEvents.js b/awx/ui/static/js/controllers/JobEvents.js index ba9e253bc8..5b856aef9d 100644 --- a/awx/ui/static/js/controllers/JobEvents.js +++ b/awx/ui/static/js/controllers/JobEvents.js @@ -38,8 +38,8 @@ function JobEventsList($filter, $scope, $rootScope, $location, $log, $routeParam $scope.removeSetHostLinks = $scope.$on('SetHostLinks', function (e, inventory_id) { for (var i = 0; i < $scope.jobevents.length; i++) { if ($scope.jobevents[i].summary_fields.host) { - $scope.jobevents[i].hostLink = "/#/inventories/" + inventory_id + "/hosts/?name=" + - encodeURI($scope.jobevents[i].summary_fields.host.name); + $scope.jobevents[i].hostLink = "/#/inventories/" + inventory_id; + //encodeURI($scope.jobevents[i].summary_fields.host.name); } } }); diff --git a/awx/ui/static/js/controllers/JobTemplates.js b/awx/ui/static/js/controllers/JobTemplates.js index 6df28e2ce3..6387d18162 100644 --- a/awx/ui/static/js/controllers/JobTemplates.js +++ b/awx/ui/static/js/controllers/JobTemplates.js @@ -337,7 +337,8 @@ JobTemplatesAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$lo function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeParams, JobTemplateForm, GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, InventoryList, CredentialList, ProjectList, LookUpInit, GetBasePath, md5Setup, ParseTypeChange, JobStatusToolTip, FormatDate, - Wait, Stream, Empty, Prompt, ParseVariableString, ToJSON, SchedulesControllerInit) { + Wait, Stream, Empty, Prompt, ParseVariableString, ToJSON, SchedulesControllerInit, JobsControllerInit, JobsListUpdate, + GetChoices) { ClearScope(); @@ -347,13 +348,15 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP loadingFinishedCount = 0, base = $location.path().replace(/^\//, '').split('/')[0], master = {}, - id = $routeParams.id, + id = $routeParams.template_id, relatedSets = {}, - checkSCMStatus, getPlaybooks, callback; + checkSCMStatus, getPlaybooks, callback, + choicesCount = 0; generator.inject(form, { mode: 'edit', related: true, scope: $scope }); $scope.parseType = 'yaml'; + $scope.showJobType = false; // Our job type options $scope.job_type_options = [ @@ -475,22 +478,20 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP }); // Set the status/badge for each related job - if ($scope.removeRelatedJobs) { - $scope.removeRelatedJobs(); + if ($scope.removeRelatedCompletedJobs) { + $scope.removeRelatedCompletedJobs(); } - $scope.removeRelatedJobs = $scope.$on('relatedjobs', function () { - var i, cDate; - if ($scope.jobs && $scope.jobs.length) { - for (i = 0; i < $scope.jobs.length; i++) { - // Convert created date to local time zone - cDate = new Date($scope.jobs[i].created); - $scope.jobs[i].created = FormatDate(cDate); - // Set tooltip and link - $scope.jobs[i].statusBadgeToolTip = JobStatusToolTip($scope.jobs[i].status) + - " Click to view status details."; - $scope.jobs[i].statusLinkTo = '/#/jobs/' + $scope.jobs[i].id; - } - } + $scope.removeRelatedCompletedJobs = $scope.$on('relatedcompleted_jobs', function () { + JobsControllerInit({ + scope: $scope, + parent_scope: $scope, + iterator: form.related.completed_jobs.iterator + }); + JobsListUpdate({ + scope: $scope, + parent_scope: $scope, + list: form.related.completed_jobs + }); }); if ($scope.cloudCredentialReadyRemove) { @@ -553,94 +554,126 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP }); Wait('start'); - // Retrieve detail record and prepopulate the form - Rest.setUrl(defaultUrl + ':id/'); - Rest.get({ params: { id: id } }) - .success(function (data) { - var fld, i; - LoadBreadCrumbs({ path: '/job_templates/' + id, title: data.name }); - for (fld in form.fields) { - if (fld !== 'variables' && data[fld] !== null && data[fld] !== undefined) { - if (form.fields[fld].type === 'select') { - if ($scope[fld + '_options'] && $scope[fld + '_options'].length > 0) { - for (i = 0; i < $scope[fld + '_options'].length; i++) { - if (data[fld] === $scope[fld + '_options'][i].value) { - $scope[fld] = $scope[fld + '_options'][i]; + + if ($scope.removeLoadJobs) { + $scope.rmoveLoadJobs(); + } + $scope.removeLoadJobs = $scope.$on('LoadJobs', function() { + // Retrieve detail record and prepopulate the form + Rest.setUrl(defaultUrl + ':id/'); + Rest.get({ params: { id: id } }) + .success(function (data) { + var fld, i; + LoadBreadCrumbs({ path: '/job_templates/' + id, title: data.name }); + for (fld in form.fields) { + if (fld !== 'variables' && data[fld] !== null && data[fld] !== undefined) { + if (form.fields[fld].type === 'select') { + if ($scope[fld + '_options'] && $scope[fld + '_options'].length > 0) { + for (i = 0; i < $scope[fld + '_options'].length; i++) { + if (data[fld] === $scope[fld + '_options'][i].value) { + $scope[fld] = $scope[fld + '_options'][i]; + } } + } else { + $scope[fld] = data[fld]; } } else { $scope[fld] = data[fld]; } - } else { - $scope[fld] = data[fld]; + master[fld] = $scope[fld]; + } + if (fld === 'variables') { + // Parse extra_vars, converting to YAML. + $scope.variables = ParseVariableString(data.extra_vars); + master.variables = $scope.variables; + } + if (form.fields[fld].type === 'lookup' && data.summary_fields[form.fields[fld].sourceModel]) { + $scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] = + data.summary_fields[form.fields[fld].sourceModel][form.fields[fld].sourceField]; + master[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] = + $scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField]; } - master[fld] = $scope[fld]; } - if (fld === 'variables') { - // Parse extra_vars, converting to YAML. - $scope.variables = ParseVariableString(data.extra_vars); - master.variables = $scope.variables; - } - if (form.fields[fld].type === 'lookup' && data.summary_fields[form.fields[fld].sourceModel]) { - $scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] = - data.summary_fields[form.fields[fld].sourceModel][form.fields[fld].sourceField]; - master[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] = - $scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField]; - } - } - $scope.url = data.url; - - relatedSets = form.relatedSets(data.related); - - $scope.callback_url = data.related.callback; - master.callback_url = $scope.callback_url; + $scope.url = data.url; + + relatedSets = form.relatedSets(data.related); + + $scope.callback_url = data.related.callback; + master.callback_url = $scope.callback_url; - LookUpInit({ - scope: $scope, - form: form, - current_item: data.inventory, - list: InventoryList, - field: 'inventory' - }); + LookUpInit({ + scope: $scope, + form: form, + current_item: data.inventory, + list: InventoryList, + field: 'inventory' + }); - LookUpInit({ - url: GetBasePath('credentials') + '?kind=ssh', - scope: $scope, - form: form, - current_item: data.credential, - list: CredentialList, - field: 'credential', - hdr: 'Select Machine Credential' - }); + LookUpInit({ + url: GetBasePath('credentials') + '?kind=ssh', + scope: $scope, + form: form, + current_item: data.credential, + list: CredentialList, + field: 'credential', + hdr: 'Select Machine Credential' + }); - LookUpInit({ - scope: $scope, - form: form, - current_item: data.project, - list: ProjectList, - field: 'project' - }); + LookUpInit({ + scope: $scope, + form: form, + current_item: data.project, + list: ProjectList, + field: 'project' + }); - RelatedSearchInit({ - scope: $scope, - form: form, - relatedSets: relatedSets - }); - - RelatedPaginateInit({ - scope: $scope, - relatedSets: relatedSets - }); + RelatedSearchInit({ + scope: $scope, + form: form, + relatedSets: relatedSets + }); + + RelatedPaginateInit({ + scope: $scope, + relatedSets: relatedSets + }); - $scope.$emit('jobTemplateLoaded', data.related.cloud_credential); - }) - .error(function (data, status) { - ProcessErrors($scope, data, status, form, { - hdr: 'Error!', - msg: 'Failed to retrieve job template: ' + $routeParams.id + '. GET status: ' + status + $scope.$emit('jobTemplateLoaded', data.related.cloud_credential); + }) + .error(function (data, status) { + ProcessErrors($scope, data, status, form, { + hdr: 'Error!', + msg: 'Failed to retrieve job template: ' + $routeParams.template_id + '. GET status: ' + status + }); }); - }); + }); + + if ($scope.removeChoicesReady) { + $scope.removeChoicesReady(); + } + $scope.removeChoicesReady = $scope.$on('choicesReady', function() { + choicesCount++; + if (choicesCount === 2) { + $scope.$emit('LoadJobs'); + } + }); + + GetChoices({ + scope: $scope, + url: GetBasePath('unified_jobs'), + field: 'status', + variable: 'status_choices', + callback: 'choicesReady' + }); + + GetChoices({ + scope: $scope, + url: GetBasePath('unified_jobs'), + field: 'type', + variable: 'type_choices', + callback: 'choicesReady' + }); function saveCompleted() { setTimeout(function() { $scope.$apply(function() { $location.path('/job_templates'); }); }, 500); @@ -713,7 +746,7 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP // Related set: Add button $scope.add = function (set) { $rootScope.flashMessage = null; - $location.path('/' + base + '/' + $routeParams.id + '/' + set); + $location.path('/' + base + '/' + $routeParams.template_id + '/' + set); }; // Related set: Edit button @@ -757,5 +790,5 @@ JobTemplatesEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$l 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit', 'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'InventoryList', 'CredentialList', 'ProjectList', 'LookUpInit', 'GetBasePath', 'md5Setup', 'ParseTypeChange', 'JobStatusToolTip', 'FormatDate', 'Wait', 'Stream', 'Empty', 'Prompt', - 'ParseVariableString', 'ToJSON', 'SchedulesControllerInit' + 'ParseVariableString', 'ToJSON', 'SchedulesControllerInit', 'JobsControllerInit', 'JobsListUpdate', 'GetChoices' ]; \ No newline at end of file diff --git a/awx/ui/static/js/controllers/Jobs.js b/awx/ui/static/js/controllers/Jobs.js index 2f89b6ba2b..35f49dbef3 100644 --- a/awx/ui/static/js/controllers/Jobs.js +++ b/awx/ui/static/js/controllers/Jobs.js @@ -21,6 +21,8 @@ function JobsListController ($scope, $compile, ClearScope, Breadcrumbs, LoadBrea LoadBreadCrumbs(); + $scope.showJobType = true; + // Add breadcrumbs e = angular.element(document.getElementById('breadcrumbs')); e.html(Breadcrumbs({ list: { editTitle: 'Jobs' } , mode: 'edit' })); @@ -62,7 +64,7 @@ function JobsListController ($scope, $compile, ClearScope, Breadcrumbs, LoadBrea scope: scheduled_scope, list: ScheduledJobsList, id: 'scheduled-jobs', - url: GetBasePath('schedules') + url: GetBasePath('schedules') + '?next_run__isnull=false' }); $scope.refreshJobs = function() { diff --git a/awx/ui/static/js/forms/JobTemplates.js b/awx/ui/static/js/forms/JobTemplates.js index 97782b1cf2..93bf5d2a58 100644 --- a/awx/ui/static/js/forms/JobTemplates.js +++ b/awx/ui/static/js/forms/JobTemplates.js @@ -23,7 +23,7 @@ angular.module('JobTemplateFormDefinition', ['SchedulesListDefinition', 'Complet collapse: true, collapseTitle: "Properties", collapseMode: 'edit', - collapseOpenFirst: true, //Always open first panel + collapseOpenFirst: false, //Always open first panel actions: { stream: { @@ -291,7 +291,7 @@ angular.module('JobTemplateFormDefinition', ['SchedulesListDefinition', 'Complet schedules: { include: "SchedulesList" }, - completed_jobs: { + "completed_jobs": { include: "CompletedJobsList" } }, @@ -300,7 +300,7 @@ angular.module('JobTemplateFormDefinition', ['SchedulesListDefinition', 'Complet return { completed_jobs: { iterator: 'completed_job', - url: urls.jobs + url: urls.jobs + '?or__status=successful&or__status=failed&or__status=error&or__status=canceled' }, schedules: { iterator: 'schedule', diff --git a/awx/ui/static/js/helpers/JobSubmission.js b/awx/ui/static/js/helpers/JobSubmission.js index 3080faf7b3..e9fd445d23 100644 --- a/awx/ui/static/js/helpers/JobSubmission.js +++ b/awx/ui/static/js/helpers/JobSubmission.js @@ -154,16 +154,21 @@ function(Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialList) { }]) // Submit request to run a playbook -.factory('PlaybookRun', ['LaunchJob', 'PromptForPasswords', 'Rest', '$location', 'GetBasePath', 'ProcessErrors', 'Wait', 'Empty', 'PromptForCredential', - function (LaunchJob, PromptForPasswords, Rest, $location, GetBasePath, ProcessErrors, Wait, Empty, PromptForCredential) { +.factory('PlaybookRun', ['$location','$routeParams', 'LaunchJob', 'PromptForPasswords', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait', 'Empty', 'PromptForCredential', + function ($location, $routeParams, LaunchJob, PromptForPasswords, Rest, GetBasePath, ProcessErrors, Wait, Empty, PromptForCredential) { return function (params) { var scope = params.scope, id = params.id, base = $location.path().replace(/^\//, '').split('/')[0], - url = GetBasePath(base) + id + '/', - job_template, - new_job_id, - launch_url; + url, job_template, new_job_id, launch_url; + + if (!Empty($routeParams.template_id)) { + // launching a job from job_template detail page + url = GetBasePath('jobs') + id + '/'; + } + else { + url = GetBasePath(base) + id + '/'; + } if (scope.removePostTheJob) { scope.removePostTheJob(); diff --git a/awx/ui/static/js/helpers/Jobs.js b/awx/ui/static/js/helpers/Jobs.js index 2221ed40a0..059a39aea8 100644 --- a/awx/ui/static/js/helpers/Jobs.js +++ b/awx/ui/static/js/helpers/Jobs.js @@ -22,7 +22,9 @@ angular.module('JobsHelper', ['Utilities', 'RestServices', 'FormGenerator', 'Job function($location, Find, DeleteJob, RelaunchJob, LogViewer) { return function(params) { var scope = params.scope, - parent_scope = params.parent_scope; + parent_scope = params.parent_scope, + iterator = (params.iterator) ? params.iterator : scope.iterator, + base = $location.path().replace(/^\//, '').split('/')[0]; scope.deleteJob = function(id) { DeleteJob({ scope: scope, id: id }); @@ -59,7 +61,13 @@ angular.module('JobsHelper', ['Utilities', 'RestServices', 'FormGenerator', 'Job }; scope.refreshJobs = function() { - parent_scope.refreshJobs(); + if (base === 'jobs') { + parent_scope.refreshJobs(); + } + else { + scope.search(iterator); + } + }; scope.viewJobLog = function(id, url) { @@ -80,8 +88,7 @@ angular.module('JobsHelper', ['Utilities', 'RestServices', 'FormGenerator', 'Job job = Find({ list: list, key: 'id', val: id }); LogViewer({ scope: scope, - url: job.url, - status_icon: 'icon-job-' + job.status + url: job.url }); } }; @@ -262,13 +269,77 @@ angular.module('JobsHelper', ['Utilities', 'RestServices', 'FormGenerator', 'Job } ]) + +.factory('JobsListUpdate', ['Rest', function(Rest) { + return function(params) { + var scope = params.scope, + parent_scope = params.scope, + list = params.list; + + scope[list.name].forEach(function(item, item_idx) { + var fld, field, + itm = scope[list.name][item_idx]; + + // Set the item type label + if (list.fields.type) { + parent_scope.type_choices.every(function(choice) { + if (choice.value === item.type) { + itm.type_label = choice.label; + return false; + } + return true; + }); + } + // Set the job status label + parent_scope.status_choices.every(function(status) { + if (status.value === item.status) { + itm.status_label = status.label; + return false; + } + return true; + }); + //Set the name link + if (item.type === "inventory_update") { + Rest.setUrl(item.related.inventory_source); + Rest.get() + .success(function(data) { + itm.nameHref = "/inventories/" + data.inventory; + }); + } + else if (item.type === "project_update") { + itm.nameHref = "/projects/" + item.project; + } + else if (item.type === "job") { + itm.nameHref = ""; + } + + if (list.name === 'completed_jobs' || list.name === 'running_jobs') { + itm.status_tip = itm.status_label + '. Click for details.'; + } + else if (list.name === 'queued_jobs') { + itm.status_tip = 'Pending'; + } + + // Copy summary_field values + for (field in list.fields) { + fld = list.fields[field]; + if (fld.sourceModel) { + if (itm.summary_fields[fld.sourceModel]) { + itm[field] = itm.summary_fields[fld.sourceModel][fld.sourceField]; + } + } + } + }); + }; +}]) + /** * * Called from JobsList controller to load each section or list on the page * */ -.factory('LoadJobsScope', ['SearchInit', 'PaginateInit', 'GenerateList', 'JobsControllerInit', 'Rest', - function(SearchInit, PaginateInit, GenerateList, JobsControllerInit, Rest) { +.factory('LoadJobsScope', ['SearchInit', 'PaginateInit', 'GenerateList', 'JobsControllerInit', 'JobsListUpdate', + function(SearchInit, PaginateInit, GenerateList, JobsControllerInit, JobsListUpdate) { return function(params) { var parent_scope = params.parent_scope, scope = params.scope, @@ -298,70 +369,15 @@ angular.module('JobsHelper', ['Utilities', 'RestServices', 'FormGenerator', 'Job url: url, pageSize: 5 }); - + scope.iterator = list.iterator; if (scope.removePostRefresh) { scope.removePostRefresh(); } scope.$on('PostRefresh', function(){ - JobsControllerInit({ scope: scope, parent_scope: parent_scope }); - - scope[list.name].forEach(function(item, item_idx) { - var fld, field, - itm = scope[list.name][item_idx]; - - // Set the item type label - if (list.fields.type) { - parent_scope.type_choices.every(function(choice) { - if (choice.value === item.type) { - itm.type_label = choice.label; - return false; - } - return true; - }); - } - // Set the job status label - parent_scope.status_choices.every(function(status) { - if (status.value === item.status) { - itm.status_label = status.label; - return false; - } - return true; - }); - //Set the name link - if (item.type === "inventory_update") { - Rest.setUrl(item.related.inventory_source); - Rest.get() - .success(function(data) { - itm.nameHref = "/inventories/" + data.inventory; - }); - } - else if (item.type === "project_update") { - itm.nameHref = "/projects/" + item.project; - } - else if (item.type === "job") { - itm.nameHref = ""; - } - - if (list.name === 'completed_jobs' || list.name === 'running_jobs') { - itm.status_tip = itm.status_label + '. Click for details.'; - } - else if (list.name === 'queued_jobs') { - itm.status_tip = 'Pending'; - } - - // Copy summary_field values - for (field in list.fields) { - fld = list.fields[field]; - if (fld.sourceModel) { - if (itm.summary_fields[fld.sourceModel]) { - itm[field] = itm.summary_fields[fld.sourceModel][fld.sourceField]; - } - } - } - }); + JobsListUpdate({ scope: scope, parent_scope: parent_scope, list: list }); parent_scope.$emit('listLoaded'); }); scope.search(list.iterator); @@ -415,7 +431,7 @@ function(Find, GetBasePath, Rest, Wait, ProcessErrors, Prompt){ Rest.destroy() .success(function () { $('#prompt-modal').modal('hide'); - scope.search(scope.iterator); + scope.refreshJobs(); }) .error(function (data, status) { $('#prompt-modal').modal('hide'); diff --git a/awx/ui/static/js/helpers/LogViewer.js b/awx/ui/static/js/helpers/LogViewer.js index 7322af9cf0..95f0a6872d 100644 --- a/awx/ui/static/js/helpers/LogViewer.js +++ b/awx/ui/static/js/helpers/LogViewer.js @@ -240,6 +240,9 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator', html += " " + scope[fld]; //html += " " + scope[fld]; } + else if (fld === 'status') { + html += " " + scope[fld]; + } else { html += scope[fld]; } diff --git a/awx/ui/static/js/helpers/Projects.js b/awx/ui/static/js/helpers/Projects.js index ee9081c347..1741d5bf3f 100644 --- a/awx/ui/static/js/helpers/Projects.js +++ b/awx/ui/static/js/helpers/Projects.js @@ -29,7 +29,7 @@ angular.module('ProjectsHelper', ['RestServices', 'Utilities', 'ProjectStatusDef break; case 'updating': case 'running': - result = 'running pulsate'; + result = 'running'; break; case 'successful': result = 'success'; diff --git a/awx/ui/static/js/helpers/Schedules.js b/awx/ui/static/js/helpers/Schedules.js index 3222e9a1c3..18a7cf429c 100644 --- a/awx/ui/static/js/helpers/Schedules.js +++ b/awx/ui/static/js/helpers/Schedules.js @@ -419,7 +419,7 @@ angular.module('SchedulesHelper', [ 'Utilities', 'RestServices', 'SchedulesHelpe }); }; - scope.refreshJobs = function() { + scope.refreshSchedule = function() { if (base === 'jobs') { parent_scope.refreshJobs(); } diff --git a/awx/ui/static/js/helpers/related-search.js b/awx/ui/static/js/helpers/related-search.js index b08e85c111..ff00b062bc 100644 --- a/awx/ui/static/js/helpers/related-search.js +++ b/awx/ui/static/js/helpers/related-search.js @@ -34,11 +34,25 @@ angular.module('RelatedSearchHelper', ['RestServices', 'Utilities', 'RefreshRela iterator = form.related[set].iterator; for (fld in form.related[set].fields) { if (form.related[set].fields[fld].key) { - scope[iterator + 'SearchField'] = fld; - scope[iterator + 'SearchFieldLabel'] = form.related[set].fields[fld].label; + if (form.related[set].fields[fld].searchable === undefined || form.related[set].fields[fld].searchable === true) { + scope[iterator + 'SearchField'] = fld; + scope[iterator + 'SearchFieldLabel'] = form.related[set].fields[fld].label; + } break; } } + + if (Empty(scope[iterator + 'SearchField'])) { + // A field marked as key may not be 'searchable'. Find the first searchable field. + for (fld in form.related[set].fields) { + if (form.related[set].fields[fld].searchable === undefined || form.related[set].fields[fld].searchable === true) { + scope[iterator + 'SearchField'] = fld; + scope[iterator + 'SearchFieldLabel'] = form.related[set].fields[fld].label; + break; + } + } + } + scope[iterator + 'SortOrder'] = null; scope[iterator + 'SearchType'] = 'icontains'; scope[iterator + 'SearchTypeLabel'] = 'Contains'; @@ -121,7 +135,7 @@ angular.module('RelatedSearchHelper', ['RestServices', 'Utilities', 'RefreshRela scope.search = function (iterator) { //scope[iterator + 'SearchSpin'] = true; Wait('start'); - scope[iterator + 'Loading'] = true; + scope[iterator + 'Loading'] = false; scope[iterator + 'HoldInput'] = true; if (scope[iterator + 'SearchValue']) { diff --git a/awx/ui/static/js/lists/CompletedJobs.js b/awx/ui/static/js/lists/CompletedJobs.js index aef27a7b1d..c5aea4470e 100644 --- a/awx/ui/static/js/lists/CompletedJobs.js +++ b/awx/ui/static/js/lists/CompletedJobs.js @@ -64,6 +64,7 @@ angular.module('CompletedJobsDefinition', []) ngBind: 'completed_job.type_label', link: false, columnClass: "col-md-2 hidden-sm hidden-xs", + columnShow: "showJobType", searchable: false }, name: { diff --git a/awx/ui/static/js/lists/ScheduledJobs.js b/awx/ui/static/js/lists/ScheduledJobs.js index 32979f4e5e..febc160f84 100644 --- a/awx/ui/static/js/lists/ScheduledJobs.js +++ b/awx/ui/static/js/lists/ScheduledJobs.js @@ -28,7 +28,8 @@ angular.module('ScheduledJobsDefinition', []) icon: 'icon-job-{{ schedule.status }}', iconOnly: true, ngClick: "toggleSchedule($event, schedule.id)", - searchable: false + searchable: false, + nosort: true }, next_run: { label: 'Next Run', @@ -61,7 +62,7 @@ angular.module('ScheduledJobsDefinition', []) refresh: { mode: 'all', awToolTip: "Refresh the page", - ngClick: "refreshJobs()" + ngClick: "refreshSchedule()" } }, diff --git a/awx/ui/static/js/lists/Schedules.js b/awx/ui/static/js/lists/Schedules.js index bb1e1c0318..3d799b85f7 100644 --- a/awx/ui/static/js/lists/Schedules.js +++ b/awx/ui/static/js/lists/Schedules.js @@ -15,7 +15,7 @@ angular.module('SchedulesListDefinition', []) iterator: 'schedule', selectTitle: '', editTitle: 'Schedules', - well: true, + well: false, index: true, hover: true, @@ -55,7 +55,7 @@ angular.module('SchedulesListDefinition', []) refresh: { mode: 'all', awToolTip: "Refresh the page", - ngClick: "refreshJobs()" + ngClick: "refreshSchedule()" }, stream: { ngClick: "showActivity()", diff --git a/awx/ui/static/partials/job_templates.html b/awx/ui/static/partials/job_templates.html index 608c60c6ee..d62a357bf0 100644 --- a/awx/ui/static/partials/job_templates.html +++ b/awx/ui/static/partials/job_templates.html @@ -1,4 +1,5 @@
+
\ No newline at end of file