Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

add select parameter type #242

Merged

Conversation

RichardW98
Copy link
Contributor

add select parameter type
Screenshot 2023-04-17 at 8 58 41 AM
Screenshot 2023-04-17 at 8 58 33 AM

continue;
}

Map<String, Object> properties = workFlowTaskParameter.getType().getAsJsonSchema();
properties.put("required", !workFlowTaskParameter.isOptional());
properties.put("description", workFlowTaskParameter.getDescription());
if (workFlowTaskParameter.getType().isSelect() && workFlowTaskParameter.getSelectOptions() != null) {
properties.put("enum", workFlowTaskParameter.getSelectOptions());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing test.

PASSWORD, TEXT, EMAIL, DATE, NUMBER, URL, SELECT, MULTI_SELECT;

public boolean isSelect() {
return SELECT.name().equals(name()) || MULTI_SELECT.name().equals(name());
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would add a test for this just in case someone delete it something in the future.

@@ -55,6 +59,12 @@ public Map<String, Object> getAsJsonSchema() {
properties.put("type", "string");
properties.put("format", "date");
break;
case SELECT:
properties.put("type", "select");
break;
Copy link
Collaborator

Choose a reason for hiding this comment

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

test

properties.put("type", "select");
break;
case MULTI_SELECT:
properties.put("type", "multi-select");
Copy link
Collaborator

Choose a reason for hiding this comment

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

test

new WorkFlowOptions.Builder()
.addNewOption(getWorkFlowOptions().get(0))
.build());
// @formatter:on
Copy link
Collaborator

Choose a reason for hiding this comment

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

you should move out the formatter TBH

@@ -78,6 +80,15 @@ public static class ArgumentRequestDTO {

String value;

public void setValue(Object value) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this used at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, now the multi-select will return a list of string, I need to deserialize it to string here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed to string.valueof to avoid some parsing issue with quotes

@gciavarrini
Copy link
Contributor

@RichardW98 There are commits that do not belong to the PR, please double check what happened during the rebase :)

PASSWORD, TEXT, EMAIL, DATE, NUMBER, URL, SELECT, MULTI_SELECT;

public boolean isSelect() {
return SELECT.name().equals(name()) || MULTI_SELECT.name().equals(name());
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like to suggest, to consider implementing this function defining an Enum subset via EnumSet.

For example:

    private EnumSet<WorkFlowTaskParameterType> selectedTypes() {
        return EnumSet.of(SELECT, MULTI_SELECT);
    }

    public boolean isSelect(WorkFlowTaskParameterType type) {
        return type != null && selectedTypes().contains(type);
    }

In this way It's possible to use factory methods available in EnumSet (such as contains, complementOf, allOf, etc.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, EnumSet is better

new WorkFlowOptions.Builder()
.addNewOption(getWorkFlowOptions().get(0))
.build());
// @formatter:on
Copy link
Contributor

Choose a reason for hiding this comment

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

Is a //formatter:off annotation missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes on & off are reversed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

you're right! I missed it!

@RichardW98 RichardW98 force-pushed the FLPATH-292-dropdown branch 2 times, most recently from 29d4434 to 3344242 Compare April 17, 2023 16:18
@RichardW98
Copy link
Contributor Author

I added some more change to combine "WorkflowTaskParameter" and "WorkflowParameter"

@pkliczewski
Copy link
Collaborator

/lgtm

@pkliczewski
Copy link
Collaborator

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Apr 17, 2023
@openshift-ci
Copy link

openshift-ci bot commented Apr 17, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: anludke

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 3d3f875 into parodos-dev:main Apr 17, 2023
@RichardW98 RichardW98 deleted the FLPATH-292-dropdown branch May 8, 2023 15:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants