From f81bc4a79ac5759b39b6904ac784a6e3a4e8121e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Laiola=20Guimar=C3=A3es?= Date: Tue, 6 Jul 2021 09:30:23 -0300 Subject: [PATCH 1/6] .DS_Store ignored --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 70861e8b6..6907d8641 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ build /bower_components /tmp /yarn-error.log -/reports/ \ No newline at end of file +/reports/.DS_Store From 01e102c1b51871516b23037d9a9c5eaae0662cdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Laiola=20Guimar=C3=A3es?= Date: Tue, 6 Jul 2021 09:33:04 -0300 Subject: [PATCH 2/6] Added API route support to :filename and :index --- src/calc2/main.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calc2/main.tsx b/src/calc2/main.tsx index c047802b3..5e2210a05 100644 --- a/src/calc2/main.tsx +++ b/src/calc2/main.tsx @@ -67,7 +67,7 @@ export class Main extends React.Component { - + (

404

From 95ae943469144193db5c148ddc7b803c4208f839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Laiola=20Guimar=C3=A3es?= Date: Tue, 6 Jul 2021 09:36:09 -0300 Subject: [PATCH 3/6] Bug fix: in case the :filename and :index are set in the URL, it is necessary to set the correct group accordingly --- src/calc2/store/groups.ts | 43 ++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/src/calc2/store/groups.ts b/src/calc2/store/groups.ts index d2ae8b8d4..ae5db5343 100644 --- a/src/calc2/store/groups.ts +++ b/src/calc2/store/groups.ts @@ -68,16 +68,39 @@ export function* rootSaga() { }; yield saga.put(success); if (setCurrent !== undefined && loadedGroups.length > 0) { - const { source, id, filename } = loadedGroups[0].groupInfo; - - const setCurrent: GROUP_SET_CURRENT = { - type: 'GROUP_SET_CURRENT', - source, - id, - filename, - index: 0, - }; - yield saga.put(setCurrent); + // In case the :filename and :index are set in the URL, + // it's necessary to set the correct group accordingly + if (setCurrent && setCurrent != 'first' && + setCurrent.filename && setCurrent.index) { + for(var i=0;i Date: Tue, 6 Jul 2021 09:39:53 -0300 Subject: [PATCH 4/6] Added support to load API data synchronously --- src/calc2/utils/groupUtils.ts | 2 +- src/calc2/views/calc.tsx | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/calc2/utils/groupUtils.ts b/src/calc2/utils/groupUtils.ts index ad4b31c84..70300262b 100644 --- a/src/calc2/utils/groupUtils.ts +++ b/src/calc2/utils/groupUtils.ts @@ -172,7 +172,7 @@ export function loadGroupsFromSource(source: GroupSourceType, id: string, mainta reject(new Error('gist ' + id + ' not found')); }, }, - async: true, + async: false, }); break; } diff --git a/src/calc2/views/calc.tsx b/src/calc2/views/calc.tsx index fe5f8aad3..7179eb65b 100644 --- a/src/calc2/views/calc.tsx +++ b/src/calc2/views/calc.tsx @@ -50,6 +50,11 @@ export class Calc extends React.Component { })*/ this.apiView = this.props.location.pathname.split("/")[2] == "api" this.params = queryString.parse(this.props.location.search) + + // It's necessary to load remote group synchronouly + if (this.apiView) { + this.loadGroup(this.props); + } } componentDidUpdate(prevProps: Props): void { From bb767d39b0b1f8bebda661048a102ab9c03d3c3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Laiola=20Guimar=C3=A3es?= Date: Tue, 6 Jul 2021 11:33:37 -0300 Subject: [PATCH 5/6] Set project requirement: Node@12. NOTE: It does not run with Node@14 nor Node@16 (tested on macOS Big Sur v11.4). --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 13abebe8c..8d659be5f 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ A relational algebra calculator ## How to build * Install yarn https://yarnpkg.com/ -* Install node https://nodejs.org/en/ +* Install node@12 https://nodejs.org/en/ * Clone the repo * Checkout the `development` branch * Execute `yarn install` to install all dependencies From 27d76edb0a3bb016d7e516f2b6ed937170bb14d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Laiola=20Guimar=C3=A3es?= Date: Mon, 9 Aug 2021 08:56:27 -0300 Subject: [PATCH 6/6] Fix issue of parsing + as a space --- src/calc2/views/api.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/calc2/views/api.tsx b/src/calc2/views/api.tsx index 728ca5755..49671bf33 100644 --- a/src/calc2/views/api.tsx +++ b/src/calc2/views/api.tsx @@ -27,7 +27,12 @@ export class Api extends React.Component { constructor(props: Props) { super(props); this.state = {}; - this.query = atob(props.params.query) + // Fix issue of parsing + as a space + // https://www.npmjs.com/package/query-string + // https://github.com/sindresorhus/query-string/issues/305 + // https://stackoverflow.com/questions/2678551/when-to-encode-space-to-plus-or-20 + // https://stackoverflow.com/questions/3794919/replace-all-spaces-in-a-string-with + this.query = atob(props.params.query.split(' ').join('+')) } componentDidMount() {