diff --git a/src/frontend/src/utils/reactflowUtils.ts b/src/frontend/src/utils/reactflowUtils.ts index b379b445e..37b71ea15 100644 --- a/src/frontend/src/utils/reactflowUtils.ts +++ b/src/frontend/src/utils/reactflowUtils.ts @@ -16,6 +16,8 @@ import { specialCharsRegex, } from "../constants/constants"; import { downloadFlowsFromDatabase } from "../controllers/API"; +import getFieldTitle from "../customNodes/utils/get-field-title"; +import { DESCRIPTIONS } from "../flow_constants"; import { APIClassType, APIKindType, @@ -37,8 +39,6 @@ import { updateEdgesHandleIdsType, } from "../types/utils/reactflowUtils"; import { createRandomKey, toTitleCase } from "./utils"; -import { DESCRIPTIONS } from "../flow_constants"; -import getFieldTitle from "../customNodes/utils/get-field-title"; const uid = new ShortUniqueId({ length: 5 }); export function checkChatInput(nodes: Node[]) { @@ -350,12 +350,7 @@ export function updateEdges(edges: Edge[]) { } export function addVersionToDuplicates(flow: FlowType, flows: FlowType[]) { - console.log("flow", flow); - console.log("flows", flows); - const existingNames = flows - .filter((f) => f.folder_id === flow.folder_id) - .map((item) => item.name); - console.log("existingNames", existingNames); + const existingNames = flows.map((item) => item.name); let newName = flow.name; let count = 1; diff --git a/src/frontend/src/utils/utils.ts b/src/frontend/src/utils/utils.ts index b1f3f858e..1b75212b3 100644 --- a/src/frontend/src/utils/utils.ts +++ b/src/frontend/src/utils/utils.ts @@ -55,7 +55,7 @@ export function normalCaseToSnakeCase(str: string): string { export function toTitleCase( str: string | undefined, - isNodeField?: boolean + isNodeField?: boolean, ): string { if (!str) return ""; let result = str @@ -64,7 +64,7 @@ export function toTitleCase( if (isNodeField) return word; if (index === 0) { return checkUpperWords( - word[0].toUpperCase() + word.slice(1).toLowerCase() + word[0].toUpperCase() + word.slice(1).toLowerCase(), ); } return checkUpperWords(word.toLowerCase()); @@ -77,7 +77,7 @@ export function toTitleCase( if (isNodeField) return word; if (index === 0) { return checkUpperWords( - word[0].toUpperCase() + word.slice(1).toLowerCase() + word[0].toUpperCase() + word.slice(1).toLowerCase(), ); } return checkUpperWords(word.toLowerCase()); @@ -181,7 +181,7 @@ export function checkLocalStorageKey(key: string): boolean { export function IncrementObjectKey( object: object, - key: string + key: string, ): { newKey: string; increment: number } { let count = 1; const type = removeCountFromString(key); @@ -216,7 +216,7 @@ export function groupByFamily( data: APIDataType, baseClasses: string, left: boolean, - flow?: NodeType[] + flow?: NodeType[], ): groupedObjType[] { const baseClassesSet = new Set(baseClasses.split("\n")); let arrOfPossibleInputs: Array<{ @@ -242,7 +242,7 @@ export function groupByFamily( baseClassesSet.has(template.type)) || (template.input_types && template.input_types.some((inputType) => - baseClassesSet.has(inputType) + baseClassesSet.has(inputType), ))) ); }; @@ -262,7 +262,7 @@ export function groupByFamily( hasBaseClassInBaseClasses: foundNode?.hasBaseClassInBaseClasses || nodeData.node!.base_classes.some((baseClass) => - baseClassesSet.has(baseClass) + baseClassesSet.has(baseClass), ), //seta como anterior ou verifica se o node tem base class displayName: nodeData.node?.display_name, }); @@ -279,10 +279,10 @@ export function groupByFamily( if (!foundNode) { foundNode = { hasBaseClassInTemplate: Object.values(node!.template).some( - checkBaseClass + checkBaseClass, ), hasBaseClassInBaseClasses: node!.base_classes.some((baseClass) => - baseClassesSet.has(baseClass) + baseClassesSet.has(baseClass), ), displayName: node?.display_name, }; @@ -351,7 +351,7 @@ export function isTimeStampString(str: string): boolean { export function extractColumnsFromRows( rows: object[], - mode: "intersection" | "union" | "all" + mode: "intersection" | "union" | "all", ): (ColDef | ColGroupDef)[] { const columnsKeys: { [key: string]: ColDef | ColGroupDef } = {}; if (rows.length === 0) { @@ -360,7 +360,7 @@ export function extractColumnsFromRows( function intersection() { for (const key in rows[0]) { columnsKeys[key] = { - headerName: key, + headerName: toTitleCase(key), field: key, cellRenderer: TableAutoCellRender, filter: true, @@ -378,7 +378,7 @@ export function extractColumnsFromRows( for (const row of rows) { for (const key in row) { columnsKeys[key] = { - headerName: key, + headerName: toTitleCase(key), field: key, filter: true, cellRenderer: TableAutoCellRender,