Skip to content

Commit

Permalink
Merge pull request #111 from oslabs-beta/main
Browse files Browse the repository at this point in the history
SeeQR v12
  • Loading branch information
derekoko authored Aug 24, 2023
2 parents 47a00ee + bd17e79 commit 98f8500
Show file tree
Hide file tree
Showing 145 changed files with 16,450 additions and 17,222 deletions.
52 changes: 42 additions & 10 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@
},
"globals": { "JSX": "readonly", "Chart": "readonly", "NodeJS": "readonly" },
"extends": [
"eslint:recommended",

"plugin:react/recommended",
"plugin:react-hooks/recommended",

"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",

"airbnb",
"plugin:import/errors",
"plugin:import/warnings",

"plugin:import/recommended",
"plugin:import/typescript",
// "plugin:@typescript-eslint/recommended",

"prettier"
],
"parser": "@typescript-eslint/parser",
Expand All @@ -21,38 +28,63 @@
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": ["react", "@typescript-eslint"],
"plugins": ["react", "react-hooks", "@typescript-eslint", "import"],
"rules": {
"react/jsx-filename-extension": [2, { "extensions": [".jsx", ".tsx"] }],
"react/jsx-filename-extension": [1, { "extensions": [".jsx", ".tsx"] }],

"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error"],

"import/extensions": [
"error",
"ignorePackages",
{ "js": "never", "jsx": "never", "ts": "never", "tsx": "never" }
],
// "import/no-extraneous-dependencies": ["error", { "devDependencies": true }], **trying to resolve the electron issue

"jsx-a11y/label-has-associated-control": "off",

// prevent wrong warning with typescript overloads
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error"],
"no-dupe-class-members": "off",

"no-dupe-class-members": "off",
"@typescript-eslint/no-dupe-class-members": ["error"],

"lines-between-class-members": "off",
"@typescript-eslint/lines-between-class-members": [
"error",
"always",
{ "exceptAfterSingleLine": true }
],
"react/jsx-curly-newline": "off",

// "react/jsx-curly-newline": "off",

// turned off because typescript, functional components and default props
// don't seem to be good friends. Decided to manually handle defaults for
// optional props instead
"react/require-default-props": "off",
"react/jsx-props-no-spreading": "off",

"camelcase": "off"

// "import/no-extraneous-dependencies": ["error", { "devDependencies": true }], **trying to resolve the electron issue
},
// "settings": "import/core-modules: [ electron ]", **trying to resolve the electron issue
"settings": {
"react": {
"version": "detect"
},
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true
}
}
},
// "settings": "import/core-modules: [ electron ]", **trying to resolve the electron issue
"root": true
}
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"singleQuote": true,
"tabWidth": 2,
"useTabs": false
"useTabs": false,
"trailingComma": "all"
}
24 changes: 11 additions & 13 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{
"liveSassCompile.settings.formats": [
{
"format": "expanded",
"savePath": "/frontend/assets/stylesheets/css",
"extensionName": ".css"
}
],
"liveSassCompile.settings.generateMap": false,
"yaml.schemas": {
"https://json.schemastore.org/electron-builder": [
"electron-builder.yml"
]
"liveSassCompile.settings.formats": [
{
"format": "expanded",
"savePath": "/frontend/assets/stylesheets/css",
"extensionName": ".css"
}
}
],
"liveSassCompile.settings.generateMap": false,
"yaml.schemas": {
"https://json.schemastore.org/electron-builder": ["electron-builder.yml"]
}
}
54 changes: 54 additions & 0 deletions DEV_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<div align="center">

<img src="./assets/readmeImages/logo_readme.png" height=300/>

</div>

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

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

<p>In this version our team focused on refactoring the broken code base from all previous versions. </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><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>
<code>if (database === DBType.postgres) {}<br>
else if (database === DBType.mysql) {}<br>
else (database === DBType.sqlite) {}<br>
</code>
<br>
<p>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 <b>BOTH THE FRONTEND AND BACKEND</b> and the <b>FRONTEND IS MUCH HARDER</b>. The work for backend is actually done and it is illustrated in the picture below </p>

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

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

