diff --git a/awx/ui/static/js/helpers/search.js b/awx/ui/static/js/helpers/search.js index 3d4116781d..b1ab7e8373 100644 --- a/awx/ui/static/js/helpers/search.js +++ b/awx/ui/static/js/helpers/search.js @@ -301,10 +301,17 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper']) if (scope[iterator + 'SearchValue' + modifier]) { // A search value was entered scope[iterator + 'ShowStartBtn' + modifier] = false; - scope[iterator + 'SearchParams'] += '&' + + if (list.fields[scope[iterator + 'SearchField' + modifier]].searchOnID) { + scope[iterator + 'SearchParams'] += '&' + list.fields[scope[iterator + 'SearchField' + modifier]].searchObject + - '__name__icontains=' + - scope[iterator + 'SearchValue' + modifier]; + '__id=' + scope[iterator + 'SearchValue' + modifier]; + } + else { + scope[iterator + 'SearchParams'] += '&' + + list.fields[scope[iterator + 'SearchField' + modifier]].searchObject + + '__name__icontains=' + + scope[iterator + 'SearchValue' + modifier]; + } } else { // Search value is empty diff --git a/awx/ui/static/js/lists/Streams.js b/awx/ui/static/js/lists/Streams.js index d4f47358b0..1c80032d2b 100644 --- a/awx/ui/static/js/lists/Streams.js +++ b/awx/ui/static/js/lists/Streams.js @@ -102,6 +102,15 @@ angular.module('StreamListDefinition', []) searchWidget: 2, searchField: 'object1' }, + job_search: { + label: 'Job', + searchOnly: true, + searchObject: 'job', + searchPlaceholder: 'Job id', + searchOnID: true, + searchWidget: 2, + searchField: 'object1' + }, organization_search: { label: 'Organization', searchOnly: true, @@ -169,6 +178,15 @@ angular.module('StreamListDefinition', []) searchWidget: 3, searchField: 'object2' }, + job_search3: { + label: 'Job', + searchOnly: true, + searchObject: 'job', + searchPlaceholder: 'Job id', + searchOnID: true, + searchWidget: 3, + searchField: 'object2' + }, job_template_search3: { label: 'Job Template', searchOnly: true, diff --git a/awx/ui/static/js/widgets/Stream.js b/awx/ui/static/js/widgets/Stream.js index e0a628db41..7bef535ed8 100644 --- a/awx/ui/static/js/widgets/Stream.js +++ b/awx/ui/static/js/widgets/Stream.js @@ -182,7 +182,7 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti descr += obj2 + name + ( (activity.operation == 'disassociate') ? ' from ' : ' to ' ); descr_nolink += obj2 + name + ( (activity.operation == 'disassociate') ? ' from ' : ' to ' ); } - if (obj2_obj && obj1_obj.name && !/^\_delete/.test(obj1_obj.name)) { + if (obj1_obj && obj1_obj.name && !/^\_delete/.test(obj1_obj.name)) { obj1_obj['base'] = obj1; descr += obj1 + ' ' + obj1_obj.name + ''; descr_nolink += obj1 + ' ' + obj1_obj.name; @@ -190,13 +190,34 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti else if (obj1) { name = ''; // find the name in changes, if needed - if ( ((!(obj1_obj && obj1_obj.name)) || obj1_obj && obj1_obj.name && /^_delete/.test(obj1_obj.name)) - && (activity.changes && activity.changes.name) ) { - if (typeof activity.changes.name == 'string') { - name = ' ' + activity.changes.name; + if ( !(obj1_obj && obj1_obj.name) || obj1_obj && obj1_obj.name && /^_delete/.test(obj1_obj.name) ) { + if (activity.changes && activity.changes.name) { + if (typeof activity.changes.name == 'string') { + name = ' ' + activity.changes.name; + } + else if (typeof activity.changes.name == 'object' && Array.isArray(activity.changes.name)) { + name = ' ' + activity.changes.name[0] + } } - else if (typeof activity.changes.name == 'object' && Array.isArray(activity.changes.name)) { - name = ' ' + activity.changes.name[0] + else if (obj1 == 'job' && obj1_obj && activity.changes && activity.changes.job_template) { + // Hack for job activity where the template name is known + if (activity.operation != 'delete') { + obj1_obj['base'] = obj1; + name = ' ' + ''+ obj1_obj.id + ' ' + activity.changes.job_template + ''; + } + else { + name = ' ' + obj1_obj.id + ' ' + activity.changes.job_template; + } + } + else if (obj1 == 'job' && obj1_obj) { + // Hack for job activity where template name not known + if (activity.operation != 'delete') { + obj1_obj['base'] = obj1; + name = ' ' + '' + obj1_obj.id + ''; + } + else { + name = ' ' + obj1_obj.id; + } } } else if (obj1_obj && obj1_obj.name) {