From f75ff15558778d891827a7b20ef720fb5a49d25c Mon Sep 17 00:00:00 2001 From: Marek Libra Date: Sun, 24 Nov 2024 13:14:10 +0100 Subject: [PATCH] fix(orchestrator): pass businessKey for assessments (#2558) * fix(orchestrator): pass businessKey for assessments Fixes: FLPATH-1881 With this change, the "Assessed by" link is shown. Signed-off-by: Marek Libra * Fix OrchestratorClient.test.ts --------- Signed-off-by: Marek Libra --- .changeset/spicy-owls-smoke.md | 7 +++ .../src/service/router.ts | 2 + .../src/generated/.METADATA.sha1 | 2 +- .../src/generated/api/definition.ts | 2 +- .../src/generated/client/api.ts | 22 ++++--- .../src/generated/docs/html/index.html | 60 +++++++++++++++---- .../docs/markdown/Apis/DefaultApi.md | 3 +- .../src/openapi/openapi.yaml | 6 ++ .../src/api/OrchestratorClient.test.ts | 21 +++++-- .../src/api/OrchestratorClient.ts | 1 + .../ExecuteWorkflowPage.tsx | 7 ++- 11 files changed, 106 insertions(+), 27 deletions(-) create mode 100644 .changeset/spicy-owls-smoke.md diff --git a/.changeset/spicy-owls-smoke.md b/.changeset/spicy-owls-smoke.md new file mode 100644 index 0000000000..0b48edd175 --- /dev/null +++ b/.changeset/spicy-owls-smoke.md @@ -0,0 +1,7 @@ +--- +"@janus-idp/backstage-plugin-orchestrator-backend": patch +"@janus-idp/backstage-plugin-orchestrator-common": patch +"@janus-idp/backstage-plugin-orchestrator": patch +--- + +The parent assessment link is shown again thanks to fixing passing of the businessKey when "execute" action is trigerred. diff --git a/plugins/orchestrator-backend/src/service/router.ts b/plugins/orchestrator-backend/src/service/router.ts index eba249371b..6e3e1eee2a 100644 --- a/plugins/orchestrator-backend/src/service/router.ts +++ b/plugins/orchestrator-backend/src/service/router.ts @@ -718,10 +718,12 @@ function setupInternalRoutes( if (decision.result === AuthorizeResult.DENY) { manageDenyAuthorization(endpointName, endpoint, _req); } + const includeAssessment = routerApi.v2.extractQueryParam( c.request, QUERY_PARAM_INCLUDE_ASSESSMENT, ); + return routerApi.v2 .getInstanceById(instanceId, !!includeAssessment) .then(result => res.status(200).json(result)) diff --git a/plugins/orchestrator-common/src/generated/.METADATA.sha1 b/plugins/orchestrator-common/src/generated/.METADATA.sha1 index 806eec65c1..2e3e08124d 100644 --- a/plugins/orchestrator-common/src/generated/.METADATA.sha1 +++ b/plugins/orchestrator-common/src/generated/.METADATA.sha1 @@ -1 +1 @@ -f4fd9f652a05159a3d506540493e275885d54dcd +b87c7d385fe5965d9eb4cc87056d13f92070965f diff --git a/plugins/orchestrator-common/src/generated/api/definition.ts b/plugins/orchestrator-common/src/generated/api/definition.ts index f77d82c095..b82ccbb251 100644 --- a/plugins/orchestrator-common/src/generated/api/definition.ts +++ b/plugins/orchestrator-common/src/generated/api/definition.ts @@ -1,5 +1,5 @@ /* eslint-disable */ /* prettier-ignore */ // GENERATED FILE DO NOT EDIT. -const OPENAPI = `{"openapi":"3.1.0","info":{"title":"Orchestratorplugin","description":"APItointeractwithorchestratorplugin","license":{"name":"Apache2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"},"version":"0.0.1"},"servers":[{"url":"/"}],"paths":{"/v2/workflows/overview":{"post":{"operationId":"getWorkflowsOverview","description":"Returnsthekeyfieldsoftheworkflowincludingdataonthelastruninstance","requestBody":{"required":false,"description":"Paginationandfilters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchRequest"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowOverviewListResultDTO"}}}},"500":{"description":"Errorfetchingworkflowoverviews","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}/overview":{"get":{"operationId":"getWorkflowOverviewById","description":"Returnsthekeyfieldsoftheworkflowincludingdataonthelastruninstance","parameters":[{"name":"workflowId","in":"path","required":true,"description":"Uniqueidentifieroftheworkflow","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowOverviewDTO"}}}},"500":{"description":"Errorfetchingworkflowoverview","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}/source":{"get":{"operationId":"getWorkflowSourceById","description":"Gettheworkflow'sdefinition","parameters":[{"name":"workflowId","in":"path","description":"IDoftheworkflowtofetch","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string"}}}},"500":{"description":"Errorfetchingworkflowsourcebyid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}/inputSchema":{"get":{"operationId":"getWorkflowInputSchemaById","description":"Gettheworkflowinputschema.Itdefinestheinputfieldsoftheworkflow","parameters":[{"name":"workflowId","in":"path","description":"IDoftheworkflowtofetch","required":true,"schema":{"type":"string"}},{"name":"instanceId","in":"query","description":"IDofinstance","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InputSchemaResponseDTO"}}}},"500":{"description":"Errorfetchingworkflowinputschemabyid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/instances":{"post":{"operationId":"getInstances","summary":"Getinstances","description":"Retrieveanarrayofworkflowexecutions(instances)","requestBody":{"required":false,"description":"Parametersforretrievinginstances","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetInstancesRequest"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessInstanceListResultDTO"}}}},"500":{"description":"Errorfetchinginstances","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}/instances":{"post":{"operationId":"getWorkflowInstances","summary":"Getinstancesforaspecificworkflow","description":"Retrieveanarrayofworkflowexecutions(instances)forthegivenworkflow","parameters":[{"name":"workflowId","in":"path","required":true,"description":"IDoftheworkflow","schema":{"type":"string"}}],"requestBody":{"required":false,"description":"Parametersforretrievingworkflowinstances","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchRequest"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessInstanceListResultDTO"}}}},"500":{"description":"Errorfetchinginstances","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/instances/{instanceId}":{"get":{"summary":"GetWorkflowInstancebyID","description":"Getaworkflowexecution/run(instance)","operationId":"getInstanceById","parameters":[{"name":"instanceId","in":"path","required":true,"description":"IDoftheworkflowinstance","schema":{"type":"string"}},{"name":"includeAssessment","in":"query","required":false,"description":"Whethertoincludeassessment","schema":{"type":"boolean","default":false}}],"responses":{"200":{"description":"Successfulresponse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssessedProcessInstanceDTO"}}}},"500":{"description":"Errorfetchinginstance","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/instances/statuses":{"get":{"operationId":"getWorkflowStatuses","summary":"Getworkflowstatuslist","description":"Retrievearraywiththestatusofallinstances","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/WorkflowRunStatusDTO"}}}}},"500":{"description":"Errorfetchingworkflowstatuses","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}/execute":{"post":{"summary":"Executeaworkflow","description":"Executeaworkflow","operationId":"executeWorkflow","parameters":[{"name":"workflowId","in":"path","description":"IDoftheworkflowtoexecute","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteWorkflowRequestDTO"}}}},"responses":{"200":{"description":"Successfulexecution","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteWorkflowResponseDTO"}}}},"500":{"description":"InternalServerError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}/{instanceId}/retrigger":{"post":{"summary":"Retriggeraninstance","description":"Retriggeraninstance","operationId":"retriggerInstance","parameters":[{"name":"workflowId","in":"path","description":"IDoftheworkflow","required":true,"schema":{"type":"string"}},{"name":"instanceId","in":"path","description":"IDoftheinstancetoretrigger","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"500":{"description":"InternalServerError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/instances/{instanceId}/abort":{"delete":{"summary":"Abortaworkflowinstance","operationId":"abortWorkflow","description":"AbortsaworkflowinstanceidentifiedbytheprovidedinstanceId.","parameters":[{"name":"instanceId","in":"path","required":true,"description":"Theidentifieroftheworkflowinstancetoabort.","schema":{"type":"string"}}],"responses":{"200":{"description":"Successfuloperation","content":{"text/plain":{"schema":{"type":"string"}}}},"500":{"description":"Errorabortingworkflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"ErrorResponse":{"description":"TheErrorResponseobjectrepresentsacommonstructureforhandlingerrorsinAPIresponses.Itincludesessentialinformationabouttheerror,suchastheerrormessageandadditionaloptionaldetails.","type":"object","properties":{"message":{"description":"Astringprovidingaconciseandhuman-readabledescriptionoftheencounterederror.ThisfieldisrequiredintheErrorResponseobject.","type":"string","default":"internalservererror"},"additionalInfo":{"description":"Anoptionalfieldthatcancontainadditionalinformationorcontextabouttheerror.Itprovidesflexibilityforincludingextradetailsbasedonspecificerrorscenarios.","type":"string"}},"required":["message"]},"GetInstancesRequest":{"type":"object","properties":{"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"},"filters":{"$ref":"#/components/schemas/SearchRequest"}}},"GetOverviewsRequestParams":{"type":"object","properties":{"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"},"filters":{"$ref":"#/components/schemas/SearchRequest"}}},"WorkflowOverviewListResultDTO":{"type":"object","properties":{"overviews":{"type":"array","items":{"$ref":"#/components/schemas/WorkflowOverviewDTO"},"minItems":0},"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"}}},"WorkflowOverviewDTO":{"type":"object","properties":{"workflowId":{"type":"string","description":"Workflowuniqueidentifier","minLength":1},"name":{"type":"string","description":"Workflowname","minLength":1},"format":{"$ref":"#/components/schemas/WorkflowFormatDTO"},"lastRunId":{"type":"string"},"lastTriggeredMs":{"type":"number","minimum":0},"lastRunStatus":{"$ref":"#/components/schemas/ProcessInstanceStatusDTO"},"category":{"$ref":"#/components/schemas/WorkflowCategoryDTO"},"avgDurationMs":{"type":"number","minimum":0},"description":{"type":"string"}},"required":["workflowId","format"]},"PaginationInfoDTO":{"type":"object","properties":{"pageSize":{"type":"number"},"offset":{"type":"number"},"totalCount":{"type":"number"},"orderDirection":{"enum":["ASC","DESC"]},"orderBy":{"type":"string"}},"additionalProperties":false},"WorkflowFormatDTO":{"type":"string","description":"Formatoftheworkflowdefinition","enum":["yaml","json"]},"WorkflowCategoryDTO":{"type":"string","description":"Categoryoftheworkflow","enum":["assessment","infrastructure"]},"WorkflowListResultDTO":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/WorkflowDTO"}},"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"}},"required":["items","paginationInfo"]},"WorkflowDTO":{"type":"object","properties":{"id":{"type":"string","description":"Workflowuniqueidentifier","minLength":1},"name":{"type":"string","description":"Workflowname","minLength":1},"format":{"$ref":"#/components/schemas/WorkflowFormatDTO"},"category":{"$ref":"#/components/schemas/WorkflowCategoryDTO"},"description":{"type":"string","description":"Descriptionoftheworkflow"},"annotations":{"type":"array","items":{"type":"string"}}},"required":["id","category","format"]},"ProcessInstanceListResultDTO":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/ProcessInstanceDTO"}},"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"}}},"AssessedProcessInstanceDTO":{"type":"object","properties":{"instance":{"$ref":"#/components/schemas/ProcessInstanceDTO"},"assessedBy":{"$ref":"#/components/schemas/ProcessInstanceDTO"}},"required":["instance"]},"ProcessInstanceDTO":{"type":"object","properties":{"id":{"type":"string"},"processId":{"type":"string"},"processName":{"type":"string"},"status":{"$ref":"#/components/schemas/ProcessInstanceStatusDTO"},"endpoint":{"type":"string"},"serviceUrl":{"type":"string"},"start":{"type":"string"},"end":{"type":"string"},"duration":{"type":"string"},"category":{"$ref":"#/components/schemas/WorkflowCategoryDTO"},"description":{"type":"string"},"workflowdata":{"$ref":"#/components/schemas/WorkflowDataDTO"},"businessKey":{"type":"string"},"nodes":{"type":"array","items":{"$ref":"#/components/schemas/NodeInstanceDTO"}},"error":{"$ref":"#/components/schemas/ProcessInstanceErrorDTO"}},"required":["id","processId","nodes"]},"WorkflowDataDTO":{"type":"object","properties":{"result":{"$ref":"#/components/schemas/WorkflowResultDTO"}},"additionalProperties":true},"WorkflowResultDTO":{"description":"Resultofaworkflowexecution","type":"object","properties":{"completedWith":{"description":"Thestateofworkflowcompletion.","type":"string","enum":["error","success"]},"message":{"description":"High-levelsummaryofthecurrentstatus,free-formtext,humanreadable.","type":"string"},"nextWorkflows":{"description":"Listofworkflowssuggestedtorunnext.Itemsatlowerindexesareofhigherpriority.","type":"array","items":{"type":"object","properties":{"id":{"description":"Workflowidentifier","type":"string"},"name":{"description":"Humanreadabletitledescribingtheworkflow.","type":"string"}},"required":["id","name"]}},"outputs":{"description":"Additionalstructuredoutputofworkflowprocessing.Thiscancontainidentifiersofcreatedresources,linkstoresources,logsorotheroutput.","type":"array","items":{"type":"object","properties":{"key":{"description":"Uniqueidentifieroftheoption.Preferablyhuman-readable.","type":"string"},"value":{"description":"Freeformvalueoftheoption.","anyOf":[{"type":"string"},{"type":"number"}]},"format":{"description":"Moredetailedtypeofthe'value'property.Defaultsto'text'.","enum":["text","number","link"]}},"required":["key","value"]}}}},"ProcessInstanceStatusDTO":{"type":"string","description":"Statusoftheworkflowrun","enum":["Active","Error","Completed","Aborted","Suspended","Pending"]},"WorkflowRunStatusDTO":{"type":"object","properties":{"key":{"type":"string"},"value":{"type":"string"}}},"ExecuteWorkflowRequestDTO":{"type":"object","properties":{"inputData":{"type":"object","additionalProperties":true}},"required":["inputData"]},"ExecuteWorkflowResponseDTO":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"]},"WorkflowProgressDTO":{"allOf":[{"$ref":"#/components/schemas/NodeInstanceDTO"},{"type":"object","properties":{"status":{"$ref":"#/components/schemas/ProcessInstanceStatusDTO"},"error":{"$ref":"#/components/schemas/ProcessInstanceErrorDTO"}}}]},"NodeInstanceDTO":{"type":"object","properties":{"__typename":{"type":"string","default":"NodeInstance","description":"Typename"},"id":{"type":"string","description":"NodeinstanceID"},"name":{"type":"string","description":"Nodename"},"type":{"type":"string","description":"Nodetype"},"enter":{"type":"string","description":"Datewhenthenodewasentered"},"exit":{"type":"string","description":"Datewhenthenodewasexited(optional)"},"definitionId":{"type":"string","description":"DefinitionID"},"nodeId":{"type":"string","description":"NodeID"}},"required":["id"]},"ProcessInstanceErrorDTO":{"type":"object","properties":{"__typename":{"type":"string","default":"ProcessInstanceError","description":"Typename"},"nodeDefinitionId":{"type":"string","description":"NodedefinitionID"},"message":{"type":"string","description":"Errormessage(optional)"}},"required":["nodeDefinitionId"]},"SearchRequest":{"type":"object","properties":{"filters":{"$ref":"#/components/schemas/Filter"},"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"}}},"Filter":{"oneOf":[{"$ref":"#/components/schemas/LogicalFilter"},{"$ref":"#/components/schemas/FieldFilter"}]},"LogicalFilter":{"type":"object","required":["operator","filters"],"properties":{"operator":{"type":"string","enum":["AND","OR","NOT"]},"filters":{"type":"array","items":{"$ref":"#/components/schemas/Filter"}}}},"FieldFilter":{"type":"object","required":["field","operator","value"],"properties":{"field":{"type":"string"},"operator":{"type":"string","enum":["EQ","GT","GTE","LT","LTE","IN","IS_NULL","CONTAINS","CONTAINS_ALL","CONTAINS_ANY","LIKE","BETWEEN"]},"value":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]}}]}}},"InputSchemaResponseDTO":{"type":"object","properties":{"inputSchema":{"type":"object"},"data":{"type":"object"}}}}}}`; +const OPENAPI = `{"openapi":"3.1.0","info":{"title":"Orchestratorplugin","description":"APItointeractwithorchestratorplugin","license":{"name":"Apache2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"},"version":"0.0.1"},"servers":[{"url":"/"}],"paths":{"/v2/workflows/overview":{"post":{"operationId":"getWorkflowsOverview","description":"Returnsthekeyfieldsoftheworkflowincludingdataonthelastruninstance","requestBody":{"required":false,"description":"Paginationandfilters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchRequest"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowOverviewListResultDTO"}}}},"500":{"description":"Errorfetchingworkflowoverviews","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}/overview":{"get":{"operationId":"getWorkflowOverviewById","description":"Returnsthekeyfieldsoftheworkflowincludingdataonthelastruninstance","parameters":[{"name":"workflowId","in":"path","required":true,"description":"Uniqueidentifieroftheworkflow","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowOverviewDTO"}}}},"500":{"description":"Errorfetchingworkflowoverview","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}/source":{"get":{"operationId":"getWorkflowSourceById","description":"Gettheworkflow'sdefinition","parameters":[{"name":"workflowId","in":"path","description":"IDoftheworkflowtofetch","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string"}}}},"500":{"description":"Errorfetchingworkflowsourcebyid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}/inputSchema":{"get":{"operationId":"getWorkflowInputSchemaById","description":"Gettheworkflowinputschema.Itdefinestheinputfieldsoftheworkflow","parameters":[{"name":"workflowId","in":"path","description":"IDoftheworkflowtofetch","required":true,"schema":{"type":"string"}},{"name":"instanceId","in":"query","description":"IDofinstance","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InputSchemaResponseDTO"}}}},"500":{"description":"Errorfetchingworkflowinputschemabyid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/instances":{"post":{"operationId":"getInstances","summary":"Getinstances","description":"Retrieveanarrayofworkflowexecutions(instances)","requestBody":{"required":false,"description":"Parametersforretrievinginstances","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetInstancesRequest"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessInstanceListResultDTO"}}}},"500":{"description":"Errorfetchinginstances","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}/instances":{"post":{"operationId":"getWorkflowInstances","summary":"Getinstancesforaspecificworkflow","description":"Retrieveanarrayofworkflowexecutions(instances)forthegivenworkflow","parameters":[{"name":"workflowId","in":"path","required":true,"description":"IDoftheworkflow","schema":{"type":"string"}}],"requestBody":{"required":false,"description":"Parametersforretrievingworkflowinstances","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchRequest"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessInstanceListResultDTO"}}}},"500":{"description":"Errorfetchinginstances","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/instances/{instanceId}":{"get":{"summary":"GetWorkflowInstancebyID","description":"Getaworkflowexecution/run(instance)","operationId":"getInstanceById","parameters":[{"name":"instanceId","in":"path","required":true,"description":"IDoftheworkflowinstance","schema":{"type":"string"}},{"name":"includeAssessment","in":"query","required":false,"description":"Whethertoincludeassessment","schema":{"type":"boolean","default":false}}],"responses":{"200":{"description":"Successfulresponse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssessedProcessInstanceDTO"}}}},"500":{"description":"Errorfetchinginstance","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/instances/statuses":{"get":{"operationId":"getWorkflowStatuses","summary":"Getworkflowstatuslist","description":"Retrievearraywiththestatusofallinstances","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/WorkflowRunStatusDTO"}}}}},"500":{"description":"Errorfetchingworkflowstatuses","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}/execute":{"post":{"summary":"Executeaworkflow","description":"Executeaworkflow","operationId":"executeWorkflow","parameters":[{"name":"workflowId","in":"path","description":"IDoftheworkflowtoexecute","required":true,"schema":{"type":"string"}},{"name":"businessKey","in":"query","description":"IDoftheparentworkflow","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteWorkflowRequestDTO"}}}},"responses":{"200":{"description":"Successfulexecution","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteWorkflowResponseDTO"}}}},"500":{"description":"InternalServerError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/{workflowId}/{instanceId}/retrigger":{"post":{"summary":"Retriggeraninstance","description":"Retriggeraninstance","operationId":"retriggerInstance","parameters":[{"name":"workflowId","in":"path","description":"IDoftheworkflow","required":true,"schema":{"type":"string"}},{"name":"instanceId","in":"path","description":"IDoftheinstancetoretrigger","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"500":{"description":"InternalServerError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/workflows/instances/{instanceId}/abort":{"delete":{"summary":"Abortaworkflowinstance","operationId":"abortWorkflow","description":"AbortsaworkflowinstanceidentifiedbytheprovidedinstanceId.","parameters":[{"name":"instanceId","in":"path","required":true,"description":"Theidentifieroftheworkflowinstancetoabort.","schema":{"type":"string"}}],"responses":{"200":{"description":"Successfuloperation","content":{"text/plain":{"schema":{"type":"string"}}}},"500":{"description":"Errorabortingworkflow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"ErrorResponse":{"description":"TheErrorResponseobjectrepresentsacommonstructureforhandlingerrorsinAPIresponses.Itincludesessentialinformationabouttheerror,suchastheerrormessageandadditionaloptionaldetails.","type":"object","properties":{"message":{"description":"Astringprovidingaconciseandhuman-readabledescriptionoftheencounterederror.ThisfieldisrequiredintheErrorResponseobject.","type":"string","default":"internalservererror"},"additionalInfo":{"description":"Anoptionalfieldthatcancontainadditionalinformationorcontextabouttheerror.Itprovidesflexibilityforincludingextradetailsbasedonspecificerrorscenarios.","type":"string"}},"required":["message"]},"GetInstancesRequest":{"type":"object","properties":{"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"},"filters":{"$ref":"#/components/schemas/SearchRequest"}}},"GetOverviewsRequestParams":{"type":"object","properties":{"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"},"filters":{"$ref":"#/components/schemas/SearchRequest"}}},"WorkflowOverviewListResultDTO":{"type":"object","properties":{"overviews":{"type":"array","items":{"$ref":"#/components/schemas/WorkflowOverviewDTO"},"minItems":0},"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"}}},"WorkflowOverviewDTO":{"type":"object","properties":{"workflowId":{"type":"string","description":"Workflowuniqueidentifier","minLength":1},"name":{"type":"string","description":"Workflowname","minLength":1},"format":{"$ref":"#/components/schemas/WorkflowFormatDTO"},"lastRunId":{"type":"string"},"lastTriggeredMs":{"type":"number","minimum":0},"lastRunStatus":{"$ref":"#/components/schemas/ProcessInstanceStatusDTO"},"category":{"$ref":"#/components/schemas/WorkflowCategoryDTO"},"avgDurationMs":{"type":"number","minimum":0},"description":{"type":"string"}},"required":["workflowId","format"]},"PaginationInfoDTO":{"type":"object","properties":{"pageSize":{"type":"number"},"offset":{"type":"number"},"totalCount":{"type":"number"},"orderDirection":{"enum":["ASC","DESC"]},"orderBy":{"type":"string"}},"additionalProperties":false},"WorkflowFormatDTO":{"type":"string","description":"Formatoftheworkflowdefinition","enum":["yaml","json"]},"WorkflowCategoryDTO":{"type":"string","description":"Categoryoftheworkflow","enum":["assessment","infrastructure"]},"WorkflowListResultDTO":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/WorkflowDTO"}},"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"}},"required":["items","paginationInfo"]},"WorkflowDTO":{"type":"object","properties":{"id":{"type":"string","description":"Workflowuniqueidentifier","minLength":1},"name":{"type":"string","description":"Workflowname","minLength":1},"format":{"$ref":"#/components/schemas/WorkflowFormatDTO"},"category":{"$ref":"#/components/schemas/WorkflowCategoryDTO"},"description":{"type":"string","description":"Descriptionoftheworkflow"},"annotations":{"type":"array","items":{"type":"string"}}},"required":["id","category","format"]},"ProcessInstanceListResultDTO":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/ProcessInstanceDTO"}},"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"}}},"AssessedProcessInstanceDTO":{"type":"object","properties":{"instance":{"$ref":"#/components/schemas/ProcessInstanceDTO"},"assessedBy":{"$ref":"#/components/schemas/ProcessInstanceDTO"}},"required":["instance"]},"ProcessInstanceDTO":{"type":"object","properties":{"id":{"type":"string"},"processId":{"type":"string"},"processName":{"type":"string"},"status":{"$ref":"#/components/schemas/ProcessInstanceStatusDTO"},"endpoint":{"type":"string"},"serviceUrl":{"type":"string"},"start":{"type":"string"},"end":{"type":"string"},"duration":{"type":"string"},"category":{"$ref":"#/components/schemas/WorkflowCategoryDTO"},"description":{"type":"string"},"workflowdata":{"$ref":"#/components/schemas/WorkflowDataDTO"},"businessKey":{"type":"string"},"nodes":{"type":"array","items":{"$ref":"#/components/schemas/NodeInstanceDTO"}},"error":{"$ref":"#/components/schemas/ProcessInstanceErrorDTO"}},"required":["id","processId","nodes"]},"WorkflowDataDTO":{"type":"object","properties":{"result":{"$ref":"#/components/schemas/WorkflowResultDTO"}},"additionalProperties":true},"WorkflowResultDTO":{"description":"Resultofaworkflowexecution","type":"object","properties":{"completedWith":{"description":"Thestateofworkflowcompletion.","type":"string","enum":["error","success"]},"message":{"description":"High-levelsummaryofthecurrentstatus,free-formtext,humanreadable.","type":"string"},"nextWorkflows":{"description":"Listofworkflowssuggestedtorunnext.Itemsatlowerindexesareofhigherpriority.","type":"array","items":{"type":"object","properties":{"id":{"description":"Workflowidentifier","type":"string"},"name":{"description":"Humanreadabletitledescribingtheworkflow.","type":"string"}},"required":["id","name"]}},"outputs":{"description":"Additionalstructuredoutputofworkflowprocessing.Thiscancontainidentifiersofcreatedresources,linkstoresources,logsorotheroutput.","type":"array","items":{"type":"object","properties":{"key":{"description":"Uniqueidentifieroftheoption.Preferablyhuman-readable.","type":"string"},"value":{"description":"Freeformvalueoftheoption.","anyOf":[{"type":"string"},{"type":"number"}]},"format":{"description":"Moredetailedtypeofthe'value'property.Defaultsto'text'.","enum":["text","number","link"]}},"required":["key","value"]}}}},"ProcessInstanceStatusDTO":{"type":"string","description":"Statusoftheworkflowrun","enum":["Active","Error","Completed","Aborted","Suspended","Pending"]},"WorkflowRunStatusDTO":{"type":"object","properties":{"key":{"type":"string"},"value":{"type":"string"}}},"ExecuteWorkflowRequestDTO":{"type":"object","properties":{"inputData":{"type":"object","additionalProperties":true}},"required":["inputData"]},"ExecuteWorkflowResponseDTO":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"]},"WorkflowProgressDTO":{"allOf":[{"$ref":"#/components/schemas/NodeInstanceDTO"},{"type":"object","properties":{"status":{"$ref":"#/components/schemas/ProcessInstanceStatusDTO"},"error":{"$ref":"#/components/schemas/ProcessInstanceErrorDTO"}}}]},"NodeInstanceDTO":{"type":"object","properties":{"__typename":{"type":"string","default":"NodeInstance","description":"Typename"},"id":{"type":"string","description":"NodeinstanceID"},"name":{"type":"string","description":"Nodename"},"type":{"type":"string","description":"Nodetype"},"enter":{"type":"string","description":"Datewhenthenodewasentered"},"exit":{"type":"string","description":"Datewhenthenodewasexited(optional)"},"definitionId":{"type":"string","description":"DefinitionID"},"nodeId":{"type":"string","description":"NodeID"}},"required":["id"]},"ProcessInstanceErrorDTO":{"type":"object","properties":{"__typename":{"type":"string","default":"ProcessInstanceError","description":"Typename"},"nodeDefinitionId":{"type":"string","description":"NodedefinitionID"},"message":{"type":"string","description":"Errormessage(optional)"}},"required":["nodeDefinitionId"]},"SearchRequest":{"type":"object","properties":{"filters":{"$ref":"#/components/schemas/Filter"},"paginationInfo":{"$ref":"#/components/schemas/PaginationInfoDTO"}}},"Filter":{"oneOf":[{"$ref":"#/components/schemas/LogicalFilter"},{"$ref":"#/components/schemas/FieldFilter"}]},"LogicalFilter":{"type":"object","required":["operator","filters"],"properties":{"operator":{"type":"string","enum":["AND","OR","NOT"]},"filters":{"type":"array","items":{"$ref":"#/components/schemas/Filter"}}}},"FieldFilter":{"type":"object","required":["field","operator","value"],"properties":{"field":{"type":"string"},"operator":{"type":"string","enum":["EQ","GT","GTE","LT","LTE","IN","IS_NULL","CONTAINS","CONTAINS_ALL","CONTAINS_ANY","LIKE","BETWEEN"]},"value":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]}}]}}},"InputSchemaResponseDTO":{"type":"object","properties":{"inputSchema":{"type":"object"},"data":{"type":"object"}}}}}}`; export const openApiDocument = JSON.parse(OPENAPI); diff --git a/plugins/orchestrator-common/src/generated/client/api.ts b/plugins/orchestrator-common/src/generated/client/api.ts index 210da157ba..6ea8b87c79 100644 --- a/plugins/orchestrator-common/src/generated/client/api.ts +++ b/plugins/orchestrator-common/src/generated/client/api.ts @@ -927,10 +927,11 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @summary Execute a workflow * @param {string} workflowId ID of the workflow to execute * @param {ExecuteWorkflowRequestDTO} executeWorkflowRequestDTO + * @param {string} [businessKey] ID of the parent workflow * @param {*} [options] Override http request option. * @throws {RequiredError} */ - executeWorkflow: async (workflowId: string, executeWorkflowRequestDTO: ExecuteWorkflowRequestDTO, options: RawAxiosRequestConfig = {}): Promise => { + executeWorkflow: async (workflowId: string, executeWorkflowRequestDTO: ExecuteWorkflowRequestDTO, businessKey?: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'workflowId' is not null or undefined assertParamExists('executeWorkflow', 'workflowId', workflowId) // verify required parameter 'executeWorkflowRequestDTO' is not null or undefined @@ -948,6 +949,10 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + if (businessKey !== undefined) { + localVarQueryParameter['businessKey'] = businessKey; + } + localVarHeaderParameter['Content-Type'] = 'application/json'; @@ -1306,11 +1311,12 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @summary Execute a workflow * @param {string} workflowId ID of the workflow to execute * @param {ExecuteWorkflowRequestDTO} executeWorkflowRequestDTO + * @param {string} [businessKey] ID of the parent workflow * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async executeWorkflow(workflowId: string, executeWorkflowRequestDTO: ExecuteWorkflowRequestDTO, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.executeWorkflow(workflowId, executeWorkflowRequestDTO, options); + async executeWorkflow(workflowId: string, executeWorkflowRequestDTO: ExecuteWorkflowRequestDTO, businessKey?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.executeWorkflow(workflowId, executeWorkflowRequestDTO, businessKey, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DefaultApi.executeWorkflow']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); @@ -1456,11 +1462,12 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa * @summary Execute a workflow * @param {string} workflowId ID of the workflow to execute * @param {ExecuteWorkflowRequestDTO} executeWorkflowRequestDTO + * @param {string} [businessKey] ID of the parent workflow * @param {*} [options] Override http request option. * @throws {RequiredError} */ - executeWorkflow(workflowId: string, executeWorkflowRequestDTO: ExecuteWorkflowRequestDTO, options?: any): AxiosPromise { - return localVarFp.executeWorkflow(workflowId, executeWorkflowRequestDTO, options).then((request) => request(axios, basePath)); + executeWorkflow(workflowId: string, executeWorkflowRequestDTO: ExecuteWorkflowRequestDTO, businessKey?: string, options?: any): AxiosPromise { + return localVarFp.executeWorkflow(workflowId, executeWorkflowRequestDTO, businessKey, options).then((request) => request(axios, basePath)); }, /** * Get a workflow execution/run (instance) @@ -1578,12 +1585,13 @@ export class DefaultApi extends BaseAPI { * @summary Execute a workflow * @param {string} workflowId ID of the workflow to execute * @param {ExecuteWorkflowRequestDTO} executeWorkflowRequestDTO + * @param {string} [businessKey] ID of the parent workflow * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DefaultApi */ - public executeWorkflow(workflowId: string, executeWorkflowRequestDTO: ExecuteWorkflowRequestDTO, options?: RawAxiosRequestConfig) { - return DefaultApiFp(this.configuration).executeWorkflow(workflowId, executeWorkflowRequestDTO, options).then((request) => request(this.axios, this.basePath)); + public executeWorkflow(workflowId: string, executeWorkflowRequestDTO: ExecuteWorkflowRequestDTO, businessKey?: string, options?: RawAxiosRequestConfig) { + return DefaultApiFp(this.configuration).executeWorkflow(workflowId, executeWorkflowRequestDTO, businessKey, options).then((request) => request(this.axios, this.basePath)); } /** diff --git a/plugins/orchestrator-common/src/generated/docs/html/index.html b/plugins/orchestrator-common/src/generated/docs/html/index.html index 7e00a2453f..044ab5f915 100644 --- a/plugins/orchestrator-common/src/generated/docs/html/index.html +++ b/plugins/orchestrator-common/src/generated/docs/html/index.html @@ -1867,7 +1867,7 @@

Usage and SDK Samples

curl -X POST \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
- "http://localhost/v2/workflows/{workflowId}/execute" \
+ "http://localhost/v2/workflows/{workflowId}/execute?businessKey=businessKey_example" \
  -d '{
   "inputData" : "{}"
 }'
