This commit is contained in:
jpellizzari
2017-02-23 15:46:20 -08:00
parent 6619f59cf1
commit 68d5f75c8f
4 changed files with 40 additions and 8 deletions

View File

@@ -312,6 +312,7 @@ export function setResourceView() {
}
export function clickNode(nodeId, label, origin) {
console.log(nodeId, label, origin);
return (dispatch, getState) => {
dispatch({
type: ActionTypes.CLICK_NODE,

View File

@@ -6,6 +6,7 @@ import { Provider } from 'react-redux';
import '../styles/main.scss';
import '../images/favicon.ico';
import configureStore from './stores/configureStore';
import runDemo from './utils/demo-utils';
const store = configureStore();
@@ -22,3 +23,7 @@ renderApp();
if (module.hot) {
module.hot.accept('./components/app', renderApp);
}
if (process.env.DEMO) {
runDemo(store.getState, store.dispatch);
}

View File

@@ -0,0 +1,23 @@
import _ from 'lodash';
import { clickNode } from '../actions/app-actions';
const INTERVAL = 3000;
function openNodeDetails(getState, dispatch) {
const action = clickNode();
if (typeof action === 'function') {
return action(dispatch, getState);
}
return dispatch(action);
}
const actions = [openNodeDetails];
export default function runDemo(getState) {
setInterval(() => {
const state = getState().toJS();
const fn = _.sample(actions);
}, INTERVAL);
}

View File

@@ -73,7 +73,10 @@ module.exports = {
template: 'app/html/index.html',
filename: 'index.html'
}),
new ContrastStyleCompiler()
new ContrastStyleCompiler(),
new webpack.DefinePlugin({
'process.env': {DEMO: process.env.DEMO ? 'true' : null }
}),
],
// Transform source code using Babel and React Hot Loader
@@ -85,13 +88,13 @@ module.exports = {
path.resolve(__dirname, 'app/scripts', 'app/styles')
],
preLoaders: [
{
test: /\.js$/,
exclude: /node_modules|vendor/,
loader: 'eslint-loader'
}
],
// preLoaders: [
// {
// test: /\.js$/,
// exclude: /node_modules|vendor/,
// loader: 'eslint-loader'
// }
// ],
loaders: [
{
test: /\.json$/,