+
-
+
diff --git a/core/app.js b/core/app.js index 4f0c4878..c5c9f9c3 100644 --- a/core/app.js +++ b/core/app.js @@ -129,10 +129,12 @@ function socket(request, response, client) { setTimeout(ping, process.timeout); } } else if (message.action == 'enableStats') { - process.stats = message.enabled; - if (!gStatsTimer) { - sendStats(); - gStatsTimer = true; + if (process) { + process.stats = message.enabled; + if (!gStatsTimer) { + sendStats(); + gStatsTimer = true; + } } } else { if (process && process.eventHandlers['message']) { diff --git a/core/client.js b/core/client.js index bfecaec0..bfa97274 100644 --- a/core/client.js +++ b/core/client.js @@ -82,6 +82,7 @@ function edit() { return; } + window.localStorage.setItem('editing', '1'); if (gSplit) { gSplit.destroy(); gSplit = undefined; @@ -114,10 +115,12 @@ function edit() { } function hideFiles() { + window.localStorage.setItem('files', '0'); document.getElementById('filesPane').classList.add('collapsed'); } function showFiles() { + window.localStorage.setItem('files', '1'); document.getElementById('filesPane').classList.remove('collapsed'); } @@ -163,11 +166,13 @@ function trace() { } function stats() { + window.localStorage.setItem('stats', '1'); document.getElementById("statsPane").style.display = 'flex'; send({action: 'enableStats', enabled: true}); } function closeStats() { + window.localStorage.setItem('stats', '0'); document.getElementById("statsPane").style.display = 'none'; send({action: 'enableStats', enabled: false}); } @@ -254,6 +259,7 @@ function load(path) { } function closeEditor() { + window.localStorage.setItem('editing', '0'); document.getElementById("editPane").style.display = 'none'; if (gSplit) { gSplit.destroy(); @@ -391,6 +397,10 @@ function receive(message) { if (window.location.hash) { send({event: "hashChange", hash: window.location.hash}); } + if (window.localStorage.getItem('stats') == '1') { + /* Stats were opened before we connected. */ + send({action: 'enableStats', enabled: true}); + } } else if (message && message.action == "setDocument") { var iframe = document.getElementById("document"); iframe.srcdoc = message.content; @@ -427,10 +437,11 @@ function receive(message) { timeseries: new TimeSeries(), }; gGraphs[key] = graph; - graph.canvas.width = '320'; - graph.canvas.width = '240'; + graph.canvas.width = 240; + graph.canvas.height = 64; var div = document.createElement('div'); div.innerText = key; + div.style.flex = '0'; document.getElementById('graphs').appendChild(div); document.getElementById('graphs').appendChild(graph.canvas); graph.chart.streamTo(graph.canvas, 1000); @@ -783,4 +794,20 @@ window.addEventListener("load", function() { } enableDragDrop(); connectSocket(window.location.pathname); + + if (window.localStorage.getItem('editing') == '1') { + edit(); + } else { + closeEditor(); + } + if (window.localStorage.getItem('files') == '1') { + showFiles(); + } else { + hideFiles(); + } + if (window.localStorage.getItem('stats') == '1') { + stats(); + } else { + closeStats(); + } }); diff --git a/core/index.html b/core/index.html index d01c8e31..35463403 100644 --- a/core/index.html +++ b/core/index.html @@ -19,11 +19,11 @@