Skip to content

Commit

Permalink
refactor: shell moved to nodejs server
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronm-2112 committed Jan 18, 2024
1 parent 05679cc commit 2f53e62
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import "./main-process/native-ui/dialogs/open-file"
import "./strain"
import "./checkDiskSpace"
import "./spreadsheet-import-gm"
import "./shell"


const sodaVersion = app.getVersion();
Expand Down
10 changes: 10 additions & 0 deletions src/main/shell.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {shell, ipcMain } from 'electron'

ipcMain.handle("shell-open-external", (event, url) => {
return shell.openExternal(url)
})


ipcMain.handle("shell-open-path", (event, path) => {
return shell.openPath(path)
})
Original file line number Diff line number Diff line change
Expand Up @@ -3851,7 +3851,7 @@ document

if (viewReportResult.isConfirmed) {
// open a shell to the raw validation report
shell.openPath(validationReportPath);
window.electron.ipcRenderer.invoke("shell-open-path", validationReportPath);
}
} else {
await Swal.fire({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ window.validateOrganizedDataset = async () => {

if (viewReportResult.isConfirmed) {
// open a shell to the raw validation report
shell.openPath(validationReportPath);
window.electron.ipcRenderer.invoke("shell-open-path", validationReportPath);
}
return;
}
Expand Down Expand Up @@ -358,7 +358,7 @@ document.querySelector(".validate-raw-report_btn").addEventListener("click", (e)
// open the text file stored at the raw validation report path
let pathToRawReport = window.path.join(window.os.homedir(), "SODA", "validation.txt");

shell.openPath(pathToRawReport);
window.electron.ipcRenderer.invoke("shell-open-path", pathToRawReport);
});

const displayValidationReportErrors = (validationReport, tableBody, validationErrorsContainer) => {
Expand Down
7 changes: 3 additions & 4 deletions src/renderer/src/scripts/others/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9231,13 +9231,12 @@ const gettingStarted = () => {

const sodaVideo = () => {
document.getElementById("overview-column-1").blur();
window.shell.openExternal("https://docs.sodaforsparc.io/docs/getting-started/user-interface");
window.electron.ipcRenderer.invoke("shell-open-external", "https://docs.sodaforsparc.io/docs/getting-started/user-interface")
};

const directToDocumentation = () => {
window.shell.openExternal(
"https://docs.sodaforsparc.io/docs/getting-started/organize-and-submit-sparc-datasets-with-soda"
);
window.electron.ipcRenderer.invoke("shell-open-external", "https://docs.sodaforsparc.io/docs/getting-started/organize-and-submit-sparc-datasets-with-soda")

document.getElementById("overview-column-2").blur();
// window.open('https://docs.sodaforsparc.io', '_blank');
};
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/src/scripts/validator/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ const validateLocalDataset = async () => {

if (viewReportResult.isConfirmed) {
// open a shell to the raw validation report
shell.openPath(validationReportPath);
window.electron.ipcRenderer.invoke("shell-open-path", validationReportPath);
}
return;
}
Expand Down Expand Up @@ -598,7 +598,7 @@ const validatePennsieveDatasetStandAlone = async () => {

if (viewReportResult.isConfirmed) {
// open a shell to the raw validation report
shell.openPath(validationReportPath);
window.electron.ipcRenderer.invoke("shell-open-path", validationReportPath);
}
return;
}
Expand Down

0 comments on commit 2f53e62

Please sign in to comment.