Skip to content

Commit

Permalink
updated with new package-lock.json
Browse files Browse the repository at this point in the history
  • Loading branch information
user-byte123 committed Feb 8, 2024
1 parent f0f859c commit 5b19be0
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 32 deletions.
54 changes: 40 additions & 14 deletions DEV_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,32 @@

<b>`Developer's Read Me`</b>

<b>`** v12.0.0 **`</b>
<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>

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.

<p><b> WHAT WE UPDATED: </b></p>

<p>1. trimmed dependency issues from 54 down to 1. this one cannot be resolved because it is from the 30 viewers</p>
<p>2. Broke backend into MVVM/MVC model</p>
<p>3. Made sure types are enforced in typescript</p>
<p>4. Fixed import and export local files</p>
<p>5. Fixed Authentication</p>
<p>1. Refactored UX/UI to enhance user's performance by streamlining key features</p>
<p>2. Implemented Query History and selected query will populate on Monaco Editor</p>
<p>3. Changed from CodeMirror to Monaco Editor to bring back in colors for selected keywords</p>
<p>4. Reimplemented table rows to display in Table View</p>
<p>5. Fixed import and export local files for Postgres and MySQL</p>
<p>6. Fixed Authentication</p>
<p>7. Added additional testing suites</p>
<p>8. Introduced layout saving for ERD view</p>

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

<p><b>1. 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>
<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>
else if (database === DBType.mysql) {}<br>
else (database === DBType.sqlite) {}<br>
Expand All @@ -34,21 +41,40 @@ 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 replace frontend/components/iews/ERTables/ERTabling.tsx when this is ready</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>2. 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>
<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>3. Async event emmiters between front/backend</b></p>
<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>

<p>1. The application on Windows may periodically crash.</p>
<p>2. There are import issues on mac computers.</p>

- Unable to import pg or mySQL database files
<p>3. Duplicates appear on previous queries.</p>

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

<p>4. Label and Group field disappears.</p>

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

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



30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<img src="./assets/readmeImages/logo_readme.png" height=300/>

[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/oslabs-beta/SeeQR)
![Release: 13.0.0](https://img.shields.io/badge/Release-12.0.0-red)
![Release: 13.0.0](https://img.shields.io/badge/Release-13.0.0-red)
![License: MIT](https://img.shields.io/badge/License-MIT-orange.svg)
![Contributions Welcome](https://img.shields.io/badge/Contributions-welcome-blue.svg)
[![Twitter](https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Ftwitter.com%2Ftheseeqr)](https://twitter.com/theseeqr)
Expand Down Expand Up @@ -69,13 +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 @@ -92,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 @@ -126,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 @@ -139,17 +148,12 @@ To get started on contributing and editing databases to this project:
- To execute the query, simply select the 'RUN QUERY' button at the bottom of the panel or press 'Ctrl-Enter' on the keyboard.
- Users have the option to run multiple queries, allowing users to obtain more reliable testing results.
- Version 13 introduces a new feature that enables users to access and view previous queries. Upon selecting a previous query, it populates the query input field, allowing users to make edits before executing.
<br />
</br>
<br>
<div align="center">
<img src="./assets/readmeImages/gifs/multisample.gif" width=800/>
<img src="./assets/readmeImages/gifs/querySearch.gif" width=800/>
</div>
<br />
<div align="center">
<img src="./assets/readmeImages/gifs/Query_Execution.gif" width=800/>
</div>
<div align="center">
<img src="./assets/readmeImages/gifs/seeQR_queryHistory.gif" width=800/>
</div>

- Save/Load Queries

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
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 5b19be0

Please sign in to comment.