From 09304beb0d268d6bb35023336a0946fb4c203504 Mon Sep 17 00:00:00 2001 From: Kaosiso Ezealigo Date: Tue, 26 Nov 2024 14:11:42 +0100 Subject: [PATCH 01/34] fix(frontend): changed sidebar menu title to app management --- agenta-web/src/components/Sidebar/config.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agenta-web/src/components/Sidebar/config.tsx b/agenta-web/src/components/Sidebar/config.tsx index b741321b96..f6b4ac3dd3 100644 --- a/agenta-web/src/components/Sidebar/config.tsx +++ b/agenta-web/src/components/Sidebar/config.tsx @@ -54,8 +54,8 @@ export const useSidebarConfig = () => { const sidebarConfig: SidebarConfig[] = [ { - key: "application-link", - title: "Applications", + key: "app-management-link", + title: "App Management", tooltip: "Create new applications or switch between your existing projects.", link: "/apps", icon: , From 95002027d164a96b8e45957c98985af342ad1292 Mon Sep 17 00:00:00 2001 From: Kaosiso Ezealigo Date: Wed, 27 Nov 2024 01:54:30 +0100 Subject: [PATCH 02/34] feat(frontend): implemented new app management view --- agenta-web/src/components/Layout/Layout.tsx | 13 +- .../app-management/components/AppCard.tsx | 166 +++++ .../app-management/components/AppTable.tsx | 122 ++++ .../components/AppTemplateCard.tsx | 128 ++++ .../components/pages/app-management/index.tsx | 631 ++++++++++++++++++ .../modals/AddAppFromTemplateModal.tsx | 173 +++++ .../modals/CreateAppStatusModal.tsx | 233 +++++++ .../modals/CustomAppCreationLoader.tsx | 245 +++++++ .../app-management/modals/DeleteAppModal.tsx | 23 + .../app-management/modals/EditAppModal.tsx | 95 +++ .../app-management/modals/MaxAppModal.tsx | 87 +++ .../modals/WriteOwnAppModal.tsx | 150 +++++ agenta-web/src/media/rag-demo-app.png | Bin 0 -> 8300 bytes agenta-web/src/pages/apps/index.tsx | 4 +- 14 files changed, 2066 insertions(+), 4 deletions(-) create mode 100644 agenta-web/src/components/pages/app-management/components/AppCard.tsx create mode 100644 agenta-web/src/components/pages/app-management/components/AppTable.tsx create mode 100644 agenta-web/src/components/pages/app-management/components/AppTemplateCard.tsx create mode 100644 agenta-web/src/components/pages/app-management/index.tsx create mode 100644 agenta-web/src/components/pages/app-management/modals/AddAppFromTemplateModal.tsx create mode 100644 agenta-web/src/components/pages/app-management/modals/CreateAppStatusModal.tsx create mode 100644 agenta-web/src/components/pages/app-management/modals/CustomAppCreationLoader.tsx create mode 100644 agenta-web/src/components/pages/app-management/modals/DeleteAppModal.tsx create mode 100644 agenta-web/src/components/pages/app-management/modals/EditAppModal.tsx create mode 100644 agenta-web/src/components/pages/app-management/modals/MaxAppModal.tsx create mode 100644 agenta-web/src/components/pages/app-management/modals/WriteOwnAppModal.tsx create mode 100644 agenta-web/src/media/rag-demo-app.png diff --git a/agenta-web/src/components/Layout/Layout.tsx b/agenta-web/src/components/Layout/Layout.tsx index 29691ee915..3ab63d20e8 100644 --- a/agenta-web/src/components/Layout/Layout.tsx +++ b/agenta-web/src/components/Layout/Layout.tsx @@ -1,5 +1,5 @@ import React, {useEffect, useMemo} from "react" -import {Breadcrumb, Layout, Modal, Space, Typography, theme} from "antd" +import {Breadcrumb, ConfigProvider, Layout, Modal, Space, Typography, theme} from "antd" import Sidebar from "../Sidebar/Sidebar" import {GithubFilled, LinkedinFilled, TwitterOutlined} from "@ant-design/icons" import Link from "next/link" @@ -198,7 +198,16 @@ const App: React.FC = ({children}) => { - {children} + + {children} + {contextHolder} diff --git a/agenta-web/src/components/pages/app-management/components/AppCard.tsx b/agenta-web/src/components/pages/app-management/components/AppCard.tsx new file mode 100644 index 0000000000..0ede9dd495 --- /dev/null +++ b/agenta-web/src/components/pages/app-management/components/AppCard.tsx @@ -0,0 +1,166 @@ +import {Card, Dropdown, Button, Typography, Tag} from "antd" +import {MoreOutlined} from "@ant-design/icons" +import {deleteApp} from "@/services/app-selector/api" +import {useState} from "react" +import {createUseStyles} from "react-jss" +import {JSSTheme, ListAppsItem} from "@/lib/Types" +import {useAppsData} from "@/contexts/app.context" +import {Note, PencilLine, Trash} from "@phosphor-icons/react" +import {useRouter} from "next/router" +import {formatDay} from "@/lib/helpers/dateTimeHelper" +import DeleteAppModal from "../modals/DeleteAppModal" +import EditAppModal from "../modals/EditAppModal" + +const {Text} = Typography + +const useStyles = createUseStyles((theme: JSSTheme) => ({ + card: { + display: "flex", + flexDirection: "column", + transition: "all 0.025s ease-in", + cursor: "pointer", + boxShadow: theme.boxShadowTertiary, + "& > .ant-card-head": { + minHeight: 0, + padding: `${theme.paddingXS}px ${theme.paddingSM}px`, + "& .ant-card-head-title": { + fontSize: theme.fontSizeLG, + fontWeight: theme.fontWeightMedium, + }, + }, + "& > .ant-card-body": { + padding: theme.paddingSM, + }, + "&:hover": { + boxShadow: theme.boxShadow, + }, + }, + app_card_link: { + display: "flex", + flexDirection: "column", + gap: "8px", + "& > div": { + display: "flex", + alignItems: "center", + justifyContent: "space-between", + textDecoration: "none", + color: theme.colorText, + }, + "& .ant-typography": { + fontSize: `${theme.fontSize}px !important`, + }, + }, +})) + +const AppCard: React.FC<{ + app: ListAppsItem +}> = ({app}) => { + const [visibleDelete, setVisibleDelete] = useState(false) + const [confirmLoading, setConfirmLoading] = useState(false) + const {mutate} = useAppsData() + const router = useRouter() + const [isEditAppModalOpen, setIsEditAppModalOpen] = useState(false) + + const handleDeleteOk = async () => { + setConfirmLoading(true) + try { + await deleteApp(app.app_id) + mutate() + } catch (error) { + console.error(error) + } finally { + // remove variant tabs position index from LS + localStorage.removeItem(`tabIndex_${app.app_id}`) + setVisibleDelete(false) + setConfirmLoading(false) + } + } + const handleDeleteCancel = () => { + setVisibleDelete(false) + } + + const classes = useStyles() + + return ( + <> + router.push(`/apps/${app.app_id}/overview`)} + extra={ + , + onClick: (e: any) => { + e.domEvent.stopPropagation() + router.push(`/apps/${app.app_id}/overview`) + }, + }, + {type: "divider"}, + { + key: "rename_app", + label: "Rename", + icon: , + onClick: (e: any) => { + e.domEvent.stopPropagation() + setIsEditAppModalOpen(true) + }, + }, + { + key: "delete_app", + label: "Delete", + icon: , + danger: true, + onClick: (e: any) => { + e.domEvent.stopPropagation() + setVisibleDelete(true) + }, + }, + ], + }} + > +