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);
}