feat: filter flows by appKey in app flows

This commit is contained in:
Ali BARIN
2022-05-09 14:15:40 +02:00
parent 7c543ff8ed
commit 91e209e961
3 changed files with 10 additions and 5 deletions

View File

@@ -4,8 +4,13 @@ import { GET_FLOWS } from 'graphql/queries/get-flows';
import AppFlowRow from 'components/AppFlowRow'; import AppFlowRow from 'components/AppFlowRow';
import type { IFlow } from '@automatisch/types'; import type { IFlow } from '@automatisch/types';
export default function AppFlows(): React.ReactElement { type AppFlowsProps = {
const { data } = useQuery(GET_FLOWS); appKey: string;
}
export default function AppFlows(props: AppFlowsProps): React.ReactElement {
const { appKey } = props;
const { data } = useQuery(GET_FLOWS, { variables: { appKey }});
const appFlows: IFlow[] = data?.getFlows || []; const appFlows: IFlow[] = data?.getFlows || [];
return ( return (

View File

@@ -1,8 +1,8 @@
import { gql } from '@apollo/client'; import { gql } from '@apollo/client';
export const GET_FLOWS = gql` export const GET_FLOWS = gql`
query GetFlows { query GetFlows($appKey: String) {
getFlows { getFlows(appKey: $appKey) {
id id
name name
} }

View File

@@ -155,7 +155,7 @@ export default function Application(): React.ReactElement {
</Box> </Box>
<Routes> <Routes>
<Route path={`${URLS.FLOWS}/*`} element={<AppFlows />} /> <Route path={`${URLS.FLOWS}/*`} element={<AppFlows appKey={appKey} />} />
<Route path={`${URLS.CONNECTIONS}/*`} element={<AppConnections appKey={appKey} />} /> <Route path={`${URLS.CONNECTIONS}/*`} element={<AppConnections appKey={appKey} />} />