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(
|
||||
<span className={cn(frozen ? "text-ice" : "")}>{name}</span>,
|
||||
);
|
||||
return displayProxy(
|
||||
<span className={cn(frozen ? "text-ice" : "")}>{name}</span>,
|
||||
);
|
||||
|
||||
// ! DEACTIVATED UNTIL BETTER IMPLEMENTATION
|
||||
// return (
|
||||
|
|
|
|||
|
|
@ -90,10 +90,14 @@ export default function ParameterComponent({
|
|||
|
||||
let flowPoolId = data.id;
|
||||
let internalOutputName = outputName;
|
||||
|
||||
if(data.node?.flow && outputProxy){
|
||||
const realOutput = getGroupOutputNodeId(data.node.flow, outputProxy.name, outputProxy.id)
|
||||
if(realOutput){
|
||||
|
||||
if (data.node?.flow && outputProxy) {
|
||||
const realOutput = getGroupOutputNodeId(
|
||||
data.node.flow,
|
||||
outputProxy.name,
|
||||
outputProxy.id,
|
||||
);
|
||||
if (realOutput) {
|
||||
flowPoolId = realOutput.id;
|
||||
internalOutputName = realOutput.outputName;
|
||||
}
|
||||
|
|
@ -102,16 +106,21 @@ export default function ParameterComponent({
|
|||
const flowPoolNode = (flowPool[flowPoolId] ?? [])[
|
||||
(flowPool[flowPoolId]?.length ?? 1) - 1
|
||||
];
|
||||
|
||||
const displayOutputPreview = !!flowPool[flowPoolId] && logHasMessage(flowPoolNode?.data,internalOutputName);
|
||||
|
||||
const unknownOutput = logTypeIsUnknown(flowPoolNode?.data,internalOutputName);
|
||||
const errorOutput = logTypeIsError(flowPoolNode?.data,internalOutputName);
|
||||
|
||||
const displayOutputPreview =
|
||||
!!flowPool[flowPoolId] &&
|
||||
logHasMessage(flowPoolNode?.data, internalOutputName);
|
||||
|
||||
const unknownOutput = logTypeIsUnknown(
|
||||
flowPoolNode?.data,
|
||||
internalOutputName,
|
||||
);
|
||||
const errorOutput = logTypeIsError(flowPoolNode?.data, internalOutputName);
|
||||
|
||||
if (outputProxy) {
|
||||
console.log(logHasMessage(flowPoolNode?.data,internalOutputName))
|
||||
console.log(logHasMessage(flowPoolNode?.data, internalOutputName));
|
||||
}
|
||||
|
||||
|
||||
const preventDefault = true;
|
||||
|
||||
function handleOutputWShortcut() {
|
||||
|
|
@ -264,7 +273,7 @@ export default function ParameterComponent({
|
|||
className={
|
||||
"relative mt-1 flex w-full flex-wrap items-center justify-between bg-muted px-5 py-2" +
|
||||
((name === "code" && type === "code") ||
|
||||
(name.includes("code") && proxy)
|
||||
(name.includes("code") && proxy)
|
||||
? " hidden"
|
||||
: "")
|
||||
}
|
||||
|
|
@ -285,7 +294,10 @@ export default function ParameterComponent({
|
|||
data-testid={`output-inspection-${title.toLowerCase()}`}
|
||||
>
|
||||
<IconComponent
|
||||
className={cn("h-4 w-4", disabledOutput ? "text-muted-foreground" : "")}
|
||||
className={cn(
|
||||
"h-4 w-4",
|
||||
disabledOutput ? "text-muted-foreground" : "",
|
||||
)}
|
||||
strokeWidth={1.5}
|
||||
name={data.node?.outputs![index].hidden ? "EyeOff" : "Eye"}
|
||||
/>
|
||||
|
|
@ -404,7 +416,7 @@ export default function ParameterComponent({
|
|||
disabled={disabled}
|
||||
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}
|
||||
value={
|
||||
!data.node!.template[name]?.value ||
|
||||
data.node!.template[name]?.value?.toString() === "{}"
|
||||
data.node!.template[name]?.value?.toString() === "{}"
|
||||
? {}
|
||||
: data.node!.template[name]?.value
|
||||
}
|
||||
|
|
@ -636,7 +648,7 @@ export default function ParameterComponent({
|
|||
editNode={false}
|
||||
value={
|
||||
data.node!.template[name]?.value?.length === 0 ||
|
||||
!data.node!.template[name]?.value
|
||||
!data.node!.template[name]?.value
|
||||
? [{ "": "" }]
|
||||
: convertObjToArray(data.node!.template[name]?.value, type!)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,12 @@ const useCheckCodeValidity = (
|
|||
);
|
||||
setIsUserEdited(data.node?.edited ?? false);
|
||||
// template.code can be undefined
|
||||
}, [data.node?.template?.code?.value, templates, setIsOutdated, setIsUserEdited]);
|
||||
}, [
|
||||
data.node?.template?.code?.value,
|
||||
templates,
|
||||
setIsOutdated,
|
||||
setIsUserEdited,
|
||||
]);
|
||||
};
|
||||
|
||||
export default useCheckCodeValidity;
|
||||
|
|
|
|||
|
|
@ -447,8 +447,9 @@ export default function NodeToolbarComponent({
|
|||
side="top"
|
||||
>
|
||||
<button
|
||||
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`}
|
||||
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`}
|
||||
onClick={() => {
|
||||
setShowModalAdvanced(true);
|
||||
}}
|
||||
|
|
@ -477,42 +478,44 @@ export default function NodeToolbarComponent({
|
|||
<IconComponent name="SaveAll" className="h-4 w-4" />
|
||||
</button>
|
||||
</ShadTooltip>*/}
|
||||
{!data.node?.flow && <ShadTooltip
|
||||
content={displayShortcut(
|
||||
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",
|
||||
{!data.node?.flow && (
|
||||
<ShadTooltip
|
||||
content={displayShortcut(
|
||||
shortcuts.find(
|
||||
({ name }) => name.split(" ")[0].toLowerCase() === "freeze",
|
||||
)!,
|
||||
)}
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
setNode(data.id, (old) => ({
|
||||
...old,
|
||||
data: {
|
||||
...old.data,
|
||||
node: {
|
||||
...old.data.node,
|
||||
frozen: old.data?.node?.frozen ? false : true,
|
||||
},
|
||||
},
|
||||
}));
|
||||
}}
|
||||
side="top"
|
||||
>
|
||||
<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
|
||||
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",
|
||||
)}
|
||||
/>
|
||||
</button>
|
||||
</ShadTooltip>}
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
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">
|
||||
<button
|
||||
|
|
@ -682,17 +685,19 @@ export default function NodeToolbarComponent({
|
|||
/>
|
||||
</SelectItem>
|
||||
)}
|
||||
{!data.node?.flow&&<SelectItem value="freeze">
|
||||
<ToolbarSelectItem
|
||||
shortcut={
|
||||
shortcuts.find((obj) => obj.name === "Freeze")?.shortcut!
|
||||
}
|
||||
value={"Freeze"}
|
||||
icon={"Snowflake"}
|
||||
dataTestId="group-button-modal"
|
||||
style={`${frozen ? " text-ice" : ""} transition-all`}
|
||||
/>
|
||||
</SelectItem>}
|
||||
{!data.node?.flow && (
|
||||
<SelectItem value="freeze">
|
||||
<ToolbarSelectItem
|
||||
shortcut={
|
||||
shortcuts.find((obj) => obj.name === "Freeze")?.shortcut!
|
||||
}
|
||||
value={"Freeze"}
|
||||
icon={"Snowflake"}
|
||||
dataTestId="group-button-modal"
|
||||
style={`${frozen ? " text-ice" : ""} transition-all`}
|
||||
/>
|
||||
</SelectItem>
|
||||
)}
|
||||
<SelectItem value="Download">
|
||||
<ToolbarSelectItem
|
||||
shortcut={
|
||||
|
|
@ -716,8 +721,9 @@ export default function NodeToolbarComponent({
|
|||
/>{" "}
|
||||
<span className="">Delete</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
|
||||
name="Delete"
|
||||
|
|
|
|||
|
|
@ -295,11 +295,7 @@ async function buildVertex({
|
|||
);
|
||||
stopBuild();
|
||||
onBuildUpdate(buildData, BuildStatus.ERROR);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
} else {
|
||||
onBuildUpdate(buildData, BuildStatus.BUILT);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,8 +98,7 @@ export function cleanEdges(nodes: NodeType[], edges: Edge[]) {
|
|||
if (scapedJSONStringfy(id) !== sourceHandle) {
|
||||
newEdges = newEdges.filter((e) => e.id !== edge.id);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
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){
|
||||
let node:NodeType|undefined = flow.data?.nodes.find((n) => n.id === p_node_id);
|
||||
if(!node) return;
|
||||
if(node.data.node?.flow){
|
||||
export function getGroupOutputNodeId(
|
||||
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.data.node?.flow) {
|
||||
let output = node.data.node.outputs?.find((o) => o.name === p_name);
|
||||
if(output && output.proxy){
|
||||
return getGroupOutputNodeId(node.data.node.flow,output.proxy.name,output.proxy.id);
|
||||
if (output && output.proxy) {
|
||||
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;
|
||||
}
|
||||
|
||||
export const logHasMessage = (data: VertexDataTypeAPI,outputName:string|undefined) => {
|
||||
export const logHasMessage = (
|
||||
data: VertexDataTypeAPI,
|
||||
outputName: string | undefined,
|
||||
) => {
|
||||
if (!outputName) return;
|
||||
const logs = data?.logs[outputName];
|
||||
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;
|
||||
const logs = data?.logs[outputName];
|
||||
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;
|
||||
const logs = data?.logs[outputName];
|
||||
if (Array.isArray(logs) && logs.length > 1) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue