use icons for running unit tests, w/ lantz

This commit is contained in:
burnettk 2023-06-01 10:43:27 -04:00
parent 619f7e41bd
commit b02c28697d
2 changed files with 22 additions and 42 deletions

View File

@ -1,4 +1,4 @@
import { PlayOutline, Checkmark, Close } from '@carbon/icons-react';
import { Rule, Checkmark, Close } from '@carbon/icons-react';
import { Button, Modal } from '@carbon/react';
import { useState } from 'react';
import { useUriListForPermissions } from '../hooks/UriListForPermissions';
@ -11,12 +11,12 @@ import {
type OwnProps = {
processModelFile?: ProcessFile;
buttonType?: string;
titleText: string;
};
export default function ProcessModelTestRun({
processModelFile,
buttonType = 'icon',
titleText,
}: OwnProps) {
const [testCaseResults, setTestCaseResults] =
useState<TestCaseResults | null>(null);
@ -153,29 +153,16 @@ export default function ProcessModelTestRun({
};
const buttonElement = () => {
if (buttonType === 'icon') {
return (
<Button
kind="ghost"
renderIcon={PlayOutline}
iconDescription="Run BPMN unit tests defined in this file"
renderIcon={Rule}
iconDescription={titleText}
hasIconOnly
size="lg"
onClick={() => onProcessModelTestRun()}
/>
);
}
if (buttonType === 'text') {
return (
<Button
onClick={() => onProcessModelTestRun()}
title="Run all BPMN unit tests for this process model"
>
Run Unit Tests
</Button>
);
}
return null;
};
return (

View File

@ -324,7 +324,10 @@ export default function ProcessModelShow() {
if (isTestCaseFile(processModelFile)) {
elements.push(
<Can I="POST" a={targetUris.processModelTestsPath} ability={ability}>
<ProcessModelTestRun processModelFile={processModelFile} />
<ProcessModelTestRun
processModelFile={processModelFile}
titleText="Run BPMN unit tests defined in this file"
/>
</Can>
);
}
@ -664,6 +667,11 @@ export default function ProcessModelShow() {
disabled={publishDisabled}
/>
</Can>
<Can I="POST" a={targetUris.processModelTestsPath} ability={ability}>
{hasTestCaseFiles ? (
<ProcessModelTestRun titleText="Run all BPMN unit tests for this process model" />
) : null}
</Can>
</Stack>
<p className="process-description">{processModel.description}</p>
<Stack orientation="horizontal" gap={3}>
@ -681,21 +689,6 @@ export default function ProcessModelShow() {
<br />
</>
</Can>
<Can
I="POST"
a={targetUris.processModelPublishPath}
ability={ability}
>
<Can
I="POST"
a={targetUris.processModelTestsPath}
ability={ability}
>
{hasTestCaseFiles ? (
<ProcessModelTestRun buttonType="text" />
) : null}
</Can>
</Can>
</Stack>
{processModelFilesSection()}
<Can I="GET" a={targetUris.processInstanceListPath} ability={ability}>