Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge main back to dev. #181

Merged
merged 6 commits into from
Aug 18, 2023
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
28 changes: 16 additions & 12 deletions src/component/Logs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,32 @@ const Logs = ({ superState, dispatcher }) => {

useEffect(() => {
if (superState.logs) {
document.getElementById('outlay').style.display = 'block';
document.getElementById('terminal').style.display = 'block';
setOutput(superState.logsmessage);
} else {
document.getElementById('terminal').style.display = 'none';
document.getElementById('outlay').style.display = 'none';
setOutput(superState.logsmessage);
}
}, [superState.logs]);

return (
<>
<div className="terminal" id="terminal">
<div className="terminal-header">
Logs
<button type="button" className="clear" onClick={clearTerminal}>Clear</button>
<button type="button" className="closelogs" onClick={closeTerminal}>X</button>
</div>
<div className="terminal-body">
{output.split('\n').map((line) => (
<div className="terminal-line">
{line}
</div>
))}
<div className="outlay" id="outlay">
<div className="terminal" id="terminal">
<div className="terminal-header">
Logs
<button type="button" className="clear" onClick={clearTerminal}>Clear</button>
<button type="button" className="closelogs" onClick={closeTerminal}>X</button>
</div>
<div className="terminal-body">
{output.split('\n').map((line) => (
<div className="terminal-line">
{line}
</div>
))}
</div>
</div>
</div>
</>
Expand Down
8 changes: 8 additions & 0 deletions src/component/logs.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
margin: 20px auto;
z-index: 10000;
}

.outlay {
position: absolute;
width: 100vw;
height: 100vh;
z-index: 999;
display: none;
}

.terminal-header {
padding: 5px;
Expand Down
3 changes: 2 additions & 1 deletion src/component/modals/GraphCompDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,14 @@ const ModalComp = ({ closeModal, superState, dispatcher }) => {
}
};

const createLibrary = () => {
const createLibrary = (e) => {
const fileName = data.label.split(':')[1];
if (fileName === undefined || fileName === '') {
toast.error('Enter File Name');
return;
}
superState.curGraphInstance.library(fileName);
submit(e);
};

return (
Expand Down
2 changes: 1 addition & 1 deletion src/config/defaultValidators.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ edges.forEach((e) => {
break;
}
}
if (numE === numEdge && numE != "0") {
if (numE === numEdge && numE != "0" && numE !== "") {
message = {
ok: false,
err: '2 edges cannot have same prefixes if they are number',
Expand Down
10 changes: 10 additions & 0 deletions src/graph-builder/graph-core/5-load-save.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,16 @@ class GraphLoadSave extends GraphUndoRedo {
const stream = await handle.createWritable();
await stream.write(blob);
await stream.close();
const fileData = await handle.getFile();
let fS = this.superState.fileState;
fS = fS.concat([{
key: `${this.superState.uploadedDirName}/${handle.name}`,
modified: fileData.lastModified,
size: fileData.size,
fileObj: fileData,
fileHandle: handle,
}]);
this.dispatcher({ type: T.SET_FILE_STATE, payload: fS });
} else {
// eslint-disable-next-line no-alert
const fileName = prompt('Filename:');
Expand Down
2 changes: 1 addition & 1 deletion src/graph-builder/graph-core/6-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class GraphServer extends GraphLoadSave {
this.dispatcher({
type: T.SET_FUNCTIONS,
payload: {
built: false, ran: false, debugged: true, cleared: false, stopped: false, destroyed: true,
built: false, ran: true, debugged: true, cleared: false, stopped: false, destroyed: true,
},
});
this.dispatcher({ type: T.SET_LOGS_MESSAGE, payload: this.superState.logsmessage + res.data.output });
Expand Down
Loading