Skip to content

Commit 709bb12

Browse files
authored
Fixes #39494 - Fix create report button is enabled when state is 'running' (#1041)
* Fixes #39494 - Fix create report button is enabled when state is 'running' * Update tests to RTL store helpers
1 parent 06228f7 commit 709bb12

3 files changed

Lines changed: 238 additions & 155 deletions

File tree

webpack/JobInvocationDetail/JobInvocationConstants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export const STATUS = {
3838
SUCCEEDED: 'succeeded',
3939
FAILED: 'failed',
4040
CANCELLED: 'cancelled',
41+
RUNNING: 'running',
4142
};
4243

4344
export const STATUS_UPPERCASE = {

webpack/JobInvocationDetail/JobInvocationToolbarButtons.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ const JobInvocationToolbarButtons = ({ jobId, data }) => {
5858
);
5959
}, [jobId, reportTemplateJobId, templateInputId]);
6060

61+
const isCreateReportDisabled =
62+
!canGenerateReportTemplates ||
63+
task?.state === STATUS.RUNNING ||
64+
task?.state === STATUS.PENDING ||
65+
reportHref === undefined;
66+
6167
const onActionFocus = useCallback(() => {
6268
const element = document.getElementById(
6369
`toggle-split-button-action-primary-${jobId}`
@@ -280,11 +286,7 @@ const JobInvocationToolbarButtons = ({ jobId, data }) => {
280286
className="button-create-report"
281287
href={reportHref}
282288
variant="secondary"
283-
isDisabled={
284-
!canGenerateReportTemplates ||
285-
task?.state === STATUS.PENDING ||
286-
reportHref === undefined
287-
}
289+
isDisabled={isCreateReportDisabled}
288290
>
289291
{__(`Create report`)}
290292
</Button>

0 commit comments

Comments
 (0)