Skip to content
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

Merged
merged 8 commits into from
Jul 22, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ How to use Aria Orchestrator Workflows and available decorators.
- [`@WaitingTimerItem`](#waitingtimeritem)
- [`@DecisionItem`](#decisionitem)
- [`@RootItem`](#rootitem)
- [`@WorkflowEndItem`](#workflowenditem)
3. [Example Workflow](#example-workflow)

### Workflow Decorator
Expand All @@ -20,6 +21,16 @@ Not implemented yet.

### Available Method Decorators

#### `@WorkflowEndItem`

The 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.

#### `@Item`

This decorator is used to specify a scriptable task.
Expand Down Expand Up @@ -64,28 +75,41 @@ This is a meta decorator. Add this to whichever function you want to be the entr
### Example Workflow

```ts
import { Workflow, Out, In, Item, RootItem, DecisionItem, WaitingTimerItem, WorkflowItem } from "vrotsc-annotations";
import {
Workflow,
Out,
In,
Item,
RootItem,
DecisionItem,
WaitingTimerItem,
WorkflowItem,
WorkflowEndItem,
} from "vrotsc-annotations";

@Workflow({
name: "Example Waiting Timer",
path: "VMware/PSCoE",
attributes: {
waitingTimer: {
type: "Date"
type: "Date",
},
counter: {
type: "number"
type: "number",
},
first: {
type: "number"
type: "number",
},
second: {
type: "number"
type: "number",
},
result: {
type: "number"
}
}
type: "number",
},
errorMessage: {
type: "string",
},
},
})
export class HandleNetworkConfigurationBackup {
@DecisionItem({ target: "waitForEvent", else: "prepareItems" })
Expand All @@ -101,9 +125,14 @@ export class HandleNetworkConfigurationBackup {

@WorkflowItem({
target: "print",
linkedItem: "9e4503db-cbaa-435a-9fad-144409c08df0"
linkedItem: "9e4503db-cbaa-435a-9fad-144409c08df0",
})
public callOtherWf(@In first: number, @In second: number, @Out result: number) {
public callOtherWf(
@In first: number,
@In second: number,
@Out result: number
) {
// NOOP
}

@Item({ target: "end" })
Expand All @@ -118,7 +147,6 @@ export class HandleNetworkConfigurationBackup {
}

counter++;

if (counter < 2) {
const tt = Date.now() + 5 * 1000;
waitingTimer = new Date(tt);
Expand All @@ -138,6 +166,16 @@ export class HandleNetworkConfigurationBackup {

@WaitingTimerItem({ target: "execute" })
public waitForEvent(@In waitingTimer: Date) {
// NOOP
}

@WorkflowEndItem({
endMode: 0,
exception: "errorMessage",
businessStatus: "Bad"
})
public workflowEnd() {
// NOOP
}
}
```
142 changes: 100 additions & 42 deletions docs/versions/latest/Release.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,78 @@
[//]: # (VERSION_PLACEHOLDER DO NOT DELETE)
[//]: # (Used when working on a new release. Placed together with the Version.md)
[//]: # (Nothing here is optional. If a step must not be performed, it must be said so)
[//]: # (Do not fill the version, it will be done automatically)
[//]: # (Quick Intro to what is the focus of this release)
[//]: # "VERSION_PLACEHOLDER DO NOT DELETE"
[//]: # "Used when working on a new release. Placed together with the Version.md"
[//]: # "Nothing here is optional. If a step must not be performed, it must be said so"
[//]: # "Do not fill the version, it will be done automatically"
[//]: # "Quick Intro to what is the focus of this release"

## Breaking Changes

[//]: # (### *Breaking Change*)
[//]: # (Describe the breaking change AND explain how to resolve it)
[//]: # (You can utilize internal links /e.g. link to the upgrade procedure, link to the improvement|deprecation that introduced this/)
[//]: # "### *Breaking Change*"
[//]: # "Describe the breaking change AND explain how to resolve it"
[//]: # "You can utilize internal links /e.g. link to the upgrade procedure, link to the improvement|deprecation that introduced this/"

## Deprecations

[//]: # (### *Deprecation*)
[//]: # (Explain what is deprecated and suggest alternatives)

[//]: # (Features -> New Functionality)
[//]: # "### *Deprecation*"
[//]: # "Explain what is deprecated and suggest alternatives"
[//]: # "Features -> New Functionality"

## Features

[//]: # (### *Feature Name*)
[//]: # (Describe the feature)
[//]: # (Optional But higlhy recommended Specify *NONE* if missing)
[//]: # (#### Relevant Documentation:)
[//]: # "### *Feature Name*"
[//]: # "Describe the feature"
[//]: # "Optional But highly recommended Specify *NONE* if missing"
[//]: # "#### Relevant Documentation:"
[//]: # "Improvements -> Bugfixes/hotfixes or general improvements"

### \*New `@WorkflowEndItem` decorator for Workflows

The 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.

Example:

```typescript
import { Workflow, RootItem, WorkflowEndItem } from "vrotsc-annotations";

@Workflow({
name: "Workflow End Exception",
path: "VMware/PSCoE",
description: "Workflow with root and end item with end mode 1",
attributes: {
errorMessage: {
type: "string",
},
businessStatus: {
type: "string",
},
endMode: {
type: "number",
},
},
})
export class WorkflowEnd {
@RootItem()
public initiateWorkflow() {
// NOOP
}

[//]: # (Improvements -> Bugfixes/hotfixes or general improvements)
@WorkflowEndItem({
endMode: 1,
exceptionVariable: "errorMessage",
businessStatus: "Bad",
})
public workflowEnd() {
// NOOP
}
}
```

### *New `WorkflowItem` decorator for Workflows
### \*New `WorkflowItem` decorator for Workflows

The new Decorator gives you the ability to specify a canvas item that calls a Workflow.

Expand All @@ -39,28 +85,37 @@ In order to bind inputs and outputs, you do it with the `@In` and `@Out` decorat
Example:

```typescript
import { Workflow, Out, In, Item, RootItem, DecisionItem, WaitingTimerItem, WorkflowItem } from "vrotsc-annotations";
import {
Workflow,
Out,
In,
Item,
RootItem,
DecisionItem,
WaitingTimerItem,
WorkflowItem,
} from "vrotsc-annotations";

@Workflow({
name: "Example Waiting Timer",
path: "VMware/PSCoE",
attributes: {
waitingTimer: {
type: "Date"
type: "Date",
},
counter: {
type: "number"
type: "number",
},
first: {
type: "number"
type: "number",
},
second: {
type: "number"
type: "number",
},
result: {
type: "number"
}
}
type: "number",
},
},
})
export class HandleNetworkConfigurationBackup {
@DecisionItem({ target: "waitForEvent", else: "prepareItems" })
Expand All @@ -76,10 +131,13 @@ export class HandleNetworkConfigurationBackup {

@WorkflowItem({
target: "print",
linkedItem: "9e4503db-cbaa-435a-9fad-144409c08df0"
linkedItem: "9e4503db-cbaa-435a-9fad-144409c08df0",
})
public callOtherWf(@In first: number, @In second: number, @Out result: number) {
}
public callOtherWf(
@In first: number,
@In second: number,
@Out result: number
) {}

@Item({ target: "end" })
public print(@In result: number) {
Expand All @@ -93,7 +151,6 @@ export class HandleNetworkConfigurationBackup {
}

counter++;

if (counter < 2) {
const tt = Date.now() + 5 * 1000;
waitingTimer = new Date(tt);
Expand All @@ -113,24 +170,25 @@ export class HandleNetworkConfigurationBackup {

@WaitingTimerItem({ target: "execute" })
public waitForEvent(@In waitingTimer: Date) {
// NOOP
}
}
```

## Improvements

[//]: # (### *Improvement Name* )
[//]: # (Talk ONLY regarding the improvement)
[//]: # (Optional But higlhy recommended)
[//]: # (#### Previous Behavior)
[//]: # (Explain how it used to behave, regarding to the change)
[//]: # (Optional But higlhy recommended)
[//]: # (#### New Behavior)
[//]: # (Explain how it behaves now, regarding to the change)
[//]: # (Optional But higlhy recommended Specify *NONE* if missing)
[//]: # (#### Relevant Documentation:)
[//]: # "### *Improvement Name* "
[//]: # "Talk ONLY regarding the improvement"
[//]: # "Optional But highly recommended"
[//]: # "#### Previous Behavior"
[//]: # "Explain how it used to behave, regarding to the change"
[//]: # "Optional But highly recommended"
[//]: # "#### New Behavior"
[//]: # "Explain how it behaves now, regarding to the change"
[//]: # "Optional But highly recommended Specify *NONE* if missing"
[//]: # "#### Relevant Documentation:"

### *ABX archetype build issue, cannot compile*
### _ABX archetype build issue, cannot compile_

Fixed an issue where the ABX archetype could not compile due to an old version of the `xmlbuilder2` package.

Expand Down Expand Up @@ -174,4 +232,4 @@ The ABX archetype now compiles successfully.

## Upgrade procedure

[//]: # (Explain in details if something needs to be done)
[//]: # "Explain in details if something needs to be done"
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Workflow, RootItem, WorkflowEndItem } from "vrotsc-annotations";

@Workflow({
name: "Workflow End Exception",
path: "VMware/PSCoE",
description: "Workflow with root and end item with end mode 1",
attributes: {
errorMessage: {
type: "string"
},
businessStatus: {
type: "string"
},
endMode: {
type: "number"
}
}
})
export class WorkflowEnd {

@RootItem()
public initiateWorkflow() {
// NOOP
}

@WorkflowEndItem({
endMode: 1,
exceptionVariable: "errorMessage",
businessStatus: "Bad"
})
public workflowEnd() {
// NOOP
}
}
26 changes: 26 additions & 0 deletions typescript/vrotsc/e2e/cases/canvas-items/end-item-happy.wf.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Workflow, RootItem, WorkflowEndItem } from "vrotsc-annotations";

@Workflow({
name: "Workflow End Happy",
path: "VMware/PSCoE",
description: "Workflow with root and end item",
attributes: {
endMode: {
type: "number"
}
}
})
export class WorkflowEnd {

@RootItem()
public initiateWorkflow() {
// NOOP
}

@WorkflowEndItem({
endMode: 0
})
public workflowEnd() {
// NOOP
}
}
Loading
Loading