From 78115d153d12c3865f6511046cbd9dd74525deb6 Mon Sep 17 00:00:00 2001 From: Anoop Chandran Date: Wed, 11 Mar 2020 20:11:55 +0100 Subject: [PATCH] Create .mse file at $HOME if it doesn't exist --- src/components/App.jsx | 2 +- src/components/Nodes.jsx | 21 ++++---- src/lib/global.js | 105 +++++++++++---------------------------- 3 files changed, 39 insertions(+), 89 deletions(-) diff --git a/src/components/App.jsx b/src/components/App.jsx index 9736392..5b466ea 100644 --- a/src/components/App.jsx +++ b/src/components/App.jsx @@ -134,7 +134,6 @@ export default function App() { setAppName(arg.appName); setAppVersion(arg.appVersion); }); - readConfig(); }, []); const classes = useStyles(); @@ -163,6 +162,7 @@ export default function App() { } console.log(appName, appVersion); + readConfig(); let windowView; if (isDashboard) { diff --git a/src/components/Nodes.jsx b/src/components/Nodes.jsx index 452e38e..87fa6cd 100644 --- a/src/components/Nodes.jsx +++ b/src/components/Nodes.jsx @@ -51,7 +51,6 @@ const useStyles = makeStyles(theme => ({ export default function Nodes() { const [data, setData] = useState({}); const [isLoaded, setLoaded] = useState(false); - const [isDatabase, setDatabase] = useState(true); const isRemoteDB = false //for split button @@ -72,9 +71,9 @@ export default function Nodes() { if (isActive) return "secondary"; }; - const activateDatabase = () => { - setDatabase(true); - }; + // const activateDatabase = () => { + // setDatabase(true); + // }; const handleMenuItemClick = (event, index) => { setSelectedIndex(index); @@ -101,7 +100,7 @@ export default function Nodes() { useEffect(() => { let didCancel = false; async function fetchData() { - if (isDatabase) { + if (db !=null) { db.query(queryText, (err, res) => { if (!err && !didCancel) { setData(res.rows); @@ -111,7 +110,7 @@ export default function Nodes() { } } - if (isDatabase) { + if (db != null) { fetchData(); if (isIntervel) { setInterval(() => { @@ -122,18 +121,18 @@ export default function Nodes() { return () => { didCancel = true; }; - }, [isDatabase, fetchInterval, isIntervel]); + }, [fetchInterval, isIntervel]); let nodesTable; if (isLoaded && data) { - if (isDatabase === false) { + if (db == null) { nodesTable = (
You have to set the path to aiida config and start the postgress server or start remote REST API connection on port 5791{" "}
); - } else if (isDatabase && !data.data) { + } else if (!data.data) { nodesTable = ; } else { nodesTable = ( @@ -171,9 +170,9 @@ export default function Nodes() { disableRipple={true} variant="outlined" className={classes.button} - onClick={activateDatabase} + // onClick={activateDatabase} > - +