Add update_build_config method that updates any part of the template
This commit is contained in:
parent
1ae8be9c0f
commit
240b1900b9
11 changed files with 257 additions and 113 deletions
|
|
@ -98,24 +98,33 @@ export default function ParameterComponent({
|
|||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await postCustomComponentUpdate(code, name);
|
||||
if (res.status === 200 && data.node?.template) {
|
||||
setNode(data.id, (oldNode) => {
|
||||
let newNode = cloneDeep(oldNode);
|
||||
await postCustomComponentUpdate(
|
||||
code,
|
||||
name,
|
||||
data.node?.template[name]?.value
|
||||
)
|
||||
.then((res) => {
|
||||
if (res.status === 200 && data.node?.template) {
|
||||
setNode(data.id, (oldNode) => {
|
||||
let newNode = cloneDeep(oldNode);
|
||||
|
||||
newNode.data = {
|
||||
...newNode.data,
|
||||
};
|
||||
newNode.data = {
|
||||
...newNode.data,
|
||||
};
|
||||
|
||||
newNode.data.node.template[name] = res.data.template[name];
|
||||
newNode.data.node.template = res.data.template;
|
||||
|
||||
return newNode;
|
||||
return newNode;
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error occurred while updating the node:", error);
|
||||
setErrorData({
|
||||
title: "Error while updating the Component",
|
||||
list: [error.response.data.detail.error ?? "Unknown error"],
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
setErrorData(err as { title: string; list?: Array<string> });
|
||||
}
|
||||
});
|
||||
|
||||
renderTooltips();
|
||||
if (delayAnimation) {
|
||||
|
|
|
|||
|
|
@ -369,11 +369,13 @@ export async function postCustomComponent(
|
|||
|
||||
export async function postCustomComponentUpdate(
|
||||
code: string,
|
||||
field: string
|
||||
field: string,
|
||||
field_value: string
|
||||
): Promise<AxiosResponse<APIClassType>> {
|
||||
return await api.post(`${BASE_URL_API}custom_component/update`, {
|
||||
code,
|
||||
field,
|
||||
field_value,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue