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 type { IFlow } from '@automatisch/types';
export default function AppFlows(): React.ReactElement {
const { data } = useQuery(GET_FLOWS);
type AppFlowsProps = {
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 || [];
return (

View File

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

View File

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