@@ -1889,9 +1889,10 @@ 

Usage and SDK Samples

DefaultApi apiInstance = new DefaultApi(); String workflowId = workflowId_example; // String | ID of the workflow to execute ExecuteWorkflowRequestDTO executeWorkflowRequestDTO = ; // ExecuteWorkflowRequestDTO | + String businessKey = businessKey_example; // String | ID of the parent workflow try { - ExecuteWorkflowResponseDTO result = apiInstance.executeWorkflow(workflowId, executeWorkflowRequestDTO); + ExecuteWorkflowResponseDTO result = apiInstance.executeWorkflow(workflowId, executeWorkflowRequestDTO, businessKey); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling DefaultApi#executeWorkflow"); @@ -1909,9 +1910,10 @@

Usage and SDK Samples

final String workflowId = new String(); // String | ID of the workflow to execute final ExecuteWorkflowRequestDTO executeWorkflowRequestDTO = new ExecuteWorkflowRequestDTO(); // ExecuteWorkflowRequestDTO | +final String businessKey = new String(); // String | ID of the parent workflow try { - final result = await api_instance.executeWorkflow(workflowId, executeWorkflowRequestDTO); + final result = await api_instance.executeWorkflow(workflowId, executeWorkflowRequestDTO, businessKey); print(result); } catch (e) { print('Exception when calling DefaultApi->executeWorkflow: $e\n'); @@ -1928,9 +1930,10 @@

