function WorkflowExecutionsComponent()

in src/Components/WorkflowExecutionsComponent.js [28:48]


function WorkflowExecutionsComponent(props) {
    const [executions, setExecutions] = useState([]);
    const [response, setResponse] = useState();
    const [nextToken, setNextToken] = useState(null);

    useEffect(async() => {
        const credentials = await Auth.currentCredentials();
        const sfnClient = new SFNClient({region: config.aws_project_region, credentials: Auth.essentialCredentials(credentials)});
        const result = await sfnClient.send(new ListExecutionsCommand({
            maxResults: 20,
            nextToken: nextToken,
            stateMachineArn: SM_ARN
        }));
        
        setResponse(result);
        setExecutions(executions.concat(result.executions));
    }, [nextToken]);

    return (
        <div>
            <Table footer={<Box textAlign="center" display={(response && response.nextToken) ? "block" : "none"}><Link variant="primary" onFollow={(event) => setNextToken(response.nextToken)}>View More</Link></Box>} header={<Header variant="h2">Workflow Executions</Header>} items={executions} columnDefinitions={[