diff --git a/src/routes.tsx b/src/routes.tsx index 580c39b70..99e4f5482 100644 --- a/src/routes.tsx +++ b/src/routes.tsx @@ -19,7 +19,7 @@ import React from 'react'; import RouteGuard from './ui/components/RouteGuard/RouteGuard'; import Person from '@material-ui/icons/Person'; -import OpenPushRequests from './ui/views/OpenPushRequests/OpenPushRequests'; +import PushRequests from './ui/views/PushRequests/PushRequests'; import PushDetails from './ui/views/PushDetails/PushDetails'; import User from './ui/views/User/UserProfile'; import UserList from './ui/views/UserList/UserList'; @@ -55,9 +55,7 @@ const dashboardRoutes: Route[] = [ path: '/push', name: 'Dashboard', icon: Dashboard, - component: (props) => ( - - ), + component: (props) => , layout: '/dashboard', visible: true, }, diff --git a/src/ui/components/CustomTabs/CustomTabs.tsx b/src/ui/components/CustomTabs/CustomTabs.tsx index 6a9211ecf..f811139bd 100644 --- a/src/ui/components/CustomTabs/CustomTabs.tsx +++ b/src/ui/components/CustomTabs/CustomTabs.tsx @@ -25,6 +25,7 @@ interface CustomTabsProps { tabs: TabItem[]; rtlActive?: boolean; plainTabs?: boolean; + defaultTab?: number; } const CustomTabs: React.FC = ({ @@ -33,8 +34,9 @@ const CustomTabs: React.FC = ({ tabs, title, rtlActive = false, + defaultTab = 0, }) => { - const [value, setValue] = useState(0); + const [value, setValue] = useState(defaultTab); const classes = useStyles(); const handleChange = (event: React.ChangeEvent, newValue: number) => { diff --git a/src/ui/views/OpenPushRequests/OpenPushRequests.tsx b/src/ui/views/PushRequests/PushRequests.tsx similarity index 80% rename from src/ui/views/OpenPushRequests/OpenPushRequests.tsx rename to src/ui/views/PushRequests/PushRequests.tsx index 41c2672a8..78638ddc6 100644 --- a/src/ui/views/OpenPushRequests/OpenPushRequests.tsx +++ b/src/ui/views/PushRequests/PushRequests.tsx @@ -4,7 +4,7 @@ import GridContainer from '../../components/Grid/GridContainer'; import PushesTable from './components/PushesTable'; import CustomTabs from '../../components/CustomTabs/CustomTabs'; import Danger from '../../components/Typography/Danger'; -import { Visibility, CheckCircle, Cancel, Block } from '@material-ui/icons'; +import { Visibility, CheckCircle, Cancel, Block, Error, List } from '@material-ui/icons'; import { TabItem } from '../../components/CustomTabs/CustomTabs'; const Dashboard: React.FC = () => { @@ -15,6 +15,11 @@ const Dashboard: React.FC = () => { }; const tabs: TabItem[] = [ + { + tabName: 'All', + tabIcon: List, + tabContent: , + }, { tabName: 'Pending', tabIcon: Visibility, @@ -51,6 +56,11 @@ const Dashboard: React.FC = () => { /> ), }, + { + tabName: 'Error', + tabIcon: Error, + tabContent: , + }, ]; return ( @@ -59,7 +69,7 @@ const Dashboard: React.FC = () => { {!errorMessage && ( - + )} diff --git a/src/ui/views/OpenPushRequests/components/PushesTable.tsx b/src/ui/views/PushRequests/components/PushesTable.tsx similarity index 93% rename from src/ui/views/OpenPushRequests/components/PushesTable.tsx rename to src/ui/views/PushRequests/components/PushesTable.tsx index 83cc90be9..88052c300 100644 --- a/src/ui/views/OpenPushRequests/components/PushesTable.tsx +++ b/src/ui/views/PushRequests/components/PushesTable.tsx @@ -40,12 +40,15 @@ const PushesTable: React.FC = (props) => { const openPush = (pushId: string) => navigate(`/dashboard/push/${pushId}`, { replace: true }); useEffect(() => { - const query = { - blocked: props.blocked ?? false, - canceled: props.canceled ?? false, - authorised: props.authorised ?? false, - rejected: props.rejected ?? false, - }; + const query: any = {}; + + // Only include filters that are explicitly set (not undefined) + if (props.blocked !== undefined) query.blocked = props.blocked; + if (props.canceled !== undefined) query.canceled = props.canceled; + if (props.authorised !== undefined) query.authorised = props.authorised; + if (props.rejected !== undefined) query.rejected = props.rejected; + if (props.error !== undefined) query.error = props.error; + getPushes(setIsLoading, setPushes, setAuth, setIsError, props.handleError, query); }, [props]);