From 9d982ebba75e016b862e5490bc07998de7f1be48 Mon Sep 17 00:00:00 2001 From: Rahul Date: Mon, 31 Jul 2023 00:33:30 +0530 Subject: [PATCH 1/3] symbolic link (create library added) --- src/component/modals/GraphCompDetails.jsx | 20 ++++++++++++++++++++ src/component/modals/OptionsModal.jsx | 22 ++++++++++++++++++++-- src/graph-builder/graph-core/6-server.js | 18 ++++++++++++++++++ src/reducer/initialState.js | 1 + src/reducer/reducer.js | 1 + 5 files changed, 60 insertions(+), 2 deletions(-) diff --git a/src/component/modals/GraphCompDetails.jsx b/src/component/modals/GraphCompDetails.jsx index b080850..6e66f5b 100644 --- a/src/component/modals/GraphCompDetails.jsx +++ b/src/component/modals/GraphCompDetails.jsx @@ -109,6 +109,15 @@ const ModalComp = ({ closeModal, superState, dispatcher }) => { } }; + const createLibrary = () => { + const fileName = data.label.split(':')[1]; + if (fileName === undefined || fileName === '') { + toast.error('Enter File Name'); + return; + } + superState.curGraphInstance.library(fileName); + }; + return (
@@ -145,6 +154,17 @@ const ModalComp = ({ closeModal, superState, dispatcher }) => { Create Help )} + { title === 'Edit Node' + ? '' + : ( + + )} ) : '' } diff --git a/src/component/modals/OptionsModal.jsx b/src/component/modals/OptionsModal.jsx index 49cd3af..1e4ec31 100644 --- a/src/component/modals/OptionsModal.jsx +++ b/src/component/modals/OptionsModal.jsx @@ -9,6 +9,7 @@ const OptionsModal = ({ superState, dispatcher }) => { const [octave, setOctave] = useState(false); const [param, setParam] = useState(''); const [maxT, setmaxT] = useState(''); + const [library, setLibrary] = useState(''); const close = () => { dispatcher({ type: T.SET_OPTIONS_MODAL, payload: false }); dispatcher( @@ -20,6 +21,7 @@ const OptionsModal = ({ superState, dispatcher }) => { maxT, param, octave, + library, }, }, ); @@ -40,6 +42,9 @@ const OptionsModal = ({ superState, dispatcher }) => { const handleMaxtimeChange = (e) => { setmaxT(e.target.value); }; + const handleLibraryChange = (e) => { + setLibrary(e.target.value); + }; const Options = 'Options'; return ( @@ -58,7 +63,7 @@ const OptionsModal = ({ superState, dispatcher }) => {
+
+ Library Path:   + +

Params: @@ -77,7 +96,6 @@ const OptionsModal = ({ superState, dispatcher }) => { cols="80" rows="10" value={param} - placeholder="//Write Script" onChange={(e) => { handleParamsChange(e); }} diff --git a/src/graph-builder/graph-core/6-server.js b/src/graph-builder/graph-core/6-server.js index 5d4513d..51a8ae8 100644 --- a/src/graph-builder/graph-core/6-server.js +++ b/src/graph-builder/graph-core/6-server.js @@ -212,6 +212,24 @@ class GraphServer extends GraphLoadSave { if (this.serverID); } + library(fileName) { + // TODO + const toastId = toast.info('LOADING.......', { + position: 'bottom-left', + autoClose: false, + }); + // this.dispatcher({ type: T.SET_LOGS, payload: false }); + Axios.post(`http://127.0.0.1:5000/library/${this.superState.uploadedDirName}?filename=${fileName}&path=${this.superState.library}`) + .then((res) => { // eslint-disable-next-line + toast.info(res.data['message']) + toast.dismiss(toastId); + }).catch((err) => { // eslint-disable-next-line + toast.error(err.message); + toast.dismiss(toastId); + }); + if (this.serverID); + } + setCurStatus() { super.setCurStatus(); this.dispatcher({ type: T.IS_WORKFLOW_ON_SERVER, payload: Boolean(this.serverID) }); diff --git a/src/reducer/initialState.js b/src/reducer/initialState.js index aea6e2e..876c8ce 100644 --- a/src/reducer/initialState.js +++ b/src/reducer/initialState.js @@ -31,6 +31,7 @@ const initialState = { inputFile: '', params: '', maxTime: '', + library: '', dockerCheck: false, unlockCheck: false, octave: false, diff --git a/src/reducer/reducer.js b/src/reducer/reducer.js index 9ad6297..a44b178 100644 --- a/src/reducer/reducer.js +++ b/src/reducer/reducer.js @@ -169,6 +169,7 @@ const reducer = (state, action) => { params: action.payload.param, maxTime: action.payload.maxT, octave: action.payload.octave, + library: action.payload.library, }; } From f5323963712c5c585916d86c9ad8fdae8b5d1962 Mon Sep 17 00:00:00 2001 From: Rahul Date: Mon, 31 Jul 2023 00:41:20 +0530 Subject: [PATCH 2/3] logs symbol changed --- src/toolbarActions/toolbarList.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/toolbarActions/toolbarList.js b/src/toolbarActions/toolbarList.js index 66e3baa..4a0983b 100644 --- a/src/toolbarActions/toolbarList.js +++ b/src/toolbarActions/toolbarList.js @@ -1,7 +1,7 @@ /* eslint-disable no-alert */ import { FaSave, FaUndo, FaRedo, FaTrash, FaFileImport, FaPlus, FaDownload, FaEdit, FaRegTimesCircle, FaHistory, - FaHammer, FaBug, FaBomb, FaToggleOn, FaThermometerEmpty, FaTrashRestore, FaCogs, FaPencilAlt, + FaHammer, FaBug, FaBomb, FaToggleOn, FaThermometerEmpty, FaTrashRestore, FaCogs, FaPencilAlt, FaTerminal, } from 'react-icons/fa'; import { @@ -130,7 +130,7 @@ const toolbarList = (state, dispatcher) => [ { type: 'action', text: 'Logs', - icon: FaBomb, + icon: FaTerminal, action: toggleLogs, active: true, visibility: true, From 2587db5067076a9c4cd7590ed97be2b1c4798163 Mon Sep 17 00:00:00 2001 From: Rahul Date: Mon, 31 Jul 2023 01:04:17 +0530 Subject: [PATCH 3/3] use of files from subdir in create and edit node disabled --- src/component/modals/NodeDetails.jsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/component/modals/NodeDetails.jsx b/src/component/modals/NodeDetails.jsx index 1a8a578..5bd76bb 100644 --- a/src/component/modals/NodeDetails.jsx +++ b/src/component/modals/NodeDetails.jsx @@ -158,6 +158,9 @@ const NodeDetails = ({ if (item.key.toString().includes('.md')) { return null; } + if (item.key.toString().split('/').length > 2) { + return null; + } // eslint-disable-next-line max-len if ((acceptedTypes.some((substring) => item.key.toString().includes(substring)))) { const fileName = item.key.toString().split('.')[0].concat('.md');