2014-09-15 16:08:26 +00:00
|
|
|
var ActionTypes = {
|
2014-12-09 17:18:14 +00:00
|
|
|
// Connection
|
|
|
|
CONNECTION_OPEN: "connection_open",
|
|
|
|
CONNECTION_CLOSE: "connection_close",
|
|
|
|
CONNECTION_ERROR: "connection_error",
|
|
|
|
|
|
|
|
// Settings
|
2014-09-17 13:22:42 +00:00
|
|
|
UPDATE_SETTINGS: "update_settings",
|
2014-09-17 15:30:19 +00:00
|
|
|
|
2014-12-09 17:18:14 +00:00
|
|
|
// EventLog
|
2014-12-09 23:47:05 +00:00
|
|
|
EVENT_STORE: "events",
|
2014-09-17 15:30:19 +00:00
|
|
|
ADD_EVENT: "add_event",
|
|
|
|
|
2014-12-09 17:18:14 +00:00
|
|
|
// Flow
|
2014-12-09 23:47:05 +00:00
|
|
|
FLOW_STORE: "flows",
|
|
|
|
};
|
|
|
|
|
|
|
|
var StoreCmds = {
|
|
|
|
ADD: "add",
|
|
|
|
UPDATE: "update",
|
|
|
|
REMOVE: "remove",
|
|
|
|
RESET: "reset"
|
2014-12-09 17:18:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
|
});
|
|
|
|
}
|
2014-09-15 16:08:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
var SettingsActions = {
|
2014-09-17 00:13:37 +00:00
|
|
|
update: function (settings) {
|
2014-09-15 22:56:43 +00:00
|
|
|
settings = _.merge({}, SettingsStore.getAll(), settings);
|
|
|
|
//TODO: Update server.
|
2014-09-15 22:05:06 +00:00
|
|
|
|
2014-09-15 22:56:43 +00:00
|
|
|
//Facebook Flux: We do an optimistic update on the client already.
|
|
|
|
AppDispatcher.dispatchViewAction({
|
2014-09-17 13:22:42 +00:00
|
|
|
type: ActionTypes.UPDATE_SETTINGS,
|
2014-09-15 22:56:43 +00:00
|
|
|
settings: settings
|
|
|
|
});
|
|
|
|
}
|
2014-09-16 04:26:16 +00:00
|
|
|
};
|
2014-09-17 15:30:19 +00:00
|
|
|
|
2014-12-09 17:18:14 +00:00
|
|
|
var EventLogActions_event_id = 0;
|
2014-09-17 15:30:19 +00:00
|
|
|
var EventLogActions = {
|
2014-11-27 00:40:26 +00:00
|
|
|
add_event: function (message) {
|
2014-09-17 15:30:19 +00:00
|
|
|
AppDispatcher.dispatchViewAction({
|
2014-12-09 23:47:05 +00:00
|
|
|
type: ActionTypes.EVENT_STORE,
|
|
|
|
cmd: StoreCmds.ADD,
|
2014-09-17 15:30:19 +00:00
|
|
|
data: {
|
|
|
|
message: message,
|
2014-09-22 01:06:19 +00:00
|
|
|
level: "web",
|
2014-12-09 17:18:14 +00:00
|
|
|
id: "viewAction-" + EventLogActions_event_id++
|
2014-09-17 15:30:19 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|