Skip to content

Commit

Permalink
Merge pull request #123 from oslabs-beta/main
Browse files Browse the repository at this point in the history
updated with package-lock.json
  • Loading branch information
choukevin612 authored Feb 8, 2024
2 parents 5ba4308 + 33ece6d commit 031e40a
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 17 deletions.
21 changes: 14 additions & 7 deletions DEV_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<b>`** v13.0.0 **`</b>

<p>In this version our team focused on refactoring the broken code base from all previous versions. </p>
<p>In this version our team prioritized improving the code base from all prior versions through refactoring. </p>

<p><b> WHAT YOU NEED TO DO FIRST: </b></p>

Expand All @@ -27,7 +27,11 @@ Run npm run dev twice if you do not manually run tsc to compile the files first.

<p><b> WHAT NEEDS TO BE DONE: </b></p>

<p>1. Refractor tableTabBar </p>

<p>1. Refactor tableTabBar Component</p>

- 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.


<p><b>2. Isolating Database</b> <br> One of the biggest tasks that we tried but <b>did not finish</b> is isolating the concerns of each database type (DBType). The current application has multiple</p>
<code>if (database === DBType.postgres) {}<br>
Expand All @@ -39,22 +43,23 @@ else (database === DBType.sqlite) {}<br>

<img src="./assets/readmeImages/erdArchitecture.png" height=500/>

<p>The road map is finish connecting the siloed pieces for postgres, then moving on to mysql <br><br> <b>***Important*** <br> There is not an entry for this system yet but this file frontend/components/iews/ERTables/ERDisplayWindow.tsx will be the entry</b></p>

<p>The road map is finish connecting the siloed pieces for postgres, then moving on to mysql <br><br> <b>***Important*** <br> There is no entry for this system yet, but this file frontend/components/iews/ERTables/ERDisplayWindow.tsx will be the entry once completed</b></p>


<p><b>3. ERD Logic Update</b><br>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 <b>BAD</b>. <br><br> 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 <b>SAVE</b> 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</p>

<img src="./assets/readmeImages/ERD_before_after.png" height=500/>

<br><br> <b>**_Important_** <br> This is wrtten at backend/src/ipcHandlers/dbCRUDHandlerERD.ts and will replace backend/src/ipcHandlers/dbCRUDHandler.ts when this is ready</b>
<br><br> <b>**_Important_** <br> This is written at backend/src/ipcHandlers/dbCRUDHandlerERD.ts and will replace backend/src/ipcHandlers/dbCRUDHandler.ts when this is ready</b>

<p><b>4. Async event emmiters between front/backend</b></p>
<p>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.<br><br>
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.<br><br>
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.<br><br>
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.
</p>
<p>4. </p>
<p>5. </p>


<p><b> WHAT IS BROKEN: </b></p>

Expand All @@ -73,5 +78,7 @@ There are still some filesystem read/write calls in the front end. This should b

<p>5. Foreign and Primary keys.</p>

- 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.
- 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.



17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,22 @@ To get started on contributing and editing databases to this project:
- Users can toggle between an 'ER DIAGRAM' view and the 'TABLES' view for each database.

<div align="center">
<img src="./assets/readmeImages/config_demo2.gif" width=800/>
<img src="./assets/readmeImages/gifs/quick_start.gif" width=800/>
<img src="./assets/readmeImages/gifs/login.gif" width=800/>
<!-- <img src="./assets/readmeImages/gifs/quick_start.gif" width=800/> -->
</div>

- Databases

- In the 'DATABASES' view, an interactive Entity Relationship Diagram (`ER DIAGRAM`) is displayed for the selected database.
- Users can now save table layout in version 13.

<br>
<div align="center">
<img src="./assets/readmeImages/gifs/save_db_layout.gif" width=800/>
</div>
<br>


- Users can select `TABLE` to see selected database in tabular form.

- Users can select a table from a list of all the tables in the schema of the currently selected database.
Expand All @@ -94,7 +101,7 @@ To get started on contributing and editing databases to this project:

<br>
<div align="center">
<img src="./assets/readmeImages/gifs/dummy_data.gif" width=800/>
<img src="./assets/readmeImages/gifs/dataTypeChange.gif" width=800/>
</div>
<br>

Expand Down Expand Up @@ -128,7 +135,7 @@ To get started on contributing and editing databases to this project:

<br>
<div align="center">
<img src="./assets/readmeImages/gifs/create_db3.gif" width=800/>
<img src="./assets/readmeImages/gifs/importCreateDB.gif" width=800/>
<img src="./assets/readmeImages/gifs/modify_db.gif" width=800/>
</div>

Expand All @@ -144,7 +151,9 @@ To get started on contributing and editing databases to this project:
</br>
<br>
<div align="center">

<img src="./assets/readmeImages/gifs/query.gif" width=800/>

</div>
<br />

Expand Down
3 changes: 2 additions & 1 deletion backend/src/models/configModel.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// import path from 'path';
import fs from 'fs';
import os from 'os';
import { DBType, LogType } from '../../../shared/types/dbTypes';
import logger from '../utils/logging/masterlog';
import { DocConfigFile } from '../../BE_types';

// HELPER FUNCTIONS

const home = process.cwd();
const home = `${os.homedir()}/Documents/SeeQR`;
const configFile = 'config.json';
const configPath = `${home}/${configFile}`;

Expand Down
2 changes: 1 addition & 1 deletion frontend/components/views/DbView/TablesTabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ function TablesTabs({
function handleClickSave(): void {
// This function sends a message to the back end with
// the data in backendObj.current
handleSaveLayout();
// handleSaveLayout();

ipcRenderer
.invoke('ertable-schemaupdate', backendObj.current, selectedDb, curDBType)
Expand Down
17 changes: 13 additions & 4 deletions roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

- General

- Refactor codebase to elimiate prop-drilling allowing for future iterability.
- Refactor codebase to elimiate <strong>prop-drilling</strong> allowing for future iterability.

- Update ui of the initial landing page of application with cloud database instructions

Expand Down Expand Up @@ -36,11 +36,13 @@

- Queries page

- fix query execution plan table view, likely broke while updating frontend dependencies
- Fix query execution plan table view, likely broke while updating frontend dependencies
- Fix query execution plan table view, likely broke while updating frontend dependencies

- add colors back to special words in query view
- Utilize local storage to save query history. Currently the history disappears when we reload application.

- work on explain function for mysql and sqlite, may have different metadata from existing postgres implementation, display whatever you can get
- Work on explain function for mysql and sqlite, may have different metadata from existing postgres implementation, display whatever you can get
- Work on explain function for mysql and sqlite, may have different metadata from existing postgres implementation, display whatever you can get


- 2D visualization / ER tables:
Expand Down Expand Up @@ -83,3 +85,10 @@
- Implement ER table functions

- Add VR functionality?

- Mac vs Windows:

- In the '../backend/src/models/configModel.ts' on line 9 - 11 specifies where the configFile will be downloaded. The 'home' variable will be different for Mac and Windows users. Utilize an if conditional statement here to prevent the need for maintaining two branches (main and devosx) for windows and mac.

- For Windows set `home = process.cwd()` on line 10 and for Mac set <br>`home = ${os.homedir()}/Documents/SeeQR` </br>

0 comments on commit 031e40a

Please sign in to comment.