Skip to content

Commit

Permalink
[Dashboard] Feature - Added Workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
SUN committed Jan 4, 2023
1 parent 3e4c7b2 commit f39f729
Show file tree
Hide file tree
Showing 7 changed files with 309 additions and 3,315 deletions.
5 changes: 4 additions & 1 deletion eventmesh-dashboard/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,7 @@ yarn-error.log*
.vercel

# VS code settings
.vscode
.vscode

# Yarn lock
yarn.lock
1 change: 1 addition & 0 deletions eventmesh-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@emotion/react": "^11.9.0",
"@emotion/styled": "^11.8.1",
"@fontsource/inter": "^4.5.10",
"@monaco-editor/react": "^4.4.6",
"axios": "^0.27.2",
"cloudevents": "^6.0.2",
"framer-motion": "^6.3.6",
Expand Down
93 changes: 93 additions & 0 deletions eventmesh-dashboard/pages/workflows/create.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import React, { useRef } from 'react';
import Head from 'next/head';
import type { NextPage } from 'next';

import {
Stack,
Breadcrumb,
BreadcrumbItem,
BreadcrumbLink,
Grid,
GridItem,
FormControl,
FormLabel,
Input,
Button,
Textarea,
} from '@chakra-ui/react';

import Editor from '@monaco-editor/react';
import { useRouter } from 'next/router';

const Workflows: NextPage = () => {
const editorRef = useRef(null);
const router = useRouter();

const handleEditorDidMount = (editor: any) => {
// here is the editor instance
// you can store it in `useRef` for further usage
console.log('hhh');
editorRef.current = editor;
};

return (
<>
<Head>
<title>Create Workflow | Apache EventMesh Dashboard</title>
</Head>
<Breadcrumb mb={2}>
<BreadcrumbItem>
<BreadcrumbLink href="/workflows">Workflows</BreadcrumbLink>
</BreadcrumbItem>

<BreadcrumbItem>
<BreadcrumbLink>Create</BreadcrumbLink>
</BreadcrumbItem>
</Breadcrumb>
<Grid
w="full"
h="calc(100vh - 56px)"
bg="white"
borderWidth="1px"
borderRadius="md"
p="6"
templateColumns="320px 1fr"
gap={6}
>
<GridItem h="full" display="flex">
<Stack w="full" direction="column">
<FormControl isRequired>
<FormLabel>Workflow name</FormLabel>
<Input placeholder="Please input" />
</FormControl>

<FormControl mt={5}>
<FormLabel>Description</FormLabel>
<Textarea minH={240} placeholder="Optional" />
</FormControl>
<Stack
direction="row"
spacing={2}
h="full"
pb="2"
alignItems="flex-end"
>
<Button colorScheme="blue">Save</Button>
<Button variant="outline" onClick={() => router.push('/workflows')}>Cancel</Button>
</Stack>
</Stack>
</GridItem>
<GridItem h="full" bgColor="blackAlpha.50">
<Editor
height="100%"
defaultLanguage="yaml"
defaultValue="# Compose your workflow here"
onMount={handleEditorDidMount}
theme="vs-dark"
/>
</GridItem>
</Grid>
</>
);
};
export default Workflows;
93 changes: 93 additions & 0 deletions eventmesh-dashboard/pages/workflows/details.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import React, { useRef } from 'react';
import Head from 'next/head';
import type { NextPage } from 'next';

import {
Stack,
Breadcrumb,
BreadcrumbItem,
BreadcrumbLink,
Grid,
GridItem,
FormControl,
FormLabel,
Input,
Button,
Textarea,
} from '@chakra-ui/react';

import Editor from '@monaco-editor/react';
import { useRouter } from 'next/router';

