Skip to content

Commit

Permalink
1. adjust the navigation menu
Browse files Browse the repository at this point in the history
2. optimized the layout
  • Loading branch information
SUN committed May 27, 2024
1 parent 6a26862 commit 4d2b285
Show file tree
Hide file tree
Showing 38 changed files with 609 additions and 290 deletions.
22 changes: 3 additions & 19 deletions eventmesh-dashboard-view/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,16 @@ import React from 'react'
import { createTheme, ThemeProvider, CssBaseline } from '@mui/material'
import AppRoutes from './routes/Routes'
import GlobalStyles from '@mui/material/GlobalStyles'
import { AppBackgroundColor, AppThemeConfig } from './app.const'

const inputGlobalStyles = (
<GlobalStyles styles={{ backgroundColor: '#f9fafb' }} />
)

function App() {
const theme = React.useMemo(
() =>
createTheme({
palette: {
primary: {
main: '#43497a'
},
background: {}
},
typography: {
fontSize: 12
}
}),
[]
) // [prefersDarkMode]
const theme = React.useMemo(() => createTheme(AppThemeConfig), []) // [prefersDarkMode]

return (
<ThemeProvider theme={theme}>
<CssBaseline />
{inputGlobalStyles}
<GlobalStyles styles={{ backgroundColor: AppBackgroundColor }} />
<AppRoutes />
</ThemeProvider>
)
Expand Down
9 changes: 9 additions & 0 deletions eventmesh-dashboard-view/src/app.const.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const AppSectionBoxShadow = '2px 2px 40px 2px rgba(0,0,0,.05)'
export const AppBackgroundColor = '#f9fafb'
export const AppThemeConfig = {
palette: {
primary: {
main: '#188aeb'
}
}
}
37 changes: 20 additions & 17 deletions eventmesh-dashboard-view/src/assets/icons/index.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
import HomeOutlinedIcon from '@mui/icons-material/HomeOutlined';
import AddCircleOutlineOutlinedIcon from '@mui/icons-material/AddCircleOutlineOutlined';
import FoundationIcon from '@mui/icons-material/Foundation';
import RefreshIcon from '@mui/icons-material/Refresh';
import HomeOutlinedIcon from '@mui/icons-material/HomeOutlined'
import AddCircleOutlineOutlinedIcon from '@mui/icons-material/AddCircleOutlineOutlined'
import FoundationIcon from '@mui/icons-material/Foundation'
import RefreshIcon from '@mui/icons-material/Refresh'
import PushPinIcon from '@mui/icons-material/PushPin'
import PushPinOutlinedIcon from '@mui/icons-material/PushPinOutlined'

import { ReactComponent as EventMeshLogoIcon } from './eventmesh-logo.svg';
import { ReactComponent as EventMeshTopicIcon } from './eventmesh-topic.svg';
import { ReactComponent as HomeIcon } from './home.svg';
import { ReactComponent as RuntimeIcon } from './runtime.svg';
import { ReactComponent as TopicIcon } from './topic.svg';
import { ReactComponent as ConnectionIcon } from './connection.svg';
import { ReactComponent as MessageIcon } from './message.svg';
import { ReactComponent as SecurityIcon } from './security.svg';

import { ReactComponent as SettingsIcon } from './settings.svg';
import { ReactComponent as UsersIcon } from './users.svg';
import { ReactComponent as LogsIcon } from './logs.svg';
import { ReactComponent as EventMeshLogoIcon } from './eventmesh-logo.svg'
import { ReactComponent as EventMeshTopicIcon } from './eventmesh-topic.svg'
import { ReactComponent as HomeIcon } from './home.svg'
import { ReactComponent as RuntimeIcon } from './runtime.svg'
import { ReactComponent as TopicIcon } from './topic.svg'
import { ReactComponent as ConnectionIcon } from './connection.svg'
import { ReactComponent as MessageIcon } from './message.svg'
import { ReactComponent as SecurityIcon } from './security.svg'

import { ReactComponent as SettingsIcon } from './settings.svg'
import { ReactComponent as UsersIcon } from './users.svg'
import { ReactComponent as LogsIcon } from './logs.svg'

export const Icons = {
HomeOutlined: HomeOutlinedIcon,
AddCircleOutlineOutlined: AddCircleOutlineOutlinedIcon,
Foundation: FoundationIcon,
Refresh: RefreshIcon,
PushPin: PushPinIcon,
PushPinOutlined: PushPinOutlinedIcon,

EventMeshLogo: EventMeshLogoIcon,
EventMeshTopic: EventMeshTopicIcon,
Expand All @@ -35,5 +38,5 @@ export const Icons = {

Settings: SettingsIcon,
Users: UsersIcon,
Logs: LogsIcon,
Logs: LogsIcon
}
2 changes: 2 additions & 0 deletions eventmesh-dashboard-view/src/components/Construction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const Construction = forwardRef<typeof Box, ConstructionProps>(
<Box
ref={ref}
sx={{
width: 1,
height: 1,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
Expand Down
27 changes: 27 additions & 0 deletions eventmesh-dashboard-view/src/components/page/RootLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React, { forwardRef } from 'react'
import { Box, Stack, StackProps } from '@mui/material'

import { Outlet } from 'react-router-dom'
import { grey } from '@mui/material/colors'
import Navigation from '../../routes/navigation/Navigation'

interface RootLayoutProps extends StackProps {}

const RootLayout = forwardRef<typeof Box, RootLayoutProps>(
({ children, ...props }, ref) => {
return (
<Stack
direction="row"
sx={{
position: 'relative',
height: '100vh',
bgcolor: grey[100]
}}>
<Navigation />
<Box sx={{ flexGrow: 1, pl: 4, overflow: 'hidden' }}>{children}</Box>
</Stack>
)
}
)
RootLayout.displayName = 'RootLayout'
export default RootLayout
1 change: 1 addition & 0 deletions eventmesh-dashboard-view/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import './styles/index.css'
import App from './App'
import reportWebVitals from './reportWebVitals'
import { BrowserRouter } from 'react-router-dom'
Expand Down
25 changes: 0 additions & 25 deletions eventmesh-dashboard-view/src/routes/RootLayout.tsx

This file was deleted.

55 changes: 33 additions & 22 deletions eventmesh-dashboard-view/src/routes/Routes.tsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,49 @@
import React from 'react'
import { useRoutes, Navigate } from 'react-router-dom'
import RootLayout from './RootLayout'
import Home from './home/Home'
import Topic from './topic/Topic'
import Runtime from './runtime/Runtime'
import Connection from './connection/Connection'
import Message from './message/Message'
import Security from './security/Security'
import ClusterOverView from './cluster/overview/Overview'
import ClusterTopic from './cluster/topic/Topic'
import ClusterRuntime from './cluster/runtime/Runtime'
import ClusterConnection from './cluster/connection/Connection'
import ClusterMessage from './cluster/message/Message'
import ClusterSecurity from './cluster/security/Security'
import Users from './users/Users'
import Logs from './logs/Logs'
import Settings from './settings/Settings'
import Clusters from './cluster/Clusters'

const AppRoutes = () => {
return useRoutes([
{
path: '/',
element: <RootLayout />,
path: '*',
element: <Navigate to="home" replace />
},
{ path: 'home', element: <Home /> },
{
path: 'clusters',
element: <Clusters />,
children: [
{ path: 'clusters', element: <Clusters /> },
{
path: '*',
element: <Navigate to="/home" replace />
},
{ path: '', element: <Navigate to="/home" /> },
{ path: 'home', element: <Home /> },
{ path: 'runtime', element: <Runtime /> },
{ path: 'topic', element: <Topic /> },
{ path: 'connection', element: <Connection /> },
{ path: 'message', element: <Message /> },
{ path: 'security', element: <Security /> },
{ path: 'settings', element: <Settings /> },
{ path: 'users', element: <Users /> },
{ path: 'logs', element: <Logs /> }
path: ':clusterId',
children: [
{
path: '*',
element: <Navigate to="home" replace />
},
{ path: 'overview', element: <ClusterOverView /> },
{ path: 'runtime', element: <ClusterRuntime /> },
{ path: 'topic', element: <ClusterTopic /> },
{ path: 'connection', element: <ClusterConnection /> },
{ path: 'message', element: <ClusterMessage /> },
{ path: 'security', element: <ClusterSecurity /> }
]
}
]
}
},
{ path: 'settings', element: <Settings /> },
{ path: 'users', element: <Users /> },
{ path: 'logs', element: <Logs /> }
])
}

Expand Down
12 changes: 12 additions & 0 deletions eventmesh-dashboard-view/src/routes/cluster/Clusters.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React, { forwardRef } from 'react'
import { Box, BoxProps } from '@mui/material'
import RootLayout from '../../components/page/RootLayout'

interface ClustersProps extends BoxProps {}

const Clusters = forwardRef<typeof Box, ClustersProps>(({ ...props }, ref) => {
return <RootLayout>Clusters</RootLayout>
})

Clusters.displayName = 'Clusters'
export default Clusters
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { forwardRef } from 'react'
import { Box, BoxProps } from '@mui/material'
import Page from '../../components/Page'
import Construction from '../../components/Construction'
import Page from '../../../components/page/Layout'
import Construction from '../../../components/Construction'

interface ConnectionProps extends BoxProps {}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { forwardRef } from 'react'
import { Box, BoxProps } from '@mui/material'
import Page from '../../components/Page'
import Construction from '../../components/Construction'
import Page from '../../../components/page/Layout'
import Construction from '../../../components/Construction'

interface MessageProps extends BoxProps {}

Expand Down
17 changes: 17 additions & 0 deletions eventmesh-dashboard-view/src/routes/cluster/overview/Overview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React, { forwardRef } from 'react'
import { Box, BoxProps } from '@mui/material'
import Construction from '../../../components/Construction'
import RootLayout from '../../../components/page/RootLayout'

interface HomeProps extends BoxProps {}

const Home = forwardRef<typeof Box, HomeProps>(({ ...props }, ref) => {
return (
<RootLayout>
<Construction />
</RootLayout>
)
})

Home.displayName = 'Home'
export default Home
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { forwardRef } from 'react'
import { Box, BoxProps } from '@mui/material'
import Page from '../../components/Page'
import Construction from '../../components/Construction'
import Page from '../../../components/page/Layout'
import Construction from '../../../components/Construction'

interface RuntimeProps extends BoxProps {}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { forwardRef } from 'react'
import { Box, BoxProps } from '@mui/material'
import Page from '../../components/Page'
import Construction from '../../components/Construction'
import Page from '../../../components/page/Layout'
import Construction from '../../../components/Construction'

interface SecurityProps extends BoxProps {}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { forwardRef, useState } from 'react'
import { Box, BoxProps, Paper, Stack } from '@mui/material'
import Page from '../../components/Page'
import React, { forwardRef } from 'react'
import { Box, BoxProps, Stack } from '@mui/material'
import Page from '../../../components/page/Layout'
import Stats from './stats/Stats'
import TopicList from './topic-list/TopicList'

Expand All @@ -9,7 +9,7 @@ interface TopicProps extends BoxProps {}
const Topic = forwardRef<typeof Box, TopicProps>(({ ...props }, ref) => {
return (
<Page>
<Stack sx={{ width: 1, height: 1, p: 2 }} spacing={3}>
<Stack sx={{ width: 1, height: 1, p: 2 }} spacing={2}>
<Stats />
<TopicList />
</Stack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import React, { forwardRef, useState, useEffect } from 'react'
import { Stack, StackProps, Select, MenuItem, Grid } from '@mui/material'
import TopicCount from './TopicCount'
import AbnormalTopicCount from './AbnormalTopicCount'
import { Icons } from '../../../assets/icons'
import { Icons } from '../../../../assets/icons'
import StatsChart from './StatsChart'
import { grey } from '@mui/material/colors'

import { useAppSelector } from '../../../store'
import { fetchResourceStats, fetchTopicStats } from '../../../service/topics'
import { useAppSelector } from '../../../../store'
import { fetchTopicStats } from '../../../../service/topics'
import { TopicStats } from './topic-stats.types'

enum TimeOptionEnum {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { forwardRef, useRef, useEffect } from 'react'
import { Box, BoxProps, Paper } from '@mui/material'
import echarts from '../../../utils/chart'
import echarts from '../../../../utils/chart'
import { grey } from '@mui/material/colors'

interface StatsChartProps extends BoxProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export type ResourceStats = {
connectionsNum: number
topicsNum: number
}
Loading

0 comments on commit 4d2b285

Please sign in to comment.