Skip to content

Merging Dev into Master #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 112 commits into from
Jan 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
b34f331
Merge pull request #9 from oslabs-beta/electron-react
mesherrera Oct 7, 2019
2153155
fixed select onchange function so the dbState reflects the right db
jenaepen Dec 16, 2019
ffbf1b8
postgress connection is made and mongoDB is charts is produced
jenaepen Dec 16, 2019
08dc0a0
Merge branch 'electron-react' into dev
Dec 17, 2019
febe894
practing with applications
jenaepen Dec 18, 2019
91ac1c0
Merge pull request #1 from ben-mizel/dev
jenaepen Dec 18, 2019
1457dfa
merging dev into jenae/valid_uri
jenaepen Dec 18, 2019
6386529
put the user settings.json back to what it was
jenaepen Dec 18, 2019
03ba3cd
delete middleware
jenaepen Dec 18, 2019
9dd6cb4
fixing front page bug
jenaepen Dec 18, 2019
48b8d58
Health Info Visualizer Update
robicano22 Dec 21, 2019
a696b8f
added X button and MS name to Modal, slight style fixes
robicano22 Dec 22, 2019
08274be
Merge branch 'chris/fe-health-info' of https://github.com/Chronos2-0/…
jenaepen Dec 24, 2019
e4ddaa6
microservices shows up when the button is pressed instead of an error…
jenaepen Dec 26, 2019
7e3734b
Merge pull request #9 from Chronos2-0/jenae/valid_uri
ben-mizel Dec 30, 2019
040b925
All ousman frontend changes
Dialloousman Dec 30, 2019
8e6e99a
Ousman front end changes
Dialloousman Dec 30, 2019
2712ef5
no change--disregard
Dialloousman Dec 30, 2019
9db5b5b
Update Main.js
Dialloousman Dec 30, 2019
0477021
Update README.md
Dialloousman Dec 31, 2019
da2af38
Update AddService.jsx
Dialloousman Dec 31, 2019
7ec44a1
Update ServiceDetails.jsx
Dialloousman Dec 31, 2019
a0e47f2
Update ServiceOverview.jsx
Dialloousman Dec 31, 2019
a7e0bde
Update index.css
Dialloousman Dec 31, 2019
8f0b977
Update mongoose-connect.js
Dialloousman Dec 31, 2019
d8e6064
Update sql-connect.js
Dialloousman Dec 31, 2019
4874ab6
Update mongoose-connect.js
Dialloousman Dec 31, 2019
ae19630
Update settings.json
Dialloousman Dec 31, 2019
9404f5e
Merge pull request #12 from Chronos2-0/ousman/frontEndChanges
Dialloousman Dec 31, 2019
7315a32
nothing added
jenaepen Dec 31, 2019
744c0d8
nothing added
jenaepen Dec 31, 2019
37c8e5a
nothing added
jenaepen Dec 31, 2019
7bb28ed
removed middleware
jenaepen Dec 31, 2019
07ebda9
add in fake picture
jenaepen Dec 31, 2019
c4a19a3
add in fake picture
jenaepen Dec 31, 2019
e06d3b6
removed fake photos
jenaepen Dec 31, 2019
c9d97c1
removed fake pic
jenaepen Dec 31, 2019
1b7d482
DS Store commit
jenaepen Dec 31, 2019
768b080
added modal and png file back in
jenaepen Dec 31, 2019
ecb329d
final dev changes
jenaepen Dec 31, 2019
4304d7c
Merge pull request #13 from Chronos2-0/devTest
jenaepen Dec 31, 2019
24761bd
Merge branch 'dev' of https://github.com/Chronos2-0/Chronos into dev
jenaepen Dec 31, 2019
f733051
updated route tracer so that it is outside of the health section and …
jenaepen Jan 2, 2020
c996642
Merge pull request #14 from Chronos2-0/jenae/ben/route_with_microserv…
robicano22 Jan 2, 2020
e39a117
Final dev updat
Dialloousman Jan 4, 2020
5626149
Update README.md
ben-mizel Jan 4, 2020
22dfe06
Resolved Conflicts
tim-atapagra Jan 4, 2020
7acad7d
Added
tim-atapagra Jan 4, 2020
f0e2688
Merge pull request #15 from Chronos2-0/ben-mizel-patch-1
tim-atapagra Jan 4, 2020
ad1738f
added MS overview refresh button
Dialloousman Jan 4, 2020
6b57606
Update ServicesDashboard.jsx
Dialloousman Jan 4, 2020
75393dd
Merge pull request #17 from Chronos2-0/ousman/Backbuttonv2
Dialloousman Jan 4, 2020
a71596d
Update README.md
tim-atapagra Jan 4, 2020
24777e6
Added logo
ben-mizel Jan 4, 2020
ceb9533
Update README.md
ben-mizel Jan 4, 2020
8a2f882
fixed button text over flow, repaired partioning background
Dialloousman Jan 4, 2020
4f24fdf
Merge pull request #18 from Chronos2-0/ousman/fixTextOverflow
Dialloousman Jan 4, 2020
b7b7fbd
Updates to dev
tim-atapagra Jan 4, 2020
61b4f6f
redoing changes
robicano22 Jan 4, 2020
061f219
Professionalized
ben-mizel Jan 4, 2020
6e0cf40
Update README.md
ben-mizel Jan 4, 2020
f3f8b38
Update README.md
ben-mizel Jan 4, 2020
6715c4a
added delete button
jenaepen Jan 4, 2020
726adf2
Merge branch 'dev' into jenae/delete_button
jenaepen Jan 4, 2020
406fbcb
Update README.md
ben-mizel Jan 4, 2020
92a6671
Update README.md
ben-mizel Jan 4, 2020
b4a6ff5
Merge pull request #20 from Chronos2-0/jenae/delete_button
jenaepen Jan 4, 2020
e410d27
splash transition update
robicano22 Jan 8, 2020
f7cd0f8
merged with dev
robicano22 Jan 8, 2020
29992e5
Fixed typos
ben-mizel Jan 8, 2020
23c0e25
splash ready, small styling changes
robicano22 Jan 8, 2020
a94ddd8
fixed broken image
robicano22 Jan 8, 2020
1632351
added traffic chart
Dialloousman Jan 8, 2020
854b6f7
inlined communication modals
Dialloousman Jan 8, 2020
a201ac4
fixed MSoverview empty space blocking
Dialloousman Jan 8, 2020
58e8dba
reset settings JSON
Dialloousman Jan 9, 2020
ed9175e
comment delete service
jenaepen Jan 9, 2020
6276a2e
jsdom for electron test
jenaepen Jan 9, 2020
0092716
Merge pull request #25 from Chronos2-0/newDevV2
Dialloousman Jan 9, 2020
105b4d0
Merge pull request #21 from Chronos2-0/ben-mizel-patch-2
Dialloousman Jan 9, 2020
9cb490b
still working on testing
jenaepen Jan 9, 2020
498f437
splash ready. only renders once per session
robicano22 Jan 9, 2020
86bd551
merged with dev, still debugging, need to switch to dev
robicano22 Jan 9, 2020
b710607
saved unsaved file to switch branches
robicano22 Jan 10, 2020
b8b9816
conflicts resolved
robicano22 Jan 10, 2020
f38d116
still trying to test
jenaepen Jan 10, 2020
dac3530
Merge pull request #26 from Chronos2-0/detached
jenaepen Jan 10, 2020
110b7c6
removed unfinish testing
jenaepen Jan 10, 2020
8919d28
merge dev into branch and fix margin on delete button
jenaepen Jan 10, 2020
ea97d07
Merge pull request #29 from Chronos2-0/jenae/comment_clean_up
robicano22 Jan 10, 2020
8c4f5b5
fixed traffic visualization to ping servers properly
Dialloousman Jan 11, 2020
3b2c10c
Merge pull request #30 from Chronos2-0/fixedChartTraffic
Dialloousman Jan 11, 2020
13a502d
health buttons are rendering below microservice details button
robicano22 Jan 11, 2020
1d3012d
tooltips are functional, and overview restructured
robicano22 Jan 12, 2020
e802431
user settings conflict resolved
robicano22 Jan 12, 2020
294056a
fixed z-index bug
robicano22 Jan 13, 2020
11ef6e4
Merge pull request #32 from Chronos2-0/chris/health-button-restructure
tim-atapagra Jan 13, 2020
082bd7d
Index dist removed
tim-atapagra Jan 14, 2020
59d1b86
added clear button logic for sql
robicano22 Jan 14, 2020
7546d72
merging with dev
robicano22 Jan 14, 2020
bc5d7e3
deleted dist folder
robicano22 Jan 14, 2020
c09cde3
Merge pull request #33 from Chronos2-0/chris/health-button-restructure
tim-atapagra Jan 14, 2020
8f9d42b
Few components updated
tim-atapagra Jan 14, 2020
18c6d15
Linter file added
tim-atapagra Jan 14, 2020
4677660
Unecessary files deleted
tim-atapagra Jan 14, 2020
1ed1f8a
Merge pull request #34 from Chronos2-0/cleanup/dev
tim-atapagra Jan 14, 2020
4ba2507
Update README.md
ben-mizel Jan 15, 2020
6023841
add testing to see if the window name is chronos
jenaepen Jan 15, 2020
dbf658d
merge dev into testing file
jenaepen Jan 15, 2020
056ea39
Merge pull request #38 from Chronos2-0/jenae/testing
jenaepen Jan 15, 2020
36e05b9
updated readme to be able to merge with master
jenaepen Jan 15, 2020
41736d3
Merge pull request #39 from Chronos2-0/testDev
jenaepen Jan 15, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "airbnb",
"root": true
}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
.eslintrc.js
package-lock.json
package-lock.json
settings.json
.DS_Store
170 changes: 151 additions & 19 deletions Main.js
Original file line number Diff line number Diff line change
@@ -1,84 +1,169 @@
const { app, BrowserWindow, ipcMain } = require('electron');
// node requirements
const {
dialog, app, BrowserWindow, ipcMain,
} = require('electron');
const fs = require('fs');
const path = require('path');
const connectSQL = require('./model/sql-connect');
const connectMongoose = require('./model/mongoose-connect');
const CommunicationSchema = require('./model/mongoose-communicatonSchema');
const HealthInfoSchema = require('./model/mongoose-healthInfoSchema');

// declare a variable pool for SQL connection
let pool;

// declare win variable ---> Ousman
let win;

// declaring a createWindow function ---> Ousman
function createWindow() {
// assign win to an instance of a new browser window.
win = new BrowserWindow({
// giving our window its width
width: 900,
// giving our window its hieght
height: 800,
// specify the path of the icon -- Which icon is this?.. note too tsure --> Ousman
icon: path.join(__dirname, 'app/assets/icons/icon.png'),
// enable node inegreation --> node intgeration, default is usally false --> Ousman
webPreferences: {
nodeIntegration: true,
},
});

// Development
// loads our application window to localHost 8080, application will not render without this loadUrl --> Ousman
win.loadURL('http://localhost:8080/');

// Production
// win.loadURL(`file://${path.join(__dirname, './dist/index.html')}`);

// assign window to null on close and set splash property in settings.json back to true so splash page renders on restart
win.on('closed', () => {
win = null;
const state = JSON.parse(
// read json from settings.json
fs.readFileSync(path.resolve(__dirname, './user/settings.json'), {
encoding: 'UTF-8',
}),
);
// reassign state.splash
state.splash = true;
fs.writeFileSync(path.resolve(__dirname, './user/settings.json'), JSON.stringify(state), { encoding: 'UTF-8' }); win = null;
});
}

// invoke createWindow function on Electron application load --> Ousman
app.on('ready', createWindow);

// quits the application when all windows are closed --> Ousman
app.on('window-all-closed', () => {
console.log('window-all-closed message received');
const state = JSON.parse(
// read json from settings.json
fs.readFileSync(path.resolve(__dirname, './user/settings.json'), {
encoding: 'UTF-8',
}),
);
// reassign state.splash
state.splash = true;
fs.writeFileSync(path.resolve(__dirname, './user/settings.json'), JSON.stringify(state), { encoding: 'UTF-8' });
// process platform is a property that return a string identifying the OS platform on which NodeJs process is running --> Ousman
if (process.platform !== 'darwin') {
// quits application
app.quit();
}
});

// event 'activate' emmitted upon application starting
app.on('activate', () => {
// if there is no window present invoke the create window function --> Ousman
if (win === null) {
createWindow();
}
});

// Fired by the useEffect hook inside of the Splash.jsx component, this message route will toggle
// splash property inside of settings.json to false once the Splash page renders itself just once
ipcMain.on('toggleSplash', (message) => {
//console.log('toggleSplash message received');
const state = JSON.parse(
// read json from settings.json
fs.readFileSync(path.resolve(__dirname, './user/settings.json'), {
encoding: 'UTF-8',
}),
);
// reassign state.splash to false
state.splash = false;

// overwrite settings.json with false splash property
fs.writeFileSync(path.resolve(__dirname, './user/settings.json'), JSON.stringify(state), { encoding: 'UTF-8' });

message.returnValue = state.splash;
});

ipcMain.on('checkSplash', (message) => {
//sconsole.log('checkSplash message received');
const state = JSON.parse(
// read json from settings.json
fs.readFileSync(path.resolve(__dirname, './user/settings.json'), {
encoding: 'UTF-8',
}),
);

message.returnValue = state.splash;
});

// Load settings JSON and returns current setup status back to the render process.
// ipc 'setup' route --> Ousman
ipcMain.on('setup', (message) => {
//console.log('setup message received');
// assigns state to the returned the object returned from settings.json --> Ousman
const state = JSON.parse(
// read json from settings.json
fs.readFileSync(path.resolve(__dirname, './user/settings.json'), {
encoding: 'UTF-8',
}),
);
// destructure setupRequired from state constant ---> Ousman
const { setupRequired } = state;
// assigning message object a property of return value and assigning it the setupRequired from state destructuring --> Ousman
message.returnValue = setupRequired;
});

// Loads existing settings JSON and update settings to include new services entered by the user.
// on ipc 'submit' request --> Ousman
ipcMain.on('submit', (message, newService) => {
// Declares a variable state and initialize it to the returned parsed json object from the user/settings.json file
const state = JSON.parse(
fs.readFileSync(path.resolve(__dirname, './user/settings.json'), {
encoding: 'UTF-8',
}),
);
// if statement is used to replace hard coded data. Hard coded data and the michelleWasHere key is needed to avoid a load error caused by Electron querying the database before a user has added or selected a database.
if (state.michelleWasHere) {

// Checks if setup is required by checking if the value for the state key 'setupRequired' is true
if (state.setupRequired) {
// If setup is required, the value for key 'setupRequired' is reassign to false and the value for key 'services' is reassign to an array with newService as its only element
state.setupRequired = false;
state.michelleWasHere = false;
state.services = [JSON.parse(newService)];
fs.writeFileSync(path.resolve(__dirname, './user/settings.json'), JSON.stringify(state));
} else {
state.setupRequired = false;
// Else the newService is pushed into the services array
state.services.push(JSON.parse(newService));
fs.writeFileSync(path.resolve(__dirname, './user/settings.json'), JSON.stringify(state));
}
}

// Rewrites user/settings.json to show state
fs.writeFileSync(path.resolve(__dirname, './user/settings.json'), JSON.stringify(state));
});

// Load settings JSON and returns updated state back to the render process.
// on ipc 'dashboard' request --> Ousman
ipcMain.on('dashboard', (message) => {
// Declares a variable state and initialize it to the returned parse json object from the user/settings.json file
const state = JSON.parse(
fs.readFileSync(path.resolve(__dirname, './user/settings.json'), {
encoding: 'UTF-8',
}),
);
// destructure services from state... what is services? --> Ousman
const { services } = state;
const dashboardList = services.reduce((acc, curVal) => {
acc.push(curVal[0]);
Expand All @@ -87,48 +172,94 @@ ipcMain.on('dashboard', (message) => {
message.returnValue = dashboardList;
});

// Deletes the service at position 'index' from the services array within the user/setting.json file,
// resets the user/setting.json file to what it was originally if all of the services are deleted,
// and sends the remaining services back to onDelete function within DeleteService as a response
ipcMain.on('deleteService', (message, index) => {
// Declares a variable state and initialize it to the returned parse json object from the user/settings.json file
let state = JSON.parse(
fs.readFileSync(path.resolve(__dirname, './user/settings.json'), {
encoding: 'UTF-8',
}),
);

// Send a response back with the updated services
const { splash } = state;
// Checks if there is more than one services in the services array
if (state.services.length > 1) {
// If true, removes the service at position 'index'
state.services.splice(index, 1);
} else {
// Else reassign state to what the user/setting.json file was originally before any database was save
state = { setupRequired: true, services: ['hard', 'coded', 'in'], splash };
}

// Rewrites json from settings.json
fs.writeFileSync(path.resolve(__dirname, './user/settings.json'), JSON.stringify(state), { encoding: 'UTF-8' });
message.sender.send('deleteResponse', state.services);
});


// Queries the database for communications information and returns it back to the render process.
ipcMain.on('overviewRequest', (message, index) => {
const databaseType = JSON.parse(
console.log('hello from overview request');
const { services } = JSON.parse(
fs.readFileSync(path.resolve(__dirname, './user/settings.json'), { encoding: 'UTF-8' }),
).services[index][1];
);

const databaseType = services[index][1];
const URI = services[index][2];

if (databaseType === 'MongoDB') {
connectMongoose(index);
connectMongoose(index, URI);
CommunicationSchema.find({}, (err, data) => {
if (err) {
console.log(`An error occured while querying the database: ${err}`);
message.sender.send('overviewResponse', JSON.stringify(err));
}

const queryResults = JSON.stringify(data);
// Asynchronous event emitter used to transmit query results back to the render process.
message.sender.send('overviewResponse', queryResults);
});
}

if (databaseType === 'SQL') {
const pool = connectSQL(index);
pool = connectSQL(index, URI);
const getCommunications = 'SELECT * FROM communications';
pool.query(getCommunications, (err, result) => {
if (err) {
console.log(err);
// error object to log to Electron GUI ---> Ousman
const errorAlert = {
type: 'error',
title: 'Error in Main process',
message: 'Database information could not be retreived. Check that table exists.',
};

// after requiring dialog in the topmost section of main. We invoke the method showMessagebox passing the error object we created --> Ousman
dialog.showMessageBox(errorAlert);


message.sender.send(JSON.stringify('Database info could not be retreived.'));
} else {
console.log('Connected to SQL Database');
const queryResults = JSON.stringify(result.rows);
// Asynchronous event emitter used to transmit query results back to the render process.
console.log('ipcMain about to send overviewResponse message');
message.sender.send('overviewResponse', queryResults);
}
const queryResults = JSON.stringify(result.rows);
// Asynchronous event emitter used to transmit query results back to the render process.
message.sender.send('overviewResponse', queryResults);
});
}
});

// Queries the database for computer health information and returns it back to the render process.
ipcMain.on('detailsRequest', (message, index) => {
console.log('detailsRequest message received');
const databaseType = JSON.parse(
fs.readFileSync(path.resolve(__dirname, './user/settings.json'), { encoding: 'UTF-8' }),
).services[index][1];

if (databaseType === 'MongoDB') {
connectMongoose(index);
HealthInfoSchema.find({}, (err, data) => {
if (err) {
message.sender.send('detailsResponse', JSON.stringify(err));
Expand All @@ -140,15 +271,16 @@ ipcMain.on('detailsRequest', (message, index) => {
}

if (databaseType === 'SQL') {
const pool = connectSQL(index);
const getHealth = 'SELECT * FROM healthInfo';
pool.query(getHealth, (err, result) => {
if (err) {
message.sender.send('detailsResponse', JSON.stringify('Database info could not be retreived.'));
}
const queryResults = JSON.stringify(result.rows);
// Asynchronous event emitter used to transmit query results back to the render process.
// console.log('healthInfo data about to comeback');
message.sender.send('detailsResponse', queryResults);
});
}
});

Loading