feat: show related flows for connections
This commit is contained in:
@@ -40,7 +40,7 @@ export default function ContextMenu(props: ContextMenuProps): React.ReactElement
|
|||||||
>
|
>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
component={Link}
|
component={Link}
|
||||||
to={URLS.APP_FLOWS(appKey)}
|
to={URLS.APP_FLOWS_FOR_CONNECTION(appKey, connectionId)}
|
||||||
onClick={createActionHandler({ type: 'viewFlows' })}
|
onClick={createActionHandler({ type: 'viewFlows' })}
|
||||||
>
|
>
|
||||||
{formatMessage('connection.viewFlows')}
|
{formatMessage('connection.viewFlows')}
|
||||||
|
@@ -21,8 +21,13 @@ const getLimitAndOffset = (page: number) => ({
|
|||||||
export default function AppFlows(props: AppFlowsProps): React.ReactElement {
|
export default function AppFlows(props: AppFlowsProps): React.ReactElement {
|
||||||
const { appKey } = props;
|
const { appKey } = props;
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
|
const connectionId = searchParams.get('connectionId') || null;
|
||||||
const page = parseInt(searchParams.get('page') || '', 10) || 1;
|
const page = parseInt(searchParams.get('page') || '', 10) || 1;
|
||||||
const { data } = useQuery(GET_FLOWS, { variables: { appKey, ...getLimitAndOffset(page) }});
|
const { data } = useQuery(GET_FLOWS, { variables: {
|
||||||
|
appKey,
|
||||||
|
connectionId,
|
||||||
|
...getLimitAndOffset(page)
|
||||||
|
}});
|
||||||
const getFlows = data?.getFlows || {};
|
const getFlows = data?.getFlows || {};
|
||||||
const { pageInfo, edges } = getFlows;
|
const { pageInfo, edges } = getFlows;
|
||||||
|
|
||||||
|
@@ -16,6 +16,7 @@ export const APP_ADD_CONNECTION_PATTERN = '/app/:appKey/connections/add';
|
|||||||
export const APP_RECONNECT_CONNECTION = (appKey: string, connectionId: string): string => `/app/${appKey}/connections/${connectionId}/reconnect`;
|
export const APP_RECONNECT_CONNECTION = (appKey: string, connectionId: string): string => `/app/${appKey}/connections/${connectionId}/reconnect`;
|
||||||
export const APP_RECONNECT_CONNECTION_PATTERN = '/app/:appKey/connections/:connectionId/reconnect';
|
export const APP_RECONNECT_CONNECTION_PATTERN = '/app/:appKey/connections/:connectionId/reconnect';
|
||||||
export const APP_FLOWS = (appKey: string): string => `/app/${appKey}/flows`;
|
export const APP_FLOWS = (appKey: string): string => `/app/${appKey}/flows`;
|
||||||
|
export const APP_FLOWS_FOR_CONNECTION = (appKey: string, connectionId: string): string => `/app/${appKey}/flows?connectionId=${connectionId}`;
|
||||||
export const APP_FLOWS_PATTERN = '/app/:appKey/flows';
|
export const APP_FLOWS_PATTERN = '/app/:appKey/flows';
|
||||||
|
|
||||||
export const EDITOR = '/editor';
|
export const EDITOR = '/editor';
|
||||||
|
@@ -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($limit: Int!, $offset: Int!, $appKey: String, $name: String) {
|
query GetFlows($limit: Int!, $offset: Int!, $appKey: String, $connectionId: String, $name: String) {
|
||||||
getFlows(limit: $limit, offset: $offset, appKey: $appKey, name: $name) {
|
getFlows(limit: $limit, offset: $offset, appKey: $appKey, connectionId: $connectionId, name: $name) {
|
||||||
pageInfo {
|
pageInfo {
|
||||||
currentPage
|
currentPage
|
||||||
totalPages
|
totalPages
|
||||||
|
Reference in New Issue
Block a user