mitmproxy/web/src/js/actions.js

38 lines
894 B
JavaScript
Raw Normal View History

2014-09-15 16:08:26 +00:00
var ActionTypes = {
2014-09-17 15:30:19 +00:00
//Settings
2014-09-17 13:22:42 +00:00
UPDATE_SETTINGS: "update_settings",
2014-09-17 15:30:19 +00:00
//EventLog
ADD_EVENT: "add_event",
//Flow
ADD_FLOW: "add_flow",
UPDATE_FLOW: "update_flow",
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-17 15:30:19 +00:00
2014-09-22 01:06:19 +00:00
var 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({
type: ActionTypes.ADD_EVENT,
data: {
message: message,
2014-09-22 01:06:19 +00:00
level: "web",
2014-11-27 00:40:26 +00:00
id: "viewAction-" + event_id++
2014-09-17 15:30:19 +00:00
}
});
}
};