Add deleteFlowPool function and useFlowsManagerStore in newChatView
This commit is contained in:
parent
c590098dad
commit
f7766118e8
2 changed files with 16 additions and 2 deletions
|
|
@ -1,8 +1,10 @@
|
||||||
import { cloneDeep } from "lodash";
|
import { cloneDeep } from "lodash";
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import IconComponent from "../../components/genericIconComponent";
|
import IconComponent from "../../components/genericIconComponent";
|
||||||
|
import { deleteFlowPool } from "../../controllers/API";
|
||||||
import useAlertStore from "../../stores/alertStore";
|
import useAlertStore from "../../stores/alertStore";
|
||||||
import useFlowStore from "../../stores/flowStore";
|
import useFlowStore from "../../stores/flowStore";
|
||||||
|
import useFlowsManagerStore from "../../stores/flowsManagerStore";
|
||||||
import { sendAllProps } from "../../types/api";
|
import { sendAllProps } from "../../types/api";
|
||||||
import {
|
import {
|
||||||
ChatMessageType,
|
ChatMessageType,
|
||||||
|
|
@ -29,6 +31,7 @@ export default function newChatView(): JSX.Element {
|
||||||
CleanFlowPool,
|
CleanFlowPool,
|
||||||
} = useFlowStore();
|
} = useFlowStore();
|
||||||
const { setErrorData } = useAlertStore();
|
const { setErrorData } = useAlertStore();
|
||||||
|
const currentFlowId = useFlowsManagerStore((state) => state.currentFlowId);
|
||||||
const [lockChat, setLockChat] = useState(false);
|
const [lockChat, setLockChat] = useState(false);
|
||||||
const messagesRef = useRef<HTMLDivElement | null>(null);
|
const messagesRef = useRef<HTMLDivElement | null>(null);
|
||||||
|
|
||||||
|
|
@ -112,7 +115,9 @@ export default function newChatView(): JSX.Element {
|
||||||
}
|
}
|
||||||
function clearChat(): void {
|
function clearChat(): void {
|
||||||
setChatHistory([]);
|
setChatHistory([]);
|
||||||
|
deleteFlowPool(currentFlowId).then((_) => {
|
||||||
CleanFlowPool();
|
CleanFlowPool();
|
||||||
|
});
|
||||||
//TODO tell backend to clear chat session
|
//TODO tell backend to clear chat session
|
||||||
if (lockChat) setLockChat(false);
|
if (lockChat) setLockChat(false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -879,8 +879,17 @@ export async function getFlowPool({
|
||||||
nodeId?: string;
|
nodeId?: string;
|
||||||
}): Promise<AxiosResponse<FlowPoolType>> {
|
}): Promise<AxiosResponse<FlowPoolType>> {
|
||||||
const config = {};
|
const config = {};
|
||||||
|
config["params"] = { flow_id: flowId };
|
||||||
if (nodeId) {
|
if (nodeId) {
|
||||||
config["params"] = { nodeId };
|
config["params"] = { nodeId };
|
||||||
}
|
}
|
||||||
return await api.get(`${BASE_URL_API}flow_pool/${flowId}`, config);
|
return await api.get(`${BASE_URL_API}monitor/builds`, config);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function deleteFlowPool(
|
||||||
|
flowId: string
|
||||||
|
): Promise<AxiosResponse<any>> {
|
||||||
|
const config = {};
|
||||||
|
config["params"] = { flow_id: flowId };
|
||||||
|
return await api.delete(`${BASE_URL_API}monitor/builds`, config);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue