diff --git a/src/ic/ic-store.js b/src/ic/ic-store.js index d91ea19..c70293f 100644 --- a/src/ic/ic-store.js +++ b/src/ic/ic-store.js @@ -23,16 +23,15 @@ import ICDataDataManager from './ic-data-data-manager'; class InfrastructureComponentStore extends ArrayStore { constructor() { - super('ic', ICsDataManager); + super('ics', ICsDataManager); } reduce(state, action) { switch(action.type) { - case 'ic/loaded': + case 'ics/loaded': // connect to each infrastructure component for (let ic of action.data) { const endpoint = _.get(ic, 'properties.endpoint') || _.get(ic, 'rawProperties.endpoint'); - if (endpoint != null && endpoint !== '') { ICDataDataManager.open(endpoint, ic.id); } else { @@ -43,32 +42,31 @@ class InfrastructureComponentStore extends ArrayStore { return super.reduce(state, action); - case 'ic/edited': + case 'ics/edited': // connect to each infrastructure component const ic = action.data; const endpoint = _.get(ic, 'properties.endpoint') || _.get(ic, 'rawProperties.endpoint'); if (endpoint != null && endpoint !== '') { - console.log("Updating IC id " + ic.id); ICDataDataManager.update(endpoint, ic.id); } return super.reduce(state, action); - case 'ic/fetched': + case 'ics/fetched': return this.updateElements(state, [action.data]); - case 'ic/fetch-error': + case 'ics/fetch-error': return state; - case 'ic/start-action': + case 'ics/start-action': if (!Array.isArray(action.data)) action.data = [ action.data ] ICsDataManager.doActions(action.ic, action.data, action.token); return state; - case 'ic/action-error': + case 'ics/action-error': console.log(action.error); return state; diff --git a/src/ic/ics-data-manager.js b/src/ic/ics-data-manager.js index 086e96f..73d3e91 100644 --- a/src/ic/ics-data-manager.js +++ b/src/ic/ics-data-manager.js @@ -28,12 +28,12 @@ class IcsDataManager extends RestDataManager { // TODO: Make only infrastructure component id dependent RestAPI.post(this.makeURL(this.url + '/' + ic.id), action, token).then(response => { AppDispatcher.dispatch({ - type: 'ic/action-started', + type: 'ics/action-started', data: response }); }).catch(error => { AppDispatcher.dispatch({ - type: 'ic/action-error', + type: 'ics/action-error', error }); }); diff --git a/src/ic/ics.js b/src/ic/ics.js index 6f3e89a..a66b271 100644 --- a/src/ic/ics.js +++ b/src/ic/ics.js @@ -85,7 +85,7 @@ class InfrastructureComponents extends Component { componentDidMount() { AppDispatcher.dispatch({ - type: 'ic/start-load', + type: 'ics/start-load', token: this.state.sessionToken, }); @@ -104,7 +104,7 @@ class InfrastructureComponents extends Component { } else { AppDispatcher.dispatch({ - type: 'ic/start-load', + type: 'ics/start-load', token: this.state.sessionToken, }); } @@ -116,7 +116,7 @@ class InfrastructureComponents extends Component { if (data) { AppDispatcher.dispatch({ - type: 'ic/start-add', + type: 'ics/start-add', data, token: this.state.sessionToken, }); @@ -132,7 +132,7 @@ class InfrastructureComponents extends Component { this.setState({ ic: ic }); AppDispatcher.dispatch({ - type: 'ic/start-edit', + type: 'ics/start-edit', data: ic, token: this.state.sessionToken, }); @@ -147,7 +147,7 @@ class InfrastructureComponents extends Component { } AppDispatcher.dispatch({ - type: 'ic/start-remove', + type: 'ics/start-remove', data: this.state.modalIC, token: this.state.sessionToken, }); @@ -168,7 +168,7 @@ class InfrastructureComponents extends Component { if (data) { AppDispatcher.dispatch({ - type: 'ic/start-add', + type: 'ics/start-add', data, token: this.state.sessionToken, }); @@ -203,7 +203,7 @@ class InfrastructureComponents extends Component { runAction = action => { for (let index of this.state.selectedICs) { AppDispatcher.dispatch({ - type: 'ic/start-action', + type: 'ics/start-action', ic: this.state.ics[index], data: action.data, token: this.state.sessionToken, diff --git a/src/scenario/scenario.js b/src/scenario/scenario.js index c4d8b60..d6e89f5 100644 --- a/src/scenario/scenario.js +++ b/src/scenario/scenario.js @@ -121,7 +121,7 @@ class Scenario extends React.Component { // load ICs to enable that simulation models work with them AppDispatcher.dispatch({ - type: 'ic/start-load', + type: 'ics/start-load', token: this.state.sessionToken, }); @@ -258,7 +258,7 @@ class Scenario extends React.Component { } AppDispatcher.dispatch({ - type: 'ic/start-action', + type: 'ics/start-action', ic: ic, data: action.data, token: this.state.sessionToken diff --git a/src/widget/widgets/custom-action.js b/src/widget/widgets/custom-action.js index 84696cb..822121d 100644 --- a/src/widget/widgets/custom-action.js +++ b/src/widget/widgets/custom-action.js @@ -48,7 +48,7 @@ class WidgetCustomAction extends Component { onClick() { AppDispatcher.dispatch({ - type: 'ic/start-action', + type: 'ics/start-action', ic: this.state.ic, data: this.props.widget.customProperties.actions, token: this.state.sessionToken