feat(TestSubstep): show continue upon successful test

This commit is contained in:
Ali BARIN
2022-09-27 21:52:23 +02:00
parent 932994622e
commit 330902ccb3
2 changed files with 8 additions and 2 deletions

View File

@@ -39,6 +39,9 @@ function TestSubstep(props: TestSubstepProps): React.ReactElement {
const [executeFlow, { data, error, loading, called, reset }] = useMutation(EXECUTE_FLOW, { context: { autoSnackbar: false }});
const response = data?.executeFlow?.data;
const isCompleted = !error && called && !loading;
const hasNoOutput = !response && isCompleted;
const {
name,
} = substep;
@@ -73,7 +76,7 @@ function TestSubstep(props: TestSubstepProps): React.ReactElement {
{error?.graphQLErrors.map((error) => (<>{error.message}<br /></>))}
</Alert>}
{called && !loading && !error && !response && (
{hasNoOutput && (
<Alert severity="warning" sx={{ mb: 1, width: '100%' }}>
<AlertTitle sx={{ fontWeight: 700 }}>{formatMessage('flowEditor.noTestDataTitle')}</AlertTitle>
@@ -96,7 +99,8 @@ function TestSubstep(props: TestSubstepProps): React.ReactElement {
disabled={editorContext.readOnly}
color="primary"
>
Test & Continue
{isCompleted && formatMessage('flowEditor.continue')}
{!isCompleted && formatMessage('flowEditor.testAndContinue')}
</LoadingButton>
</ListItem>
</Collapse>

View File

@@ -49,6 +49,8 @@
"flowEditor.publishedFlowCannotBeUpdated": "To edit this flow, you must first unpublish it.",
"flowEditor.noTestDataTitle": "We couldn't find matching data",
"flowEditor.noTestDataMessage": "Create a sample in the associated service and test the step again.",
"flowEditor.testAndContinue": "Test & Continue",
"flowEditor.continue": "Continue",
"flow.createdAt": "created {datetime}",
"flow.updatedAt": "updated {datetime}",
"flow.view": "View",