-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[vrotsc] (#340) Add Workflow canvas Workflow End item #348
Conversation
Signed-off-by: Alexander Kantchev <[email protected]>
Signed-off-by: Alexander Kantchev <[email protected]>
Signed-off-by: Alexander Kantchev <[email protected]>
Signed-off-by: Alexander Kantchev <[email protected]>
In the example, why do we have: @WorkflowEndItem({
endMode: 1,
exception: "errorMessage",
})
public workflowEnd(@In endMode: number, @Out errorMessage: string) {
// NOOP
}
|
@@ -19,6 +19,9 @@ import { Workflow, Out, In, Item, RootItem, DecisionItem, WaitingTimerItem, Work | |||
}, | |||
result: { | |||
type: "number" | |||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why modify this test? I see you may be confused but this test is to test the WorkflowItem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this serves as an integration test for the currently supported components.
exception: "errorMessage", | ||
businessStatus: "Bad" | ||
}) | ||
public workflowEnd(@In endMode: number, @Out errorMessage: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is endMode needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is required by the XML representation of the component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an input parameter, end-mode
is a property of the workflow item. It makes no sense to have it as an input too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code updated.
@WorkflowEndItem({ | ||
endMode: 0 | ||
}) | ||
public workflowEnd(@In endMode: number) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is required by the XML representation of the component.
...sc/src/compiler/transformer/fileTransformers/workflow/decorators/endItemDecoratorStrategy.ts
Show resolved
Hide resolved
...sc/src/compiler/transformer/fileTransformers/workflow/decorators/endItemDecoratorStrategy.ts
Show resolved
Hide resolved
const endMode = itemInfo?.canvasItemPolymorphicBag?.endMode; | ||
const exceptionVariable = itemInfo?.canvasItemPolymorphicBag?.exception; | ||
const businessStatus = itemInfo?.canvasItemPolymorphicBag?.businessStatus; | ||
const hasException = (exceptionVariable !== null && exceptionVariable !== undefined && exceptionVariable); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
! exceptionVariable
Checks for all of these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not
const hasBusinessStatus = (businessStatus !== null && businessStatus !== undefined && businessStatus); | ||
|
||
stringBuilder.append(`<workflow-item name="item${pos}" type="end" end-mode="${endMode}" `); | ||
if (hasException) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only for endmode 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually not, you can support endMode = 1 and without throwing of an exception, in case the error is handled in another workflow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the UI this is not present, I found no way to do this
...sc/src/compiler/transformer/fileTransformers/workflow/decorators/endItemDecoratorStrategy.ts
Show resolved
Hide resolved
|
||
interface VroWorkflowEndItemConfiguration { | ||
endMode?: WorkflowEndMode; | ||
exception?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exception
will mean sth else in other items... can we rename this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code updated.
To control the end mode of the end component, this could support the following scenarios:
The use case 3 can be used when the workflow is controlled by other workflow and does not need exception throwing when the exit code is 1 |
Signed-off-by: Alexander Kantchev <[email protected]>
I am ok with it being in the decorator, I meant |
…ters. Signed-off-by: Alexander Kantchev <[email protected]>
Signed-off-by: Alexander Kantchev <[email protected]>
Signed-off-by: Alexander Kantchev <[email protected]>
*New
@WorkflowEndItem
decorator for WorkflowsThe decorator is used to specify a custom workflow end item.
Supported Parameters
endMode
- End mode of the component, could be one of 0 or 1, where 0 is exit success and 1 is error.exceptionVariable
- Exception variable that will hold the exception data when triggered.businessStatus
- Value of the business status in the end component.In order to bind inputs and outputs, you do it with the
@Out
decorator. This is the same way we do it for other items.Example:
Checklist
Fixed #XXX -
orClosed #XXX -
prefix to auto-close the issueTesting
Added e2e tests to the PR and also tested on an actual environment. Testing process on live environment:
typescript-project-all
.Release Notes
*New
@WorkflowEndItem
decorator for WorkflowsThe decorator is used to specify a custom workflow end item.
Supported Parameters
endMode
- End mode of the component, could be one of 0 or 1, where 0 is exit success and 1 is error.exceptionVariable
- Exception variable that will hold the exception data when triggered.businessStatus
- Value of the business status assigned with the end.In order to bind inputs and outputs, you do it with the
@Out
decorator. This is the same way we do it for other items.Related issues and PRs
Implementation of #340