Skip to content

Commit

Permalink
new add and delete node features along with improved UI features
Browse files Browse the repository at this point in the history
  • Loading branch information
itsMando committed May 6, 2024
1 parent 6ad1e09 commit 6b404e2
Show file tree
Hide file tree
Showing 26 changed files with 657 additions and 272 deletions.
1 change: 0 additions & 1 deletion glimpse/config/appConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
}
},
"nodes": {
"shape": "image",
"borderWidth": 2,
"font": {
"color": "#000",
Expand Down
26 changes: 11 additions & 15 deletions glimpse/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ const exportThemeFile = async (themeData) => {
if (dir2save.canceled) return null;
dir2save = dir2save.filePaths[0];

console.log(dir2save);

fs.writeFileSync(path.join(dir2save, filename), themeData);
}

Expand All @@ -196,10 +194,8 @@ const json2glmFunc = async (jsonData) => {
if (dir2save.canceled) return null;
dir2save = dir2save.filePaths[0];

console.log(dir2save);

const parsedData = JSON.parse(jsonData);
const json2glmArg = process.platform == "darwin" ? "json2glm" : "json2glm.exe";
const json2glmArg = process.platform == "darwin" ? ".\\tools\\json2glm" : ".\\tools\\json2glm.exe";

// for each json file data, make a json file and turn it to a glm file
for (const file of Object.keys(parsedData)) {
Expand Down Expand Up @@ -296,11 +292,11 @@ const makeWindow = () => {
id: "layout-theme",
type: "radio",
},
{
label: "Fishing",
id: "fishing-theme",
type: "radio",
}
// {
// label: "Fishing",
// id: "fishing-theme",
// type: "radio",
// }
]
},
{
Expand Down Expand Up @@ -373,19 +369,19 @@ app.whenReady().then(() => {
// autoUpdater.checkForUpdatesAndNotify();
makeWindow();

app.on("before-quit", () => {
kill(process.pid);
});

app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
makeWindow();
}
});
});

app.on("quit", () => {
kill(process.pid);
});

app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
kill(process.pid);
}
});
56 changes: 31 additions & 25 deletions glimpse/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"productName": "GLIMPSE",
"version": "0.2.1",
"version": "0.2.2",
"main": "main.js",
"description": "A lightweight power grid model visualization tool",
"author": "Armando Mendoza Sanchez",
"name": "glimpse-0.2.1",
"name": "glimpse-0.2.2",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "webpack --config webpack.common.js --watch",
Expand All @@ -25,13 +25,19 @@
}
],
"asar": true,
"extraResources": ["./themes/**", "./data/**", "./config/**"],
"extraResources": [
"./themes/**",
"./data/**",
"./config/**"
],
"appId": "com.github.pnnl.GLIMPSE",
"win": {
"target": [
{
"target": "nsis",
"arch": ["x64"]
"arch": [
"x64"
]
}
]
},
Expand All @@ -41,43 +47,43 @@
}
},
"dependencies": {
"@mui/icons-material": "^5.14.12",
"react-router-dom": "^6.16.0",
"@emotion/styled": "^11.11.0",
"electron-updater": "^6.1.8",
"socket.io-client": "^4.7.4",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.14.12",
"@mui/material": "^5.14.12",
"ajv": "^8.12.0",
"child_process": "^1.0.2",
"electron-updater": "^6.1.8",
"fs": "^0.0.1-security",
"vis-network": "^9.1.9",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.16.0",
"socket.io-client": "^4.7.4",
"tree-kill": "^1.2.2",
"vis-data": "^7.1.7",
"react": "^18.2.0",
"ajv": "^8.12.0"
"vis-network": "^9.1.9"
},
"devDependencies": {
"@electron-forge/plugin-auto-unpack-natives": "^7.3.0",
"@electron-forge/maker-squirrel": "^7.3.0",
"@electron-forge/plugin-fuses": "^7.3.0",
"@babel/core": "^7.23.0",
"@babel/preset-env": "^7.22.20",
"@babel/preset-react": "^7.22.15",
"@electron-forge/cli": "^7.3.0",
"@electron-forge/maker-deb": "^7.3.0",
"@electron-forge/maker-rpm": "^7.3.0",
"@electron-forge/maker-squirrel": "^7.3.0",
"@electron-forge/maker-zip": "^7.3.0",
"electron-reload": "^2.0.0-alpha.1",
"@babel/preset-react": "^7.22.15",
"@babel/preset-env": "^7.22.20",
"@electron-forge/cli": "^7.3.0",
"@electron-forge/plugin-auto-unpack-natives": "^7.3.0",
"@electron-forge/plugin-fuses": "^7.3.0",
"@electron/packager": "^18.1.3",
"electron-builder": "^24.13.3",
"@babel/core": "^7.23.0",
"babel-loader": "^9.1.3",
"sass-loader": "^13.3.2",
"style-loader": "^3.3.3",
"webpack-cli": "^5.1.4",
"css-loader": "^6.8.1",
"electron": "^26.4.0",
"electron-builder": "^24.13.3",
"electron-reload": "^2.0.0-alpha.1",
"sass": "^1.68.0",
"sass-loader": "^13.3.2",
"style-loader": "^3.3.3",
"webpack": "^5.88.2",
"sass": "^1.68.0"
"webpack-cli": "^5.1.4"
}
}
25 changes: 20 additions & 5 deletions glimpse/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,29 @@ const { contextBridge, ipcRenderer } = require("electron");

// endpoints to be used as API for communication between the renderer process and main process
contextBridge.exposeInMainWorld("glimpseAPI", {
onShowAttributes: (callback) => ipcRenderer.on("show-attributes", (_event, showBool) => callback(showBool)),
onUpdateData: (callback) => ipcRenderer.on("update-data", (_event, data) => callback(data)),
onShowVisOptions: (callback) => ipcRenderer.on("show-vis-options", () => callback()),
onExportTheme: (callback) => ipcRenderer.on("export-theme", () => callback()),
onShowAttributes: (callback) => {
ipcRenderer.on("show-attributes", (_event, showBool) => callback(showBool));
return () => ipcRenderer.removeAllListeners("show-attributes");
},
onUpdateData: (callback) => {
ipcRenderer.on("update-data", (_event, data) => callback(data));
return () => ipcRenderer.removeAllListeners("update-data");
},
onShowVisOptions: (callback) => {
ipcRenderer.on("show-vis-options", () => callback());
return () => ipcRenderer.removeAllListeners("show-vis-options");
},
onExportTheme: (callback) => {
ipcRenderer.on("export-theme", () => callback());
return () => ipcRenderer.removeAllListeners("export-theme");
},
validate: (jsonFilePath) => ipcRenderer.invoke("validate", jsonFilePath),
getThemeJsonData: (path) => ipcRenderer.invoke("getThemeJsonData", path),
exportTheme: (themeData) => ipcRenderer.send("exportTheme", themeData),
onExtract: (callback) => ipcRenderer.on("extract", () => callback()),
onExtract: (callback) => {
ipcRenderer.on("extract", () => callback())
return () => ipcRenderer.removeAllListeners("extract");
},
getStats: (dataObject) => ipcRenderer.invoke("getStats", dataObject),
json2glm: (jsonData) => ipcRenderer.send("json2glm", jsonData),
glm2json: (paths) => ipcRenderer.invoke("glm2json", paths),
Expand Down
8 changes: 4 additions & 4 deletions glimpse/renderer/public/imgs/Capacitor.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion glimpse/renderer/public/imgs/Inverter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6b404e2

Please sign in to comment.