From 03af6b350756548b5663db9d9c7ced1a78d91051 Mon Sep 17 00:00:00 2001 From: Leigh Johnson Date: Fri, 8 Jul 2016 16:29:48 -0400 Subject: [PATCH 1/2] fix activity stream inventory script url, handle update operations in a separate case, resolves #1721 kickback --- awx/ui/client/src/widgets/Stream.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/awx/ui/client/src/widgets/Stream.js b/awx/ui/client/src/widgets/Stream.js index 4a8c6aeb61..56e92e384f 100644 --- a/awx/ui/client/src/widgets/Stream.js +++ b/awx/ui/client/src/widgets/Stream.js @@ -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 " - 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; } From 0b8bec3da67a769fe134b35bac8fdc0957eb03a2 Mon Sep 17 00:00:00 2001 From: Leigh Johnson Date: Fri, 8 Jul 2016 17:01:25 -0400 Subject: [PATCH 2/2] remove log --- awx/ui/client/src/widgets/Stream.js | 1 - 1 file changed, 1 deletion(-) diff --git a/awx/ui/client/src/widgets/Stream.js b/awx/ui/client/src/widgets/Stream.js index 56e92e384f..f3e9271264 100644 --- a/awx/ui/client/src/widgets/Stream.js +++ b/awx/ui/client/src/widgets/Stream.js @@ -28,7 +28,6 @@ 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