Skip to content

Commit 71fa68b

Browse files
authored
feat(x2a): disable the Next phase run action based on status and phase (#2296)
Signed-off-by: Marek Libra <marek.libra@gmail.com>
1 parent f4f63b9 commit 71fa68b

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

workspaces/x2a/plugins/x2a/src/components/ModuleTable/ModuleTable.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,21 @@ const useColumns = ({
9696
}, [t, lastPhaseCell, artifactsCell]);
9797
};
9898

99+
const canRunNextPhase = ({ module }: { module: Module }) => {
100+
const nextPhase = getNextPhase(module);
101+
if (!nextPhase) {
102+
return false;
103+
}
104+
105+
// TODO: Consider check whether we have all artifacts instead of just checking the last job status
106+
const lastJob = getLastJob(module);
107+
if (!lastJob || lastJob.status === 'success') {
108+
return true;
109+
}
110+
111+
return false;
112+
};
113+
99114
export const ModuleTable = ({
100115
modules,
101116
forceRefresh,
@@ -154,7 +169,7 @@ export const ModuleTable = ({
154169
icon: PlayArrowIcon,
155170
onClick: () => handleRunNext(rowData),
156171
tooltip: t('module.actions.runNextPhase'),
157-
disabled: !getNextPhase(rowData),
172+
disabled: !canRunNextPhase({ module: rowData }),
158173
}),
159174
];
160175

0 commit comments

Comments
 (0)