Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 5 additions & 4 deletions src/GraphArea.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ function Graph({
}, [active, instance, graphID, dispatcher]);

useEffect(() => {
if (!ref.current) return;
setContainerDim(ref.current);
const handleResize = () => setContainerDim(ref.current);
window.addEventListener('resize', handleResize);
setInstance(initialiseNewGraph());
if (ref.current) {
setContainerDim(ref.current);
window.addEventListener('resize', handleResize);
setInstance(initialiseNewGraph());
}
return () => window.removeEventListener('resize', handleResize);
}, [ref]);

Expand Down
47 changes: 27 additions & 20 deletions src/graph-builder/graph-core/6-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class GraphServer extends GraphLoadSave {
// this.setGraphML(graphXML);
// });
// } else {
// // eslint-disable-next-line no-toast.success
// toast.success('Not on server');
// }
// }
Expand All @@ -65,7 +64,6 @@ class GraphServer extends GraphLoadSave {

// });
// } else {
// // eslint-disable-next-line no-toast.success
// toast.success('Not on server');
// }
// }
Expand Down Expand Up @@ -119,7 +117,6 @@ class GraphServer extends GraphLoadSave {
toast.error(err.response?.data?.message || err.message);
});
} else {
// eslint-disable-next-line no-toast.success
toast.success('Not on server');
}
}
Expand All @@ -133,7 +130,6 @@ class GraphServer extends GraphLoadSave {

});
} else {
// eslint-disable-next-line no-toast.success
toast.success('Not on server');
}
}
Expand Down Expand Up @@ -170,12 +166,16 @@ class GraphServer extends GraphLoadSave {
build() {
const graphName = this.getCurrentGraphName();
if (!graphName) return;
const url = `${EXECUTION_ENGINE_URL}/build/${this.superState.uploadedDirName}`
+ `?fetch=${graphName}&unlock=${this.superState.unlockCheck}`
+ `&docker=${this.superState.dockerCheck}`
+ `&maxtime=${this.superState.maxTime}`
+ `&params=${this.superState.params}`
+ `&octave=${this.superState.octave}`;
const query = new URLSearchParams({
fetch: graphName,
unlock: this.superState.unlockCheck,
docker: this.superState.dockerCheck,
maxtime: this.superState.maxTime,
params: this.superState.params,
octave: this.superState.octave,
});
const url = `${EXECUTION_ENGINE_URL}/build/${encodeURIComponent(this.superState.uploadedDirName)}`
+ `?${query.toString()}`;
this.serverAction('post', url, {
built: false, ran: true, debugged: true, cleared: false, stopped: false, destroyed: true,
}, (res) => {
Expand All @@ -186,7 +186,7 @@ class GraphServer extends GraphLoadSave {
debug() {
const graphName = this.getCurrentGraphName();
if (!graphName) return;
const url = `${EXECUTION_ENGINE_URL}/debug/${graphName}`;
const url = `${EXECUTION_ENGINE_URL}/debug/${encodeURIComponent(graphName)}`;
this.serverAction('post', url, {
built: false, ran: false, debugged: false, cleared: true, stopped: true, destroyed: true,
});
Expand All @@ -195,7 +195,7 @@ class GraphServer extends GraphLoadSave {
run() {
const graphName = this.getCurrentGraphName();
if (!graphName) return;
const url = `${EXECUTION_ENGINE_URL}/run/${graphName}`;
const url = `${EXECUTION_ENGINE_URL}/run/${encodeURIComponent(graphName)}`;
this.serverAction('post', url, {
built: false, ran: false, debugged: false, cleared: true, stopped: true, destroyed: true,
});
Expand All @@ -204,10 +204,13 @@ class GraphServer extends GraphLoadSave {
clear() {
const graphName = this.getCurrentGraphName();
if (!graphName) return;
const url = `${EXECUTION_ENGINE_URL}/clear/${graphName}`
+ `?unlock=${this.superState.unlockCheck}`
+ `&maxtime=${this.superState.maxTime}`
+ `&params=${this.superState.params}`;
const query = new URLSearchParams({
unlock: this.superState.unlockCheck,
maxtime: this.superState.maxTime,
params: this.superState.params,
});
const url = `${EXECUTION_ENGINE_URL}/clear/${encodeURIComponent(graphName)}`
+ `?${query.toString()}`;
this.serverAction('post', url, {
built: false, ran: true, debugged: true, cleared: false, stopped: true, destroyed: true,
});
Expand All @@ -216,7 +219,7 @@ class GraphServer extends GraphLoadSave {
stop() {
const graphName = this.getCurrentGraphName();
if (!graphName) return;
const url = `${EXECUTION_ENGINE_URL}/stop/${graphName}`;
const url = `${EXECUTION_ENGINE_URL}/stop/${encodeURIComponent(graphName)}`;
this.serverAction('post', url, {
built: false, ran: false, debugged: false, cleared: true, stopped: false, destroyed: true,
});
Expand All @@ -225,15 +228,19 @@ class GraphServer extends GraphLoadSave {
destroy() {
const graphName = this.getCurrentGraphName();
if (!graphName) return;
const url = `${EXECUTION_ENGINE_URL}/destroy/${graphName}`;
const url = `${EXECUTION_ENGINE_URL}/destroy/${encodeURIComponent(graphName)}`;
this.serverAction('delete', url, {
built: true, ran: false, debugged: false, cleared: false, stopped: false, destroyed: false,
});
}

library(fileName) {
const url = `${EXECUTION_ENGINE_URL}/library/${this.superState.uploadedDirName}`
+ `?filename=${fileName}&path=${this.superState.library}`;
const query = new URLSearchParams({
filename: fileName,
path: this.superState.library,
});
const url = `${EXECUTION_ENGINE_URL}/library/${encodeURIComponent(this.superState.uploadedDirName)}`
+ `?${query.toString()}`;
this.serverAction('post', url, null);
}

Expand Down