diff --git a/src/App.css b/src/App.css index f862af1..7655d63 100644 --- a/src/App.css +++ b/src/App.css @@ -67,6 +67,7 @@ html, body { .sidebar{ width:100%; flex-direction:row; + overflow-x: auto; } .svg-container{ width:100%; diff --git a/src/App.jsx b/src/App.jsx index 76d28ae..627f75f 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -32,6 +32,15 @@ const theme = createTheme({ }); +const saveToLocalStorage = (key, data) => { + localStorage.setItem(key, JSON.stringify(data)); +}; + +const loadFromLocalStorage = (key) => { + const data = localStorage.getItem(key); + return data ? JSON.parse(data) : null; +}; + function App() { const [graph, setGraph] = useState({ nodes: [], edges: [] }); const [platformModel, setPlatformModel] = useState(null) @@ -45,9 +54,32 @@ function App() { const [highlightNodePM, setHighlightedNodePM] = useState(null); const [highlightedEdgePM, setHighlightedEdgePM] = useState(null); const fileInputRef = useRef(null); - + const [savedData, setSavedData] = useState(null); const message_size = 20; + useEffect(() => { + const data = loadFromLocalStorage('model'); + if (data) { + setSavedData(data); + } + }, []); + + const handleSave = () => { + const dataToSave = { + application: { tasks: graph.nodes, messages: graph.edges }, + platform: platformModel + }; + saveToLocalStorage('model', dataToSave); + setSavedData(dataToSave); + }; + + const handleSavedLoad = () => { + if (savedData) { + setJsonData(savedData); + } + }; + + // Message injection time is the time at which the message is injected into the network, 0 denotes absence of any delay const message_injection_time = 0; @@ -244,7 +276,7 @@ function App() {
-

Schedule Visualization

+

Distributed Scheduling

{jsonData && <> @@ -266,6 +298,8 @@ function App() { + {jsonData && } + {savedData && }