Skip to content

Commit

Permalink
Merge pull request #3 from 2060-io/feat-schema
Browse files Browse the repository at this point in the history
perf: adjust with templates
  • Loading branch information
lotharking authored Jun 19, 2024
2 parents e112378 + e1bd615 commit b63ec07
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -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
TEMPLATE_SCHEMA_DIR=Fastbot/schema_dir.json
4 changes: 2 additions & 2 deletions src/components/Services/DtsViewEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function DtsViewEdit() {
const checkConfigStructure = async (e: ChangeEvent<HTMLTextAreaElement>) =>{
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();
Expand All @@ -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,
Expand Down

0 comments on commit b63ec07

Please sign in to comment.