Apply Prettier formatting
This commit is contained in:
parent
47c0522c7b
commit
68e609fe34
7 changed files with 122 additions and 85 deletions
|
|
@ -92,7 +92,11 @@ export default function ParameterComponent({
|
||||||
let internalOutputName = outputName;
|
let internalOutputName = outputName;
|
||||||
|
|
||||||
if (data.node?.flow && outputProxy) {
|
if (data.node?.flow && outputProxy) {
|
||||||
const realOutput = getGroupOutputNodeId(data.node.flow, outputProxy.name, outputProxy.id)
|
const realOutput = getGroupOutputNodeId(
|
||||||
|
data.node.flow,
|
||||||
|
outputProxy.name,
|
||||||
|
outputProxy.id,
|
||||||
|
);
|
||||||
if (realOutput) {
|
if (realOutput) {
|
||||||
flowPoolId = realOutput.id;
|
flowPoolId = realOutput.id;
|
||||||
internalOutputName = realOutput.outputName;
|
internalOutputName = realOutput.outputName;
|
||||||
|
|
@ -103,13 +107,18 @@ export default function ParameterComponent({
|
||||||
(flowPool[flowPoolId]?.length ?? 1) - 1
|
(flowPool[flowPoolId]?.length ?? 1) - 1
|
||||||
];
|
];
|
||||||
|
|
||||||
const displayOutputPreview = !!flowPool[flowPoolId] && logHasMessage(flowPoolNode?.data,internalOutputName);
|
const displayOutputPreview =
|
||||||
|
!!flowPool[flowPoolId] &&
|
||||||
|
logHasMessage(flowPoolNode?.data, internalOutputName);
|
||||||
|
|
||||||
const unknownOutput = logTypeIsUnknown(flowPoolNode?.data,internalOutputName);
|
const unknownOutput = logTypeIsUnknown(
|
||||||
|
flowPoolNode?.data,
|
||||||
|
internalOutputName,
|
||||||
|
);
|
||||||
const errorOutput = logTypeIsError(flowPoolNode?.data, internalOutputName);
|
const errorOutput = logTypeIsError(flowPoolNode?.data, internalOutputName);
|
||||||
|
|
||||||
if (outputProxy) {
|
if (outputProxy) {
|
||||||
console.log(logHasMessage(flowPoolNode?.data,internalOutputName))
|
console.log(logHasMessage(flowPoolNode?.data, internalOutputName));
|
||||||
}
|
}
|
||||||
|
|
||||||
const preventDefault = true;
|
const preventDefault = true;
|
||||||
|
|
@ -285,7 +294,10 @@ export default function ParameterComponent({
|
||||||
data-testid={`output-inspection-${title.toLowerCase()}`}
|
data-testid={`output-inspection-${title.toLowerCase()}`}
|
||||||
>
|
>
|
||||||
<IconComponent
|
<IconComponent
|
||||||
className={cn("h-4 w-4", disabledOutput ? "text-muted-foreground" : "")}
|
className={cn(
|
||||||
|
"h-4 w-4",
|
||||||
|
disabledOutput ? "text-muted-foreground" : "",
|
||||||
|
)}
|
||||||
strokeWidth={1.5}
|
strokeWidth={1.5}
|
||||||
name={data.node?.outputs![index].hidden ? "EyeOff" : "Eye"}
|
name={data.node?.outputs![index].hidden ? "EyeOff" : "Eye"}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,12 @@ const useCheckCodeValidity = (
|
||||||
);
|
);
|
||||||
setIsUserEdited(data.node?.edited ?? false);
|
setIsUserEdited(data.node?.edited ?? false);
|
||||||
// template.code can be undefined
|
// template.code can be undefined
|
||||||
}, [data.node?.template?.code?.value, templates, setIsOutdated, setIsUserEdited]);
|
}, [
|
||||||
|
data.node?.template?.code?.value,
|
||||||
|
templates,
|
||||||
|
setIsOutdated,
|
||||||
|
setIsUserEdited,
|
||||||
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default useCheckCodeValidity;
|
export default useCheckCodeValidity;
|
||||||
|
|
|
||||||
|
|
@ -447,7 +447,8 @@ export default function NodeToolbarComponent({
|
||||||
side="top"
|
side="top"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
className={`${isGroup ? "rounded-l-md" : ""
|
className={`${
|
||||||
|
isGroup ? "rounded-l-md" : ""
|
||||||
} relative -ml-px inline-flex items-center bg-background px-2 py-2 text-foreground shadow-md ring-1 ring-inset ring-ring transition-all duration-500 ease-in-out hover:bg-muted focus:z-10`}
|
} relative -ml-px inline-flex items-center bg-background px-2 py-2 text-foreground shadow-md ring-1 ring-inset ring-ring transition-all duration-500 ease-in-out hover:bg-muted focus:z-10`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setShowModalAdvanced(true);
|
setShowModalAdvanced(true);
|
||||||
|
|
@ -477,7 +478,8 @@ export default function NodeToolbarComponent({
|
||||||
<IconComponent name="SaveAll" className="h-4 w-4" />
|
<IconComponent name="SaveAll" className="h-4 w-4" />
|
||||||
</button>
|
</button>
|
||||||
</ShadTooltip>*/}
|
</ShadTooltip>*/}
|
||||||
{!data.node?.flow && <ShadTooltip
|
{!data.node?.flow && (
|
||||||
|
<ShadTooltip
|
||||||
content={displayShortcut(
|
content={displayShortcut(
|
||||||
shortcuts.find(
|
shortcuts.find(
|
||||||
({ name }) => name.split(" ")[0].toLowerCase() === "freeze",
|
({ name }) => name.split(" ")[0].toLowerCase() === "freeze",
|
||||||
|
|
@ -512,7 +514,8 @@ export default function NodeToolbarComponent({
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
</ShadTooltip>}
|
</ShadTooltip>
|
||||||
|
)}
|
||||||
|
|
||||||
{/*<ShadTooltip content={"Duplicate"} side="top">
|
{/*<ShadTooltip content={"Duplicate"} side="top">
|
||||||
<button
|
<button
|
||||||
|
|
@ -682,7 +685,8 @@ export default function NodeToolbarComponent({
|
||||||
/>
|
/>
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
)}
|
)}
|
||||||
{!data.node?.flow&&<SelectItem value="freeze">
|
{!data.node?.flow && (
|
||||||
|
<SelectItem value="freeze">
|
||||||
<ToolbarSelectItem
|
<ToolbarSelectItem
|
||||||
shortcut={
|
shortcut={
|
||||||
shortcuts.find((obj) => obj.name === "Freeze")?.shortcut!
|
shortcuts.find((obj) => obj.name === "Freeze")?.shortcut!
|
||||||
|
|
@ -692,7 +696,8 @@ export default function NodeToolbarComponent({
|
||||||
dataTestId="group-button-modal"
|
dataTestId="group-button-modal"
|
||||||
style={`${frozen ? " text-ice" : ""} transition-all`}
|
style={`${frozen ? " text-ice" : ""} transition-all`}
|
||||||
/>
|
/>
|
||||||
</SelectItem>}
|
</SelectItem>
|
||||||
|
)}
|
||||||
<SelectItem value="Download">
|
<SelectItem value="Download">
|
||||||
<ToolbarSelectItem
|
<ToolbarSelectItem
|
||||||
shortcut={
|
shortcut={
|
||||||
|
|
@ -716,7 +721,8 @@ export default function NodeToolbarComponent({
|
||||||
/>{" "}
|
/>{" "}
|
||||||
<span className="">Delete</span>{" "}
|
<span className="">Delete</span>{" "}
|
||||||
<span
|
<span
|
||||||
className={`absolute right-2 top-2 flex items-center justify-center rounded-sm px-1 py-[0.2] ${deleteIsFocus ? " " : "bg-muted"
|
className={`absolute right-2 top-2 flex items-center justify-center rounded-sm px-1 py-[0.2] ${
|
||||||
|
deleteIsFocus ? " " : "bg-muted"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<IconComponent
|
<IconComponent
|
||||||
|
|
|
||||||
|
|
@ -295,11 +295,7 @@ async function buildVertex({
|
||||||
);
|
);
|
||||||
stopBuild();
|
stopBuild();
|
||||||
onBuildUpdate(buildData, BuildStatus.ERROR);
|
onBuildUpdate(buildData, BuildStatus.ERROR);
|
||||||
|
} else {
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
onBuildUpdate(buildData, BuildStatus.BUILT);
|
onBuildUpdate(buildData, BuildStatus.BUILT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,8 +98,7 @@ export function cleanEdges(nodes: NodeType[], edges: Edge[]) {
|
||||||
if (scapedJSONStringfy(id) !== sourceHandle) {
|
if (scapedJSONStringfy(id) !== sourceHandle) {
|
||||||
newEdges = newEdges.filter((e) => e.id !== edge.id);
|
newEdges = newEdges.filter((e) => e.id !== edge.id);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
newEdges = newEdges.filter((e) => e.id !== edge.id);
|
newEdges = newEdges.filter((e) => e.id !== edge.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1491,13 +1490,23 @@ export function updateGroupRecursion(groupNode: NodeType, edges: Edge[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getGroupOutputNodeId(flow:FlowType,p_name:string,p_node_id:string){
|
export function getGroupOutputNodeId(
|
||||||
let node:NodeType|undefined = flow.data?.nodes.find((n) => n.id === p_node_id);
|
flow: FlowType,
|
||||||
|
p_name: string,
|
||||||
|
p_node_id: string,
|
||||||
|
) {
|
||||||
|
let node: NodeType | undefined = flow.data?.nodes.find(
|
||||||
|
(n) => n.id === p_node_id,
|
||||||
|
);
|
||||||
if (!node) return;
|
if (!node) return;
|
||||||
if (node.data.node?.flow) {
|
if (node.data.node?.flow) {
|
||||||
let output = node.data.node.outputs?.find((o) => o.name === p_name);
|
let output = node.data.node.outputs?.find((o) => o.name === p_name);
|
||||||
if (output && output.proxy) {
|
if (output && output.proxy) {
|
||||||
return getGroupOutputNodeId(node.data.node.flow,output.proxy.name,output.proxy.id);
|
return getGroupOutputNodeId(
|
||||||
|
node.data.node.flow,
|
||||||
|
output.proxy.name,
|
||||||
|
output.proxy.id,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { id: node.id, outputName: p_name };
|
return { id: node.id, outputName: p_name };
|
||||||
|
|
|
||||||
|
|
@ -425,7 +425,10 @@ export function messagesSorter(a: any, b: any) {
|
||||||
return orderA - orderB;
|
return orderA - orderB;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const logHasMessage = (data: VertexDataTypeAPI,outputName:string|undefined) => {
|
export const logHasMessage = (
|
||||||
|
data: VertexDataTypeAPI,
|
||||||
|
outputName: string | undefined,
|
||||||
|
) => {
|
||||||
if (!outputName) return;
|
if (!outputName) return;
|
||||||
const logs = data?.logs[outputName];
|
const logs = data?.logs[outputName];
|
||||||
if (Array.isArray(logs) && logs.length > 1) {
|
if (Array.isArray(logs) && logs.length > 1) {
|
||||||
|
|
@ -435,7 +438,10 @@ export const logHasMessage = (data: VertexDataTypeAPI,outputName:string|undefine
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const logTypeIsUnknown = (data: VertexDataTypeAPI,outputName:string|undefined) => {
|
export const logTypeIsUnknown = (
|
||||||
|
data: VertexDataTypeAPI,
|
||||||
|
outputName: string | undefined,
|
||||||
|
) => {
|
||||||
if (!outputName) return;
|
if (!outputName) return;
|
||||||
const logs = data?.logs[outputName];
|
const logs = data?.logs[outputName];
|
||||||
if (Array.isArray(logs) && logs.length > 1) {
|
if (Array.isArray(logs) && logs.length > 1) {
|
||||||
|
|
@ -445,7 +451,10 @@ export const logTypeIsUnknown = (data: VertexDataTypeAPI,outputName:string|undef
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const logTypeIsError = (data: VertexDataTypeAPI,outputName:string|undefined) => {
|
export const logTypeIsError = (
|
||||||
|
data: VertexDataTypeAPI,
|
||||||
|
outputName: string | undefined,
|
||||||
|
) => {
|
||||||
if (!outputName) return;
|
if (!outputName) return;
|
||||||
const logs = data?.logs[outputName];
|
const logs = data?.logs[outputName];
|
||||||
if (Array.isArray(logs) && logs.length > 1) {
|
if (Array.isArray(logs) && logs.length > 1) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue