Skip to content

Commit 129efab

Browse files
committed
refactored code and merged
1 parent bfd2bf8 commit 129efab

File tree

16 files changed

+198
-156
lines changed

16 files changed

+198
-156
lines changed

.DS_Store

0 Bytes
Binary file not shown.

app/server/controllers/mongoSchemaController.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

app/server/schema.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const MongoClient = require('mongodb').MongoClient;
44
var pluralize = require('pluralize');
55
const { ipcMain } = require('electron')
66

7-
87
const {
98
GraphQLObjectType,
109
GraphQLString,
@@ -15,7 +14,6 @@ const {
1514
GraphQLNonNull,
1615
} = graphql;
1716

18-
1917
const converter = {};
2018
let rootQueryObj = {};
2119

@@ -264,10 +262,8 @@ ipcMain.on('selectedSchemas', (event, arg) => {
264262
`${addWhiteSpace(4)}},|`;
265263

266264
// resetting the fieldsObject
267-
// console.log('this is stringObj ====>', strFieldsObj);
268265
fieldsObj = {};
269266
strFields = '';
270-
// mutationObjStr = '';
271267
mutationToString = '';
272268
mongoSchemaStr = '';
273269
}

app/server/server.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66
const fs = require('fs');
77
const { graphqlHTTP } = require('express-graphql');
88
const schemaRoute = require('./schema');
9-
109
const mongoSchemaController = require('./controllers/mongoSchemaController');
1110

12-
1311
app.use(express.json());
1412
app.use(cors());
1513

@@ -45,7 +43,6 @@ app.use((err, req, res, next) => {
4543
return res.status(errorObj.status).json(errorObj.message);
4644
});
4745

48-
4946
app.listen(3000, () => console.log('listening on port 3000'));
5047
module.exports = app;
5148
})()

app/src/App.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ import "./public/index.css";
66

77
// Create main App component
88
const App = () => {
9+
return (
910
<div>
1011
<Container />
1112
<AutoUpdate />
1213
</div>
14+
)
1315
}
1416
// Export the App component
1517
export default App;

app/src/Components/AutoUpdate.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
2-
import "./public/index.css";
2+
import "../public/index.css";
33
const { ipcRenderer } = require('electron')
44

55
const AutoUpdate = () => {
@@ -27,12 +27,12 @@ const AutoUpdate = () => {
2727
};
2828

2929
return (
30-
<div id="notification" class="hidden">
30+
<div id="notification" className="hidden">
3131
<p id="message"></p>
32-
<button id="close-button" onClick="closeNotification()">
32+
<button id="close-button" onClick={closeNotification}>
3333
Close
3434
</button>
35-
<button id="restart-button" onClick="restartApp()" class="hidden">
35+
<button id="restart-button" onClick={restartApp} className="hidden">
3636
Restart
3737
</button>
3838
</div>

app/src/Components/CheckBox.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@ const CheckBox = (props) => {
66
<div className="checkboxContainer" id="box">
77
<form className="checkboxForm">
88
<label className="checkboxLabel">
9-
<input className="checkbox" type="checkbox" name={props.name} onClick={props.clicked} />
10-
{/* name is the key which is the obj */}
9+
<input className="checkbox" type="checkbox" name={props.name} onClick={props.clicked} disabled={props.toggleCheckbox}/>
1110
{props.name}
1211
</label>
1312
</form>
1413
</div>
1514
)
1615
}
1716

18-
19-
2017
export default CheckBox;

app/src/Components/DropDownMenu.js

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,16 @@
22
// research code mirror to hold the schemas
33
// todo: create functionality so that when a checkbox is clicked, the schema appears on the page
44

5-
import React, { useState, useEffect } from 'react';
5+
import React from 'react';
66
import CheckBox from './CheckBox';
7+
import {ipcRenderer} from "electron";
78

8-
9-
const DropDownMenu = ({schemaData, uriData, sendSchemas, addCheckmark}) => {
10-
11-
const checkHandler = e => {
12-
const schemaNames = Object.keys(schemaData);
13-
const tools = props.schemaNames.clicked; //Array in parent component
14-
const value = e.target.value; //Checkbox value
15-
16-
props.addCheckmark(value);
17-
};
18-
9+
const DropDownMenu = ({schemaData, uriData, sendSchemas, addCheckmark, toggleBtn, toggleCheckbox}) => {
1910
const checkBoxComponents = [];
2011

2112
for (let key in schemaData) {
2213
checkBoxComponents.push(
23-
<CheckBox name={key} key={`checkbox${key}`} clicked={addCheckmark} />
14+
<CheckBox name={key} key={`dropdown${key}`} clicked={addCheckmark} toggleCheckbox={toggleCheckbox} />
2415
)
2516
}
2617

@@ -30,13 +21,11 @@ const DropDownMenu = ({schemaData, uriData, sendSchemas, addCheckmark}) => {
3021
{checkBoxComponents}
3122
</div>
3223
<div className="addSchemaBtn" >
33-
<button className="AddSelectedSchemasButton" onClick={sendSchemas}><span>Add Selected Schemas</span></button>
24+
<button className={toggleBtn ? "AddSelectedSchemasButton": "disableAddSelected"} onClick={sendSchemas} disabled={!toggleBtn}><span>Add Selected Schemas</span></button>
3425
</div>
3526
</div>
3627
)
3728
}
3829

39-
40-
4130
export default DropDownMenu;
4231

app/src/Components/MongoDBURI.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const MongoDBURI = ({schemaData, uriData, submitbtn, geturi}) => {
77
<div className="formContainer">
88
<div className="formClass">
99
<form className="form__group field">
10-
<input className="form__field" type="input" onChange= {geturi} id='name' placeholder=" Input Your MongoDB URI"/>
10+
<input className="form__field" type="input" onChange={geturi} id='name' placeholder=" Input Your MongoDB URI"/>
1111
<label className="form__label"> MongoDB URI </label>
1212
<input className="URISubmitButton" type="submit" value="Submit" onClick={submitbtn} style={{display: "none"}}/>
1313
</form>

app/src/Components/MongoSchemaIDE.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ const MongoSchemaIDE = ({schemaData, selectedSchemaData, graphQLSchema}) => {
8787
<CodeMirror
8888
value={_.isEmpty(graphQLSchema) ? `/*
8989
*** Input MongoDB Uri ***
90+
*** Press Enter ***
9091
*** Click Add Selected Schemas ***
9192
*** View GraphQL Schemas Here ***
9293
*/` : combined}

0 commit comments

Comments
 (0)