From ff9cc8b28393f6beba1ed42ade074672183313e9 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Fri, 3 Jun 2016 18:35:27 -0700 Subject: web: remove old event log store --- web/src/js/actions.js | 15 --------------- web/src/js/components/proxyapp.js | 6 +----- web/src/js/connection.js | 8 ++++---- web/src/js/store/store.js | 22 ++-------------------- web/src/js/utils.js | 1 - 5 files changed, 7 insertions(+), 45 deletions(-) (limited to 'web/src/js') diff --git a/web/src/js/actions.js b/web/src/js/actions.js index c77cdf73..588245ae 100644 --- a/web/src/js/actions.js +++ b/web/src/js/actions.js @@ -60,21 +60,6 @@ export var SettingsActions = { } }; -var EventLogActions_event_id = 0; -export var EventLogActions = { - add_event: function (message) { - AppDispatcher.dispatchViewAction({ - type: ActionTypes.EVENT_STORE, - cmd: StoreCmds.ADD, - data: { - message: message, - level: "web", - id: "viewAction-" + EventLogActions_event_id++ - } - }); - } -}; - export var FlowActions = { accept: function (flow) { $.post("/flows/" + flow.id + "/accept"); diff --git a/web/src/js/components/proxyapp.js b/web/src/js/components/proxyapp.js index 99b64580..9e4bd0a4 100644 --- a/web/src/js/components/proxyapp.js +++ b/web/src/js/components/proxyapp.js @@ -9,7 +9,7 @@ import MainView from "./mainview.js"; import Footer from "./footer.js"; import {Header, MainMenu} from "./header.js"; import EventLog from "./eventlog.js" -import {EventLogStore, FlowStore, SettingsStore} from "../store/store.js"; +import {FlowStore, SettingsStore} from "../store/store.js"; import {Key} from "../utils.js"; @@ -24,7 +24,6 @@ var Reports = React.createClass({ var ProxyAppMain = React.createClass({ childContextTypes: { flowStore: React.PropTypes.object.isRequired, - eventStore: React.PropTypes.object.isRequired, returnFocus: React.PropTypes.func.isRequired, location: React.PropTypes.object.isRequired, }, @@ -63,13 +62,11 @@ var ProxyAppMain = React.createClass({ getChildContext: function () { return { flowStore: this.state.flowStore, - eventStore: this.state.eventStore, returnFocus: this.focus, location: this.props.location }; }, getInitialState: function () { - var eventStore = new EventLogStore(); var flowStore = new FlowStore(); var settingsStore = new SettingsStore(); @@ -79,7 +76,6 @@ var ProxyAppMain = React.createClass({ return { settings: settingsStore.dict, flowStore: flowStore, - eventStore: eventStore }; }, focus: function () { diff --git a/web/src/js/connection.js b/web/src/js/connection.js index 090dbb29..bf9b16d3 100644 --- a/web/src/js/connection.js +++ b/web/src/js/connection.js @@ -1,4 +1,4 @@ -import {ConnectionActions, EventLogActions} from "./actions.js"; +import {ConnectionActions} from "./actions.js"; import {AppDispatcher} from "./dispatcher.js"; import * as webSocketActions from "./ducks/websocket" import * as eventLogActions from "./ducks/eventLog" @@ -27,12 +27,12 @@ export default function Connection(url, dispatch) { }; ws.onerror = function () { ConnectionActions.error(); - EventLogActions.add_event("WebSocket connection error."); + dispatch(eventLogActions.addLogEntry("WebSocket connection error.")); }; ws.onclose = function () { ConnectionActions.close(); - EventLogActions.add_event("WebSocket connection closed."); - dispatch(websocketActions.disconnected()); + dispatch(eventLogActions.addLogEntry("WebSocket connection closed.")); + dispatch(webSocketActions.disconnected()); }; return ws; } \ No newline at end of file diff --git a/web/src/js/store/store.js b/web/src/js/store/store.js index a16a0369..65355684 100644 --- a/web/src/js/store/store.js +++ b/web/src/js/store/store.js @@ -2,7 +2,6 @@ import _ from "lodash"; import $ from "jquery"; import {EventEmitter} from 'events'; -import { EventLogActions } from "../actions.js" import {ActionTypes, StoreCmds} from "../actions.js"; import {AppDispatcher} from "../dispatcher.js"; @@ -118,7 +117,7 @@ _.extend(LiveStoreMixin.prototype, { this.handle_fetch(message.data); }.bind(this)) .fail(function () { - EventLogActions.add_event("Could not fetch " + this.type); + console.error("Could not fetch " + this.type) }.bind(this)); } }, @@ -153,21 +152,4 @@ export function FlowStore() { export function SettingsStore() { return new LiveDictStore(ActionTypes.SETTINGS_STORE); -} - -export function EventLogStore() { - LiveListStore.call(this, ActionTypes.EVENT_STORE); -} -_.extend(EventLogStore.prototype, LiveListStore.prototype, { - fetch: function(){ - LiveListStore.prototype.fetch.apply(this, arguments); - - // Make sure to display updates even if fetching all events failed. - // This way, we can send "fetch failed" log messages to the log. - if(this._fetchxhr){ - this._fetchxhr.fail(function(){ - this.handle_fetch(null); - }.bind(this)); - } - } -}); +} \ No newline at end of file diff --git a/web/src/js/utils.js b/web/src/js/utils.js index 97737b20..2e5c3005 100644 --- a/web/src/js/utils.js +++ b/web/src/js/utils.js @@ -99,7 +99,6 @@ $(document).ajaxError(function (event, jqXHR, ajaxSettings, thrownError) { } var message = jqXHR.responseText; console.error(thrownError, message, arguments); - actions.EventLogActions.add_event(thrownError + ": " + message); alert(message); }); -- cgit v1.2.3