1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 09:51:09 +03:00

AC-976 add job template name to activity stream

This commit is contained in:
Chris Houseknecht 2014-01-28 18:47:46 -05:00 committed by Matthew Jones
parent dce52fc5ca
commit c18cb5a622
3 changed files with 56 additions and 10 deletions

View File

@ -301,11 +301,18 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
if (scope[iterator + 'SearchValue' + modifier]) {
// A search value was entered
scope[iterator + 'ShowStartBtn' + modifier] = false;
if (list.fields[scope[iterator + 'SearchField' + modifier]].searchOnID) {
scope[iterator + 'SearchParams'] += '&' +
list.fields[scope[iterator + 'SearchField' + modifier]].searchObject +
'__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
scope[iterator + 'ShowStartBtn' + modifier] = true;

View File

@ -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,

View File

@ -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 + ' <a href=\"' + BuildUrl(obj1_obj) + '\">' + obj1_obj.name + '</a>';
descr_nolink += obj1 + ' ' + obj1_obj.name;
@ -190,8 +190,8 @@ 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 ( !(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;
}
@ -199,6 +199,27 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
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 = ' ' + '<a href=\"' + BuildUrl(obj1_obj) + '\">'+ obj1_obj.id + ' ' + activity.changes.job_template + '</a>';
}
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 = ' ' + '<a href=\"' + BuildUrl(obj1_obj) + '\">' + obj1_obj.id + '</a>';
}
else {
name = ' ' + obj1_obj.id;
}
}
}
else if (obj1_obj && obj1_obj.name) {
name = ' ' + stripDeleted(obj1_obj.name);
}