-
Notifications
You must be signed in to change notification settings - Fork 30
[vrotsc,vrotsc-annotations] (#869) Add Workflow Canvas Item for Switch Component #910
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
2c4ba42
5694343
6cc122f
c387fa1
cf2c0cd
5e9fac1
a7a028b
89929f0
3c075c4
babb10c
d05e9ae
baa8d9a
7eb9455
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import { Workflow, SwitchItem } from "vrotsc-annotations"; | ||
|
|
||
| @Workflow({ | ||
| name: "Switch Boolean Cases", | ||
| path: "VMware/PSCoE", | ||
| description: "Switch test with boolean conditions and mixed types", | ||
| attributes: { | ||
| isEnabled: { | ||
| type: "boolean" | ||
| }, | ||
| priority: { | ||
| type: "number" | ||
| }, | ||
| } | ||
| }) | ||
| export class SwitchBooleanCases { | ||
|
|
||
| @SwitchItem({ | ||
| cases: [ | ||
| { condition: true, target: "enableFeature", variable: "isEnabled", type: "boolean" }, | ||
| { condition: false, target: "disableFeature", variable: "isEnabled", type: "boolean" } | ||
| ], | ||
| defaultTarget: "handleUndefined" | ||
| }) | ||
| public switchByBoolean(isEnabled: boolean, priority: number) { | ||
| // Boolean switch logic | ||
| } | ||
|
|
||
| public enableFeature() { | ||
| System.log("Feature is enabled"); | ||
| } | ||
|
|
||
| public disableFeature() { | ||
| System.log("Feature is disabled"); | ||
| } | ||
|
|
||
| public handleUndefined() { | ||
| System.log("Boolean value is undefined"); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { Workflow, SwitchItem } from "vrotsc-annotations"; | ||
|
|
||
| @Workflow({ | ||
| name: "Switch Edge Cases", | ||
| path: "VMware/PSCoE", | ||
| description: "Switch test covering edge cases - no default target, single case, and complex conditions", | ||
| attributes: { | ||
| errorCode: { | ||
| type: "number" | ||
| }, | ||
| } | ||
| }) | ||
| export class SwitchEdgeCases { | ||
|
|
||
| @SwitchItem({ | ||
| cases: [ | ||
| { condition: 404, target: "handleNotFound", variable: "errorCode", type: "number", comparator: "0" }, | ||
| { condition: 500, target: "handleServerError", variable: "errorCode", type: "number", comparator: "0" }, | ||
| { condition: 403, target: "handleForbidden", variable: "errorCode", type: "number", comparator: "0" } | ||
| ], | ||
| // No default target - will fall through to next item | ||
| }) | ||
| public switchErrorCodes(errorCode: number) { | ||
| // Error code switch without default | ||
| System.log("Processing error code: " + errorCode); | ||
| } | ||
|
|
||
| public handleNotFound() { | ||
| System.log("404 - Resource not found"); | ||
| } | ||
|
|
||
| public handleServerError() { | ||
| System.log("500 - Internal server error"); | ||
| } | ||
|
|
||
| public handleForbidden() { | ||
| System.log("403 - Access forbidden"); | ||
| } | ||
|
|
||
| public fallbackHandler() { | ||
| System.log("Unhandled error code - using fallback"); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import { Workflow, SwitchItem } from "vrotsc-annotations"; | ||
|
|
||
| @Workflow({ | ||
| name: "Switch Happy Path", | ||
| path: "VMware/PSCoE", | ||
| description: "Basic switch test with multiple numeric cases and default target", | ||
| attributes: { | ||
| operationType: { | ||
| type: "number" | ||
| }, | ||
| } | ||
| }) | ||
| export class SwitchHappyPath { | ||
|
|
||
| @SwitchItem({ | ||
| cases: [ | ||
| { condition: 1, target: "createResource", variable: "operationType", type: "number" }, | ||
| { condition: 2, target: "updateResource", variable: "operationType", type: "number" }, | ||
| { condition: 3, target: "deleteResource", variable: "operationType", type: "number" } | ||
| ], | ||
| defaultTarget: "logUnknownOperation" | ||
| }) | ||
| public switchElement(operationType: number) { | ||
| // Switch logic will be generated automatically | ||
| } | ||
|
|
||
| public createResource() { | ||
| System.log("Creating resource"); | ||
| } | ||
|
|
||
| public updateResource() { | ||
| System.log("Updating resource"); | ||
| } | ||
|
|
||
| public deleteResource() { | ||
| System.log("Deleting resource"); | ||
| } | ||
|
|
||
| public logUnknownOperation() { | ||
| System.log("Unknown operation type"); | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.