const Workflows: NextPage = () => {
const router = useRouter();
const editorRef = useRef(null);

const handleEditorDidMount = (editor: any) => {
// here is the editor instance
// you can store it in `useRef` for further usage
console.log('hhh');
editorRef.current = editor;
};

return (
<>
<Head>
<title>Create Workflow | Apache EventMesh Dashboard</title>
</Head>
<Breadcrumb mb={2}>
<BreadcrumbItem>
<BreadcrumbLink href="/workflows">Workflows</BreadcrumbLink>
</BreadcrumbItem>

<BreadcrumbItem>
<BreadcrumbLink>Create</BreadcrumbLink>
</BreadcrumbItem>
</Breadcrumb>
<Grid
w="full"
h="calc(100vh - 56px)"
bg="white"
borderWidth="1px"
borderRadius="md"
p="6"
templateColumns="320px 1fr"
gap={6}
>
<GridItem h="full" display="flex">
<Stack w="full" direction="column">
<FormControl isRequired>
<FormLabel>Workflow name</FormLabel>
<Input placeholder="Please input" />
</FormControl>

<FormControl mt={5}>
<FormLabel>Description</FormLabel>
<Textarea minH={240} placeholder="Optional" />
</FormControl>
<Stack
direction="row"
spacing={2}
h="full"
pb="2"
alignItems="flex-end"
>
<Button colorScheme="blue">Save</Button>
<Button variant="outline">Cancel</Button>
</Stack>
</Stack>
</GridItem>
<GridItem h="full" bgColor="blackAlpha.50">
<Editor
height="100%"
defaultLanguage="yaml"
defaultValue="# Compose your workflow here"
onMount={handleEditorDidMount}
theme="vs-dark"
/>
</GridItem>
</Grid>
</>
);
};
export default Workflows;
3 changes: 3 additions & 0 deletions eventmesh-dashboard/pages/workflows/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Workflow from './workflows';

export default Workflow;
115 changes: 115 additions & 0 deletions eventmesh-dashboard/pages/workflows/workflows.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import React from 'react';
import Head from 'next/head';
import type { NextPage } from 'next';
import { useRouter } from 'next/router';

import {
Divider,
Button,
Flex,
Input,
Stack,
Select,
Table,
Thead,
Tbody,
Tr,
Th,
Td,
TableContainer,
} from '@chakra-ui/react';

const Workflows: NextPage = () => {
const router = useRouter();

return (
<>
<Head>
<title>Workflows | Apache EventMesh Dashboard</title>
</Head>
<Flex
w="full"
h="full"
bg="white"
flexDirection="column"
borderWidth="1px"
borderRadius="md"
overflow="hidden"
p="6"
>
<Flex w="full" justifyContent="space-between" mt="2" mb="2">
<Button
size="md"
backgroundColor="#2a62ad"
color="white"
_hover={{ bg: '#dce5fe', color: '#2a62ad' }}
onClick={() => router.push('/workflows/create')}
>
Create Wokrflow
</Button>
<Stack direction="row" spacing="2">
<Input size="md" placeholder="Workflow name" />
<Select size="md" placeholder="Status">
<option value="option1">Option 1</option>
<option value="option2">Option 2</option>
<option value="option3">Option 3</option>
<option value="option3">Option 3</option>
</Select>
<Button size="md" w="60" colorScheme="blue" variant="outline">
Refresh
</Button>
</Stack>
</Flex>
<Divider mt="15" mb="15" orientation="horizontal" />
<TableContainer>
<Table variant="simple" size="sm">
<Thead>
<Tr>
<Th>Name</Th>
<Th>Created At</Th>
<Th>Status</Th>
<Th>Logs</Th>
<Th isNumeric>Total Instance</Th>
<Th isNumeric>Running</Th>
<Th isNumeric>Failed</Th>
<Th isNumeric>Timeout</Th>
<Th isNumeric>Aborted</Th>
<Th>Actions</Th>
</Tr>
</Thead>
<Tbody>
<Tr>
<Td>
<Button size="sm" colorScheme="blue" variant="ghost">
HelloWorld
</Button>
</Td>
<Td>2022-12-1 12:10:12</Td>
<Td>Active</Td>
<Td>On</Td>
<Td isNumeric>3</Td>
<Td isNumeric>1</Td>
<Td isNumeric>1</Td>
<Td isNumeric>0</Td>
<Td isNumeric>1</Td>
<Td>
<Button size="sm" colorScheme="blue" variant="ghost">
Execute
</Button>
<Button size="sm" colorScheme="blue" variant="ghost">
Edit
</Button>
<Button size="sm" colorScheme="blue" variant="ghost">
Delete
</Button>
</Td>
</Tr>
</Tbody>
</Table>
</TableContainer>
</Flex>
</>
);
};

export default Workflows;
Loading

0 comments on commit f39f729

Please sign in to comment.