Apply Prettier formatting
This commit is contained in:
parent
47c0522c7b
commit
68e609fe34
7 changed files with 122 additions and 85 deletions
|
|
@ -38,9 +38,9 @@ export default function OutputComponent({
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return displayProxy(
|
return displayProxy(
|
||||||
<span className={cn(frozen ? "text-ice" : "")}>{name}</span>,
|
<span className={cn(frozen ? "text-ice" : "")}>{name}</span>,
|
||||||
);
|
);
|
||||||
|
|
||||||
// ! DEACTIVATED UNTIL BETTER IMPLEMENTATION
|
// ! DEACTIVATED UNTIL BETTER IMPLEMENTATION
|
||||||
// return (
|
// return (
|
||||||
|
|
|
||||||
|
|
@ -90,10 +90,14 @@ export default function ParameterComponent({
|
||||||
|
|
||||||
let flowPoolId = data.id;
|
let flowPoolId = data.id;
|
||||||
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(
|
||||||
if(realOutput){
|
data.node.flow,
|
||||||
|
outputProxy.name,
|
||||||
|
outputProxy.id,
|
||||||
|
);
|
||||||
|
if (realOutput) {
|
||||||
flowPoolId = realOutput.id;
|
flowPoolId = realOutput.id;
|
||||||
internalOutputName = realOutput.outputName;
|
internalOutputName = realOutput.outputName;
|
||||||
}
|
}
|
||||||
|
|
@ -102,16 +106,21 @@ export default function ParameterComponent({
|
||||||
const flowPoolNode = (flowPool[flowPoolId] ?? [])[
|
const flowPoolNode = (flowPool[flowPoolId] ?? [])[
|
||||||
(flowPool[flowPoolId]?.length ?? 1) - 1
|
(flowPool[flowPoolId]?.length ?? 1) - 1
|
||||||
];
|
];
|
||||||
|
|
||||||
const displayOutputPreview = !!flowPool[flowPoolId] && logHasMessage(flowPoolNode?.data,internalOutputName);
|
const displayOutputPreview =
|
||||||
|
!!flowPool[flowPoolId] &&
|
||||||
const unknownOutput = logTypeIsUnknown(flowPoolNode?.data,internalOutputName);
|
logHasMessage(flowPoolNode?.data, internalOutputName);
|
||||||
const errorOutput = logTypeIsError(flowPoolNode?.data,internalOutputName);
|
|
||||||
|
const unknownOutput = logTypeIsUnknown(
|
||||||
|
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;
|
||||||
|
|
||||||
function handleOutputWShortcut() {
|
function handleOutputWShortcut() {
|
||||||
|
|
@ -264,7 +273,7 @@ export default function ParameterComponent({
|
||||||
className={
|
className={
|
||||||
"relative mt-1 flex w-full flex-wrap items-center justify-between bg-muted px-5 py-2" +
|
"relative mt-1 flex w-full flex-wrap items-center justify-between bg-muted px-5 py-2" +
|
||||||
((name === "code" && type === "code") ||
|
((name === "code" && type === "code") ||
|
||||||
(name.includes("code") && proxy)
|
(name.includes("code") && proxy)
|
||||||
? " hidden"
|
? " hidden"
|
||||||
: "")
|
: "")
|
||||||
}
|
}
|
||||||
|
|
@ -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"}
|
||||||
/>
|
/>
|
||||||
|
|
@ -404,7 +416,7 @@ export default function ParameterComponent({
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
value={
|
value={
|
||||||
!data.node!.template[name]?.value ||
|
!data.node!.template[name]?.value ||
|
||||||
data.node!.template[name]?.value === ""
|
data.node!.template[name]?.value === ""
|
||||||
? [""]
|
? [""]
|
||||||
: data.node!.template[name]?.value
|
: data.node!.template[name]?.value
|
||||||
}
|
}
|
||||||
|
|
@ -619,7 +631,7 @@ export default function ParameterComponent({
|
||||||
editNode={false}
|
editNode={false}
|
||||||
value={
|
value={
|
||||||
!data.node!.template[name]?.value ||
|
!data.node!.template[name]?.value ||
|
||||||
data.node!.template[name]?.value?.toString() === "{}"
|
data.node!.template[name]?.value?.toString() === "{}"
|
||||||
? {}
|
? {}
|
||||||
: data.node!.template[name]?.value
|
: data.node!.template[name]?.value
|
||||||
}
|
}
|
||||||
|
|
@ -636,7 +648,7 @@ export default function ParameterComponent({
|
||||||
editNode={false}
|
editNode={false}
|
||||||
value={
|
value={
|
||||||
data.node!.template[name]?.value?.length === 0 ||
|
data.node!.template[name]?.value?.length === 0 ||
|
||||||
!data.node!.template[name]?.value
|
!data.node!.template[name]?.value
|
||||||
? [{ "": "" }]
|
? [{ "": "" }]
|
||||||
: convertObjToArray(data.node!.template[name]?.value, type!)
|
: convertObjToArray(data.node!.template[name]?.value, type!)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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,8 +447,9 @@ export default function NodeToolbarComponent({
|
||||||
side="top"
|
side="top"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
className={`${isGroup ? "rounded-l-md" : ""
|
className={`${
|
||||||
} 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`}
|
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`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setShowModalAdvanced(true);
|
setShowModalAdvanced(true);
|
||||||
}}
|
}}
|
||||||
|
|
@ -477,42 +478,44 @@ 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 && (
|
||||||
content={displayShortcut(
|
<ShadTooltip
|
||||||
shortcuts.find(
|
content={displayShortcut(
|
||||||
({ name }) => name.split(" ")[0].toLowerCase() === "freeze",
|
shortcuts.find(
|
||||||
)!,
|
({ name }) => name.split(" ")[0].toLowerCase() === "freeze",
|
||||||
)}
|
)!,
|
||||||
side="top"
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
className={classNames(
|
|
||||||
"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={(event) => {
|
side="top"
|
||||||
event.preventDefault();
|
|
||||||
setNode(data.id, (old) => ({
|
|
||||||
...old,
|
|
||||||
data: {
|
|
||||||
...old.data,
|
|
||||||
node: {
|
|
||||||
...old.data.node,
|
|
||||||
frozen: old.data?.node?.frozen ? false : true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<IconComponent
|
<button
|
||||||
name="Snowflake"
|
className={classNames(
|
||||||
className={cn(
|
"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",
|
||||||
"h-4 w-4 transition-all",
|
|
||||||
// TODO UPDATE THIS COLOR TO BE A VARIABLE
|
|
||||||
frozen ? "animate-wiggle text-ice" : "",
|
|
||||||
)}
|
)}
|
||||||
/>
|
onClick={(event) => {
|
||||||
</button>
|
event.preventDefault();
|
||||||
</ShadTooltip>}
|
setNode(data.id, (old) => ({
|
||||||
|
...old,
|
||||||
|
data: {
|
||||||
|
...old.data,
|
||||||
|
node: {
|
||||||
|
...old.data.node,
|
||||||
|
frozen: old.data?.node?.frozen ? false : true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IconComponent
|
||||||
|
name="Snowflake"
|
||||||
|
className={cn(
|
||||||
|
"h-4 w-4 transition-all",
|
||||||
|
// TODO UPDATE THIS COLOR TO BE A VARIABLE
|
||||||
|
frozen ? "animate-wiggle text-ice" : "",
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</ShadTooltip>
|
||||||
|
)}
|
||||||
|
|
||||||
{/*<ShadTooltip content={"Duplicate"} side="top">
|
{/*<ShadTooltip content={"Duplicate"} side="top">
|
||||||
<button
|
<button
|
||||||
|
|
@ -682,17 +685,19 @@ export default function NodeToolbarComponent({
|
||||||
/>
|
/>
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
)}
|
)}
|
||||||
{!data.node?.flow&&<SelectItem value="freeze">
|
{!data.node?.flow && (
|
||||||
<ToolbarSelectItem
|
<SelectItem value="freeze">
|
||||||
shortcut={
|
<ToolbarSelectItem
|
||||||
shortcuts.find((obj) => obj.name === "Freeze")?.shortcut!
|
shortcut={
|
||||||
}
|
shortcuts.find((obj) => obj.name === "Freeze")?.shortcut!
|
||||||
value={"Freeze"}
|
}
|
||||||
icon={"Snowflake"}
|
value={"Freeze"}
|
||||||
dataTestId="group-button-modal"
|
icon={"Snowflake"}
|
||||||
style={`${frozen ? " text-ice" : ""} transition-all`}
|
dataTestId="group-button-modal"
|
||||||
/>
|
style={`${frozen ? " text-ice" : ""} transition-all`}
|
||||||
</SelectItem>}
|
/>
|
||||||
|
</SelectItem>
|
||||||
|
)}
|
||||||
<SelectItem value="Download">
|
<SelectItem value="Download">
|
||||||
<ToolbarSelectItem
|
<ToolbarSelectItem
|
||||||
shortcut={
|
shortcut={
|
||||||
|
|
@ -716,8 +721,9 @@ 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
|
||||||
name="Delete"
|
name="Delete"
|
||||||
|
|
|
||||||
|
|
@ -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,14 +1490,24 @@ 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,
|
||||||
if(!node) return;
|
p_name: string,
|
||||||
if(node.data.node?.flow){
|
p_node_id: string,
|
||||||
|
) {
|
||||||
|
let node: NodeType | undefined = flow.data?.nodes.find(
|
||||||
|
(n) => n.id === p_node_id,
|
||||||
|
);
|
||||||
|
if (!node) return;
|
||||||
|
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