Skip to content

Commit

Permalink
Merge pull request #181 from ControlCore-Project/main
Browse files Browse the repository at this point in the history
Merge main back to dev.
  • Loading branch information
pradeeban authored Aug 18, 2023
2 parents a57e054 + 7b30f08 commit 4f2e6c8
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 15 deletions.
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

0 comments on commit 4f2e6c8

Please sign in to comment.