<p><b>3. 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>
55 changes: 28 additions & 27 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: 11.0.0](https://img.shields.io/badge/Release-11.0.0-red)
![Release: 12.0.0](https://img.shields.io/badge/Release-12.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 All @@ -15,7 +15,7 @@

</div>

### For the latest in-depth docs for v11.0.0, please visit our [docs site](http://www.seeqrapp.com/docs).
### For the latest in-depth docs for v12.0.0, please visit our [docs site](http://www.seeqrapp.com/docs).

## Table of Contents

Expand All @@ -28,7 +28,6 @@
- [Core Team](#core-team)
- [License](#license)


## Getting Started

To get started on contributing and editing databases to this project:
Expand Down Expand Up @@ -56,7 +55,6 @@ To get started on contributing and editing databases to this project:
- [D3.js](https://github.com/d3/d3)
- [Three-Spritetext](https://github.com/vasturiano/three-spritetext)


## Interface & Features

- Overview
Expand All @@ -79,22 +77,25 @@ To get started on contributing and editing databases to this project:

- In the 'DATABASES' view, an interactive Entity Relationship Diagram (`ER DIAGRAM`) is displayed for the selected database.
- 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.

- Information about the selected table is then displayed.
- The name and size of the selected database are also displayed at the top of the page.
- Users can also generate large amounts of foreign-key compliant dummy data for the selected table in the current database. Currently supported data types are:

- INT
- BIGINT
- VARCHAR
- BOOLEAN
- DATE

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

- <strong>NEW</strong> 3D Database Visualization
- From the 'DATABASES' view, select the '3D View' tab on the far right of the sidebar to launch the brand new 3D database visualizer.
- Individual table nodes are distinguished by their different colors
Expand All @@ -103,25 +104,25 @@ To get started on contributing and editing databases to this project:
- Navigate through the 3D space using left click to rotate, scroll wheel to zoom, and right click to pan.
- Click and drag nodes to visually organize them
- Click on a table or column node to quickly view the data stored within
<br>
<div align="center">
<img src="./assets/readmeImages/gifs/3dhome.gif" width=800/>
</div>
<br>
<div align="center">
<img src="./assets/readmeImages/gifs/3dfk.gif" width=800/>
</div>
<br>
<div align="center">
<img src="./assets/readmeImages/gifs/3dtables.gif" width=800/>
</div>
<br>
<div align="center">
<img src="./assets/readmeImages/gifs/3dhome.gif" width=800/>
</div>
<br>
<div align="center">
<img src="./assets/readmeImages/gifs/3dfk.gif" width=800/>
</div>
<br>
<div align="center">
<img src="./assets/readmeImages/gifs/3dtables.gif" width=800/>
</div>

<br>
- Create/Edit Database

- Users can create a new database from scratch by clicking the `Create New Database` button at the bottom of the sidebar.
- Users can modify the newly created database as well as any existing databases using the `ER Diagram` to create/change/delete tables and columns.
- The `Export` button will write a .sql file on the user's desktop of the selected database.
- Users can create a new database from scratch by clicking the `Create New Database` button at the bottom of the sidebar.
- Users can modify the newly created database as well as any existing databases using the `ER Diagram` to create/change/delete tables and columns.
- The `Export` button will write a .sql file on the user's desktop of the selected database.

<br>
<div align="center">
Expand All @@ -137,7 +138,7 @@ To get started on contributing and editing databases to this project:
- Please note that only labelled queries will be saved in the current session for future references.
- To execute the query, simply select the 'RUN QUERY' button at the bottom of the panel or press 'Ctrl-Enter' on the keyboard.
- The 11th version now includes the functionality to run multiple queries, allowing users to obtain more reliable testing results.
<br />
<br />
<div align="center">
<img src="./assets/readmeImages/gifs/multisample.gif" width=800/>
</div>
Expand Down Expand Up @@ -201,7 +202,7 @@ We've released SeeQR because it's a useful tool to help optimize SQL databases.

## Core Team

[Ching-Yuan Lai (Eric)](https://github.com/paranoidFrappe) | [Jamie Zhang](https://github.com/haemie) | [Julian Macalalag](https://github.com/juzi3) | [Nathan Chong](https://github.com/nathanhchong) | [Junaid Ahmed](https://github.com/junaid-ahmed7) | [Chase Sizemore](https://github.com/ChaseSizemore) | [Oscar Romero](https://github.com/creaturenex) | [Anthony Deng](https://github.com/anthonyadeng) | [Aya Moosa](https://github.com/Hiya-its-Aya) | [Trevor Ferguson](https://github.com/TrevorJFerguson) | [Pauline Nguyen](https://github.com/paulinekpn) | [Utkarsh Uppal](https://github.com/utyvert) | [Fred Jeong](https://github.com/fred-jeong) | [Gabriel Kime](https://github.com/wizardbusiness) | [Chris Fryer](github.com/frynoceros) | [Ian Grepo](https://github.com/RadiantGH) | [Michelle Chang](https://github.com/mkchang168) | [Jake Bradbeer](https://github.com/JBradbeer) | [Bryan Santos](https://github.com/santosb93) | [William Trey Lewis](https://github.com/treyfrog128) | [Brandon Lee](https://github.com/BrandonW-Lee) | [Casey Escovedo](https://github.com/caseyescovedo) | [Casey Walker](https://github.com/cwalker3011) | [Catherine Chiu](https://github.com/catherinechiu) | [Chris Akinrinade](https://github.com/chrisakinrinade) | [Cindy Chau](https://github.com/cindychau) | [Claudio Santos](https://github.com/Claudiohbsantos) | [Eric Han](https://github.com/ericJH92) | [Faraz Akhtar](https://github.com/faraza22) | [Frank Norton](https://github.com/FrankNorton32) | [Harrison Nam](https://github.com/harrynam07) | [James Kolotouros](https://github.com/dkolotouros) | [Jennifer Courtner](https://github.com/jcourtner) | [John Wagner](https://github.com/jwagner988) | [Justin Dury-Agri](https://github.com/justinD-A) | [Justin Hicks](https://github.com/JuiceBawks) | [Katie Klochan](https://github.com/kklochan) | [May Wirapa Boonyasurat](https://github.com/mimiwrp) | [Mercer Stronck](https://github.com/mercerstronck) | [Muhammad Trad](https://github.com/muhammadtrad) | [Richard Guo](https://github.com/richardguoo) | [Richard Lam](https://github.com/rlam108) | [Sam Frakes](https://github.com/frakes413) | [Serena Kuo](https://github.com/serenackuo) | [Timothy Sin](https://github.com/timothysin) | [Vincent Trang](https://github.com/vincentt114)
[Annabelle Ni](https://github.com/annni11) | [Derek Koh](https://github.com/derekoko) | [Peter Zepf](https://github.com/peterzepf) | [Tony Gao](https://github.com/tgao17) | [Ching-Yuan Lai (Eric)](https://github.com/paranoidFrappe) | [Jamie Zhang](https://github.com/haemie) | [Julian Macalalag](https://github.com/juzi3) | [Nathan Chong](https://github.com/nathanhchong) | [Junaid Ahmed](https://github.com/junaid-ahmed7) | [Chase Sizemore](https://github.com/ChaseSizemore) | [Oscar Romero](https://github.com/creaturenex) | [Anthony Deng](https://github.com/anthonyadeng) | [Aya Moosa](https://github.com/Hiya-its-Aya) | [Trevor Ferguson](https://github.com/TrevorJFerguson) | [Pauline Nguyen](https://github.com/paulinekpn) | [Utkarsh Uppal](https://github.com/utyvert) | [Fred Jeong](https://github.com/fred-jeong) | [Gabriel Kime](https://github.com/wizardbusiness) | [Chris Fryer](github.com/frynoceros) | [Ian Grepo](https://github.com/RadiantGH) | [Michelle Chang](https://github.com/mkchang168) | [Jake Bradbeer](https://github.com/JBradbeer) | [Bryan Santos](https://github.com/santosb93) | [William Trey Lewis](https://github.com/treyfrog128) | [Brandon Lee](https://github.com/BrandonW-Lee) | [Casey Escovedo](https://github.com/caseyescovedo) | [Casey Walker](https://github.com/cwalker3011) | [Catherine Chiu](https://github.com/catherinechiu) | [Chris Akinrinade](https://github.com/chrisakinrinade) | [Cindy Chau](https://github.com/cindychau) | [Claudio Santos](https://github.com/Claudiohbsantos) | [Eric Han](https://github.com/ericJH92) | [Faraz Akhtar](https://github.com/faraza22) | [Frank Norton](https://github.com/FrankNorton32) | [Harrison Nam](https://github.com/harrynam07) | [James Kolotouros](https://github.com/dkolotouros) | [Jennifer Courtner](https://github.com/jcourtner) | [John Wagner](https://github.com/jwagner988) | [Justin Dury-Agri](https://github.com/justinD-A) | [Justin Hicks](https://github.com/JuiceBawks) | [Katie Klochan](https://github.com/kklochan) | [May Wirapa Boonyasurat](https://github.com/mimiwrp) | [Mercer Stronck](https://github.com/mercerstronck) | [Muhammad Trad](https://github.com/muhammadtrad) | [Richard Guo](https://github.com/richardguoo) | [Richard Lam](https://github.com/rlam108) | [Sam Frakes](https://github.com/frakes413) | [Serena Kuo](https://github.com/serenackuo) | [Timothy Sin](https://github.com/timothysin) | [Vincent Trang](https://github.com/vincentt114)

## License

Expand Down
68 changes: 68 additions & 0 deletions __tests__/backend/src/models/dbCRUDHAndler.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
describe('dbCRUDHandler tests', () => {
// setBaseConnections
describe('erTableSchemaUpdate tests', () => {
test('it should only receive backendObj as parameter', () => {});
test('it should send async started back to frontend', () => {});
test(
'it should send backendObj to helper function to receive a queryString and a dbType back as query',
);
test(
'it should use query.queryString and query.dbType to run queryModel.query',
);
});
});

describe('ertable-functions tests', () => {
describe('erdObjToQuery tests', () => {
test('it should only receive backendObj as parameter', () => {});
test('it should create an empty array', () => {});
test('it should identity the erdDbType from dbState', () => {});
test('it should use erdDbType to pick an appropriate query function for backendObj to act on and receive a query bacj', () => {});
test('it should return a query string');
});
});

/*
const backendObj = {
database: 'tester2',
updates: {
addTables: [
{
is_insertable_into: 'yes',
table_name: 'NewTable8',
table_schema: 'puclic',
table_catalog: 'tester2',
columns: []
}
],
dropTables: [{
table_name: 'newtable5',
table_schema: 'puclic'
}
],
alterTables: [
{
is_insertable_into: null,
table_catalog: 'tester2',
table_name: 'newtable7',
new_table_name: null,
table_schema: 'puclic',
addColumns: [Array],
dropColumns: [],
alterColumns: []
},
{
is_insertable_into: null,
table_catalog: 'tester2',
table_name: 'newtable7',
new_table_name: null,
table_schema: 'puclic',
addColumns: [Array],
dropColumns: [],
alterColumns: []
}]
}
}
*/
Loading

0 comments on commit 98f8500

Please sign in to comment.