mirror of
https://github.com/ansible/awx.git
synced 2026-01-22 06:58:06 -03:30
fix activity stream inventory script url, handle update operations in a separate case, resolves #1721 kickback
This commit is contained in:
parent
33547259e2
commit
03af6b3507
@ -28,11 +28,15 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
||||
// arguments are: a summary_field object, a resource type, an activity stream object
|
||||
function ($log, $filter) {
|
||||
return function (obj, resource, activity) {
|
||||
console.log(obj, resource)
|
||||
var url = '/#/';
|
||||
// try/except pattern asserts that:
|
||||
// if we encounter a case where a UI url can't or shouldn't be generated, just supply the name of the resource
|
||||
try {
|
||||
switch (resource) {
|
||||
case 'custom_inventory_script':
|
||||
url += 'inventory_scripts/' + obj.id + '/';
|
||||
break;
|
||||
case 'group':
|
||||
if (activity.operation === 'create' || activity.operation === 'delete'){
|
||||
// the API formats the changes.inventory field as str 'myInventoryName-PrimaryKey'
|
||||
@ -47,7 +51,7 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
||||
url += 'home/hosts/' + obj.id;
|
||||
break;
|
||||
case 'job':
|
||||
url += 'jobs/?id=' + obj.id;
|
||||
url += 'jobs/' + obj.id;
|
||||
break;
|
||||
case 'inventory':
|
||||
url += 'inventories/' + obj.id + '/';
|
||||
@ -192,11 +196,13 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
||||
case 'delete':
|
||||
activity.description += activity.object1 + BuildAnchor(activity.changes, activity.object1, activity);
|
||||
break;
|
||||
// equivalent to 'create' or 'update'
|
||||
// expected outcome: "operation <object1>"
|
||||
default:
|
||||
case 'update':
|
||||
activity.description += activity.object1 + BuildAnchor(activity.summary_fields[activity.object1][0], activity.object1, activity);
|
||||
break;
|
||||
case 'create':
|
||||
activity.description += activity.object1 + BuildAnchor(activity.changes, activity.object1, activity);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user