Merge pull request #2889 from leigh-johnson/1721

Fix activity stream urls, handle update operations separately
This commit is contained in:
Leigh Johnson
2016-07-09 01:05:06 -04:00
committed by GitHub

View File

@@ -33,6 +33,9 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
// if we encounter a case where a UI url can't or shouldn't be generated, just supply the name of the resource // if we encounter a case where a UI url can't or shouldn't be generated, just supply the name of the resource
try { try {
switch (resource) { switch (resource) {
case 'custom_inventory_script':
url += 'inventory_scripts/' + obj.id + '/';
break;
case 'group': case 'group':
if (activity.operation === 'create' || activity.operation === 'delete'){ if (activity.operation === 'create' || activity.operation === 'delete'){
// the API formats the changes.inventory field as str 'myInventoryName-PrimaryKey' // the API formats the changes.inventory field as str 'myInventoryName-PrimaryKey'
@@ -47,7 +50,7 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
url += 'home/hosts/' + obj.id; url += 'home/hosts/' + obj.id;
break; break;
case 'job': case 'job':
url += 'jobs/?id=' + obj.id; url += 'jobs/' + obj.id;
break; break;
case 'inventory': case 'inventory':
url += 'inventories/' + obj.id + '/'; url += 'inventories/' + obj.id + '/';
@@ -192,11 +195,13 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
case 'delete': case 'delete':
activity.description += activity.object1 + BuildAnchor(activity.changes, activity.object1, activity); activity.description += activity.object1 + BuildAnchor(activity.changes, activity.object1, activity);
break; break;
// equivalent to 'create' or 'update'
// expected outcome: "operation <object1>" // expected outcome: "operation <object1>"
default: case 'update':
activity.description += activity.object1 + BuildAnchor(activity.summary_fields[activity.object1][0], activity.object1, activity); activity.description += activity.object1 + BuildAnchor(activity.summary_fields[activity.object1][0], activity.object1, activity);
break; break;
case 'create':
activity.description += activity.object1 + BuildAnchor(activity.changes, activity.object1, activity);
break;
} }
break; break;
} }