components/utils.js -> common.js

Too many utils modules makes things confusing. These are more "common
components" or "common mixins" than utils anyway.
This commit is contained in:
Aldo Cortesi 2015-01-01 20:49:32 +13:00
parent 866a408120
commit 4d01e22f26
8 changed files with 237 additions and 241 deletions

File diff suppressed because one or more lines are too long

View File

@ -2,8 +2,6 @@ var React = require("react");
var ReactRouter = require("react-router"); var ReactRouter = require("react-router");
var _ = require("lodash"); var _ = require("lodash");
//React utils. For other utilities, see ../utils.js
// http://blog.vjeux.com/2013/javascript/scroll-position-with-react.html (also contains inverse example) // http://blog.vjeux.com/2013/javascript/scroll-position-with-react.html (also contains inverse example)
var AutoScrollMixin = { var AutoScrollMixin = {
componentWillUpdate: function () { componentWillUpdate: function () {

View File

@ -1,5 +1,5 @@
var React = require("react"); var React = require("react");
var utils = require("./utils.js"); var common = require("./common.js");
var VirtualScrollMixin = require("./virtualscroll.js"); var VirtualScrollMixin = require("./virtualscroll.js");
var views = require("../store/view.js"); var views = require("../store/view.js");
@ -29,7 +29,7 @@ var LogMessage = React.createClass({
}); });
var EventLogContents = React.createClass({ var EventLogContents = React.createClass({
mixins: [utils.AutoScrollMixin, VirtualScrollMixin], mixins: [common.AutoScrollMixin, VirtualScrollMixin],
getInitialState: function () { getInitialState: function () {
return { return {
log: [] log: []

View File

@ -1,7 +1,7 @@
var React = require("react"); var React = require("react");
var _ = require("lodash"); var _ = require("lodash");
var utils = require("./utils.js"); var common = require("./common.js");
var actions = require("../actions.js"); var actions = require("../actions.js");
var flowutils = require("../flow/utils.js"); var flowutils = require("../flow/utils.js");
var toputils = require("../utils.js"); var toputils = require("../utils.js");
@ -337,7 +337,7 @@ var allTabs = {
}; };
var FlowDetail = React.createClass({ var FlowDetail = React.createClass({
mixins: [utils.StickyHeadMixin, utils.Navigation, utils.State], mixins: [common.StickyHeadMixin, common.Navigation, common.State],
getTabs: function (flow) { getTabs: function (flow) {
var tabs = []; var tabs = [];
["request", "response", "error"].forEach(function (e) { ["request", "response", "error"].forEach(function (e) {

View File

@ -1,5 +1,5 @@
var React = require("react"); var React = require("react");
var utils = require("./utils.js"); var common = require("./common.js");
var VirtualScrollMixin = require("./virtualscroll.js"); var VirtualScrollMixin = require("./virtualscroll.js");
var flowtable_columns = require("./flowtable-columns.js"); var flowtable_columns = require("./flowtable-columns.js");
@ -57,7 +57,7 @@ var FlowTableHead = React.createClass({
var ROW_HEIGHT = 32; var ROW_HEIGHT = 32;
var FlowTable = React.createClass({ var FlowTable = React.createClass({
mixins: [utils.StickyHeadMixin, utils.AutoScrollMixin, VirtualScrollMixin], mixins: [common.StickyHeadMixin, common.AutoScrollMixin, VirtualScrollMixin],
getInitialState: function () { getInitialState: function () {
return { return {
columns: flowtable_columns columns: flowtable_columns

View File

@ -1,7 +1,7 @@
var React = require("react"); var React = require("react");
var $ = require("jquery"); var $ = require("jquery");
var utils = require("./utils.js"); var common = require("./common.js");
var FilterDocs = React.createClass({ var FilterDocs = React.createClass({
statics: { statics: {
@ -153,7 +153,7 @@ var FilterInput = React.createClass({
}); });
var MainMenu = React.createClass({ var MainMenu = React.createClass({
mixins: [utils.Navigation, utils.State], mixins: [common.Navigation, common.State],
statics: { statics: {
title: "Start", title: "Start",
route: "flows" route: "flows"
@ -210,7 +210,7 @@ var ViewMenu = React.createClass({
title: "View", title: "View",
route: "flows" route: "flows"
}, },
mixins: [utils.Navigation, utils.State], mixins: [common.Navigation, common.State],
toggleEventLog: function () { toggleEventLog: function () {
var d = {}; var d = {};
@ -339,7 +339,7 @@ var header_entries = [MainMenu, ViewMenu /*, ReportsMenu */];
var Header = React.createClass({ var Header = React.createClass({
mixins: [utils.Navigation], mixins: [common.Navigation],
getInitialState: function () { getInitialState: function () {
return { return {
active: header_entries[0] active: header_entries[0]

View File

@ -1,6 +1,6 @@
var React = require("react"); var React = require("react");
var utils = require("./utils.js"); var common = require("./common.js");
var toputils = require("../utils.js"); var toputils = require("../utils.js");
var views = require("../store/view.js"); var views = require("../store/view.js");
var Filt = require("../filt/filt.js"); var Filt = require("../filt/filt.js");
@ -9,7 +9,7 @@ var flowdetail = require("./flowdetail.js");
var MainView = React.createClass({ var MainView = React.createClass({
mixins: [utils.Navigation, utils.State], mixins: [common.Navigation, common.State],
getInitialState: function () { getInitialState: function () {
this.onQueryChange(Query.FILTER, function () { this.onQueryChange(Query.FILTER, function () {
this.state.view.recalculate(this.getViewFilt(), this.getViewSort()); this.state.view.recalculate(this.getViewFilt(), this.getViewSort());
@ -210,7 +210,7 @@ var MainView = React.createClass({
var details; var details;
if (selected) { if (selected) {
details = [ details = [
<utils.Splitter key="splitter"/>, <common.Splitter key="splitter"/>,
<flowdetail.FlowDetail key="flowDetails" ref="flowDetails" flow={selected}/> <flowdetail.FlowDetail key="flowDetails" ref="flowDetails" flow={selected}/>
]; ];
} else { } else {

View File

@ -2,7 +2,7 @@ var React = require("react");
var ReactRouter = require("react-router"); var ReactRouter = require("react-router");
var _ = require("lodash"); var _ = require("lodash");
var utils = require("./utils.js"); var common = require("./common.js");
var MainView = require("./mainview.js"); var MainView = require("./mainview.js");
var Footer = require("./footer.js"); var Footer = require("./footer.js");
var header = require("./header.js"); var header = require("./header.js");
@ -19,7 +19,7 @@ var Reports = React.createClass({
var ProxyAppMain = React.createClass({ var ProxyAppMain = React.createClass({
mixins: [utils.State], mixins: [common.State],
getInitialState: function () { getInitialState: function () {
var eventStore = new store.EventLogStore(); var eventStore = new store.EventLogStore();
var flowStore = new store.FlowStore(); var flowStore = new store.FlowStore();
@ -51,7 +51,7 @@ var ProxyAppMain = React.createClass({
var eventlog; var eventlog;
if (this.getQuery()[Query.SHOW_EVENTLOG]) { if (this.getQuery()[Query.SHOW_EVENTLOG]) {
eventlog = [ eventlog = [
<utils.Splitter key="splitter" axis="y"/>, <common.Splitter key="splitter" axis="y"/>,
<EventLog key="eventlog" eventStore={this.state.eventStore}/> <EventLog key="eventlog" eventStore={this.state.eventStore}/>
]; ];
} else { } else {