From c730605198a574a946292ef18299ac301a23e034 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Thu, 21 May 2020 15:34:57 +0300 Subject: [PATCH 1/2] UI crash due to multiple redundant telemetry requests fix --- .../cc/ui/src/components/pages/MapPage.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/pages/MapPage.js b/monkey/monkey_island/cc/ui/src/components/pages/MapPage.js index 997a2ae4c..2962b839a 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/MapPage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/MapPage.js @@ -23,7 +23,8 @@ class MapPageComponent extends AuthComponent { telemetryLastTimestamp: null, isScrolledUp: false, telemetryLines: 0, - telemetryCurrentLine: 0 + telemetryCurrentLine: 0, + telemetryUpdateInProgress: false }; this.telemConsole = React.createRef(); this.handleScroll = this.handleScroll.bind(this); @@ -72,16 +73,20 @@ class MapPageComponent extends AuthComponent { }; updateTelemetryFromServer = () => { + if( this.state.telemetryUpdateInProgress ) { + return + } + this.setState({telemetryUpdateInProgress: true}); this.authFetch('/api/telemetry-feed?timestamp=' + this.state.telemetryLastTimestamp) .then(res => res.json()) .then(res => { if ('telemetries' in res) { let newTelem = this.state.telemetry.concat(res['telemetries']); - this.setState( { telemetry: newTelem, - telemetryLastTimestamp: res['timestamp'] + telemetryLastTimestamp: res['timestamp'], + telemetryUpdateInProgress: false }); this.props.onStatusChange(); From c75190eede6bb6f8d8b65ec9a75f3c9ddd66b8d1 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Thu, 21 May 2020 17:30:59 +0300 Subject: [PATCH 2/2] Map jitter fix --- .../monkey_island/cc/ui/src/components/map/MapOptions.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/map/MapOptions.js b/monkey/monkey_island/cc/ui/src/components/map/MapOptions.js index 742d061f4..e09e93124 100644 --- a/monkey/monkey_island/cc/ui/src/components/map/MapOptions.js +++ b/monkey/monkey_island/cc/ui/src/components/map/MapOptions.js @@ -41,9 +41,12 @@ export const basic_options = { physics: { barnesHut: { gravitationalConstant: -120000, - avoidOverlap: 0.5 + avoidOverlap: 0.5, + springLength: 100, + springConstant: 0.025 }, - minVelocity: 0.75 + minVelocity: 0.3, + maxVelocity: 25 } };