More browesrification.

This commit is contained in:
Aldo Cortesi 2014-12-31 18:14:17 +13:00
parent 2152d4dd92
commit 67f6f67c48
6 changed files with 254 additions and 81 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,5 @@
var $ = require("jquery");
var ActionTypes = {
// Connection
CONNECTION_OPEN: "connection_open",
@ -38,7 +40,7 @@ var ConnectionActions = {
var SettingsActions = {
update: function (settings) {
jQuery.ajax({
$.ajax({
type: "PUT",
url: "/settings",
data: settings
@ -72,25 +74,25 @@ var EventLogActions = {
var FlowActions = {
accept: function (flow) {
jQuery.post("/flows/" + flow.id + "/accept");
$.post("/flows/" + flow.id + "/accept");
},
accept_all: function(){
jQuery.post("/flows/accept");
$.post("/flows/accept");
},
"delete": function(flow){
jQuery.ajax({
$.ajax({
type:"DELETE",
url: "/flows/" + flow.id
});
},
duplicate: function(flow){
jQuery.post("/flows/" + flow.id + "/duplicate");
$.post("/flows/" + flow.id + "/duplicate");
},
replay: function(flow){
jQuery.post("/flows/" + flow.id + "/replay");
$.post("/flows/" + flow.id + "/replay");
},
revert: function(flow){
jQuery.post("/flows/" + flow.id + "/revert");
$.post("/flows/" + flow.id + "/revert");
},
update: function (flow) {
AppDispatcher.dispatchViewAction({
@ -100,7 +102,7 @@ var FlowActions = {
});
},
clear: function(){
jQuery.post("/clear");
$.post("/clear");
}
};

View File

@ -1,3 +1,8 @@
var React = require("react");
var utils = require("./utils.jsx.js");
var VirtualScrollMixin = require("./virtualscroll.jsx.js");
var views = require("../store/view.js");
var LogMessage = React.createClass({
render: function () {
var entry = this.props.entry;
@ -24,7 +29,7 @@ var LogMessage = React.createClass({
});
var EventLogContents = React.createClass({
mixins: [AutoScrollMixin, VirtualScrollMixin],
mixins: [utils.AutoScrollMixin, VirtualScrollMixin],
getInitialState: function () {
return {
log: []
@ -37,7 +42,7 @@ var EventLogContents = React.createClass({
this.closeView();
},
openView: function (store) {
var view = new StoreView(store, function (entry) {
var view = new views.StoreView(store, function (entry) {
return this.props.filter[entry.level];
}.bind(this));
this.setState({
@ -146,3 +151,5 @@ var EventLog = React.createClass({
);
}
});
module.exports = EventLog;

View File

@ -1,6 +1,7 @@
var React = require("react");
var utils = require("./utils.jsx.js");
var toputils = require("../utils.js");
var views = require("../store/view.js");
var Filt = require("../filt/filt.js");
FlowTable = require("./flowtable.jsx.js");
@ -126,49 +127,49 @@ var MainView = React.createClass({
return;
}
switch (e.keyCode) {
case Key.K:
case Key.UP:
case toputils.Key.K:
case toputils.Key.UP:
this.selectFlowRelative(-1);
break;
case Key.J:
case Key.DOWN:
case toputils.Key.J:
case toputils.Key.DOWN:
this.selectFlowRelative(+1);
break;
case Key.SPACE:
case Key.PAGE_DOWN:
case toputils.Key.SPACE:
case toputils.Key.PAGE_DOWN:
this.selectFlowRelative(+10);
break;
case Key.PAGE_UP:
case toputils.Key.PAGE_UP:
this.selectFlowRelative(-10);
break;
case Key.END:
case toputils.Key.END:
this.selectFlowRelative(+1e10);
break;
case Key.HOME:
case toputils.Key.HOME:
this.selectFlowRelative(-1e10);
break;
case Key.ESC:
case toputils.Key.ESC:
this.selectFlow(null);
break;
case Key.H:
case Key.LEFT:
case toputils.Key.H:
case toputils.Key.LEFT:
if (this.refs.flowDetails) {
this.refs.flowDetails.nextTab(-1);
}
break;
case Key.L:
case Key.TAB:
case Key.RIGHT:
case toputils.Key.L:
case toputils.Key.TAB:
case toputils.Key.RIGHT:
if (this.refs.flowDetails) {
this.refs.flowDetails.nextTab(+1);
}
break;
case Key.C:
case toputils.Key.C:
if (e.shiftKey) {
FlowActions.clear();
}
break;
case Key.D:
case toputils.Key.D:
if (flow) {
if (e.shiftKey) {
FlowActions.duplicate(flow);
@ -177,19 +178,19 @@ var MainView = React.createClass({
}
}
break;
case Key.A:
case toputils.Key.A:
if (e.shiftKey) {
FlowActions.accept_all();
} else if (flow && flow.intercepted) {
FlowActions.accept(flow);
}
break;
case Key.R:
case toputils.Key.R:
if (!e.shiftKey && flow) {
FlowActions.replay(flow);
}
break;
case Key.V:
case toputils.Key.V:
if(e.shiftKey && flow && flow.modified) {
FlowActions.revert(flow);
}

View File

@ -6,6 +6,7 @@ var utils = require("./utils.jsx.js");
var MainView = require("./mainview.jsx.js");
var Footer = require("./footer.jsx.js");
var header = require("./header.jsx.js");
var EventLog = require("./eventlog.jsx.js");
var store = require("../store/store.js");
@ -50,7 +51,7 @@ var ProxyAppMain = React.createClass({
var eventlog;
if (this.getQuery()[Query.SHOW_EVENTLOG]) {
eventlog = [
<Splitter key="splitter" axis="y"/>,
<utils.Splitter key="splitter" axis="y"/>,
<EventLog key="eventlog" eventStore={this.state.eventStore}/>
];
} else {

View File

@ -112,5 +112,6 @@ module.exports = {
EventEmitter: EventEmitter,
formatSize: formatSize,
formatTimeDelta: formatTimeDelta,
formatTimeStamp: formatTimeStamp
formatTimeStamp: formatTimeStamp,
Key: Key
};