mirror of
https://github.com/ansible/awx.git
synced 2026-03-04 02:01:01 -03:30
AC-979 using activity stream object arrays correctly. AC-980 fixed Action label on detail dialog.
This commit is contained in:
committed by
Matthew Jones
parent
45418626e7
commit
dce52fc5ca
@@ -23,22 +23,10 @@ angular.module('ActivityDetailDefinition', [])
|
|||||||
readonly: true
|
readonly: true
|
||||||
},
|
},
|
||||||
operation: {
|
operation: {
|
||||||
label: 'Operation',
|
label: 'Action',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
readonly: true
|
readonly: true
|
||||||
},
|
},
|
||||||
/*object1_name: {
|
|
||||||
label: '\{\{ object1 \}\}',
|
|
||||||
type: 'text',
|
|
||||||
ngHide: '!object1',
|
|
||||||
readonly: true
|
|
||||||
},
|
|
||||||
object2_name: {
|
|
||||||
label: '\{\{ object2 \}\}',
|
|
||||||
type: 'text',
|
|
||||||
ngHide: '!object2',
|
|
||||||
readonly: true
|
|
||||||
},*/
|
|
||||||
changes: {
|
changes: {
|
||||||
label: 'Changes',
|
label: 'Changes',
|
||||||
type: 'textarea',
|
type: 'textarea',
|
||||||
|
|||||||
@@ -146,41 +146,51 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
|||||||
descr += activity.operation;
|
descr += activity.operation;
|
||||||
descr += (/e$/.test(activity.operation)) ? 'd ' : 'ed ';
|
descr += (/e$/.test(activity.operation)) ? 'd ' : 'ed ';
|
||||||
descr_nolink = descr;
|
descr_nolink = descr;
|
||||||
|
|
||||||
|
// labels
|
||||||
var obj1 = activity.object1;
|
var obj1 = activity.object1;
|
||||||
var obj2 = activity.object2;
|
var obj2 = activity.object2;
|
||||||
|
|
||||||
|
// objects
|
||||||
|
var obj1_obj = (activity.summary_fields[obj1]) ? activity.summary_fields[obj1][0] : null;
|
||||||
|
if (obj1 == obj2) {
|
||||||
|
var obj2_obj = activity.summary_fields[obj1][1];
|
||||||
|
}
|
||||||
|
else if (activity.summary_fields[obj2]) {
|
||||||
|
var obj2_obj = activity.summary_fields[obj2][0];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var obj2_obj = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (obj1 == 'user' || obj2 == 'user') {
|
if (obj1 == 'user' || obj2 == 'user') {
|
||||||
activity.summary_fields['user'][0].name = activity.summary_fields['user'][0].username;
|
activity.summary_fields['user'][0].name = activity.summary_fields['user'][0].username;
|
||||||
}
|
}
|
||||||
|
|
||||||
var name;
|
var name;
|
||||||
if (activity.summary_fields[obj2] && activity.summary_fields[obj2][0].name
|
if (obj2_obj && obj2_obj.name && !/^_delete/.test(obj2_obj.name)) {
|
||||||
&& !/^_delete/.test(activity.summary_fields[obj2][0].name)) {
|
obj2_obj['base'] = obj2;
|
||||||
activity.summary_fields[obj2][0]['base'] = obj2;
|
descr += obj2 + ' <a href=\"' + BuildUrl(obj2_obj) + '\">'
|
||||||
descr += obj2 + ' <a href=\"' + BuildUrl(activity.summary_fields[obj2][0]) + '\">'
|
+ obj2_obj.name + '</a>' + ( (activity.operation == 'disassociate') ? ' from ' : ' to ' );
|
||||||
+ activity.summary_fields[obj2][0].name + '</a>' + ( (activity.operation == 'disassociate') ? ' from ' : ' to ' );
|
descr_nolink += obj2 + ' ' + obj2_obj.name + ( (activity.operation == 'disassociate') ? ' from ' : ' to ' );
|
||||||
descr_nolink += obj2 + ' ' + activity.summary_fields[obj2][0].name + ( (activity.operation == 'disassociate') ? ' from ' : ' to ' );
|
|
||||||
}
|
}
|
||||||
else if (activity.object2) {
|
else if (obj2) {
|
||||||
name = '';
|
name = '';
|
||||||
if (activity.summary_fields[obj2] && activity.summary_fields[obj2][0].name) {
|
if (obj2_obj && obj2_obj.name) {
|
||||||
name = ' ' + stripDeleted(activity.summary_fields[obj2][0].name);
|
name = ' ' + stripDeleted(obj2_obj.name);
|
||||||
}
|
}
|
||||||
descr += activity.object2 + name + ( (activity.operation == 'disassociate') ? ' from ' : ' to ' );
|
descr += obj2 + name + ( (activity.operation == 'disassociate') ? ' from ' : ' to ' );
|
||||||
descr_nolink += activity.object2 + name + ( (activity.operation == 'disassociate') ? ' from ' : ' to ' );
|
descr_nolink += obj2 + name + ( (activity.operation == 'disassociate') ? ' from ' : ' to ' );
|
||||||
}
|
}
|
||||||
if (activity.summary_fields[obj1] && activity.summary_fields[obj1][0].name
|
if (obj2_obj && obj1_obj.name && !/^\_delete/.test(obj1_obj.name)) {
|
||||||
&& !/^\_delete/.test(activity.summary_fields[obj1][0].name)) {
|
obj1_obj['base'] = obj1;
|
||||||
activity.summary_fields[obj1][0]['base'] = obj1;
|
descr += obj1 + ' <a href=\"' + BuildUrl(obj1_obj) + '\">' + obj1_obj.name + '</a>';
|
||||||
descr += obj1 + ' <a href=\"' + BuildUrl(activity.summary_fields[obj1][0]) + '\">'
|
descr_nolink += obj1 + ' ' + obj1_obj.name;
|
||||||
+ activity.summary_fields[obj1][0].name + '</a>';
|
|
||||||
descr_nolink += obj1 + ' ' + activity.summary_fields[obj1][0].name;
|
|
||||||
}
|
}
|
||||||
else if (activity.object1) {
|
else if (obj1) {
|
||||||
name = '';
|
name = '';
|
||||||
if ( ((!(activity.summary_fields[obj1] && activity.summary_fields[obj1][0].name)) ||
|
// find the name in changes, if needed
|
||||||
activity.summary_fields[obj1] && activity.summary_fields[obj1][0].name &&
|
if ( ((!(obj1_obj && obj1_obj.name)) || obj1_obj && obj1_obj.name && /^_delete/.test(obj1_obj.name))
|
||||||
/^_delete/.test(activity.summary_fields[obj1][0].name))
|
|
||||||
&& (activity.changes && activity.changes.name) ) {
|
&& (activity.changes && activity.changes.name) ) {
|
||||||
if (typeof activity.changes.name == 'string') {
|
if (typeof activity.changes.name == 'string') {
|
||||||
name = ' ' + activity.changes.name;
|
name = ' ' + activity.changes.name;
|
||||||
@@ -189,11 +199,11 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
|||||||
name = ' ' + activity.changes.name[0]
|
name = ' ' + activity.changes.name[0]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (activity.summary_fields[obj1] && activity.summary_fields[obj1][0].name) {
|
else if (obj1_obj && obj1_obj.name) {
|
||||||
name = ' ' + stripDeleted(activity.summary_fields[obj1][0].name);
|
name = ' ' + stripDeleted(obj1_obj.name);
|
||||||
}
|
}
|
||||||
descr += activity.object1 + name;
|
descr += obj1 + name;
|
||||||
descr_nolink += activity.object1 + name;
|
descr_nolink += obj1 + name;
|
||||||
}
|
}
|
||||||
activity['description'] = descr;
|
activity['description'] = descr;
|
||||||
activity['description_nolink'] = descr_nolink;
|
activity['description_nolink'] = descr_nolink;
|
||||||
|
|||||||
Reference in New Issue
Block a user