var ActionTypes = { // Connection CONNECTION_OPEN: "connection_open", CONNECTION_CLOSE: "connection_close", CONNECTION_ERROR: "connection_error", // Stores SETTINGS_STORE: "settings", EVENT_STORE: "events", FLOW_STORE: "flows", }; var StoreCmds = { ADD: "add", UPDATE: "update", REMOVE: "remove", RESET: "reset" }; var ConnectionActions = { open: function () { AppDispatcher.dispatchViewAction({ type: ActionTypes.CONNECTION_OPEN }); }, close: function () { AppDispatcher.dispatchViewAction({ type: ActionTypes.CONNECTION_CLOSE }); }, error: function () { AppDispatcher.dispatchViewAction({ type: ActionTypes.CONNECTION_ERROR }); } }; var SettingsActions = { update: function (settings) { jQuery.ajax({ type: "PUT", url: "/settings", data: settings }); /* //Facebook Flux: We do an optimistic update on the client already. AppDispatcher.dispatchViewAction({ type: ActionTypes.SETTINGS_STORE, cmd: StoreCmds.UPDATE, data: settings }); */ } }; var EventLogActions_event_id = 0; 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++ } }); } }; var FlowActions = { accept: function (flow) { jQuery.post("/flows/" + flow.id + "/accept"); }, accept_all: function(){ jQuery.post("/flows/accept"); }, update: function (flow) { AppDispatcher.dispatchViewAction({ type: ActionTypes.FLOW_STORE, cmd: StoreCmds.UPDATE, data: flow }); }, clear: function(){ jQuery.post("/clear"); } }; Query = { FILTER: "f", HIGHLIGHT: "h", SHOW_EVENTLOG: "e" };