-
Notifications
You must be signed in to change notification settings - Fork 945
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
Import workflow #986
Import workflow #986
Conversation
…src/' <!-- ELLIPSIS_HIDDEN --> > [!IMPORTANT] > Add `ImportWorkflowButton` to import workflows from YAML/JSON files in the `Workflows` component. > > - **Feature Addition**: > - Adds `ImportWorkflowButton` component in `ImportWorkflowButton.tsx` to import workflows from YAML or JSON files. > - Integrates `ImportWorkflowButton` into `Workflows.tsx`, allowing users to import workflows directly from the UI. > - **Functionality**: > - Uses `useMutation` from `@tanstack/react-query` to handle file upload and server interaction. > - Converts JSON files to YAML before sending to the server. > - On success, navigates to the workflow edit page; on error, displays a toast notification. > - **UI Changes**: > - Adds tooltip to `ImportWorkflowButton` explaining its functionality. > - Adjusts layout in `Workflows.tsx` to accommodate the new import button. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=Skyvern-AI%2Fskyvern-cloud&utm_source=github&utm_medium=referral)<sup> for 2dde8b1c11929940899737561b50d8f21daa0696. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN -->
There was a problem hiding this 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 cf2fc41 in 16 seconds
More details
- Looked at
169
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
3
drafted comments based on config settings.
1. skyvern-frontend/src/routes/workflows/ImportWorkflowButton.tsx:19
- Draft comment:
Consider renamingisJsonString
toisValidJson
for clarity. Also, directly return the result of the try-catch block for better readability.
function isValidJson(str: string): boolean {
try {
JSON.parse(str);
return true;
} catch (e) {
return false;
}
}
- Reason this comment was not posted:
Confidence changes required:50%
The function isJsonString is used to check if a string is a valid JSON. However, it can be improved for better readability and performance.
2. skyvern-frontend/src/routes/workflows/ImportWorkflowButton.tsx:84
- Draft comment:
UseisLoading
instead ofisPending
to check the mutation state.
{createWorkflowFromYamlMutation.isLoading ? (
- Reason this comment was not posted:
Confidence changes required:50%
ThecreateWorkflowFromYamlMutation
usesisPending
to check the mutation state, butuseMutation
providesisLoading
for this purpose.
3. skyvern-frontend/src/routes/workflows/Workflows.tsx:190
- Draft comment:
UseisLoading
instead ofisPending
to check the mutation state.
{createNewWorkflowMutation.isLoading ? (
- Reason this comment was not posted:
Confidence changes required:50%
ThecreateNewWorkflowMutation
usesisPending
to check the mutation state, butuseMutation
providesisLoading
for this purpose.
Workflow ID: wflow_gUf6gA8i5avuc8l4
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Changes requested. Reviewed everything up to cf2fc41 in 35 seconds
More details
- Looked at
169
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
2
drafted comments based on config settings.
1. skyvern-frontend/src/routes/workflows/ImportWorkflowButton.tsx:19
- Draft comment:
Consider renamingisJsonString
toisValidJson
for better readability. Additionally, you can simplify the function by returning the result of the try-catch directly:
function isValidJson(str: string): boolean {
try {
JSON.parse(str);
return true;
} catch (e) {
return false;
}
}
- Reason this comment was not posted:
Confidence changes required:50%
The function isJsonString is used to check if a string is a valid JSON. However, it can be improved for better readability and performance.
2. skyvern-frontend/src/routes/workflows/Workflows.tsx:185
- Draft comment:
createNewWorkflowMutation.isPending
should becreateNewWorkflowMutation.isLoading
for consistency withuseMutation
API. This also applies to line 191. - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_QCE9BhYFhJ6JFoUc
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
}} | ||
/> | ||
<div className="flex h-full cursor-pointer items-center gap-2 rounded-md bg-secondary px-4 py-2 font-bold text-secondary-foreground hover:bg-secondary/90"> | ||
{createWorkflowFromYamlMutation.isPending ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createWorkflowFromYamlMutation.isPending
should be createWorkflowFromYamlMutation.isLoading
for consistency with useMutation
API.
Important
Adds
ImportWorkflowButton
to import workflows from YAML/JSON files in theWorkflows
component, with server interaction and UI adjustments.ImportWorkflowButton
component inImportWorkflowButton.tsx
to import workflows from YAML or JSON files.ImportWorkflowButton
intoWorkflows.tsx
, allowing users to import workflows directly from the UI.useMutation
from@tanstack/react-query
to handle file upload and server interaction.ImportWorkflowButton
explaining its functionality.Workflows.tsx
to accommodate the new import button.This description was created by
for cf2fc41. It will automatically update as commits are pushed.