This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git

commit 03c9fa3cf6a895445c1a0e5dedc9694522ff8331
Author: Alex Heneveld <[email protected]>
AuthorDate: Wed Nov 2 00:19:09 2022 +0000

    fix replay api call for recent server contract change, and tidy-up
---
 .../components/providers/entity-api.provider.js    | 22 +++++++++++-----------
 .../inspect/activities/detail/detail.controller.js |  7 +++++--
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git 
a/ui-modules/app-inspector/app/components/providers/entity-api.provider.js 
b/ui-modules/app-inspector/app/components/providers/entity-api.provider.js
index 39c28fe0..6c0f1613 100644
--- a/ui-modules/app-inspector/app/components/providers/entity-api.provider.js
+++ b/ui-modules/app-inspector/app/components/providers/entity-api.provider.js
@@ -141,7 +141,7 @@ function EntityApi($http, $q) {
         return $http.get('/v1/applications/' + applicationId + '/entities/' + 
entityId + '/activities', {observable: true, ignoreLoadingBar: true});
     }
     function getEntityActivitiesDeep(applicationId, entityId) {
-        return $http.get('/v1/applications/' + applicationId + '/entities/' + 
entityId + '/activities?recurse=true', {observable: true, ignoreLoadingBar: 
true});
+        return $http.get('/v1/applications/' + applicationId + '/entities/' + 
entityId + '/activities', {observable: true, ignoreLoadingBar: true, params: { 
recurse: true }});
     }
 
     function getEntityLocations(applicationId, entityId) {
@@ -166,18 +166,18 @@ function EntityApi($http, $q) {
         ]);
     }
     function expungeEntity(applicationId, entityId, release) {
-        return $http.post('/v1/applications/' + applicationId + '/entities/' + 
entityId + '/expunge?release=' + release + '&timeout=0');
+        return $http.post('/v1/applications/' + applicationId + '/entities/' + 
entityId + '/expunge', null, { params: { release, timeout: 0 } });
     }
-    function invokeEntityEffector(applicationId, entityId, effectorId, params) 
{
-        return $http.post('/v1/applications/' + applicationId + '/entities/' + 
entityId + '/effectors/' + effectorId + '?timeout=0', params);
+    function invokeEntityEffector(applicationId, entityId, effectorId, body) {
+        return $http.post('/v1/applications/' + applicationId + '/entities/' + 
entityId + '/effectors/' + effectorId, body, { params: { timeout: 0 } });
     }
     
-    function addEntityPolicy(applicationId, entityId, policyType, params) {
-        return $http.post('/v1/applications/'+ applicationId +'/entities/' + 
entityId + '/policies/?type=' + policyType, params);
+    function addEntityPolicy(applicationId, entityId, policyType, body) {
+        return $http.post('/v1/applications/'+ applicationId +'/entities/' + 
entityId + '/policies', body, { params: { type: policyType } });
     }
 
-    function addEntityAdjunct(applicationId, entityId, adjunctType, params) {
-        return $http.post('/v1/applications/'+ applicationId +'/entities/' + 
entityId + '/adjuncts/?type=' + adjunctType, params);
+    function addEntityAdjunct(applicationId, entityId, adjunctType, body) {
+        return $http.post('/v1/applications/'+ applicationId +'/entities/' + 
entityId + '/adjuncts', body, { params: { type: adjunctType } });
     }
     function startEntityAdjunct(applicationId, entityId, adjunctId) {
         return $http.post('/v1/applications/'+ applicationId +'/entities/' + 
entityId + '/adjuncts/' + adjunctId + '/start');
@@ -188,8 +188,8 @@ function EntityApi($http, $q) {
     function destroyEntityAdjunct(applicationId, entityId, adjunctId) {
         return $http.delete('/v1/applications/'+ applicationId +'/entities/' + 
entityId + '/adjuncts/' + adjunctId);
     }
-    function updateEntityAdjunctConfig(applicationId, entityId, adjunctId, 
configId, data) {
-        return $http.post('/v1/applications/'+ applicationId +'/entities/' + 
entityId + '/adjuncts/' + adjunctId + '/config/' + configId, data);
+    function updateEntityAdjunctConfig(applicationId, entityId, adjunctId, 
configId, body) {
+        return $http.post('/v1/applications/'+ applicationId +'/entities/' + 
entityId + '/adjuncts/' + adjunctId + '/config/' + configId, body);
     }
     function getWorkflows(applicationId, entityId) {
         return $http.get('/v1/applications/'+ applicationId +'/entities/' + 
entityId + '/workflows/', {observable: true, ignoreLoadingBar: true});
@@ -199,6 +199,6 @@ function EntityApi($http, $q) {
     }
     function replayWorkflow(applicationId, entityId, workflowId, step, 
options) {
         return $http.post('/v1/applications/'+ applicationId +'/entities/' + 
entityId + '/workflows/' + workflowId
-            + '/replay/from/' + step, {params: options});
+            + '/replay/from/' + step, null, {params: options});
     }
 }
\ No newline at end of file
diff --git 
a/ui-modules/app-inspector/app/views/main/inspect/activities/detail/detail.controller.js
 
b/ui-modules/app-inspector/app/views/main/inspect/activities/detail/detail.controller.js
index 7475be5a..f09de2bf 100644
--- 
a/ui-modules/app-inspector/app/views/main/inspect/activities/detail/detail.controller.js
+++ 
b/ui-modules/app-inspector/app/views/main/inspect/activities/detail/detail.controller.js
@@ -166,7 +166,7 @@ function DetailController($scope, $state, $stateParams, 
$location, $log, $uibMod
 
                         if (replayableFromStart) {
                             let w1 = 'Restart', w2 = '(not resumable)';
-                            if (stepIndex<0) { w1 = 'Run'; w2 = 'again'; }
+                            if (stepIndex<0 || (_.isNil(stepIndex) && 
vm.model.workflow.data.replayableLastStep==-2)) { w1 = 'Run'; w2 = 'again'; }
                             else if (_.isNil(stepIndex)) { w2 = '(did not 
start)'; }
                             else if (replayableContinuing) w2 = '';
 
@@ -187,11 +187,14 @@ function DetailController($scope, $state, $stateParams, 
$location, $log, $uibMod
                                 if (r.force) opts.force = true;
                                 entityApi.replayWorkflow(applicationId, 
entityId, $scope.workflowId, r.targetId, opts)
                                     .then(response => {
+                                        console.log("Replay requested", 
response);
                                         
$state.go('main.inspect.activities.detail', {
                                             applicationId: applicationId,
                                             entityId: entityId,
-                                            activityId: response.data,
+                                            activityId: response.data.id,
                                         });
+                                    }).catch(error => {
+                                        console.log("Replay failed", error);
                                     });
                             };
                         });

Reply via email to