Skip to content

Latest commit

 

History

History
84 lines (49 loc) · 6.43 KB

DEV_README.md

File metadata and controls

84 lines (49 loc) · 6.43 KB

Developer's Read Me

** v13.0.0 **

In this version our team prioritized improving the code base from all prior versions through refactoring.

WHAT YOU NEED TO DO FIRST:

Run npm run dev twice if you do not manually run tsc to compile the files first. The ts files have to compile before electron-dev and webpack-dev can start.

WHAT WE UPDATED:

1. Refactored UX/UI to enhance user's performance by streamlining key features

2. Implemented Query History and selected query will populate on Monaco Editor

3. Changed from CodeMirror to Monaco Editor to bring back in colors for selected keywords

4. Reimplemented table rows to display in Table View

5. Fixed import and export local files for Postgres and MySQL

6. Fixed Authentication

7. Added additional testing suites

8. Introduced layout saving for ERD view

WHAT NEEDS TO BE DONE:

1. Refactor tableTabBar Component

  • Migrated ERTabling to tableTabBar component to access the ERD because it lacked a parent compartment for prop drilling, hindering the addition of new features. Going forward, a more maintainable solution should be implemented like Redux or Zustand.

2. Isolating Database
One of the biggest tasks that we tried but did not finish is isolating the concerns of each database type (DBType). The current application has multiple

if (database === DBType.postgres) {}
else if (database === DBType.mysql) {}
else (database === DBType.sqlite) {}

situations and it is not good. instead we will use switch statements to preemptively throw operations into seperate functions to completely silo cases for Postgres, Mysql, and SqLite. This is a task for BOTH THE FRONTEND AND BACKEND and the FRONTEND IS MUCH HARDER. The work for backend is actually done and it is illustrated in the picture below

The road map is finish connecting the siloed pieces for postgres, then moving on to mysql

***Important***
There is no entry for this system yet, but this file frontend/components/iews/ERTables/ERDisplayWindow.tsx will be the entry once completed

3. ERD Logic Update
Currently, previous wrote the frontend to send back a big bundle of all the operations done in the frontend ERD Table. This ERD table object is divided by add, drop, and alter. All the add operations will execute first then drop, then alter. This is BAD.

We need to redesign frontend to send back "sequental" operations instead of bundling operations by add, drop, alter because it takes care of multiple edge cases and users in the front can do as many operations they want to ensure SAVE works. I illustrated the problem below. The current backend is written out already. We just need to make sure the frontend is send back the appropriate logic



Important
This is written at backend/src/ipcHandlers/dbCRUDHandlerERD.ts and will replace backend/src/ipcHandlers/dbCRUDHandler.ts when this is ready

4. Async event emmiters between front/backend

Currently, the way the feedback modal works is by handling events that are emitted from both the frontend and the backend. Ideally, this should be refactored to be state dependent rather than event dependent, as it controls the display of the modal. This can be tied into the centralized async event emitter added to frontend/components/app.tsx, in conjunction with migration to reducers from state variables. The goal will be to house modal messages in the store tied to the main app reducer. From there, the async handler can send new messages to the state via main app dispatch, and any other front end feedback can do the same.

The main roadblock in the way of finalizing the transfer of event handlers out of the frontend is the way the dblist (list of databases in the sidebar) gets updated. Many event handlers in the backend send a dblist update event out to update the front end. Ideally, this should be handled by returning the new dblist changes out of the handler and using that resolved value to update state whenever an action would cause a dblist change. Right now, app.tsx has a useEffect running that listens for those dblist updates every frame. This is inefficient as a frontend concern.

The spinner currently works in a similar way to feedback. Once all async is completely migrated (including dblist update changes), this spinner can simply be tied to the loading property in the main app state.

There are still some filesystem read/write calls in the front end. This should be refactored to an async call that requests the backend handle the file system read/write for proper separation of concerns.

WHAT IS BROKEN:

1. The application on Windows may periodically crash.

2. There are import issues on Mac computers.

  • Unable to import pg or mySQL database files

3. Duplicates appear on previous queries.

  • In 'queryView', the 'queriesRan' state is defined, set, and passed down as a prop to its child component 'queryHistory'. On line 54 of 'queryHistory', duplicate query saved in the queriesRan state are removed. However, there's a problem: when we click the format button in QuerySqlInput and then run the query, it saves the query again. This happens because the new Set method doesn't recognize the formatted SQL strings due to the presence of '\n' characters. Consequently, clicking the run query button for both unformatted and formatted SQL strings results in duplicates being saved in the query history.

4. Label and Group field disappears.

  • In the queries tab, the Label and Group text in input field will disappear when selecting the Monaco Editor.
  • The bug may arise from the useEffect hook, which triggers every time the component updates. Any changes detected in the editor results in a new Monaco Editor instance, potentially resetting the label and group text inputs.

5. Foreign and Primary keys.

  • Unable to select the primary and/or foreign key of a newly added column until the column is saved onto the database. Once saved onto the database, we can then select the primary and foreign key and save them onto the database.