mirror of
https://github.com/Unleash/unleash.git
synced 2025-11-10 01:19:53 +01:00
Provides store method for retrieving traffic usage data based on period parameter, and UI + ui hook with the new chart for displaying traffic usage data spread out over selectable month.  In this PR we copied and adapted a plugin written by DX for highlighting a column in the chart:  There are some minor improvements planned which will come in a separate PR, reversing the order in legend and tooltip so the colors go from light to dark, and adding a month -sum below the legend ## Discussion points - Should any of this be extracted as a separate reusable component? --------- Co-authored-by: Nuno Góis <github@nunogois.com>
71 lines
2.2 KiB
TypeScript
71 lines
2.2 KiB
TypeScript
import { lazy } from 'react';
|
|
|
|
import { Tab, Tabs } from '@mui/material';
|
|
import { Route, Routes, useLocation } from 'react-router-dom';
|
|
import { TabLink } from 'component/common/TabNav/TabLink';
|
|
import { PageContent } from 'component/common/PageContent/PageContent';
|
|
|
|
const NetworkOverview = lazy(() => import('./NetworkOverview/NetworkOverview'));
|
|
const NetworkTraffic = lazy(() => import('./NetworkTraffic/NetworkTraffic'));
|
|
const NetworkTrafficUsage = lazy(
|
|
() => import('./NetworkTrafficUsage/NetworkTrafficUsage'),
|
|
);
|
|
|
|
const tabs = [
|
|
{
|
|
label: 'Overview',
|
|
path: '/admin/network',
|
|
},
|
|
{
|
|
label: 'Traffic',
|
|
path: '/admin/network/traffic',
|
|
},
|
|
{
|
|
label: 'Data Usage',
|
|
path: '/admin/network/data-usage',
|
|
},
|
|
];
|
|
|
|
export const Network = () => {
|
|
const { pathname } = useLocation();
|
|
|
|
return (
|
|
<div>
|
|
<PageContent
|
|
withTabs
|
|
header={
|
|
<Tabs
|
|
value={pathname}
|
|
indicatorColor='primary'
|
|
textColor='primary'
|
|
variant='scrollable'
|
|
allowScrollButtonsMobile
|
|
>
|
|
{tabs.map(({ label, path }) => (
|
|
<Tab
|
|
key={label}
|
|
value={path}
|
|
label={
|
|
<TabLink to={path}>
|
|
<span>{label}</span>
|
|
</TabLink>
|
|
}
|
|
sx={{ padding: 0 }}
|
|
/>
|
|
))}
|
|
</Tabs>
|
|
}
|
|
>
|
|
<Routes>
|
|
<Route path='traffic' element={<NetworkTraffic />} />
|
|
<Route path='*' element={<NetworkOverview />} />
|
|
<Route
|
|
path='data-usage'
|
|
element={<NetworkTrafficUsage />}
|
|
/>
|
|
</Routes>
|
|
</PageContent>
|
|
</div>
|
|
);
|
|
};
|