Usage and SDK Samples

DefaultApi apiInstance = new DefaultApi(); String workflowId = workflowId_example; // String | ID of the workflow to execute ExecuteWorkflowRequestDTO executeWorkflowRequestDTO = ; // ExecuteWorkflowRequestDTO | + String businessKey = businessKey_example; // String | ID of the parent workflow try { - ExecuteWorkflowResponseDTO result = apiInstance.executeWorkflow(workflowId, executeWorkflowRequestDTO); + ExecuteWorkflowResponseDTO result = apiInstance.executeWorkflow(workflowId, executeWorkflowRequestDTO, businessKey); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling DefaultApi#executeWorkflow"); @@ -1950,10 +1953,12 @@

Usage and SDK Samples

DefaultApi *apiInstance = [[DefaultApi alloc] init]; String *workflowId = workflowId_example; // ID of the workflow to execute (default to null) ExecuteWorkflowRequestDTO *executeWorkflowRequestDTO = ; // +String *businessKey = businessKey_example; // ID of the parent workflow (optional) (default to null) // Execute a workflow [apiInstance executeWorkflowWith:workflowId executeWorkflowRequestDTO:executeWorkflowRequestDTO + businessKey:businessKey completionHandler: ^(ExecuteWorkflowResponseDTO output, NSError* error) { if (output) { NSLog(@"%@", output); @@ -1972,6 +1977,9 @@

