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,vrotsc-annotations] (#336) Add Workflow Canvas Item for User Interaction Component #400

Merged
merged 22 commits into from
Sep 30, 2024

Conversation

akantchev
Copy link
Contributor

@akantchev akantchev commented Aug 29, 2024

User Interaction Workflow Item

The decorator is used to specify an user interaction workflow item.

Supported Parameters

  • target - The name of the target to that user interaction workflow item is connected to. You can specify another user interaction workflow item as a target, thus chaining multiple user interaction components.

In order to bind inputs and outputs, you do it with the @In and @Out decorators.

Inputs

If you need to specify certain access limitation for the user interaction component you can specify them with @In decorators.
Those inputs are optional.

  • security_assignees (type Array/LdapUser) - Any user from this array of users will be authorized to fill in this form.
  • security_assignee_groups (type Array/LdapGroup) - Any user member of any of the groups will be authorized to fill in this form.
  • security_group (type LdapGroup) - Any user member of this group will be authorized to fill in this form.
  • timeout_date (type Date) - If not null, this input item will wait until date and will continue workflow execution.

Note that those parameters should match also the input parameters of the workflow.

Known Limitations for the Input Parameters

The names of the variables in the additional method decorators should be as following:

  • security_assignees - for the security assignees parameter.
  • security_assignee_groups - for the security assignee group parameter.
  • security_group - for the security group parameter.
  • timeout_date - for the timeout date parameter.

Outputs

You can specify multiple output variables that would hold the answer of the user interaction components.

Example Workflow

import {
    Workflow,
    In,
    Item,
    RootItem,
    UserInteractionItem,
} from "vrotsc-annotations";

@Workflow({
    name: "User Interaction",
    path: "VMware/PSCoE",
    description: "Adding user interaction parameters",
})
export class UserInteractionWorkflow {

    @RootItem({ target: "userInteraction1Enter", exception: "" })
    public start() {
        System.log("Starting workflow");
    }

    @UserInteractionItem({
        target: "userInteraction2Enter",
    })
    public userInteraction1Enter() {
        System.log("User interaction component 1 activation");
    }

    @UserInteractionItem({
        target: "userInteractionExit",
    })
    public userInteraction2Enter(
        @In security_assignees: LdapUser[],
        @In security_assignee_groups: LdapGroup[],
        @In security_group: LdapGroup,
        @In timeout_date?: Date,
        @In userInteractionAnswer?: string
    ) {
        System.log("User interaction component 2 activation");
    }

    @Item({ target: "end" })
    public userInteractionExit(@In userInteractionAnswer: string) {
        System.log("User Interaction exit");
    }

User_Interaction_Canvas_Item_Workflow

Checklist

  • I have added relevant error handling and logging messages to help troubleshooting
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation, relevant usage information (if applicable)
  • I have updated the PR title with affected component, related issue number and a short summary of the changes introduced
  • I have added labels for implementation kind (kind/) and version type (version/)
  • I have tested against live environment, if applicable
  • I have my changes rebased and squashed to the minimal number of relevant commits. Notice: don't squash all commits
  • I have added a descriptive commit message with a short title, including a Fixed #XXX - or Closed #XXX - prefix to auto-close the issue

Testing

End to end tests for the user interaction component were also added.

Related issue:

#336

Signed-off-by: Alexander Kantchev <[email protected]>
…orator strategies. Removed obsolete structures.

Signed-off-by: Alexander Kantchev <[email protected]>
@akantchev akantchev added area/vro-types Relates to changes to the type definitions lang/typescript Related to typescript code area/vrotsc Relates to `vrotsc` module version/minor Introduces a non-breaking feature or change kind/feature New Feature to the project labels Aug 29, 2024
@akantchev akantchev self-assigned this Aug 29, 2024
@akantchev akantchev requested a review from a team as a code owner August 29, 2024 12:33
@akantchev akantchev marked this pull request as draft August 29, 2024 12:57
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]>
Signed-off-by: Alexander Kantchev <[email protected]>
@akantchev akantchev linked an issue Sep 11, 2024 that may be closed by this pull request
@VenelinBakalov VenelinBakalov marked this pull request as ready for review September 11, 2024 12:04
Signed-off-by: Alexander Kantchev <[email protected]>
Signed-off-by: Alexander Kantchev <[email protected]>
Copy link
Collaborator

@Michaelpalacce Michaelpalacce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't agree with this approach. I am not going to approve these changes. If someone else wants to do so, feel free, I will remove my review then

Signed-off-by: Alexander Kantchev <[email protected]>
Signed-off-by: Alexander Kantchev <[email protected]>
@akantchev akantchev removed the request for review from Michaelpalacce September 26, 2024 08:40
@akantchev akantchev requested review from Michaelpalacce and removed request for Michaelpalacce September 27, 2024 09:44
Signed-off-by: Alexander Kantchev <[email protected]>
@akantchev akantchev dismissed Michaelpalacce’s stale review September 27, 2024 09:47

Disimssing review as per reviewer request.

@akantchev akantchev removed the request for review from Michaelpalacce September 27, 2024 09:47
@akantchev akantchev merged commit b7abed3 into main Sep 30, 2024
10 checks passed
@VenelinBakalov VenelinBakalov deleted the feature/336-canvas-item-user-interaction branch September 30, 2024 08:23
@Michaelpalacce
Copy link
Collaborator

I can't believe we merged this 😮

We are using the "Strategy Pattern" for this. The whole point it was done this way was so we can avoid inheritance... https://www.geeksforgeeks.org/favoring-composition-over-inheritance-in-java-with-examples/

Now we've created an entirely useless abstract parent, that easily could have been a function if we were so worried about duplication.

I am not saying to never use inheritance, but doing so in a Strategy pattern is... atrocious.

Not to mention the wrappers that were added to the parent class. The way it was done, completely breaks SRP.

Let's introduce more complexity for the sake of complexity in this "overly simple project", it boggles my mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/vro-types Relates to changes to the type definitions area/vrotsc Relates to `vrotsc` module kind/feature New Feature to the project lang/typescript Related to typescript code version/minor Introduces a non-breaking feature or change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Canvas Item Decorator For User Interaction
3 participants