From 4a08f9c632c8c32f8f48ffdfddc5afcf4e2cd152 Mon Sep 17 00:00:00 2001 From: dxyinme Date: Tue, 25 Feb 2025 20:35:06 +0800 Subject: [PATCH 1/4] tasks finished --- src/routes/routesConfig.tsx | 20 +++++++++++++++++ src/views/Bags/Bags.tsx | 3 ++- src/views/Bags/SingleBag.tsx | 33 ++++++++++++++++++++++++---- src/views/Bags/SingleBagModels.d.ts | 6 +++++ src/views/Nodes/Nodes.tsx | 19 ++++++++++------ src/views/Tasks/SingleTask.tsx | 34 +++++++++++++++++++++++++++++ src/views/Tasks/Tasks.tsx | 32 +++++++++++++++++++++++++++ src/views/commons/notfound.tsx | 16 ++++++++++++++ 8 files changed, 151 insertions(+), 12 deletions(-) create mode 100644 src/views/Bags/SingleBagModels.d.ts create mode 100644 src/views/Tasks/SingleTask.tsx create mode 100644 src/views/Tasks/Tasks.tsx create mode 100644 src/views/commons/notfound.tsx diff --git a/src/routes/routesConfig.tsx b/src/routes/routesConfig.tsx index 90b3f7e..a507d67 100644 --- a/src/routes/routesConfig.tsx +++ b/src/routes/routesConfig.tsx @@ -4,6 +4,8 @@ const Home = lazy(() => import('../views/Home/Home')); const Bags = lazy(() => import('../views/Bags/Bags')); const SingleBag = lazy(() => import('../views/Bags/SingleBag')); const Nodes = lazy(() => import('../views/Nodes/Nodes')); +const SingleTask = lazy(() => import('../views/Tasks/SingleTask')); +const Tasks = lazy(() => import('../views/Tasks/Tasks')); const LukaRoutes: IRouteType.IRoute[] = [ { @@ -33,6 +35,24 @@ const LukaRoutes: IRouteType.IRoute[] = [ }, children: [] }, + { + name: 'single task', + path: '/bags/:bagDisplayName/tasks/:taskDisplayName', + element: SingleTask, + meta: { + title: 'single task', + }, + children: [] + }, + { + name: 'tasks', + path: '/bags/:bagDisplayName/tasks', + element: Tasks, + meta: { + title: 'tasks', + }, + children: [] + }, { name: 'nodes', path: '/nodes', diff --git a/src/views/Bags/Bags.tsx b/src/views/Bags/Bags.tsx index ae5da5d..6cf4f61 100644 --- a/src/views/Bags/Bags.tsx +++ b/src/views/Bags/Bags.tsx @@ -24,7 +24,8 @@ function CallListBagsAPI(): BagsViewsProp.BagType[] { } const onSearch: SearchProps['onSearch'] = (value, _e, info) => { - JumpTo('/bags/' + value.trim()) + value = value.trim() + JumpTo('/bags/' + value) } function ListBags(props: BagsViewsProp.HiddenProps) { diff --git a/src/views/Bags/SingleBag.tsx b/src/views/Bags/SingleBag.tsx index 2a9efac..3dd2128 100644 --- a/src/views/Bags/SingleBag.tsx +++ b/src/views/Bags/SingleBag.tsx @@ -1,13 +1,38 @@ -import { Flex, Layout } from "antd"; +import { Flex, Layout, Card, Space } from "antd"; import React from "react"; import LukaFooter from "../commons/footer"; import { LukaHeaderStyle } from "../css/commoncss"; import { useParams } from "react-router-dom"; import LukaBreadcrumb from "../commons/Breadcrumb"; +import NotFound from "../commons/notfound"; const { Content, Header } = Layout; + +function CheckIfBagExists(value: string): boolean { + if (value.localeCompare("existbag") === 0) { + return true + } + return false +} + +function BagInfo(bagInfo: SingleBagViewProp.BagInfoProps) { + return ( + + +

Create Time: {bagInfo.CreateTime.toString()}

+
+
+ ) +} + function SingleBag() { const { bagDisplayName } = useParams() + + if (!CheckIfBagExists(bagDisplayName!)) { + return ( + + ) + } return (
Hello Luka
@@ -17,9 +42,9 @@ function SingleBag() {
{bagDisplayName}
]}> -
- Single Bag -
+
diff --git a/src/views/Bags/SingleBagModels.d.ts b/src/views/Bags/SingleBagModels.d.ts new file mode 100644 index 0000000..746ca32 --- /dev/null +++ b/src/views/Bags/SingleBagModels.d.ts @@ -0,0 +1,6 @@ +declare namespace SingleBagViewProp { + interface BagInfoProps { + Name: string; + CreateTime: Date; + } +} \ No newline at end of file diff --git a/src/views/Nodes/Nodes.tsx b/src/views/Nodes/Nodes.tsx index 245b72f..5180e71 100644 --- a/src/views/Nodes/Nodes.tsx +++ b/src/views/Nodes/Nodes.tsx @@ -5,22 +5,23 @@ import LukaBreadcrumb from "../commons/Breadcrumb"; const { Header, Content } = Layout; interface NodeContentProps { - NodeId: string; + Id: string; + Name?: string; } -function NodeContent(props: NodeContentProps) { +function NodeContent(nodeContent: NodeContentProps) { return (
- {props.NodeId} + {nodeContent.Id}
) } -function Node(props: NodeContentProps) { +function Node(nodeContent: NodeContentProps) { return ( - - + + ) } @@ -35,7 +36,11 @@ function Nodes() { ]} /> - + + + + + diff --git a/src/views/Tasks/SingleTask.tsx b/src/views/Tasks/SingleTask.tsx new file mode 100644 index 0000000..419e3de --- /dev/null +++ b/src/views/Tasks/SingleTask.tsx @@ -0,0 +1,34 @@ +import { Flex, Layout } from "antd"; +import React from "react"; +import LukaFooter from "../commons/footer"; +import { LukaHeaderStyle } from "../css/commoncss"; +import { useParams } from "react-router-dom"; +import LukaBreadcrumb from "../commons/Breadcrumb"; +const { Content, Header } = Layout; + +function SingleTask() { + const { bagDisplayName, taskDisplayName } = useParams() + const bagLink = `/bags/${bagDisplayName}` + const tasksLink = bagLink + `/tasks` + return ( + +
Hello Luka
+ Home, + Bags, + {bagDisplayName}, + Tasks, +
{taskDisplayName}
, + ] + }>
+ +
+ Single Task +
+
+ +
+ ) +}; + +export default SingleTask; \ No newline at end of file diff --git a/src/views/Tasks/Tasks.tsx b/src/views/Tasks/Tasks.tsx new file mode 100644 index 0000000..0592b19 --- /dev/null +++ b/src/views/Tasks/Tasks.tsx @@ -0,0 +1,32 @@ +import { Flex, Layout } from "antd"; +import React from "react"; +import LukaFooter from "../commons/footer"; +import { LukaHeaderStyle } from "../css/commoncss"; +import { useParams } from "react-router-dom"; +import LukaBreadcrumb from "../commons/Breadcrumb"; +const { Content, Header } = Layout; + +function Tasks() { + const { bagDisplayName } = useParams() + const bagLink = `/bags/${bagDisplayName}` + return ( + +
Hello Luka
+ Home, + Bags, + {bagDisplayName}, +
Tasks
+ ] + }>
+ +
+ Tasks +
+
+ +
+ ) +}; + +export default Tasks; \ No newline at end of file diff --git a/src/views/commons/notfound.tsx b/src/views/commons/notfound.tsx new file mode 100644 index 0000000..8f6e7cc --- /dev/null +++ b/src/views/commons/notfound.tsx @@ -0,0 +1,16 @@ +import { Button, Layout } from "antd"; +import React from "react"; +const { Content } = Layout; + +const NotFound: React.FC = () => { + return ( + + Not Found + + + ) +} + +export default NotFound; \ No newline at end of file From 4dada3198a33668da3f6e365a08a2f5e0e285c0f Mon Sep 17 00:00:00 2001 From: dxyinme Date: Tue, 25 Feb 2025 21:30:46 +0800 Subject: [PATCH 2/4] move react-script to vite --- .gitignore | 1 + public/favicon.ico => favicon.ico | Bin public/index.html => index.html | 11 +- public/logo192.png => logo192.png | Bin public/logo512.png => logo512.png | Bin public/manifest.json => manifest.json | 2 +- package.json | 20 +- public/robots.txt => robots.txt | 0 src/react-app-env.d.ts | 1 - src/views/Home/Home.test.tsx | 3 +- src/views/commons/Breadcrumb.test.tsx | 3 +- tsconfig.json | 7 +- vite-env.d.ts | 2 + vite.config.ts | 15 + vitest.config.ts | 11 + yarn.lock | 9470 ++++--------------------- 16 files changed, 1561 insertions(+), 7985 deletions(-) rename public/favicon.ico => favicon.ico (100%) rename public/index.html => index.html (81%) rename public/logo192.png => logo192.png (100%) rename public/logo512.png => logo512.png (100%) rename public/manifest.json => manifest.json (99%) rename public/robots.txt => robots.txt (100%) delete mode 100644 src/react-app-env.d.ts create mode 100644 vite-env.d.ts create mode 100644 vite.config.ts create mode 100644 vitest.config.ts diff --git a/.gitignore b/.gitignore index 4d29575..800f3a8 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ # production /build +/dist # misc .DS_Store diff --git a/public/favicon.ico b/favicon.ico similarity index 100% rename from public/favicon.ico rename to favicon.ico diff --git a/public/index.html b/index.html similarity index 81% rename from public/index.html rename to index.html index c73c5f0..d9f6dbd 100644 --- a/public/index.html +++ b/index.html @@ -3,22 +3,22 @@ - + - + - + @@ -28,6 +28,7 @@
+