Fix formatting issues and update code style
This commit is contained in:
parent
42ce5b7112
commit
7efa79af69
5 changed files with 32 additions and 20 deletions
|
|
@ -144,7 +144,7 @@ async def get_current_user_for_websocket(
|
||||||
return await api_key_security(api_key, query_param, db)
|
return await api_key_security(api_key, query_param, db)
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def get_current_active_user(current_user: Annotated[User, Depends(get_current_user)]):
|
def get_current_active_user(current_user: Annotated[User, Depends(get_current_user)]):
|
||||||
if not current_user.is_active:
|
if not current_user.is_active:
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ export default function CodeAreaModal({
|
||||||
readOnly={readonly}
|
readOnly={readonly}
|
||||||
value={code}
|
value={code}
|
||||||
mode="python"
|
mode="python"
|
||||||
setOptions={{ fontFamily: "monospace"}}
|
setOptions={{ fontFamily: "monospace" }}
|
||||||
height={height ?? "100%"}
|
height={height ?? "100%"}
|
||||||
highlightActiveLine={true}
|
highlightActiveLine={true}
|
||||||
showPrintMargin={false}
|
showPrintMargin={false}
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,15 @@ export default function NodeToolbarComponent({
|
||||||
break;
|
break;
|
||||||
case "ungroup":
|
case "ungroup":
|
||||||
takeSnapshot();
|
takeSnapshot();
|
||||||
expandGroupNode(data.id, updateFlowPosition(position, data.node?.flow!), data.node!.template, nodes, edges, setNodes, setEdges);
|
expandGroupNode(
|
||||||
|
data.id,
|
||||||
|
updateFlowPosition(position, data.node?.flow!),
|
||||||
|
data.node!.template,
|
||||||
|
nodes,
|
||||||
|
edges,
|
||||||
|
setNodes,
|
||||||
|
setEdges
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case "override":
|
case "override":
|
||||||
setShowOverrideModal(true);
|
setShowOverrideModal(true);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { AxiosError } from "axios";
|
import { AxiosError } from "axios";
|
||||||
|
import { cloneDeep } from "lodash";
|
||||||
import { Edge, Node, Viewport, XYPosition } from "reactflow";
|
import { Edge, Node, Viewport, XYPosition } from "reactflow";
|
||||||
import { create } from "zustand";
|
import { create } from "zustand";
|
||||||
import {
|
import {
|
||||||
|
|
@ -24,7 +25,6 @@ import useAlertStore from "./alertStore";
|
||||||
import { useDarkStore } from "./darkStore";
|
import { useDarkStore } from "./darkStore";
|
||||||
import useFlowStore from "./flowStore";
|
import useFlowStore from "./flowStore";
|
||||||
import { useTypesStore } from "./typesStore";
|
import { useTypesStore } from "./typesStore";
|
||||||
import { cloneDeep } from "lodash";
|
|
||||||
|
|
||||||
let saveTimeoutId: NodeJS.Timeout | null = null;
|
let saveTimeoutId: NodeJS.Timeout | null = null;
|
||||||
|
|
||||||
|
|
@ -330,7 +330,10 @@ const useFlowsManagerStore = create<FlowsManagerStoreType>((set, get) => ({
|
||||||
const currentFlowId = get().currentFlowId;
|
const currentFlowId = get().currentFlowId;
|
||||||
// push the current graph to the past state
|
// push the current graph to the past state
|
||||||
const flowStore = useFlowStore.getState();
|
const flowStore = useFlowStore.getState();
|
||||||
const newState = {nodes: cloneDeep(flowStore.nodes), edges: cloneDeep(flowStore.edges)};
|
const newState = {
|
||||||
|
nodes: cloneDeep(flowStore.nodes),
|
||||||
|
edges: cloneDeep(flowStore.edges),
|
||||||
|
};
|
||||||
const pastLength = past[currentFlowId]?.length ?? 0;
|
const pastLength = past[currentFlowId]?.length ?? 0;
|
||||||
if (
|
if (
|
||||||
pastLength > 0 &&
|
pastLength > 0 &&
|
||||||
|
|
|
||||||
|
|
@ -651,13 +651,19 @@ export function updateFlowPosition(NewPosition: XYPosition, flow: FlowType) {
|
||||||
x: NewPosition.x - middlePoint.x,
|
x: NewPosition.x - middlePoint.x,
|
||||||
y: NewPosition.y - middlePoint.y,
|
y: NewPosition.y - middlePoint.y,
|
||||||
};
|
};
|
||||||
return {...flow, data: {...flow.data!, nodes: flow.data!.nodes.map((node) => ({
|
return {
|
||||||
...node,
|
...flow,
|
||||||
position: {
|
data: {
|
||||||
x: node.position.x + deltaPosition.x,
|
...flow.data!,
|
||||||
y: node.position.y + deltaPosition.y,
|
nodes: flow.data!.nodes.map((node) => ({
|
||||||
|
...node,
|
||||||
|
position: {
|
||||||
|
x: node.position.x + deltaPosition.x,
|
||||||
|
y: node.position.y + deltaPosition.y,
|
||||||
|
},
|
||||||
|
})),
|
||||||
},
|
},
|
||||||
}))}};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function concatFlows(
|
export function concatFlows(
|
||||||
|
|
@ -939,7 +945,7 @@ export function expandGroupNode(
|
||||||
nodes: Node[],
|
nodes: Node[],
|
||||||
edges: Edge[],
|
edges: Edge[],
|
||||||
setNodes: (update: Node[] | ((oldState: Node[]) => Node[])) => void,
|
setNodes: (update: Node[] | ((oldState: Node[]) => Node[])) => void,
|
||||||
setEdges: (update: Edge[] | ((oldState: Edge[]) => Edge[])) => void,
|
setEdges: (update: Edge[] | ((oldState: Edge[]) => Edge[])) => void
|
||||||
) {
|
) {
|
||||||
const idsMap = updateIds(flow!.data!);
|
const idsMap = updateIds(flow!.data!);
|
||||||
updateProxyIdsOnTemplate(template, idsMap);
|
updateProxyIdsOnTemplate(template, idsMap);
|
||||||
|
|
@ -1024,14 +1030,9 @@ export function expandGroupNode(
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const filteredNodes = [
|
const filteredNodes = [...nodes.filter((n) => n.id !== id), ...gNodes];
|
||||||
...nodes.filter((n) => n.id !== id),
|
|
||||||
...gNodes,
|
|
||||||
];
|
|
||||||
const filteredEdges = [
|
const filteredEdges = [
|
||||||
...edges.filter(
|
...edges.filter((e) => e.target !== id && e.source !== id),
|
||||||
(e) => e.target !== id && e.source !== id
|
|
||||||
),
|
|
||||||
...gEdges,
|
...gEdges,
|
||||||
...updatedEdges,
|
...updatedEdges,
|
||||||
];
|
];
|
||||||
|
|
@ -1067,7 +1068,7 @@ export function createFlowComponent(
|
||||||
edges: [],
|
edges: [],
|
||||||
nodes: [
|
nodes: [
|
||||||
{
|
{
|
||||||
data: {...nodeData, node: {...nodeData.node, official: false}},
|
data: { ...nodeData, node: { ...nodeData.node, official: false } },
|
||||||
id: nodeData.id,
|
id: nodeData.id,
|
||||||
position: { x: 0, y: 0 },
|
position: { x: 0, y: 0 },
|
||||||
type: "genericNode",
|
type: "genericNode",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue