Skip to content

Commit 0cb3058

Browse files
authored
Merge pull request #22 from oslabs-beta/stephenfeature
Stephenfeature
2 parents bdf3b1c + 5aa4ed2 commit 0cb3058

File tree

8 files changed

+1569
-108
lines changed

8 files changed

+1569
-108
lines changed

app/context/ApplicationContext.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ const ApplicationContextProvider: React.FC<AppContextProps> = React.memo(props =
4040
*/
4141
// v10: Invoked by connectToDB, passing in app (card title)
4242
const fetchServicesNames = useCallback((application: string) => {
43+
44+
console.log({application});
4345
// console.log('Hi, inside ApplicationConext - fetchServicesNames callback. Sending servicesRequest to ipcMain.');
4446
console.log('app when fetch services name: ', application);
4547
console.log(application)
@@ -69,6 +71,7 @@ const ApplicationContextProvider: React.FC<AppContextProps> = React.memo(props =
6971
ipcRenderer.removeAllListeners('databaseConnected');
7072
ipcRenderer.send('connect', username, index, URI, databaseType);
7173
ipcRenderer.on('databaseConnected', (event: Electron.Event, data: any) => {
74+
console.log({data});
7275
if(data === true) {
7376
fetchServicesNames(application);
7477
} else {

electron/Main.ts

+32-1
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
import { app, BrowserWindow, ipcMain } from 'electron';
1+
import { app, BrowserWindow, ipcMain, session } from 'electron';
22
import './routes/dashboard';
33
import { clearGuestSettings } from './routes/dashboard';
44
import './routes/data';
55
import './routes/cloudbased';
66
import path from 'path';
7+
import installExtension, { REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS } from 'electron-devtools-installer'
78

89
// Declare variable to be used as the application window
910
let win: Electron.BrowserWindow;
1011

1112
app.commandLine.appendSwitch('remote-debugging-port', '9222');
1213

14+
// Path to reactDevTools
15+
const reactDevToolsPath = path.resolve(__dirname, '../node_modules/react-devtools');
16+
1317
/**
1418
* @desc createWindow sets up the environment of the window (dimensions, port, initial settings)
1519
*/
@@ -56,9 +60,36 @@ const createWindow = () => {
5660
});
5761
};
5862

63+
const addDevTools = async () => {
64+
// await installExtension(REACT_DEVELOPER_TOOLS, { loadExtensionOptions: { allowFileAccess: true }})
65+
// .then((name) => console.log(`Added Extension: ${name}`))
66+
// .catch((err) => console.log('An error occurred: ', err));
67+
// await installExtension(reactDevToolsPath)
68+
// .then((name) => console.log(`Added Extension: ${name}`))
69+
// .catch((err) => console.log('An error occurred: ', err));
70+
71+
await installExtension(REDUX_DEVTOOLS)
72+
.then((name) => console.log(`Added Extension: ${name}`))
73+
.catch((err) => console.log('An error occurred: ', err));
74+
75+
await session.defaultSession.loadExtension(reactDevToolsPath);
76+
};
77+
78+
app.whenReady().then(async () => {
79+
await addDevTools();
80+
81+
// await session.defaultSession.loadExtension(reactDevToolsPath);
82+
});
5983
// Invoke the createWindow function when Electron application loads
6084
app.on('ready', createWindow);
6185

86+
// Loads reactDevTools extension
87+
// app.whenReady().then(async () => {
88+
// console.log(reactDevToolsPath);
89+
// await session.defaultSession.loadExtension(reactDevToolsPath);
90+
// console.log({reactDevToolsPath})
91+
// });
92+
6293
// Quits application when all windows are closed
6394
app.on('window-all-closed', () => {
6495
app.quit();

electron/routes/data.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ ipcMain.on('servicesRequest', async (message: Electron.IpcMainEvent) => {
8484
// console.log('Hi, inside data.ts line 97 - servicesRequest. Fetching services...');
8585

8686
// Mongo Database
87-
// console.log('data.ts line 100 CurrentDataBase TYPE:', currentDatabaseType);
87+
console.log('data.ts line 100 CurrentDataBase TYPE:', currentDatabaseType);
8888
if (currentDatabaseType === 'MongoDB' ) {
8989
// Get all documents from the services collection
9090
//>>>>>

examples/microservices/sample.env

-15
This file was deleted.

0 commit comments

Comments
 (0)