From 6d64c44002689d0686cac8bdd15c0efe6984b492 Mon Sep 17 00:00:00 2001 From: Nathan Vieira Marcelino Date: Mon, 23 Oct 2023 07:02:32 -0300 Subject: [PATCH 01/10] fix: local forage key --- .../src/context/authentication/authentication.context.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/context/authentication/authentication.context.tsx b/frontend/src/context/authentication/authentication.context.tsx index d33d84fc..0b2af220 100644 --- a/frontend/src/context/authentication/authentication.context.tsx +++ b/frontend/src/context/authentication/authentication.context.tsx @@ -1,4 +1,3 @@ -import localforage from "localforage"; import React, { type ReactNode, useCallback, @@ -9,6 +8,7 @@ import React, { } from "react"; import { useNavigate } from "react-router-dom"; import { toast } from "react-toastify"; +import localForage from "services/config/localForage.config"; import { createCustomContext } from "utils"; import { postAuthLogin, postAuthRegister } from "./api"; @@ -54,7 +54,7 @@ export const AuthenticationProvider: React.FC<{ children: ReactNode }> = ({ const logout = useCallback(() => { localStorage.clear(); - void localforage.clear(); + void localForage.clear(); isLogged.current = false; setStore((store) => ({ ...store, From a72d4a4e119e95d3ec6c34485960e04be79470b4 Mon Sep 17 00:00:00 2001 From: Vinicius Vaz Date: Tue, 24 Oct 2023 11:11:33 -0300 Subject: [PATCH 02/10] fix default values in forms --- frontend/src/features/workflowEditor/utils/jsonSchema.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/src/features/workflowEditor/utils/jsonSchema.ts b/frontend/src/features/workflowEditor/utils/jsonSchema.ts index ed6c962d..8d9e32a2 100644 --- a/frontend/src/features/workflowEditor/utils/jsonSchema.ts +++ b/frontend/src/features/workflowEditor/utils/jsonSchema.ts @@ -96,6 +96,8 @@ export const extractDefaultValues = ( output[key] = value.default; } else if ("properties" in value) { output[key] = extractDefaultValues(value as any, output[key]); + } else { + output[key] = ""; } } } From 7575177393de8056f84065f30307fc98fb1a64e4 Mon Sep 17 00:00:00 2001 From: Vinicius Vaz Date: Wed, 25 Oct 2023 07:56:18 -0300 Subject: [PATCH 03/10] fix on change dayjs error for datetime objects --- frontend/src/components/DatetimeInput/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/DatetimeInput/index.tsx b/frontend/src/components/DatetimeInput/index.tsx index 859b59cc..8faf004f 100644 --- a/frontend/src/components/DatetimeInput/index.tsx +++ b/frontend/src/components/DatetimeInput/index.tsx @@ -51,7 +51,7 @@ function DatetimeInput({ format="DD/MM/YYYY HH:mm" value={dayjs(value)} onChange={(e) => { - onChange(dayjs(e).toISOString() as any); + e?.isValid() ? onChange(e.toISOString()) : onChange(null); }} {...rest} /> From 5a7e27feb0fa641a4c85fc605f0dfdb9ebbbb29d Mon Sep 17 00:00:00 2001 From: Vinicius Vaz Date: Wed, 25 Oct 2023 07:56:49 -0300 Subject: [PATCH 04/10] using regex to validate time and datetime objects --- .../SidebarForm/PieceForm/validation.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/validation.ts b/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/validation.ts index 4249994f..bef607c8 100644 --- a/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/validation.ts +++ b/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/validation.ts @@ -108,7 +108,7 @@ function getValidationValueBySchemaType(schema: any) { if (fromUpstream) { return yup.mixed().notRequired(); } - return yup.string().required(); + return yup.date().required(); }), }); } else if (schema.type === "string" && schema?.format === "time") { @@ -118,7 +118,13 @@ function getValidationValueBySchemaType(schema: any) { if (fromUpstream) { return yup.mixed().notRequired(); } - return yup.string().required(); + return yup + .string() + .required("Time is required") // Change the error message as needed + .test("valid-datetime", "Invalid time format", (value) => { + const timeRegex = /^\d{2}:\d{2}(:\d{2})?$/; + return timeRegex.test(value); + }); }), }); } else if (schema.type === "string" && schema?.format === "date-time") { @@ -128,7 +134,14 @@ function getValidationValueBySchemaType(schema: any) { if (fromUpstream) { return yup.mixed().notRequired(); } - return yup.string().required(); + return yup + .string() + .required("Datetime is required") // Change the error message as needed + .test("valid-datetime", "Invalid datetime format", (value) => { + const dateTimeRegex = + /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(?:\.\d{1,3})?)?Z?$/; + return dateTimeRegex.test(value); + }); }), }); } else if (schema.type === "string" && schema?.widget === "codeeditor") { From 287d8c12238725afab0d3ed534f71828eb345474 Mon Sep 17 00:00:00 2001 From: Vinicius Vaz Date: Wed, 25 Oct 2023 08:19:55 -0300 Subject: [PATCH 05/10] using schema required values in validation --- .../SidebarForm/PieceForm/validation.ts | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/validation.ts b/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/validation.ts index bef607c8..264be0e5 100644 --- a/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/validation.ts +++ b/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/validation.ts @@ -64,7 +64,7 @@ const validationObject = () => { }); }; -function getValidationValueBySchemaType(schema: any) { +function getValidationValueBySchemaType(schema: any, required: boolean) { let inputSchema; if (schema.type === "number" && !schema.format) { @@ -74,7 +74,7 @@ function getValidationValueBySchemaType(schema: any) { if (fromUpstream) { return yup.mixed().notRequired(); } - return yup.number().typeError("Must must be a number").required(); + return yup.number().typeError("Must must be a number").required(); // number is always required }), }); } else if (schema.type === "integer" && !schema.format) { @@ -88,7 +88,7 @@ function getValidationValueBySchemaType(schema: any) { .number() .integer() .typeError("Must must be a number") - .required(); + .required(); // number is always required }), }); } else if (schema.type === "boolean" && !schema.format) { @@ -98,7 +98,7 @@ function getValidationValueBySchemaType(schema: any) { if (fromUpstream) { return yup.mixed().notRequired(); } - return yup.boolean().required(); + return yup.boolean().required(); // boolean is always required }), }); } else if (schema.type === "string" && schema.format === "date") { @@ -108,7 +108,7 @@ function getValidationValueBySchemaType(schema: any) { if (fromUpstream) { return yup.mixed().notRequired(); } - return yup.date().required(); + return yup.date().required(); // date is always required }), }); } else if (schema.type === "string" && schema?.format === "time") { @@ -120,11 +120,11 @@ function getValidationValueBySchemaType(schema: any) { } return yup .string() - .required("Time is required") // Change the error message as needed + .required("Time is required") .test("valid-datetime", "Invalid time format", (value) => { const timeRegex = /^\d{2}:\d{2}(:\d{2})?$/; return timeRegex.test(value); - }); + }); // Time is always required }), }); } else if (schema.type === "string" && schema?.format === "date-time") { @@ -141,7 +141,7 @@ function getValidationValueBySchemaType(schema: any) { const dateTimeRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(?:\.\d{1,3})?)?Z?$/; return dateTimeRegex.test(value); - }); + }); // Datetime is always required }), }); } else if (schema.type === "string" && schema?.widget === "codeeditor") { @@ -151,7 +151,7 @@ function getValidationValueBySchemaType(schema: any) { if (fromUpstream) { return yup.mixed().notRequired(); } - return yup.string(); + return required ? yup.string().required() : yup.string(); }), }); } else if (schema.type === "string" && !schema.format) { @@ -161,7 +161,7 @@ function getValidationValueBySchemaType(schema: any) { if (fromUpstream) { return yup.mixed().notRequired(); } - return yup.string().required(); + return required ? yup.string().required() : yup.string(); }), }); } else if (schema.type === "object") { @@ -178,6 +178,8 @@ export function createInputsSchemaValidation(schema: any) { return yup.mixed().notRequired(); } + const requiredFields = schema?.required || []; + const validationSchema = Object.entries(schema.properties).reduce( (acc, cur: [string, any]) => { const [key, subSchema] = cur; @@ -189,14 +191,16 @@ export function createInputsSchemaValidation(schema: any) { const subItemSchemaName = subSchema.items.$ref.split("/").pop(); subItemSchema = schema.definitions?.[subItemSchemaName]; } + const required = true; // for arrays, we always require the value inputSchema = yup.object({ ...defaultValidation, value: yup .array() - .of(getValidationValueBySchemaType(subItemSchema) as any), + .of(getValidationValueBySchemaType(subItemSchema, required) as any), }); } else { - inputSchema = getValidationValueBySchemaType(subSchema); + const required = requiredFields.includes(key); + inputSchema = getValidationValueBySchemaType(subSchema, required); } return { ...acc, [key]: inputSchema }; From eaf53613ba81e35d74533c8ef151a15577d8a639 Mon Sep 17 00:00:00 2001 From: Vinicius Vaz Date: Wed, 25 Oct 2023 08:34:43 -0300 Subject: [PATCH 06/10] update default repo version --- docker-compose-dev.yaml | 2 +- rest/core/settings.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose-dev.yaml b/docker-compose-dev.yaml index c9696f06..c3038c99 100644 --- a/docker-compose-dev.yaml +++ b/docker-compose-dev.yaml @@ -309,7 +309,7 @@ services: - DOMINO_DB_HOST=domino_postgres - DOMINO_DB_PORT=5432 - DOMINO_DB_NAME=postgres - - DOMINO_DEFAULT_PIECES_REPOSITORY_VERSION=0.3.14 + - DOMINO_DEFAULT_PIECES_REPOSITORY_VERSION=0.4.2 - DOMINO_DEFAULT_PIECES_REPOSITORY_TOKEN=${DOMINO_DEFAULT_PIECES_REPOSITORY_TOKEN} - DOMINO_GITHUB_ACCESS_TOKEN_WORKFLOWS=${DOMINO_GITHUB_ACCESS_TOKEN_WORKFLOWS} - DOMINO_GITHUB_WORKFLOWS_REPOSITORY=${DOMINO_GITHUB_WORKFLOWS_REPOSITORY} diff --git a/rest/core/settings.py b/rest/core/settings.py index a093a293..b128bf38 100644 --- a/rest/core/settings.py +++ b/rest/core/settings.py @@ -50,7 +50,7 @@ class Settings(BaseSettings): # Default domino pieces repository DOMINO_DEFAULT_PIECES_REPOSITORY = os.environ.get('DOMINO_DEFAULT_PIECES_REPOSITORY', "Tauffer-Consulting/default_domino_pieces") - DOMINO_DEFAULT_PIECES_REPOSITORY_VERSION = os.environ.get('DOMINO_DEFAULT_PIECES_REPOSITORY_VERSION', "0.3.14") + DOMINO_DEFAULT_PIECES_REPOSITORY_VERSION = os.environ.get('DOMINO_DEFAULT_PIECES_REPOSITORY_VERSION', "0.4.2") DOMINO_DEFAULT_PIECES_REPOSITORY_SOURCE = os.environ.get('DOMINO_DEFAULT_PIECES_REPOSITORY_SOURCE', "github") DOMINO_DEFAULT_PIECES_REPOSITORY_TOKEN: EmptyStrToNone = os.environ.get('DOMINO_DEFAULT_PIECES_REPOSITORY_TOKEN', "") DOMINO_DEFAULT_PIECES_REPOSITORY_URL: str = os.environ.get('DOMINO_DEFAULT_PIECES_REPOSITORY_URL', 'https://github.com/Tauffer-Consulting/default_domino_pieces') From 9c106a50307f63e7a335a6b36679bc5112f785aa Mon Sep 17 00:00:00 2001 From: Vinicius Vaz Date: Wed, 25 Oct 2023 09:08:16 -0300 Subject: [PATCH 07/10] fix style of large upstream names --- .../SidebarForm/PieceForm/PieceFormItem/index.tsx | 2 +- .../workflowEditor/components/SidebarForm/index.tsx | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/PieceFormItem/index.tsx b/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/PieceFormItem/index.tsx index 8dfff74c..618da339 100644 --- a/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/PieceFormItem/index.tsx +++ b/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/PieceFormItem/index.tsx @@ -187,7 +187,7 @@ const PieceFormItem: React.FC = ({ alignItems="flex-start" sx={{ paddingTop: "10px" }} > - + {inputElement} diff --git a/frontend/src/features/workflowEditor/components/SidebarForm/index.tsx b/frontend/src/features/workflowEditor/components/SidebarForm/index.tsx index c47d304b..936a57f5 100644 --- a/frontend/src/features/workflowEditor/components/SidebarForm/index.tsx +++ b/frontend/src/features/workflowEditor/components/SidebarForm/index.tsx @@ -193,7 +193,13 @@ const SidebarPieceForm: React.FC = (props) => { -
+
Date: Wed, 25 Oct 2023 09:28:56 -0300 Subject: [PATCH 08/10] fix markdown task result --- .../WorkflowDetail/CustomTabMenu/TaskResult.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/features/workflows/components/WorkflowDetail/CustomTabMenu/TaskResult.tsx b/frontend/src/features/workflows/components/WorkflowDetail/CustomTabMenu/TaskResult.tsx index 0ef46f1f..85f1f785 100644 --- a/frontend/src/features/workflows/components/WorkflowDetail/CustomTabMenu/TaskResult.tsx +++ b/frontend/src/features/workflows/components/WorkflowDetail/CustomTabMenu/TaskResult.tsx @@ -28,7 +28,6 @@ export const TaskResult = (props: ITaskResultProps) => { if (!base64_content || !file_type) { return No content; } - switch (file_type) { case "txt": return
{window.atob(base64_content)}
; @@ -61,7 +60,12 @@ export const TaskResult = (props: ITaskResultProps) => { ); case "md": - return {window.atob(base64_content)}; + return ( +
+ {window.atob(base64_content)}; +
+ ); + case "pdf": return (
From e898e7a4e57f1e83b28f18f8edc9a86cc6126c2f Mon Sep 17 00:00:00 2001 From: Vinicius Vaz Date: Wed, 25 Oct 2023 09:54:32 -0300 Subject: [PATCH 09/10] fix node style in panel --- frontend/src/components/WorkflowPanel/RunNode/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/WorkflowPanel/RunNode/index.tsx b/frontend/src/components/WorkflowPanel/RunNode/index.tsx index b021a9ee..21c658c8 100644 --- a/frontend/src/components/WorkflowPanel/RunNode/index.tsx +++ b/frontend/src/components/WorkflowPanel/RunNode/index.tsx @@ -90,8 +90,9 @@ const RunNode = memo(({ id, data, selected }) => { flexDirection: "row", justifyContent: "center", alignItems: "center", - + textAlign: "center", position: "relative", + padding: 1, width: 150, height: 70, lineHeight: "60px", From 37c6d5d36274f727c57c20efca7ad68ed304446c Mon Sep 17 00:00:00 2001 From: Vinicius Vaz Date: Wed, 25 Oct 2023 10:13:03 -0300 Subject: [PATCH 10/10] add margin to icon --- frontend/src/components/WorkflowPanel/DefaultNode/index.tsx | 1 + frontend/src/components/WorkflowPanel/RunNode/index.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/frontend/src/components/WorkflowPanel/DefaultNode/index.tsx b/frontend/src/components/WorkflowPanel/DefaultNode/index.tsx index 420dcee7..6f351d66 100644 --- a/frontend/src/components/WorkflowPanel/DefaultNode/index.tsx +++ b/frontend/src/components/WorkflowPanel/DefaultNode/index.tsx @@ -114,6 +114,7 @@ export const CustomNode = memo(({ id, data, selected }) => { style: { width: "20px", height: "20px", + margin: "5px", ...data.style.iconStyle, }, }; diff --git a/frontend/src/components/WorkflowPanel/RunNode/index.tsx b/frontend/src/components/WorkflowPanel/RunNode/index.tsx index 21c658c8..6ee470b7 100644 --- a/frontend/src/components/WorkflowPanel/RunNode/index.tsx +++ b/frontend/src/components/WorkflowPanel/RunNode/index.tsx @@ -127,6 +127,7 @@ const RunNode = memo(({ id, data, selected }) => { style: { width: "20px", height: "20px", + margin: "5px", ...data.style.iconStyle, }, };