Usage and SDK Samples

var api = new OrchestratorPlugin.DefaultApi() var workflowId = workflowId_example; // {String} ID of the workflow to execute var executeWorkflowRequestDTO = ; // {ExecuteWorkflowRequestDTO} +var opts = { + 'businessKey': businessKey_example // {String} ID of the parent workflow +}; var callback = function(error, data, response) { if (error) { @@ -1980,7 +1988,7 @@

Usage and SDK Samples

console.log('API called successfully. Returned data: ' + data); } }; -api.executeWorkflow(workflowId, executeWorkflowRequestDTO, callback); +api.executeWorkflow(workflowId, executeWorkflowRequestDTO, opts, callback);
@@ -2005,10 +2013,11 @@

Usage and SDK Samples

var apiInstance = new DefaultApi(); var workflowId = workflowId_example; // String | ID of the workflow to execute (default to null) var executeWorkflowRequestDTO = new ExecuteWorkflowRequestDTO(); // ExecuteWorkflowRequestDTO | + var businessKey = businessKey_example; // String | ID of the parent workflow (optional) (default to null) try { // Execute a workflow - ExecuteWorkflowResponseDTO result = apiInstance.executeWorkflow(workflowId, executeWorkflowRequestDTO); + ExecuteWorkflowResponseDTO result = apiInstance.executeWorkflow(workflowId, executeWorkflowRequestDTO, businessKey); Debug.WriteLine(result); } catch (Exception e) { Debug.Print("Exception when calling DefaultApi.executeWorkflow: " + e.Message ); @@ -2027,9 +2036,10 @@

