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

Add ability to add default values to workflow parameters #865

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

ykeremy
Copy link
Contributor

@ykeremy ykeremy commented Sep 20, 2024

🚀 This description was created by cd11f88

feat: add default value support for workflow parameters

Summary:

Add default value support for workflow parameters with UI updates and JSON parsing.

Key points:

  • Add default value support for workflow parameters.
  • Update UI in FlowRenderer.tsx, WorkflowEditor.tsx, WorkflowParameterAddPanel.tsx, and WorkflowParameterEditPanel.tsx.
  • Use AutoResizingTextarea for string parameters and add Label for boolean parameters in WorkflowParameterInput.tsx.
  • Handle JSON parsing for default values.
  • Add getDefaultValueForParameterType function in workflowEditorUtils.ts.
  • Update WorkflowParameterYAML to use unknown for default_value.

Generated with ❤️ by ellipsis.dev

…src/'

<!-- ELLIPSIS_HIDDEN -->

| 🚀 | This description was created by 370ad16b5841fa91e23e2a0ac9fa41a2fcf2e057  |
|--------|--------|

feat: add default value support for workflow parameters

### Summary:
Add default value support for workflow parameters with UI updates and JSON parsing.

**Key points**:
- Add default value support for workflow parameters.
- Update UI in `FlowRenderer.tsx` and `WorkflowEditor.tsx`.
- Allow setting/editing default values in `WorkflowParameterAddPanel.tsx` and `WorkflowParameterEditPanel.tsx`.
- Handle JSON parsing for default values.
- Replace `Input` with `AutoResizingTextarea` for string parameters in `WorkflowParameterInput.tsx`.
- Add `Label` for boolean parameters in `WorkflowParameterInput.tsx`.
- Add `getDefaultValueForParameterType` function in `workflowEditorUtils.ts`.
- Update `WorkflowParameterYAML` to use `unknown` for `default_value`.

----
Generated with ❤️ by [ellipsis.dev](https://www.ellipsis.dev)

<!-- ELLIPSIS_HIDDEN -->
@ykeremy ykeremy added the sync label Sep 20, 2024
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to cd11f88 in 39 seconds

More details
  • Looked at 566 lines of code in 10 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts:770
  • Draft comment:
    The getDefaultValueForParameterType function is redundant as a similar function defaultValue exists in WorkflowRunParameters.tsx. Consider consolidating these functions to avoid redundancy.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The comment points out a potential redundancy, which is a valid concern for code quality. However, without seeing WorkflowRunParameters.tsx, I cannot confirm if the functions are indeed redundant. The comment is speculative as it assumes redundancy without strong evidence from the diff itself.
    I might be missing the context of WorkflowRunParameters.tsx, which could confirm the redundancy. However, the rules state to ignore cross-file issues, and the comment is speculative without strong evidence.
    The rules emphasize focusing on the current file and changes. Since the comment is speculative and involves another file, it should be removed.
    Remove the comment as it is speculative and involves cross-file issues, which are not to be considered.
2. skyvern-frontend/src/routes/workflows/WorkflowParameterInput.tsx:60
  • Draft comment:
    The checked variable is unnecessary. The Checkbox component can handle the boolean conversion internally. Simplify by directly passing value.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The checked variable in the WorkflowParameterInput component is unnecessary because the Checkbox component can handle the boolean conversion internally. This can simplify the code.
3. skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts:33
  • Draft comment:
    The default_value property is now optional. Ensure all code handling WorkflowParameterYAML accounts for this to avoid undefined errors.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The default_value property in WorkflowParameterYAML is now optional, which is a good change to accommodate parameters without default values. However, ensure that all parts of the codebase that handle this type are aware of this change to avoid potential undefined errors.

Workflow ID: wflow_YnChGESvhp2fcK2B


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on cd11f88 in 41 seconds

More details
  • Looked at 566 lines of code in 10 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts:770
  • Draft comment:
    Consider adding a default case to handle unexpected parameterType values in getDefaultValueForParameterType.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The getDefaultValueForParameterType function in workflowEditorUtils.ts is not handling the case where the parameterType is not one of the expected values. This could lead to unexpected behavior if an invalid parameterType is passed.
2. skyvern-frontend/src/routes/workflows/editor/FlowRenderer.tsx:76
  • Draft comment:
    Consider directly assigning default_value: parameter.defaultValue instead of using the spread operator for better readability.
  • Reason this comment was not posted:
    Confidence changes required: 30%
    The convertToParametersYAML function in FlowRenderer.tsx is using a spread operator to conditionally add default_value. This is fine, but it could be more readable by directly assigning default_value to parameter.defaultValue without the spread operator.
3. skyvern-frontend/src/routes/workflows/WorkflowParameterInput.tsx:57
  • Draft comment:
    Consider adding validation to ensure the input is a valid number before calling parseInt or parseFloat.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    In WorkflowParameterInput.tsx, the onChange handlers for integer and float types do not handle invalid inputs gracefully. If the input is not a valid number, parseInt and parseFloat will return NaN, which might not be the desired behavior.

Workflow ID: wflow_7J2T3JZDIEopNo9s


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@msalihaltun msalihaltun merged commit e9184bc into main Sep 20, 2024
2 checks passed
@msalihaltun msalihaltun deleted the salih/workflow-parameter-default-value branch September 20, 2024 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants