-
Notifications
You must be signed in to change notification settings - Fork 21
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, vrotsc-annotations] (#339) Add Workflow canvas Default Error Handler item #346
[vrotsc, vrotsc-annotations] (#339) Add Workflow canvas Default Error Handler item #346
Conversation
…corator. Signed-off-by: Alexander Kantchev <[email protected]>
@akantchev, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
Signed-off-by: Alexander Kantchev <[email protected]>
Signed-off-by: Alexander Kantchev <[email protected]>
@akantchev, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
1 similar comment
@akantchev, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
Signed-off-by: Alexander Kantchev <[email protected]>
@akantchev, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
1 similar comment
@akantchev, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
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.
Non relevant
// NOOP | ||
} | ||
|
||
@DefaultErrorHandler({ |
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.
Don't modify old tests like this, rather add new ones
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 one serves as an integration test for all currently supported workflow items, hence it should be here, Furthermore there are other tests for this specific functionality as well.
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.
No it doesn't 😄 the example was just too big perhaps, but it was meant mainly for 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.
Discussed offline, comment not applicable anymore.
<?xml version="1.0" encoding="utf-8" ?><workflow xmlns="http://vmware.com/vco/workflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://vmware.com/vco/workflow http://vmware.com/vco/workflow/Workflow-v4.xsd" root-name="item1" object-name="workflow:name=generic" id="983d90ae-55f4-3618-b049-264e66324e74" version="1.0.0" api-version="6.0.0" restartMode="1" resumeFromFailedMode="0"><display-name><![CDATA[Waiting Timer Edge]]></display-name><description><![CDATA[Waiting timer will point to end with target]]></description><position x="105" y="45.90909090909091" /><attrib name="waitingTimer" type="Date" read-only="false" /><attrib name="counter" type="number" read-only="false" /><workflow-item name="item0" type="end" end-mode="0"><position x="585.0" y="45.40909090909091" /></workflow-item><workflow-item name="item1" out-name="item0" type="waiting-timer"><display-name><![CDATA[waitForEvent]]></display-name><in-binding><bind name="timer.date" type="Date" export-name="waitingTimer" /></in-binding><position x="225.0" y="55.40909090909091" /></workflow-item><workflow-item name="item2" out-name="item0" type="task"><script encoded="false"><![CDATA[]]></script><display-name><![CDATA[shouldNotGoHere]]></display-name><position x="385.0" y="55.40909090909091" /></workflow-item><presentation><p-param name="waitingTimer"><desc><![CDATA[waitingTimer]]></desc></p-param></presentation></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.
Why are there changes 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.
Due to changes in the typescript representations of the workflows.
@@ -58,6 +58,7 @@ export interface WorkflowItemDescriptor<T = any> { | |||
canvasItemPolymorphicBag: T; | |||
polyglot?: PolyglotDescriptor; | |||
parent: WorkflowDescriptor; | |||
type?: WorkflowItemType; |
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.
You should get this from the assigned strategy. You can do descriptor.strategy.getDecoratorType()
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.
Property removed.
import { buildItemParameterBindings, InputOutputBindings } from "./helpers/presentation"; | ||
|
||
// UI positioning constants in the output XML file. | ||
const xBasePosition = 180; |
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.
We have a task for 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.
Excellent
const exceptionVariable = itemInfo?.canvasItemPolymorphicBag?.exception; | ||
const hasException = (exceptionVariable !== null && exceptionVariable !== undefined && exceptionVariable); | ||
|
||
stringBuilder.append(`<error-handler name="item${pos}" `); |
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.
To make it more readable, maybe sth like:
stringBuilder.append(`<error-handler`
+ ` name="item${pos}" `
+ ` ${hasException ? `throw-bind-name="${exceptionVariable}" ` : ""}`
+ `>`).appendLine();
as we do with others?
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 your proposal is less readable.
stringBuilder.append("</error-handler>").appendLine(); | ||
|
||
// attach a default end item to the error handler, note that the name of the end item and the error handler should be the same | ||
const defaultEndItem = this.buildDefaultEndItem(itemInfo, pos, 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.
This doesn't really make sense, the whole idea is that they can attach to an end item or another task to handle the error in some way
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.
Besides, this can easily point to the default end
item that was created.
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 it does, it should have a default end item, attached to the error handler.
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.
You didn't answer the first question. users can point to a task or sth else, how do we handle that?
Where is the requirement to have a default end item?
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.
Discussed offline, comment not applicable anymore.
@@ -127,6 +127,8 @@ type CompositeType = { | |||
|
|||
type AttributeValue = CompositeType | SupportedValues | SupportedValues[]; | |||
|
|||
type WorkflowEndMode = 0 | 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.
Not needed
@@ -253,7 +266,11 @@ interface VroPolyglotDecorator { | |||
new(obj?: VroPolyglotConfiguration): VroPolyglotConfiguration; | |||
} | |||
|
|||
interface VroPolyglotConfiguration { package: string, method: string; } | |||
interface VroPolyglotConfiguration { |
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.
Let's revert 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.
Discussed offline, reverting is not needed.
|
||
interface VroWorkflowDefaultErrorHandlerDecorator { | ||
(obj?: VroItemConfiguration): VroWorkflowDefaultErrorHandlerMethodDecorator; | ||
new(obj?: VroItemConfiguration): VroItemConfiguration; |
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.
Each item should have their own definition so they are easy to change and don't bring confusion
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 does not make sense to have own definition in this case, as it does not bring new properties.
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.
So each other type have their own Config Type, but specifically the DefaultErrorhanlder
will point to the Item
one? Isn't it more clear for the user if it has it's own?
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.
Discussed offline, decided that the whole interface will be reworked using inheritance once all needed workflow components are implemented (will be done in a separate PR).
itemInfo.target = propValue; | ||
break; | ||
} | ||
case "exception": { |
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.
Annotation variable name changed.
Signed-off-by: Alexander Kantchev <[email protected]>
@akantchev, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
1 similar comment
@akantchev, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
Signed-off-by: Alexander Kantchev <[email protected]>
Signed-off-by: Alexander Kantchev <[email protected]>
@akantchev, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
1 similar comment
@akantchev, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
*New
DefaultErrorHandler
decorator for WorkflowsThis decorator is used to specify a default error handler. It can be bound either to a workflow item component or workflow end.
Supported Parameters
target
- target item to be attached to the default error handler, could be one of workflow item or workflow end.exceptionVariable
- Exception variable that will hold the exception data when triggered.In order to bind inputs and outputs, you do it with the
@In
and@Out
decorators. 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
.Test Screenshot
Release Notes
*New
DefaultErrorHandler
decorator for WorkflowsThis decorator is used to specify a default error handler. Note that the default error handler will be generated
with its own end workflow item as it is required by the component.
Supported Parameters
target
- Not implemented yetexception
- if set the variable will be bound to the error handler and its own end workflow component.If set the end workflow component bound to the error handler will have exit code 1, otherwise the exit code will be 0.
Related issues and PRs
Implementation of #339