From e1bd6156f7af9606261b82e014b0699689c8acf5 Mon Sep 17 00:00:00 2001 From: Andres Vallecilla Date: Wed, 19 Jun 2024 16:04:28 -0500 Subject: [PATCH] perf: adjust with templates --- .env.production | 2 +- src/components/Services/DtsViewEdit.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.env.production b/.env.production index 0f68e67e..f2d8b0c7 100644 --- a/.env.production +++ b/.env.production @@ -8,4 +8,4 @@ KEYCLOAK_PRES_REQ_CONF_ID="showcase-person" # Template repo TEMPLATE_DIR=2060-io/dashboard-templates TEMPLATE_BRANCH=main -TEMPLATE_SCHEMA_DIR=Fastbot/schema.yml \ No newline at end of file +TEMPLATE_SCHEMA_DIR=Fastbot/schema_dir.json \ No newline at end of file diff --git a/src/components/Services/DtsViewEdit.tsx b/src/components/Services/DtsViewEdit.tsx index 6da8a35b..872facf2 100644 --- a/src/components/Services/DtsViewEdit.tsx +++ b/src/components/Services/DtsViewEdit.tsx @@ -69,7 +69,7 @@ function DtsViewEdit() { const checkConfigStructure = async (e: ChangeEvent) =>{ setDtsVO({...dtsVO, config: e.target.value}); try { - const file: SchemaConfig = load(await readGithubValue(`${process.env.TEMPLATE_DIR}/${process.env.TEMPLATE_BRANCH}/${process.env.TEMPLATE_SCHEMA_DIR}`)) as SchemaConfig; + const file: SchemaConfig = JSON.parse(await readGithubValue(`${process.env.TEMPLATE_DIR}/${process.env.TEMPLATE_BRANCH}/${process.env.TEMPLATE_SCHEMA_DIR}`)) as SchemaConfig; if(file && file.config && typeof file.config === 'object'){ const ajv = new Ajv(); @@ -93,7 +93,7 @@ function DtsViewEdit() { try { const response = await fetch(`https://api.github.com/repos/${process.env.TEMPLATE_DIR??''}/contents`); const data: ApiGitHub[] = await response.json(); - const folders = data.filter((item:ApiGitHub) => item.type === 'dir'); + const folders = data.filter((item:ApiGitHub) => item.type === 'dir' && !item.name.startsWith('.')); let templates: TemplateInfo[] = folders.map(folder => ({ name: folder.name,