forked from github-starred/komodo
improve build cancel disabled logic to prevent redundant cancels
This commit is contained in:
@@ -125,3 +125,35 @@ export const logToHtml = (log: string) => {
|
||||
});
|
||||
return convert.toHtml(sanitized);
|
||||
};
|
||||
|
||||
export const getUpdateQuery = (
|
||||
target: Types.ResourceTarget,
|
||||
deployments: Types.DeploymentListItem[] | undefined
|
||||
) => {
|
||||
const build_id =
|
||||
target.type === "Deployment"
|
||||
? deployments?.find((d) => d.id === target.id)?.info.build_id
|
||||
: undefined;
|
||||
if (build_id) {
|
||||
return {
|
||||
$or: [
|
||||
{
|
||||
"target.type": target.type,
|
||||
"target.id": target.id,
|
||||
},
|
||||
{
|
||||
"target.type": "Build",
|
||||
"target.id": build_id,
|
||||
operation: {
|
||||
$in: [Types.Operation.RunBuild, Types.Operation.CancelBuild],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
"target.type": target.type,
|
||||
"target.id": target.id,
|
||||
};
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user