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",
|
|
|
|
|
2014-12-10 14:25:40 +00:00
|
|
|
// Stores
|
|
|
|
SETTINGS_STORE: "settings",
|
2014-12-09 23:47:05 +00:00
|
|
|
EVENT_STORE: "events",
|
|
|
|
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-12-10 14:25:40 +00:00
|
|
|
|
2014-09-15 22:56:43 +00:00
|
|
|
//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-12-10 14:25:40 +00:00
|
|
|
type: ActionTypes.SETTINGS_STORE,
|
|
|
|
cmd: StoreCmds.UPDATE,
|
|
|
|
data: settings
|
2014-09-15 22:56:43 +00:00
|
|
|
});
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|