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 _ = 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)
var AutoScrollMixin = {
componentWillUpdate: function () {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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