Usage and SDK Samples

$api_instance = new OpenAPITools\Client\Api\DefaultApi(); $workflowId = workflowId_example; // String | ID of the workflow to execute $executeWorkflowRequestDTO = ; // ExecuteWorkflowRequestDTO | +$businessKey = businessKey_example; // String | ID of the parent workflow try { - $result = $api_instance->executeWorkflow($workflowId, $executeWorkflowRequestDTO); + $result = $api_instance->executeWorkflow($workflowId, $executeWorkflowRequestDTO, $businessKey); print_r($result); } catch (Exception $e) { echo 'Exception when calling DefaultApi->executeWorkflow: ', $e->getMessage(), PHP_EOL; @@ -2046,9 +2056,10 @@

Usage and SDK Samples

my $api_instance = WWW::OPenAPIClient::DefaultApi->new(); my $workflowId = workflowId_example; # String | ID of the workflow to execute my $executeWorkflowRequestDTO = WWW::OPenAPIClient::Object::ExecuteWorkflowRequestDTO->new(); # ExecuteWorkflowRequestDTO | +my $businessKey = businessKey_example; # String | ID of the parent workflow eval { - my $result = $api_instance->executeWorkflow(workflowId => $workflowId, executeWorkflowRequestDTO => $executeWorkflowRequestDTO); + my $result = $api_instance->executeWorkflow(workflowId => $workflowId, executeWorkflowRequestDTO => $executeWorkflowRequestDTO, businessKey => $businessKey); print Dumper($result); }; if ($@) { @@ -2067,10 +2078,11 @@

