@ -30,19 +30,17 @@ export const useUseAsDraftWorkflowVersionSingleRecordAction: ActionHookWithoutOb
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const workflowStatuses = workflow?.statuses;
|
const hasAlreadyDraftVersion =
|
||||||
|
workflow?.versions.some((version) => version.status === 'DRAFT') || false;
|
||||||
|
|
||||||
const shouldBeRegistered =
|
const shouldBeRegistered =
|
||||||
isDefined(workflowVersion) &&
|
isDefined(workflowVersion) &&
|
||||||
isDefined(workflow) &&
|
isDefined(workflow) &&
|
||||||
isDefined(workflowStatuses) &&
|
|
||||||
workflowVersion.status !== 'DRAFT';
|
workflowVersion.status !== 'DRAFT';
|
||||||
|
|
||||||
const onClick = async () => {
|
const onClick = async () => {
|
||||||
if (!shouldBeRegistered) return;
|
if (!shouldBeRegistered) return;
|
||||||
|
|
||||||
const hasAlreadyDraftVersion = workflowStatuses.includes('DRAFT');
|
|
||||||
|
|
||||||
if (hasAlreadyDraftVersion) {
|
if (hasAlreadyDraftVersion) {
|
||||||
setOpenOverrideWorkflowDraftConfirmationModal(true);
|
setOpenOverrideWorkflowDraftConfirmationModal(true);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user