deloreanup's People
deloreanup's Issues
Main component that manages others components
Swagger autogenerated client apis issue
The swagger autogenerated client apis have an issue that is the impossibility to change the host in which perform the routes in a cleaned way.
Here a bad solution in which it's changed the value of the property basePath
of the ContainerApi
object.
The problem is also the fact that from each node I can get only the host (eg. http://localhost:5555
) but the basePath
include also the fixed part of the api's path (ie. api/v{version}
).
In this bad solution this fixed part is hard coded and appended to the host of the node. It's necessary to find a better solution.
deloreanUp/Backend/src/Plugins/docBridge/containers.js
Lines 3 to 23 in a036c8b
docNodesCache responses not aligned with backend responses
In Frontend/src/plugins/cache/docNodesCache.js
the response of the methods that maps the API of the backend should return the same objects of the backend's API.
For example the method getNodes()
should return the following object:
{
nodes: Array<Node>
}
Now, it return this Array<Node>
instead of the above example.
A full reference to the objects to be returned can founded here Backend/swagger-v2.yml
looking at the responses of the path routes.
Separate utility function from application function
The file should be divided into two separate files, one containing general method to interact with the browser cache (eg. cacheUtility) and second one containing the application function such as getNodes()
(eg. docNodes).
deloreanUp/Frontend/src/plugins/cache/docNodesCache.js
Lines 1 to 250 in f1d5489
General data adpter
It's necessary to create a general data adapter responsible for retrieving data. In particular, this adapter in its first version should simply:
- check if the requested are in the cache, if it is return the data
- if data are not in the cache, it has to retrive them using the
backendAdapter
plugin and then save them in the cache for future requests
Component to show a doc-node entity
Component to show a container entity
Create an adapter that call the api of the backend and return promises with the results
Flow and linter errors
Running the commands to check the correctness of flow and linter raise many errors related to this file.
Note: it is possible to run the checks using:
yarn flow:status or npm run flow:status
yarn lint or npm run lint
deloreanUp/Frontend/src/plugins/cache/docNodesCache.js
Lines 1 to 250 in f1d5489
Update
Flow error log:
> flow status --quiet
Error ------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:51:58
Cannot assign function to `getDatabaseConnection` because:
- property `result` is missing in function [1] but exists in `IndexedDatabaseConnection` [2].
- property `store` is missing in function [1] but exists in `IndexedDatabaseConnection` [2].
- property `tx` is missing in function [1] but exists in `IndexedDatabaseConnection` [2].
src/plugins/cache/docNodesCache.js:51:58
v--------------
51| const getDatabaseConnection: IndexedDatabaseConnection = (openedDB) => {
52| let connection: IndexedDatabaseConnection = {}
53|
54| connection.result = openedDB.result
55| connection.tx = connection.result.transaction(STORE_NAME, 'readwrite')
56| connection.store = connection.tx.objectStore(STORE_NAME)
57|
58| return connection
59| }
^ [1]
References:
src/plugins/cache/docNodesCache.js:51:30
51| const getDatabaseConnection: IndexedDatabaseConnection = (openedDB) => {
^^^^^^^^^^^^^^^^^^^^^^^^^ [2]
Error -------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:91:5
Cannot assign function to `db.onsuccess` because property `onsuccess` is missing in undefined [1].
src/plugins/cache/docNodesCache.js:91:5
91| db.onsuccess = () => {
^^^^^^^^^^^^
References:
src/plugins/cache/docNodesCache.js:37:5
37| return
^^^^^^ [1]
Error ------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:92:24
Cannot call `getDatabaseConnection` because a call signature declaring the expected parameter / return type is missing
in `IndexedDatabaseConnection` [1].
src/plugins/cache/docNodesCache.js:92:24
92| let connection = getDatabaseConnection(db)
^^^^^^^^^^^^^^^^^^^^^^^^^
References:
src/plugins/cache/docNodesCache.js:51:30
51| const getDatabaseConnection: IndexedDatabaseConnection = (openedDB) => {
^^^^^^^^^^^^^^^^^^^^^^^^^ [1]
Error -------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:94:7
Cannot resolve name `dbRequest`.
94| dbRequest.onsuccess = (event) => {
^^^^^^^^^
Error -------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:95:9
Cannot resolve name `response`.
95| response.data = event.type
^^^^^^^^
Error ------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:100:9
Cannot resolve name `response`.
100| response.data = event.type
^^^^^^^^
Error ------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:117:5
Cannot assign function to `db.onsuccess` because property `onsuccess` is missing in undefined [1].
src/plugins/cache/docNodesCache.js:117:5
117| db.onsuccess = () => {
^^^^^^^^^^^^
References:
src/plugins/cache/docNodesCache.js:37:5
37| return
^^^^^^ [1]
Error ------------------------------------------------------------------------ src/plugins/cache/docNodesCache.js:118:24
Cannot call `getDatabaseConnection` because a call signature declaring the expected parameter / return type is missing
in `IndexedDatabaseConnection` [1].
src/plugins/cache/docNodesCache.js:118:24
118| let connection = getDatabaseConnection(db)
^^^^^^^^^^^^^^^^^^^^^^^^^
References:
src/plugins/cache/docNodesCache.js:51:30
51| const getDatabaseConnection: IndexedDatabaseConnection = (openedDB) => {
^^^^^^^^^^^^^^^^^^^^^^^^^ [1]
Error ------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:120:7
Cannot resolve name `dbRequest`.
120| dbRequest.onsuccess = (event) => {
^^^^^^^^^
Error ------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:121:9
Cannot resolve name `response`.
121| response.data = event.type
^^^^^^^^
Error ------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:126:9
Cannot resolve name `response`.
126| response.data = event.type
^^^^^^^^
Error ------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:144:5
Cannot assign function to `db.onsuccess` because property `onsuccess` is missing in undefined [1].
src/plugins/cache/docNodesCache.js:144:5
144| db.onsuccess = () => {
^^^^^^^^^^^^
References:
src/plugins/cache/docNodesCache.js:37:5
37| return
^^^^^^ [1]
Error ------------------------------------------------------------------------ src/plugins/cache/docNodesCache.js:145:24
Cannot call `getDatabaseConnection` because a call signature declaring the expected parameter / return type is missing
in `IndexedDatabaseConnection` [1].
src/plugins/cache/docNodesCache.js:145:24
145| let connection = getDatabaseConnection(db)
^^^^^^^^^^^^^^^^^^^^^^^^^
References:
src/plugins/cache/docNodesCache.js:51:30
51| const getDatabaseConnection: IndexedDatabaseConnection = (openedDB) => {
^^^^^^^^^^^^^^^^^^^^^^^^^ [1]
Error ------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:167:5
Cannot assign function to `db.onsuccess` because property `onsuccess` is missing in undefined [1].
src/plugins/cache/docNodesCache.js:167:5
167| db.onsuccess = () => {
^^^^^^^^^^^^
References:
src/plugins/cache/docNodesCache.js:37:5
37| return
^^^^^^ [1]
Error ------------------------------------------------------------------------ src/plugins/cache/docNodesCache.js:168:24
Cannot call `getDatabaseConnection` because a call signature declaring the expected parameter / return type is missing
in `IndexedDatabaseConnection` [1].
src/plugins/cache/docNodesCache.js:168:24
168| let connection = getDatabaseConnection(db)
^^^^^^^^^^^^^^^^^^^^^^^^^
References:
src/plugins/cache/docNodesCache.js:51:30
51| const getDatabaseConnection: IndexedDatabaseConnection = (openedDB) => {
^^^^^^^^^^^^^^^^^^^^^^^^^ [1]
Error ------------------------------------------------------------------------- src/plugins/cache/docNodesCache.js:193:5
Cannot assign function to `db.onsuccess` because property `onsuccess` is missing in undefined [1].
src/plugins/cache/docNodesCache.js:193:5
193| db.onsuccess = () => {
^^^^^^^^^^^^
References:
src/plugins/cache/docNodesCache.js:37:5
37| return
^^^^^^ [1]
Error ------------------------------------------------------------------------ src/plugins/cache/docNodesCache.js:194:24
Cannot call `getDatabaseConnection` because a call signature declaring the expected parameter / return type is missing
in `IndexedDatabaseConnection` [1].
src/plugins/cache/docNodesCache.js:194:24
194| let connection = getDatabaseConnection(db)
^^^^^^^^^^^^^^^^^^^^^^^^^
References:
src/plugins/cache/docNodesCache.js:51:30
51| const getDatabaseConnection: IndexedDatabaseConnection = (openedDB) => {
^^^^^^^^^^^^^^^^^^^^^^^^^ [1]
Found 19 errors
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! frontend@1.0.0 flow:status: `flow status --quiet`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the frontend@1.0.0 flow:status script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Lint error log:
> eslint --cache --format codeframe --ext mjs,jsx,js src test
error: 'result' is assigned a value but never used (no-unused-vars) at src/plugins/cache/docNodesCache.js:93:11:
91 | db.onsuccess = () => {
92 | let connection = getDatabaseConnection(db)
> 93 | let result = connection.store.clear()
| ^
94 | dbRequest.onsuccess = (event) => {
95 | response.data = event.type
96 | response.success = true
error: 'dbRequest' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:94:7:
92 | let connection = getDatabaseConnection(db)
93 | let result = connection.store.clear()
> 94 | dbRequest.onsuccess = (event) => {
| ^
95 | response.data = event.type
96 | response.success = true
97 | resolve(response)
error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:95:9:
93 | let result = connection.store.clear()
94 | dbRequest.onsuccess = (event) => {
> 95 | response.data = event.type
| ^
96 | response.success = true
97 | resolve(response)
98 | }
error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:96:9:
94 | dbRequest.onsuccess = (event) => {
95 | response.data = event.type
> 96 | response.success = true
| ^
97 | resolve(response)
98 | }
99 | dbRequest.onerror = (event) => {
error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:97:17:
95 | response.data = event.type
96 | response.success = true
> 97 | resolve(response)
| ^
98 | }
99 | dbRequest.onerror = (event) => {
100 | response.data = event.type
error: 'dbRequest' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:99:7:
97 | resolve(response)
98 | }
> 99 | dbRequest.onerror = (event) => {
| ^
100 | response.data = event.type
101 | response.success = false
102 | reject(response)
error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:100:9:
98 | }
99 | dbRequest.onerror = (event) => {
> 100 | response.data = event.type
| ^
101 | response.success = false
102 | reject(response)
103 | }
error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:101:9:
99 | dbRequest.onerror = (event) => {
100 | response.data = event.type
> 101 | response.success = false
| ^
102 | reject(response)
103 | }
104 | }
error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:102:16:
100 | response.data = event.type
101 | response.success = false
> 102 | reject(response)
| ^
103 | }
104 | }
105 | })
error: 'result' is assigned a value but never used (no-unused-vars) at src/plugins/cache/docNodesCache.js:119:11:
117 | db.onsuccess = () => {
118 | let connection = getDatabaseConnection(db)
> 119 | let result = connection.store.put(node)
| ^
120 | dbRequest.onsuccess = (event) => {
121 | response.data = event.type
122 | response.success = true
error: 'dbRequest' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:120:7:
118 | let connection = getDatabaseConnection(db)
119 | let result = connection.store.put(node)
> 120 | dbRequest.onsuccess = (event) => {
| ^
121 | response.data = event.type
122 | response.success = true
123 | resolve(response)
error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:121:9:
119 | let result = connection.store.put(node)
120 | dbRequest.onsuccess = (event) => {
> 121 | response.data = event.type
| ^
122 | response.success = true
123 | resolve(response)
124 | }
error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:122:9:
120 | dbRequest.onsuccess = (event) => {
121 | response.data = event.type
> 122 | response.success = true
| ^
123 | resolve(response)
124 | }
125 | dbRequest.onerror = (event) => {
error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:123:17:
121 | response.data = event.type
122 | response.success = true
> 123 | resolve(response)
| ^
124 | }
125 | dbRequest.onerror = (event) => {
126 | response.data = event.type
error: 'dbRequest' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:125:7:
123 | resolve(response)
124 | }
> 125 | dbRequest.onerror = (event) => {
| ^
126 | response.data = event.type
127 | response.success = false
128 | reject(response)
error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:126:9:
124 | }
125 | dbRequest.onerror = (event) => {
> 126 | response.data = event.type
| ^
127 | response.success = false
128 | reject(response)
129 | }
error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:127:9:
125 | dbRequest.onerror = (event) => {
126 | response.data = event.type
> 127 | response.success = false
| ^
128 | reject(response)
129 | }
130 | }
error: 'response' is not defined (no-undef) at src/plugins/cache/docNodesCache.js:128:16:
126 | response.data = event.type
127 | response.success = false
> 128 | reject(response)
| ^
129 | }
130 | }
131 | })
18 errors found.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! frontend@1.0.0 lint: `eslint --cache --format codeframe --ext mjs,jsx,js src test`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the frontend@1.0.0 lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.