mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-16 03:49:52 +00:00
wip
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
23
client/app/scripts/utils/demo-utils.js
Normal file
23
client/app/scripts/utils/demo-utils.js
Normal 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);
|
||||
}
|
||||
@@ -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$/,
|
||||
|
||||
Reference in New Issue
Block a user