Add stopBuild functionality to buildVertices function
This commit is contained in:
parent
f58c2d4964
commit
4e8de33f75
1 changed files with 12 additions and 0 deletions
|
|
@ -26,6 +26,7 @@ export async function buildVertices({
|
||||||
let orderResponse = await getVerticesOrder(flowId, nodeId);
|
let orderResponse = await getVerticesOrder(flowId, nodeId);
|
||||||
let verticesOrder: Array<Array<string>> = orderResponse.data.ids;
|
let verticesOrder: Array<Array<string>> = orderResponse.data.ids;
|
||||||
let vertices_layers: Array<Array<string>> = [];
|
let vertices_layers: Array<Array<string>> = [];
|
||||||
|
let stop = false;
|
||||||
|
|
||||||
if (nodeId) {
|
if (nodeId) {
|
||||||
for (let i = 0; i < verticesOrder.length; i += 1) {
|
for (let i = 0; i < verticesOrder.length; i += 1) {
|
||||||
|
|
@ -61,7 +62,14 @@ export async function buildVertices({
|
||||||
onBuildError,
|
onBuildError,
|
||||||
verticesIds,
|
verticesIds,
|
||||||
buildResults,
|
buildResults,
|
||||||
|
stopBuild:()=>{stop=true}
|
||||||
});
|
});
|
||||||
|
if(stop){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(stop){
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -78,6 +86,7 @@ async function buildVertex({
|
||||||
onBuildError,
|
onBuildError,
|
||||||
verticesIds,
|
verticesIds,
|
||||||
buildResults,
|
buildResults,
|
||||||
|
stopBuild,
|
||||||
}: {
|
}: {
|
||||||
flowId: string;
|
flowId: string;
|
||||||
id: string;
|
id: string;
|
||||||
|
|
@ -85,6 +94,7 @@ async function buildVertex({
|
||||||
onBuildError?: (title, list, idList: string[]) => void;
|
onBuildError?: (title, list, idList: string[]) => void;
|
||||||
verticesIds: string[];
|
verticesIds: string[];
|
||||||
buildResults: boolean[];
|
buildResults: boolean[];
|
||||||
|
stopBuild:()=>void;
|
||||||
}) {
|
}) {
|
||||||
try {
|
try {
|
||||||
const buildRes = await postBuildVertex(flowId, id);
|
const buildRes = await postBuildVertex(flowId, id);
|
||||||
|
|
@ -97,6 +107,7 @@ async function buildVertex({
|
||||||
[buildData.params],
|
[buildData.params],
|
||||||
verticesIds
|
verticesIds
|
||||||
);
|
);
|
||||||
|
stopBuild();
|
||||||
}
|
}
|
||||||
data[buildData.id] = buildData;
|
data[buildData.id] = buildData;
|
||||||
onBuildUpdate({ data, id: buildData.id });
|
onBuildUpdate({ data, id: buildData.id });
|
||||||
|
|
@ -108,5 +119,6 @@ async function buildVertex({
|
||||||
[(error as AxiosError<any>).response?.data?.detail ?? "Unknown Error"],
|
[(error as AxiosError<any>).response?.data?.detail ?? "Unknown Error"],
|
||||||
verticesIds
|
verticesIds
|
||||||
);
|
);
|
||||||
|
stopBuild();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue