Преглед изворни кода

Made changes to the demo module.

Tomislav Cvetic пре 8 година
родитељ
комит
6f04753ca4

+ 1 - 1
package.json

@@ -25,7 +25,7 @@
   },
   "scripts": {
     "start": "react-scripts start",
-    "watch": "concurrently --names 'WEBP,STYL' --prefix name -c 'bgBlue.bold,bgMagenta.bold' 'npm run styles:watch' 'npm run start'",
+    "watch": "concurrently --names \"WEBP,STYL\" --prefix name -c \"bgBlue.bold,bgMagenta.bold\" \"npm run styles:watch\" \"npm run start\"",
     "build": "react-scripts build",
     "test": "react-scripts test --env=jsdom",
     "styles": "stylus -u autoprefixer-stylus ./src/css/style.styl -o ./src/css/style.css",

+ 18 - 0
src/demo_module/components/DemoModule.js

@@ -0,0 +1,18 @@
+import React from 'react'
+
+class DemoModule extends React.Component {
+  render () {
+    return (
+      <div className='app-main'>
+        <div className='app-content'>
+          <p>Place content here.</p>
+        </div>
+        <div className='app-aside-left'>
+          <p>Place aside here.</p>
+        </div>
+      </div>
+    )
+  }
+}
+
+export default DemoModule

+ 0 - 11
src/demo_module/components/EditRegister.js

@@ -1,11 +0,0 @@
-import React from 'react'
-
-class EditRegisters extends React.Component {
-  render () {
-    return (
-      <p>bit</p>
-    )
-  }
-}
-
-export default EditRegisters

+ 0 - 47
src/demo_module/components/EditRegistermap.js

@@ -1,47 +0,0 @@
-import React from 'react'
-
-class EditRegistermap extends React.Component {
-  constructor () {
-    super()
-    this.update = this.update.bind(this)
-  }
-
-  update () {
-    const { registermap, actions } = this.props
-    actions.updateRegistermap(registermap.id, {
-      id: registermap.id,
-      name: this.regmapName.value,
-      description: this.regmapDescription.value,
-      nrOfRegisters: this.regmapNrOfRegisters.value,
-      bitsPerRegister: this.regmapBitsPerRegister.value,
-      modes: this.regmapModes.value
-    })
-  }
-
-  render () {
-    const { registermap } = this.props
-    console.log('Edit registermap', registermap)
-
-    return (
-      <form className='app-form'>
-        <fieldset className='create-registermap-form-basic'>
-          <button onClick={this.toggleExtended}>+</button>
-          <input type='text' ref={input => { this.regmapName = input }} value={registermap.name} onChange={this.update} placeholder='Registermap Name' />
-          <input type='text' ref={input => { this.regmapDescription = input }} value={registermap.description} onChange={this.update} placeholder='Description' />
-        </fieldset>
-        <fieldset className='create-registermap-form-extended'>
-          <input type='text' ref={input => { this.regmapNrOfRegisters = input }} value={registermap.nrOfRegisters} onChange={this.update} placeholder='Number of registers' />
-          <input type='text' ref={input => { this.regmapBitsPerRegister = input }} value={registermap.bitsPerRegister} onChange={this.update} placeholder='Bits per register' />
-          <input type='text' ref={input => { this.regmapModes = input }} list='modes' value={registermap.modes} onChange={this.update} placeholder='modes' />
-          <datalist id='modes'>
-            <option value='GPS only'>GPS only</option>
-            <option value='Multi GNSS'>Multi GNSS</option>
-          </datalist>
-          <button type='submit'>Save</button>
-        </fieldset>
-      </form>
-    )
-  }
-}
-
-export default EditRegistermap

+ 0 - 70
src/demo_module/components/EditSetting.js

@@ -1,70 +0,0 @@
-import React from 'react'
-
-class EditSetting extends React.Component {
-  constructor () {
-    super()
-    this.saveSetting = this.saveSetting.bind(this)
-    this.updateSetting = this.updateSetting.bind(this)
-  }
-
-  saveSetting (event) {
-    event.preventDefault()
-    this.props.actions.updateSetting(12, {
-      name: this.name.value,
-      description: this.description.value,
-      nrOfBits: this.nrOfBits.value,
-      comment: this.comment.value,
-      format: this.format.value,
-      formatOverride: this.formatOverride.value
-    })
-    console.log('Saving ')
-  }
-
-  updateSetting (event) {
-    event.preventDefault()
-    this.props.actions.updateSetting(this.id.value, {
-      name: this.name.value,
-      description: this.description.value,
-      nrOfBits: this.nrOfBits.value,
-      comment: this.comment.value,
-      format: this.format.value,
-      formatOverride: this.formatOverride.value
-    })
-    console.log('Updating')
-  }
-
-  checkSetting (event) {
-
-  }
-
-  render () {
-    const { setting } = this.props
-    if (typeof setting.id === 'undefined') {
-      setting.id = null
-      setting.name = ''
-      setting.description = ''
-      setting.nrOfBits = 1
-      setting.range = {
-        lower: 0,
-        upper: 1
-      }
-      setting.comment = ''
-      setting.format = ''
-      setting.formatOverride = {}
-    }
-    return (
-      <form className='app-form' onSubmit={this.saveSetting}>
-        <input type='text' ref={input => { this.name = input }} value={setting.name} placeholder='Setting name' onChange={this.updateSetting} onBlur={this.checkSetting} />
-        <input type='text' ref={input => { this.description = input }} value={setting.description} placeholder='Description' onChange={this.updateSetting} onBlur={this.checkSetting} />
-        <input type='text' ref={input => { this.id = input }} value={setting.id} placeholder='Description' onChange={this.updateSetting} onBlur={this.checkSetting} />
-        <input type='text' ref={input => { this.nrOfBits = input }} value={setting.nrOfBits} placeholder='Number of bits' onChange={this.updateSetting} onBlur={this.checkSetting} />
-        <input type='text' ref={input => { this.comment = input }} value={setting.comment} placeholder='Comment' onChange={this.updateSetting} onBlur={this.checkSetting} />
-        <input type='text' ref={input => { this.format = input }} value={setting.format} placeholder='Format' onChange={this.updateSetting} onBlur={this.checkSetting} />
-        <input type='text' ref={input => { this.formatOverride = input }} value={setting.formatOverride} placeholder='Format Override' onChange={this.updateSetting} onBlur={this.checkSetting} />
-        <button type='submit'>Save</button>
-      </form>
-    )
-  }
-}
-
-export default EditSetting

+ 0 - 38
src/demo_module/components/Registermap.js

@@ -1,38 +0,0 @@
-import React from 'react'
-import ShowRegistermap from './ShowRegistermap'
-import RegistermapList from './RegistermapList'
-
-class Registermap extends React.Component {
-  render () {
-    // Retrieve the registermapId from the URL
-    const { registermapId } = this.props.params
-    const { registermapActions } = this.props
-    const { registermap, settings } = this.props.registermap
-
-    let registerMap
-    if (typeof registermapId !== 'undefined' && registermap && registermap.length > 0) {
-      // It the registermapId is defined, check whether there's such a registermap
-      registerMap = registermap.find(registermap => { return (registermap.id === registermapId) })
-    } else if (registermap && registermap.length > 0) {
-      registerMap = registermap[0]
-      this.props.router.transitionTo(`/registermap/${registerMap}`)
-    }
-    console.log('Registermap', registerMap, registermap, settings)
-
-    return (
-      <div className='app-main'>
-        <div className='app-content'>
-          <button onClick={registermapActions.loadSamples}>Load sample data</button>
-          {(typeof registerMap !== 'undefined') ? <ShowRegistermap registermap={registerMap} settingList={settings} actions={registermapActions} /> : <p>Please select a registermap.</p>}
-        </div>
-        <div className='app-aside-left'>
-          <p>New Registermap Button</p>
-          <p>Registermap List</p>
-          {<RegistermapList registermapList={registermap} />}
-        </div>
-      </div>
-    )
-  }
-}
-
-export default Registermap

+ 0 - 23
src/demo_module/components/RegistermapList.js

@@ -1,23 +0,0 @@
-import React from 'react'
-import { Link } from 'react-router'
-
-class RegistermapList extends React.Component {
-  render () {
-    const { registermapList } = this.props
-    if (typeof registermapList !== 'undefined' && registermapList.length > 0) {
-      return (
-        <ul className='registermap-list scrollable'>
-          {registermapList.map((registermap, key) =>
-            <li key={key}><Link to={`/registermap/${registermap.id}`}>{registermap.name}</Link></li>
-          )}
-        </ul>
-      )
-    } else {
-      return (
-        <p>No registermaps found.</p>
-      )
-    }
-  }
-}
-
-export default RegistermapList

+ 0 - 84
src/demo_module/components/ShowRegistermap.js

@@ -1,84 +0,0 @@
-import React from 'react'
-import EditRegistermap from './EditRegistermap'
-import EditSetting from './EditSetting'
-import './registermap.css'
-
-class ShowRegistermap extends React.Component {
-  constructor () {
-    super()
-    this.sayMyName = this.sayMyName.bind(this)
-    this.table = this.table.bind(this)
-
-    this.bitmap = {}
-  }
-
-  sayMyName (event) {
-    event.preventDefault()
-    console.log('Hi, my name is', event)
-  }
-
-  table (registermap, settings) {
-    // Generate a table with rows for registers and columns for bits
-    let trow = []
-    let idx
-
-    const thead = []
-    const tbody = []
-
-    for (let idxCol = 0; idxCol < registermap.bitsPerRegister; idxCol += 1) {
-      trow.push(<th key={idxCol}>{idxCol}</th>)
-    }
-    trow.push(<th key={registermap.bitsPerRegister}>Register Name</th>)
-    thead.push(<tr key={-1}>{trow}</tr>)
-
-    for (let idxRow = 0; idxRow < registermap.nrOfRegisters; idxRow += 1) {
-      trow = []
-      for (let idxCol = 0; idxCol < registermap.bitsPerRegister; idxCol += 1) {
-        idx = idxRow * registermap.bitsPerRegister + idxCol
-        this.bitmap[idx] = ''
-        trow.push(<td key={idx} onClick={this.sayMyName}>{this.bitmap[idx]}</td>)
-      }
-      trow.push(<td key={`inp${idxRow}`}><input ref={input => { this.bitmap[idxRow] = input }} type='text' placeholder={`register${idxRow}`} onChange={this.updateRegister} /></td>)
-      tbody.push(<tr key={idxRow}>{trow}</tr>)
-    }
-    return (
-      <table>
-        <thead>{thead}</thead>
-        <tbody>{tbody}</tbody>
-      </table>
-    )
-  }
-
-  render () {
-    const { registermap, settingList, actions } = this.props
-    console.log('Show registermap', registermap, settingList, actions)
-    if (typeof settingList === 'undefined') {
-      return (
-        <p>Please select a registermap</p>
-      )
-    }
-
-    return (
-      <div className='content-flex'>
-        <div className='content-main'>
-          <h2>Registermap {registermap.name}</h2>
-          <EditRegistermap registermap={registermap} actions={actions} />
-          <h2>Registers</h2>
-          {this.table(registermap, settingList)}
-          <div>Warning: Not all settings fit in the registers!</div>
-        </div>
-        <div className='content-aside-right'>
-          <h2>Settings</h2>
-          {settingList.map((value, idx) => {
-            return (
-              <EditSetting key={idx} setting={value} actions={actions} />
-            )
-          }
-          )}
-        </div>
-      </div>
-    )
-  }
-}
-
-export default ShowRegistermap

+ 0 - 0
src/demo_module/components/registermap.css → src/demo_module/components/demo.css


+ 0 - 0
src/demo_module/components/registermap.styl → src/demo_module/components/demo.styl


+ 4 - 6
src/demo_module/components/index.js

@@ -1,7 +1,5 @@
-import EditRegistermap from './EditRegistermap'
-import EditSetting from './EditSetting'
-import EditRegister from './EditRegister'
-import Registermap from './Registermap'
-import ShowRegistermap from './ShowRegistermap'
+/** Import all components you want to make visible to other modules. */
+import DemoModule from './DemoModule'
 
-export default { Registermap, EditRegistermap, EditSetting, EditRegister, ShowRegistermap }
+/** And export them */
+export default { DemoModule }

+ 3 - 6
src/demo_module/constants.js

@@ -2,13 +2,10 @@
  * constants.js
  *
  * Collection of all constants used in the component.
- * Also define 'name' which is used to identify the component.
+ * Define 'NAME' which is used to identify the component.
  **/
 
 /** NAME is used to identify the module and to specify actions and reducers. */
-export const NAME = 'registermap'
+export const NAME = 'demo_module'
+export const DATA = ['primary', 'secondary']
 console.log('Constants NAME', NAME)
-
-/** DATA contains a list with the state variable names used in the module */
-export const DATA = ['primary', 'secondary1', 'secondary2']
-console.log('Constants DATA', DATA)

+ 3 - 17
src/demo_module/index.js

@@ -7,10 +7,8 @@
  **/
 
 import * as constants from './constants'
-import { actions, reducer, state } from './state'
+import { actionCreators, reducer, state } from './state'
 import components from './components'
-// import { createSelector } from 'reselect'
-// import { NAME } from './constants'
 // import _ from 'lodash'
 
 const filters = {
@@ -22,18 +20,6 @@ const selectors = {
   getActive: () => []
 }
 
-function registermapFactory () {
-  return {
-
-  }
-}
-
-function settingFactory () {
-  return {
-
-  }
-}
-
 /* export const getAll = state => state[NAME]
 export const getActive = _.compose(filterActive, getAll)
 export const getCounts = createSelector(
@@ -45,5 +31,5 @@ export const getCounts = createSelector(
     })
 ) */
 
-console.log('Exporting registermap:', { actions, constants, components, filters, selectors, reducer, state, registermapFactory, settingFactory })
-export default { actions, constants, components, filters, selectors, reducer, state, registermapFactory, settingFactory }
+console.log('Exporting demo_module:', { actionCreators, constants, components, filters, selectors, reducer, state })
+export default { actionCreators, constants, components, filters, selectors, reducer, state }

+ 10 - 29
src/demo_module/initialData.js

@@ -5,9 +5,11 @@
 /**
   * primary contains the primary data for the module.
   * It could come from a database, file or any other asynchronous source.
-  * It can have joins from other databases directly in a field (e.g. joins)
+  * Include secondary joins directly as objects into the primary, if they
+  * are exclusive to the one primary. This makes access and version tagging
+  * easier.
   **/
-export const primary = [{
+const primary = [{
   id: 'primary-1',
   name: 'String1',
   active: true,
@@ -15,10 +17,9 @@ export const primary = [{
     { id: 'item1-1' },
     { id: 'item1-2' }
   ],
-  joins: [{
+  secondar: [{
     id: 'id2',
-    primaryId: 'primary-1',
-    name: 'secondary1-2'
+    name: 'secondary-1'
   }]
 }, {
   id: 'primary-2',
@@ -30,33 +31,13 @@ export const primary = [{
     { id: 'item2-3' },
     { id: 'item2-4' }
   ],
-  joins: [{
+  secondary: [{
     id: 'id1',
-    primaryId: 'primary-2',
-    name: 'secondary1-1'
+    name: 'secondary-2'
   }, {
     id: 'id3',
-    primaryId: 'primary-2',
-    name: 'secondary1-3'
+    name: 'secondary-3'
   }]
 }]
 
-/**
-  * secondary contains the secondary data for the module.
-  * It could come from a database, file or any other asynchronous source.
-  * It is collected from the source and placed as reference in the primary data.
-  * It should have a reference to the primary item it belongs to.
-  **/
-export const secondary2 = [{
-  id: 'id1',
-  primaryId: 'primary-1',
-  name: 'secondary2-1'
-}, {
-  id: 'id2',
-  primaryId: 'primary-2',
-  name: 'secondary2-2'
-}, {
-  id: 'id3',
-  primaryId: 'primary-1',
-  name: 'secondary2-3'
-}]
+export default primary

+ 109 - 80
src/demo_module/state.js

@@ -1,118 +1,147 @@
 /**
  * state.js
  *
- * Collection of everything which has to do with state changes.
- * - actionTypes
+ * The application uses Redux to handle the state.
+ * Redux has a **store** which allows access to the one big state of the
+ * modules. It also has a dispatcher, which receives actions and calls
+ * reducer functions to act on them.
+ *
+ * The store handles all state changes. For that, a module
+ * defines **action creators**, which are helper functions generating action
+ * objects. An action object contains a 'type' property, which gives the action
+ * a name, and a payload, which will be processed.
+ *
+ * The processing unit is called a **reducer** and is exported as 'reducer' in
+ * this file. It is a function which receives
+ * the current state and an action and returns the processed state. It is good
+ * practice, that the reducer doesn't change the state (which is passed by
+ * reference), but creates a modified state and returns it. Also, the reducer
+ * should return immediately. If an asynchronous operation has to be executed,
+ * it is handled through redux-sagas, which is basically a concurrent process
+ * triggered by a reducer, which generates a new action once it's completed. 
+ *
+ * Action creators (defined as 'actions' in this file) are bound to the 
+ * Redux dispatcher in 'index.js'. When they are called, the dispatcher sends
+ * the greated action to **all** reducers. This module, and other modules which
+ * change the state of this module, use these action creators to modifiy the 
+ * state.
+ *
+ * This file exports everything which is necessary to set up and operate the 
+ * state of this module.
  * - actions
  * - reducers
+ * - state
+ * - sagas
  **/
 
+
+/* Import NAME and DATA to be able to create action creators */
 import { NAME, DATA } from './constants'
-import { primary, secondary2 } from './initialData'
-// import { call, put, takeEvery } from 'redux-saga/effects'
+import primary from './initialData'
+import { delay } from 'redux-saga'
+import { call, put, takeEvery } from 'redux-saga/effects'
+
 
 /** actionTypes define what actions are handeled by the reducer. */
-export const actionTypes = {}
-export const actions = {}
+const actionTypes = {}
+export const actionCreators = {}
 
-// Generate default actionsTypes CREATE, UPDATE, DELETE for every data type
-DATA.forEach(data => {
+// Generate default actionsTypes CREATE, UPDATE, REMOVE
+DATA.forEach(dataItem => {
   ['create', 'update', 'delete'].forEach(action => {
-    const actionType = `${action.toUpperCase()}_${data.toUpperCase()}`
-    const actionName = `${action}${data[0].toUpperCase()}${data.substring(1)}`
+    // The Redux convention is to name action types e.g. demo_module/UPDATE
+    // For action creators, we define here the name e.g. removePrimary(id, data)
+    // where id is the element id and data is the element itself.
+    const actionType = `${action.toUpperCase()}_${dataItem.toUpperCase()}`
+    const actionName = `${action}${dataItem[0].toUpperCase()}${dataItem[0].substring(1)}`
+    actionCreators[actionName] = (id, data) => { return { type: actionType, id, data } }
     actionTypes[actionType] = `${NAME}/${actionType}`
-    actions[actionName] = (id, data) => { return { type: actionType, id, data } }
   })
 })
+/* in our case we generate e.g.
+createPrimary (id, data) {
+  // id will be ignored, data will be inserted into state.primary
+}
+updateSecondary1 (id, data) {
+  // id is used to find the secondary item. data is the new value of the item.
+}
+removeSecondary2 (id, data) {
+  // id is used to find the secondary item. 
+}
+*/
+
+// Add specific action creators here:
+actionCreators['loadSamples'] = () => { return { type: `${NAME}/LOAD_SAMPLES` } }
+console.log('State actionTypes, actionCreators', actionTypes, actionCreators)
 
-// Add specific actionTypes/actions
-actionTypes['LOAD_SAMPLES'] = `${NAME}/LOAD_SAMPLES`
-actions['loadSamples'] = () => { return { type: `${NAME}/LOAD_SAMPLES` } }
-console.log('State actionTypes, actions', actionTypes, actions)
 
 /** state definition */
 /** It is generally easier to not have another object here. If you can combine everything into
   * the primary data, do it. */
-export const state = {
-  primary: [],
-  secondary2: []
-}
+export const state = []
 console.log('State state', state)
 
+
 /** reducer is called by the redux dispatcher and handles all component actions */
-function secondaryReducer (state = {}, action) {
-  console.log(`Entering registermap setting reducer.`, state, action)
+/** The module's root reducer tries to split up the state and let specific
+  * specialized reducers handle the work. This is not necessary, but more
+  * convenient and readable. */
+  // In this example it is assumed, that the secondary items have a key 'primaryId',
+  // which references the primary data element.
+export function reducer (state = [], action) {
+  console.log(`Entering demo_module root reducer.`, state, action)
+  const idx = state.findIndex(elem => {return (action.id === elem.id)})
+  if (action.type.match(/SECONDARY/)) {
+    // leave immediately, if no idx was found (operations on secondary not valid )
+    if (idx < 0) {
+      return state
+    }
+    console.log(`Using secondary reducer.`)
+    const subState = state.secondary
+    const reducedState = secondaryReducer(subState, action)
+    const nextState = {
+      ...state,
+      secondary: reducedState
+    }
+    console.log('Leaving demo_module root reducer', subState, reducedState, nextState)
+    return nextState
+  }
   switch (action.type) {
-    case actionTypes.CREATE_SETTING:
-      console.log(`Creating setting.`, state, action)
-      return {
-        ...state,
-        [action.project.projectId]: action.project
-      }
-    case actionTypes.UPDATE_SETTING:
-      console.log(`Update setting.`, state, action)
-      return {
-        ...state,
-        [action.projectId]: action.project
-      }
-    case actionTypes.DELETE_SETTING:
-      console.log(`Delete setting.`, state, action)
-      return {
-        ...state,
-        [action.projectId]: null
-      }
+    case actionTypes.CREATE_PRIMARY:
+      return state
+    case actionTypes.UPDATE_PRIMARY:
+      return state
+    case actionTypes.REMOVE_PRIMARY:
+      return state
+    case actionTypes.LOAD_SAMPLES:
+      return state
     default:
       return state
   }
 }
 
-function primaryReducer (state = {}, action) {
-  console.log(`Entering registermap reducer.`, state, action)
+function secondaryReducer (state = [], action) {
+  console.log(`Entering secondary reducer.`, state, action)
+  const idx = state.findIndex(elem => {return (action.id === elem.id)})
+  let nextState
   switch (action.type) {
-    case actionTypes.CREATE_REGISTERMAP:
-      console.log(`Creating registermap.`, state, action)
-      return {
-        ...state,
-        [action.project.projectId]: action.project
-      }
-    case actionTypes.UPDATE_REGISTERMAP:
-      console.log(`Update registermap.`, state, action)
-      const idx = state.findIndex(elem => { return (elem.id === action.registermapId) })
-      console.log(`Update registermap.`, idx)
-      const next = [
-        ...state.slice(0, idx),
-        action.registermap,
-        ...state.slice(idx + 1)
-      ]
-      console.log(`Update registermap.`, next)
-      return next
-    case actionTypes.DELETE_REGISTERMAP:
-      console.log(`Delete registermap.`, state, action)
-      return {
-        ...state,
-        [action.projectId]: null
-      }
+    case actionTypes.CREATE_SECONDARY:
+      nextState = [ ...state, action.data ]
+      console.log(`Creating secondary.`, state, nextState)
+      return nextState
+    case actionTypes.UPDATE_SECONDARY:
+      nextState = [ ...state.slice(0, idx), action.data, ...state.slice(idx + 1)]
+      console.log(`Updating secondary.`, idx, state, nextState)
+      return nextState
+    case actionTypes.DELETE_SECONDARY:
+      nextState = [ ...state.slice(0, idx), ...state.slice(idx + 1) ]
+      console.log(`Deleting secondary.`, idx, state, nextState)
+      return nextState
     default:
       return state
   }
 }
 
-export function reducer (state = {}, action) {
-  console.log(`Entering registermap root reducer.`, state, action)
-  if (typeof action.settingId !== 'undefined') {
-    return {
-      ...state,
-      registermap: secondaryReducer(state.registermap, action)
-    }
-  }
-  if (typeof action.registermapId !== 'undefined') {
-    return {
-      ...state,
-      registermap: primaryReducer(state.registermap, action)
-    }
-  }
-  return state
-}
 console.log('State reducer', reducer)
 
 /** sagas are asynchronous workers (JS generators) to handle the state.

+ 8 - 3
src/index.js

@@ -8,6 +8,7 @@ import { syncHistoryWithStore, routerReducer } from 'react-router-redux'
 import Main from './Main'
 import project from './project'
 import registermap from './registermap'
+import demo_module from './demo_module'
 import './index.css'
 
 /**
@@ -16,13 +17,15 @@ import './index.css'
 const rootReducer = combineReducers({
   project: project.reducer,
   registermap: registermap.reducer,
+  demo_module: demo_module.reducer,
   routing: routerReducer
 })
 console.log('Root reducer:', rootReducer)
 
 const defaultState = {
   project: project.state,
-  registermap: registermap.state
+  registermap: registermap.state,
+  demo_module: demo_module.state
 }
 console.log('Default state:', defaultState)
 
@@ -32,9 +35,11 @@ const enhancers = compose(
 console.log('Enhancers:', enhancers)
 
 const store = createStore(rootReducer, defaultState, enhancers)
+console.log('store:', store)
 const history = syncHistoryWithStore(browserHistory, store)
+console.log('history:', history)
 
-const actionCreators = { project: project.actions, registermap: registermap.actions }
+const actionCreators = { project: project.actions, registermap: registermap.actions, demo_module: demo_module.actionCreators }
 
 function mapStateToProps (state) {
   const propState = {}
@@ -64,7 +69,7 @@ const router = (
     <Router history={history}>
       <Route component={App}>
         <Route path='/'>
-          <IndexRoute component={project.components.Project} />
+          <IndexRoute component={demo_module.components.DemoModule} />
           <Route path='/project/:projectId' component={project.components.Project} />
           <Route path='/project' component={project.components.Project} />
           <Route path='/registermap/:registermapId' component={registermap.components.Registermap} />

+ 1 - 1
src/registermap/index.js

@@ -45,5 +45,5 @@ export const getCounts = createSelector(
     })
 ) */
 
-console.log('Exporting registermap:', { actions, constants, components, filters, selectors, reducer, state, registermapFactory, settingFactory })
+//console.log('Exporting registermap:', { actions, constants, components, filters, selectors, reducer, state, registermapFactory, settingFactory })
 export default { actions, constants, components, filters, selectors, reducer, state, registermapFactory, settingFactory }