From 420ee7bcf48921911779682db8456c59827a6fc9 Mon Sep 17 00:00:00 2001 From: Phodal Huang Date: Sun, 12 Dec 2021 23:46:49 +0800 Subject: [PATCH] docs(transflow): replace transfunc.js with transflow.yaml --- examples/_quake/transfuncs.js | 26 -------------------------- quake_webapp/index.html | 4 +--- src/server/transflow_api.rs | 5 ++++- 3 files changed, 5 insertions(+), 30 deletions(-) diff --git a/examples/_quake/transfuncs.js b/examples/_quake/transfuncs.js index e9502e2b..e69de29b 100644 --- a/examples/_quake/transfuncs.js +++ b/examples/_quake/transfuncs.js @@ -1,26 +0,0 @@ -function from_todo_blog_to_quake_calendar(todos, blogs) { - let results = []; - for (let todo of todos) { - results.push({ - type: "todo", - id: todo.id, - title: todo.title, - content: todo.content, - created_date: todo.created_date, - updated_date: todo.updated_date - }) - } - - for (let blog of blogs) { - results.push({ - type: "blog", - id: blog.id, - title: blog.title, - content: blog.description, - created_date: blog.created_date, - created_date: blog.updated_date - }) - } - - return results; -} diff --git a/quake_webapp/index.html b/quake_webapp/index.html index bbc3a04d..ffbb473b 100644 --- a/quake_webapp/index.html +++ b/quake_webapp/index.html @@ -28,9 +28,7 @@
diff --git a/src/server/transflow_api.rs b/src/server/transflow_api.rs index eb93b818..0d85f86a 100644 --- a/src/server/transflow_api.rs +++ b/src/server/transflow_api.rs @@ -55,7 +55,10 @@ pub(crate) async fn translate( Ok(JavaScript(scripts)) } -/// saved transflow scripts +/// todo: load transflow from yaml files +/// 1. load yaml file with define +/// 2. generate js scripts +/// 3. create router #[get("/script")] pub(crate) async fn transfunc_script(config: &State) -> Option { let path = PathBuf::from(config.workspace.clone());