Usage and SDK Samples

api_instance = openapi_client.DefaultApi() workflowId = workflowId_example # String | ID of the workflow to execute (default to null) executeWorkflowRequestDTO = # ExecuteWorkflowRequestDTO | +businessKey = businessKey_example # String | ID of the parent workflow (optional) (default to null) try: # Execute a workflow - api_response = api_instance.execute_workflow(workflowId, executeWorkflowRequestDTO) + api_response = api_instance.execute_workflow(workflowId, executeWorkflowRequestDTO, businessKey=businessKey) pprint(api_response) except ApiException as e: print("Exception when calling DefaultApi->executeWorkflow: %s\n" % e) @@ -2082,9 +2094,10 @@

Usage and SDK Samples

pub fn main() { let workflowId = workflowId_example; // String let executeWorkflowRequestDTO = ; // ExecuteWorkflowRequestDTO + let businessKey = businessKey_example; // String let mut context = DefaultApi::Context::default(); - let result = client.executeWorkflow(workflowId, executeWorkflowRequestDTO, &context).wait(); + let result = client.executeWorkflow(workflowId, executeWorkflowRequestDTO, businessKey, &context).wait(); println!("{:?}", result); } @@ -2179,6 +2192,33 @@

Parameters

+
Query parameters
+ + + + + + + + + +
NameDescription
businessKey + + +
+
+
+ + String + + +
+ID of the parent workflow +
+
+
+
+

Responses

diff --git a/plugins/orchestrator-common/src/generated/docs/markdown/Apis/DefaultApi.md b/plugins/orchestrator-common/src/generated/docs/markdown/Apis/DefaultApi.md index 0d275149cf..24e594da9b 100644 --- a/plugins/orchestrator-common/src/generated/docs/markdown/Apis/DefaultApi.md +++ b/plugins/orchestrator-common/src/generated/docs/markdown/Apis/DefaultApi.md @@ -46,7 +46,7 @@ No authorization required # **executeWorkflow** -> ExecuteWorkflowResponseDTO executeWorkflow(workflowId, ExecuteWorkflowRequestDTO) +> ExecuteWorkflowResponseDTO executeWorkflow(workflowId, ExecuteWorkflowRequestDTO, businessKey) Execute a workflow @@ -58,6 +58,7 @@ Execute a workflow |------------- | ------------- | ------------- | -------------| | **workflowId** | **String**| ID of the workflow to execute | [default to null] | | **ExecuteWorkflowRequestDTO** | [**ExecuteWorkflowRequestDTO**](../Models/ExecuteWorkflowRequestDTO.md)| | | +| **businessKey** | **String**| ID of the parent workflow | [optional] [default to null] | ### Return type diff --git a/plugins/orchestrator-common/src/openapi/openapi.yaml b/plugins/orchestrator-common/src/openapi/openapi.yaml index 330276e3b0..7ef9c0f2b6 100644 --- a/plugins/orchestrator-common/src/openapi/openapi.yaml +++ b/plugins/orchestrator-common/src/openapi/openapi.yaml @@ -231,6 +231,12 @@ paths: required: true schema: type: string + - name: businessKey + in: query + description: ID of the parent workflow + required: false + schema: + type: string requestBody: required: true content: diff --git a/plugins/orchestrator/src/api/OrchestratorClient.test.ts b/plugins/orchestrator/src/api/OrchestratorClient.test.ts index 3f2fd7af8d..f50a2261b4 100644 --- a/plugins/orchestrator/src/api/OrchestratorClient.test.ts +++ b/plugins/orchestrator/src/api/OrchestratorClient.test.ts @@ -98,13 +98,16 @@ describe('OrchestratorClient', () => { mockExecResponse: ExecuteWorkflowResponseDTO, executeWorkflowSpy: jest.SpyInstance, parameters: JsonObject, + businessKey?: string, ) => { return () => { expect(result).toBeDefined(); expect(result.data).toEqual(mockExecResponse); expect(axios.request).toHaveBeenCalledTimes(1); expect(axios.request).toHaveBeenCalledWith({ - ...getAxiosTestRequest(`/v2/workflows/${workflowId}/execute`), + ...getAxiosTestRequest( + `/v2/workflows/${workflowId}/execute${businessKey ? `?businessKey=${businessKey}` : ''}`, + ), data: JSON.stringify({ inputData: parameters }), method: 'POST', headers: { @@ -116,6 +119,7 @@ describe('OrchestratorClient', () => { expect(executeWorkflowSpy).toHaveBeenCalledWith( workflowId, { inputData: parameters }, + businessKey, getDefaultTestRequestConfig(), ); }; @@ -138,25 +142,33 @@ describe('OrchestratorClient', () => { }); it('should execute workflow with business key', async () => { // Given + const businessKey = 'business123'; const { mockExecResponse, executeWorkflowSpy, args } = setupTest( 'execId001', {}, - 'business123', + businessKey, ); const result = await orchestratorClient.executeWorkflow(args); expect( - getExpectations(result, mockExecResponse, executeWorkflowSpy, {}), + getExpectations( + result, + mockExecResponse, + executeWorkflowSpy, + {}, + businessKey, + ), ).not.toThrow(); }); it('should execute workflow with parameters and business key', async () => { // Given + const businessKey = 'business123'; const parameters = { param1: 'one', param2: 2, param3: true }; const { mockExecResponse, executeWorkflowSpy, args } = setupTest( 'execId001', parameters, - 'business123', + businessKey, ); const result = await orchestratorClient.executeWorkflow(args); @@ -167,6 +179,7 @@ describe('OrchestratorClient', () => { mockExecResponse, executeWorkflowSpy, parameters, + businessKey, ), ).not.toThrow(); }); diff --git a/plugins/orchestrator/src/api/OrchestratorClient.ts b/plugins/orchestrator/src/api/OrchestratorClient.ts index 2d7c818dae..30256b15b5 100644 --- a/plugins/orchestrator/src/api/OrchestratorClient.ts +++ b/plugins/orchestrator/src/api/OrchestratorClient.ts @@ -94,6 +94,7 @@ export class OrchestratorClient implements OrchestratorApi { return await defaultApi.executeWorkflow( args.workflowId, { inputData: args.parameters }, + args.businessKey, reqConfigOption, ); } catch (err) { diff --git a/plugins/orchestrator/src/components/ExecuteWorkflowPage/ExecuteWorkflowPage.tsx b/plugins/orchestrator/src/components/ExecuteWorkflowPage/ExecuteWorkflowPage.tsx index c3c365c5a8..65af687a42 100644 --- a/plugins/orchestrator/src/components/ExecuteWorkflowPage/ExecuteWorkflowPage.tsx +++ b/plugins/orchestrator/src/components/ExecuteWorkflowPage/ExecuteWorkflowPage.tsx @@ -42,6 +42,7 @@ export const ExecuteWorkflowPage = () => { const [assessmentInstanceId] = useQueryParamState( QUERY_PARAM_ASSESSMENT_INSTANCE_ID, ); + const effectiveInstanceId = assessmentInstanceId || instanceId; const navigate = useNavigate(); const instanceLink = useRouteRef(workflowInstanceRouteRef); const { @@ -51,7 +52,7 @@ export const ExecuteWorkflowPage = () => { } = useAsync(async (): Promise => { const res = await orchestratorApi.getWorkflowDataInputSchema( workflowId, - assessmentInstanceId || instanceId, + effectiveInstanceId, ); return res.data; }, [orchestratorApi, workflowId]); @@ -74,7 +75,7 @@ export const ExecuteWorkflowPage = () => { const response = await orchestratorApi.executeWorkflow({ workflowId, parameters, - businessKey: assessmentInstanceId, + businessKey: effectiveInstanceId, }); navigate(instanceLink({ instanceId: response.data.id })); } catch (err) { @@ -83,7 +84,7 @@ export const ExecuteWorkflowPage = () => { setIsExecuting(false); } }, - [orchestratorApi, workflowId, navigate, instanceLink, assessmentInstanceId], + [orchestratorApi, workflowId, navigate, instanceLink, effectiveInstanceId], ); const error = responseError || workflowNameError;