-
Notifications
You must be signed in to change notification settings - Fork 923
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔄 synced local 'skyvern-frontend/src/' with remote 'skyvern-frontend/…
…src/' <!-- ELLIPSIS_HIDDEN --> > [!IMPORTANT] > Add a new Credentials UI feature with components, routes, and workflow integration for managing passwords and credit cards. > > - **UI Components**: > - Add `CredentialsPage`, `CredentialsList`, `CredentialsModal`, `CredentialItem`, `DeleteCredentialButton`, `PasswordCredentialContent`, `CreditCardCredentialContent` for managing credentials. > - Add `DropdownWithOptions` and `KeyIcon` components. > - **Routing**: > - Add new route `/credentials` with `CredentialsPageLayout` and `CredentialsPage` in `router.tsx`. > - Update `SideNav.tsx` to include a link to the Credentials page. > - **Context and State**: > - Introduce `CloudContext` in `CloudContext.ts` to manage cloud-specific features. > - Implement `useCredentialModalState` for managing credential modal state. > - **API and Types**: > - Define types for credentials in `types.ts` and `api/types.ts`. > - Add functions `isPasswordCredential` and `isCreditCardCredential` in `api/types.ts`. > - **Workflow Integration**: > - Update `FlowRenderer.tsx`, `WorkflowEditor.tsx`, and related panels to support credential parameters. > - Add `CredentialSelector` component for selecting credentials in workflows. > > <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 9276028e5855356f178604ec1ee1dde8ab59a1fd. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN -->
- Loading branch information
1 parent
39ab9c0
commit 1e9ae54
Showing
13 changed files
with
337 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { | ||
Select, | ||
SelectContent, | ||
SelectItem, | ||
SelectTrigger, | ||
SelectValue, | ||
} from "./ui/select"; | ||
|
||
type Item = { | ||
label: string; | ||
value: string; | ||
}; | ||
|
||
type Props = { | ||
options: Item[]; | ||
value: string; | ||
onChange: (selected: string) => void; | ||
placeholder?: string; | ||
className?: string; | ||
}; | ||
|
||
function DropdownWithOptions({ | ||
options, | ||
value, | ||
onChange, | ||
placeholder, | ||
className, | ||
}: Props) { | ||
return ( | ||
<Select | ||
value={value} | ||
onValueChange={(value) => { | ||
onChange(value); | ||
}} | ||
> | ||
<SelectTrigger className={className}> | ||
<SelectValue placeholder={placeholder} /> | ||
</SelectTrigger> | ||
<SelectContent className="max-h-48"> | ||
{options.map((option) => ( | ||
<SelectItem key={option.value} value={option.value}> | ||
{option.label} | ||
</SelectItem> | ||
))} | ||
</SelectContent> | ||
</Select> | ||
); | ||
} | ||
|
||
export { DropdownWithOptions }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
type Props = { | ||
className?: string; | ||
}; | ||
|
||
function KeyIcon({ className }: Props) { | ||
return ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="24" | ||
height="24" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
className={className} | ||
> | ||
<path | ||
d="M17 8.99994C17 8.48812 16.8047 7.9763 16.4142 7.58579C16.0237 7.19526 15.5118 7 15 7M15 15C18.3137 15 21 12.3137 21 9C21 5.68629 18.3137 3 15 3C11.6863 3 9 5.68629 9 9C9 9.27368 9.01832 9.54308 9.05381 9.80704C9.11218 10.2412 9.14136 10.4583 9.12172 10.5956C9.10125 10.7387 9.0752 10.8157 9.00469 10.9419C8.937 11.063 8.81771 11.1823 8.57913 11.4209L3.46863 16.5314C3.29568 16.7043 3.2092 16.7908 3.14736 16.8917C3.09253 16.9812 3.05213 17.0787 3.02763 17.1808C3 17.2959 3 17.4182 3 17.6627V19.4C3 19.9601 3 20.2401 3.10899 20.454C3.20487 20.6422 3.35785 20.7951 3.54601 20.891C3.75992 21 4.03995 21 4.6 21H7V19H9V17H11L12.5791 15.4209C12.8177 15.1823 12.937 15.063 13.0581 14.9953C13.1843 14.9248 13.2613 14.8987 13.4044 14.8783C13.5417 14.8586 13.7588 14.8878 14.193 14.9462C14.4569 14.9817 14.7263 15 15 15Z" | ||
stroke="currentColor" | ||
strokeWidth="2" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
</svg> | ||
); | ||
} | ||
|
||
export { KeyIcon }; |
66 changes: 66 additions & 0 deletions
66
skyvern-frontend/src/routes/workflows/components/CredentialSelector.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { getClient } from "@/api/AxiosClient"; | ||
import { CredentialApiResponse } from "@/api/types"; | ||
import { | ||
Select, | ||
SelectContent, | ||
SelectItem, | ||
SelectTrigger, | ||
SelectValue, | ||
} from "@/components/ui/select"; | ||
import { Skeleton } from "@/components/ui/skeleton"; | ||
import { useCredentialGetter } from "@/hooks/useCredentialGetter"; | ||
import { useQuery } from "@tanstack/react-query"; | ||
|
||
type Props = { | ||
value: string; | ||
onChange: (value: string) => void; | ||
}; | ||
|
||
function CredentialSelector({ value, onChange }: Props) { | ||
const credentialGetter = useCredentialGetter(); | ||
|
||
const { data: credentials, isFetching } = useQuery< | ||
Array<CredentialApiResponse> | ||
>({ | ||
queryKey: ["credentials"], | ||
queryFn: async () => { | ||
const client = await getClient(credentialGetter); | ||
return await client.get("/credentials").then((res) => res.data); | ||
}, | ||
}); | ||
|
||
if (isFetching) { | ||
return <Skeleton className="h-10 w-full" />; | ||
} | ||
|
||
if (!credentials) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Select value={value} onValueChange={onChange}> | ||
<SelectTrigger> | ||
<SelectValue placeholder="Select a credential" /> | ||
</SelectTrigger> | ||
<SelectContent> | ||
{credentials.map((credential) => ( | ||
<SelectItem | ||
key={credential.credential_id} | ||
value={credential.credential_id} | ||
> | ||
<div className="space-y-2"> | ||
<p className="text-sm font-medium">{credential.name}</p> | ||
<p className="text-xs text-slate-400"> | ||
{credential.credential_type === "password" | ||
? "Password" | ||
: "Credit Card"} | ||
</p> | ||
</div> | ||
</SelectItem> | ||
))} | ||
</SelectContent> | ||
</Select> | ||
); | ||
} | ||
|
||
export { CredentialSelector }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.