From d5f94b76986615b255b77b2a7b7ed336e5ad4838 Mon Sep 17 00:00:00 2001 From: Emiliano Ciavatta Date: Wed, 7 Oct 2020 14:58:48 +0200 Subject: Implement notifications --- frontend/src/views/Footer.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'frontend/src/views/Footer.js') diff --git a/frontend/src/views/Footer.js b/frontend/src/views/Footer.js index ad1e4f7..dcf9cf8 100644 --- a/frontend/src/views/Footer.js +++ b/frontend/src/views/Footer.js @@ -13,9 +13,9 @@ import { import {TimeRange, TimeSeries} from "pondjs"; import backend from "../backend"; import ChoiceField from "../components/fields/ChoiceField"; -import dispatcher from "../globals"; import {withRouter} from "react-router-dom"; import log from "../log"; +import dispatcher from "../dispatcher"; class Footer extends Component { @@ -39,15 +39,12 @@ class Footer extends Component { componentDidMount() { const filteredPort = this.filteredPort(); this.setState({filteredPort}); - this.loadStatistics(this.state.metric, filteredPort).then(() => - log.debug("Statistics loaded after mount")); - - dispatcher.register((payload) => { - if (payload.actionType === "connections-update") { - this.setState({ - selection: new TimeRange(payload.from, payload.to), - }); - } + this.loadStatistics(this.state.metric, filteredPort).then(() => log.debug("Statistics loaded after mount")); + + dispatcher.register("connection_updates", payload => { + this.setState({ + selection: new TimeRange(payload.from, payload.to), + }); }); } @@ -109,8 +106,7 @@ class Footer extends Component { clearTimeout(this.selectionTimeout); } this.selectionTimeout = setTimeout(() => { - dispatcher.dispatch({ - actionType: "timeline-update", + dispatcher.dispatch("timeline_updates", { from: timeRange.begin(), to: timeRange.end() }); -- cgit v1.2.3-70-g09d2