Skip to content

Commit 789a368

Browse files
Merge pull request #4154 from Agenta-AI/feat/open-playground-from-application-table
enhance: open `playground` from `prompt` table
2 parents a837491 + c820b37 commit 789a368

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

web/oss/src/components/pages/app-management/components/ApplicationManagementSection.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {useSetAtom, useAtomValue} from "jotai"
77
import {useRouter} from "next/router"
88

99
import {openDeleteAppModalAtom} from "@/oss/components/pages/app-management/modals/DeleteAppModal/store/deleteAppModalStore"
10+
import {usePlaygroundNavigation} from "@/oss/hooks/usePlaygroundNavigation"
1011
import useURL from "@/oss/hooks/useURL"
1112

1213
import {
@@ -35,6 +36,7 @@ const ApplicationManagementSection = ({
3536
}: ApplicationManagementSectionProps) => {
3637
const router = useRouter()
3738
const {baseAppURL} = useURL()
39+
const {goToPlayground} = usePlaygroundNavigation()
3840
const openDeleteAppModal = useSetAtom(openDeleteAppModalAtom)
3941
const filteredAppCount = useAtomValue(appWorkflowCountAtom)
4042
const totalAppCount = useAtomValue(appWorkflowTotalCountAtom)
@@ -51,14 +53,17 @@ const ApplicationManagementSection = ({
5153
onOpen: (record) => {
5254
router.push(`${baseAppURL}/${record.workflowId}/overview`)
5355
},
56+
onOpenPlayground: (record) => {
57+
goToPlayground(undefined, {appId: record.workflowId})
58+
},
5459
onDelete: (record) => {
5560
openDeleteAppModal({
5661
id: record.workflowId,
5762
name: record.name,
5863
})
5964
},
6065
}),
61-
[router, baseAppURL, openDeleteAppModal],
66+
[router, baseAppURL, goToPlayground, openDeleteAppModal],
6267
)
6368

6469
const table = useTableManager<AppWorkflowRow>({

web/oss/src/components/pages/app-management/components/appWorkflowColumns.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {workflowAppTypeAtomFamily} from "@agenta/entities/workflow"
22
import {createStandardColumns} from "@agenta/ui/table"
3-
import {Note, Trash} from "@phosphor-icons/react"
3+
import {Note, Rocket, Trash} from "@phosphor-icons/react"
44
import {Tag} from "antd"
55
import {useAtomValue} from "jotai"
66
import {getDefaultStore} from "jotai/vanilla"
@@ -42,6 +42,7 @@ export const AppNameCell = ({workflowId, name}: {workflowId: string; name: strin
4242

4343
export interface AppWorkflowColumnActions {
4444
onOpen: (record: AppWorkflowRow) => void
45+
onOpenPlayground: (record: AppWorkflowRow) => void
4546
onDelete: (record: AppWorkflowRow) => void
4647
}
4748

@@ -75,14 +76,20 @@ export function createAppWorkflowColumns(actions: AppWorkflowColumnActions) {
7576
items: [
7677
{
7778
key: "open_app",
78-
label: "Open",
79+
label: "Open overview",
7980
icon: <Note size={16} />,
8081
onClick: (record) => actions.onOpen(record),
8182
},
83+
{
84+
key: "open_playground",
85+
label: "Open in playground",
86+
icon: <Rocket size={16} />,
87+
onClick: (record) => actions.onOpenPlayground(record),
88+
},
8289
{type: "divider"},
8390
{
8491
key: "delete_app",
85-
label: "Delete",
92+
label: "Archive",
8693
icon: <Trash size={16} />,
8794
danger: true,
8895
onClick: (record) => actions.onDelete(record),

web/oss/src/components/pages/app-management/modals/DeleteAppModal/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const DeleteAppModal = (props = {}) => {
6060
{...props}
6161
open={open}
6262
>
63-
<p>Are you sure you want to delete {appDetails?.name}?</p>
63+
<p>Are you sure you want to archive {appDetails?.name}?</p>
6464
</Modal>
6565
)
6666
}

0 commit comments

Comments
 (0)