Continue move to redux
This commit is contained in:
77
src/App.js
77
src/App.js
@@ -16,6 +16,7 @@ import Text from './components/UI/Text/Text';
|
|||||||
import UpgradeIcon from './components/UpgradeIcon/UpgradeIcon';
|
import UpgradeIcon from './components/UpgradeIcon/UpgradeIcon';
|
||||||
import UpgradeUI from './components/UpgradeUI/UpgradeUI';
|
import UpgradeUI from './components/UpgradeUI/UpgradeUI';
|
||||||
import IPCContainer from './containers/IPCContainer/IPCContainer';
|
import IPCContainer from './containers/IPCContainer/IPCContainer';
|
||||||
|
import {detectUIUpgrade, setDismissUIUpgrade} from './redux/actions/release_version_actions';
|
||||||
|
|
||||||
const Constants = require('./constants');
|
const Constants = require('./constants');
|
||||||
const Scheduler = require('node-schedule');
|
const Scheduler = require('node-schedule');
|
||||||
@@ -38,7 +39,6 @@ class App extends IPCContainer {
|
|||||||
this.setRequestHandler(Constants.IPC_Extract_Release_Complete, this.onExtractReleaseComplete);
|
this.setRequestHandler(Constants.IPC_Extract_Release_Complete, this.onExtractReleaseComplete);
|
||||||
this.setRequestHandler(Constants.IPC_Get_State_Reply, this.onGetStateReply);
|
this.setRequestHandler(Constants.IPC_Get_State_Reply, this.onGetStateReply);
|
||||||
this.setRequestHandler(Constants.IPC_Grab_Releases_Reply, this.onGrabReleasesReply);
|
this.setRequestHandler(Constants.IPC_Grab_Releases_Reply, this.onGrabReleasesReply);
|
||||||
this.setRequestHandler(Constants.IPC_Grab_UI_Releases_Reply, this.onGrabUiReleasesReply);
|
|
||||||
this.setRequestHandler(Constants.IPC_Install_Dependency_Reply, this.onInstallDependencyReply);
|
this.setRequestHandler(Constants.IPC_Install_Dependency_Reply, this.onInstallDependencyReply);
|
||||||
this.setRequestHandler(Constants.IPC_Install_Upgrade_Reply, this.onInstallUpgradeReply);
|
this.setRequestHandler(Constants.IPC_Install_Upgrade_Reply, this.onInstallUpgradeReply);
|
||||||
|
|
||||||
@@ -63,16 +63,7 @@ class App extends IPCContainer {
|
|||||||
LocationsLookup: {},
|
LocationsLookup: {},
|
||||||
MissingDependencies: [],
|
MissingDependencies: [],
|
||||||
Release: 2,
|
Release: 2,
|
||||||
ReleaseTypes: [
|
|
||||||
'Release',
|
|
||||||
'RC',
|
|
||||||
'Beta',
|
|
||||||
'Alpha',
|
|
||||||
],
|
|
||||||
InstalledVersion: 'none',
|
InstalledVersion: 'none',
|
||||||
UpgradeAvailable: false,
|
|
||||||
UpgradeData: {},
|
|
||||||
UpgradeDismissed: false,
|
|
||||||
Version: -1,
|
Version: -1,
|
||||||
VersionAvailable: false,
|
VersionAvailable: false,
|
||||||
VersionLookup: {
|
VersionLookup: {
|
||||||
@@ -149,13 +140,13 @@ class App extends IPCContainer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getSelectedVersion = () => {
|
getSelectedVersion = () => {
|
||||||
return this.state.VersionLookup[this.state.ReleaseTypes[this.state.Release]][this.state.Version];
|
return this.state.VersionLookup[Constants.RELEASE_TYPES[this.state.Release]][this.state.Version];
|
||||||
};
|
};
|
||||||
|
|
||||||
grabReleases = () => {
|
grabReleases = () => {
|
||||||
if (this.props.AppPlatform !== 'unknown') {
|
if (this.props.AppPlatform !== 'unknown') {
|
||||||
this.sendRequest(Constants.IPC_Grab_Releases);
|
this.sendRequest(Constants.IPC_Grab_Releases);
|
||||||
this.sendRequest(Constants.IPC_Grab_UI_Releases);
|
this.props.detectUIUpgrade();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -210,7 +201,7 @@ class App extends IPCContainer {
|
|||||||
|
|
||||||
handleReleaseChanged = (e) => {
|
handleReleaseChanged = (e) => {
|
||||||
const val = parseInt(e.target.value, 10);
|
const val = parseInt(e.target.value, 10);
|
||||||
const versionIndex = this.state.VersionLookup[this.state.ReleaseTypes[val]].length - 1;
|
const versionIndex = this.state.VersionLookup[Constants.RELEASE_TYPES[val]].length - 1;
|
||||||
this.setState({
|
this.setState({
|
||||||
Release: val,
|
Release: val,
|
||||||
Version: versionIndex
|
Version: versionIndex
|
||||||
@@ -241,7 +232,7 @@ class App extends IPCContainer {
|
|||||||
DownloadingUpgrade: true,
|
DownloadingUpgrade: true,
|
||||||
DownloadName: 'UI Upgrade',
|
DownloadName: 'UI Upgrade',
|
||||||
}, ()=> {
|
}, ()=> {
|
||||||
const url = this.state.UpgradeData.urls[0];
|
const url = this.props.UpgradeData.urls[0];
|
||||||
this.sendRequest(Constants.IPC_Download_File, {
|
this.sendRequest(Constants.IPC_Download_File, {
|
||||||
Filename: this.props.Platform === 'win32' ? 'upgrade.exe' : this.extractFileNameFromURL(url),
|
Filename: this.props.Platform === 'win32' ? 'upgrade.exe' : this.extractFileNameFromURL(url),
|
||||||
URL: url,
|
URL: url,
|
||||||
@@ -300,7 +291,7 @@ class App extends IPCContainer {
|
|||||||
let versionAvailable = false;
|
let versionAvailable = false;
|
||||||
|
|
||||||
if (installedVersion !== 'none') {
|
if (installedVersion !== 'none') {
|
||||||
const latestVersion = this.state.VersionLookup[this.state.ReleaseTypes[this.state.Release]].length - 1;
|
const latestVersion = this.state.VersionLookup[Constants.RELEASE_TYPES[this.state.Release]].length - 1;
|
||||||
let version = this.state.Version;
|
let version = this.state.Version;
|
||||||
if (version === -1) {
|
if (version === -1) {
|
||||||
version = latestVersion;
|
version = latestVersion;
|
||||||
@@ -386,9 +377,9 @@ class App extends IPCContainer {
|
|||||||
|
|
||||||
onGrabReleasesReply = ()=> {
|
onGrabReleasesReply = ()=> {
|
||||||
const doUpdate = (locationsLookup, versionLookup) => {
|
const doUpdate = (locationsLookup, versionLookup) => {
|
||||||
const latestVersion = versionLookup[this.state.ReleaseTypes[this.state.Release]].length - 1;
|
const latestVersion = versionLookup[Constants.RELEASE_TYPES[this.state.Release]].length - 1;
|
||||||
let version = this.state.Version;
|
let version = this.state.Version;
|
||||||
if ((version === -1) || !versionLookup[this.state.ReleaseTypes[this.state.Release]][version]) {
|
if ((version === -1) || !versionLookup[Constants.RELEASE_TYPES[this.state.Release]][version]) {
|
||||||
version = latestVersion;
|
version = latestVersion;
|
||||||
this.saveState(version);
|
this.saveState(version);
|
||||||
}
|
}
|
||||||
@@ -437,29 +428,6 @@ class App extends IPCContainer {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
onGrabUiReleasesReply = ()=> {
|
|
||||||
axios
|
|
||||||
.get(Constants.UI_RELEASES_URL)
|
|
||||||
.then(response => {
|
|
||||||
const data = response.data;
|
|
||||||
if (data.Versions &&
|
|
||||||
data.Versions[this.props.AppPlatform] &&
|
|
||||||
(data.Versions[this.props.AppPlatform].length > 0) &&
|
|
||||||
(data.Versions[this.props.AppPlatform][0] !== this.props.version)) {
|
|
||||||
this.setState({
|
|
||||||
UpgradeAvailable: true,
|
|
||||||
UpgradeDismissed: false,
|
|
||||||
UpgradeData: data.Locations[this.props.AppPlatform][data.Versions[this.props.AppPlatform][0]],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}).catch(() => {
|
|
||||||
this.setState({
|
|
||||||
UpgradeAvailable: false,
|
|
||||||
UpgradeData: {},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
onInstallDependencyReply = (event, arg) => {
|
onInstallDependencyReply = (event, arg) => {
|
||||||
if (arg.data.Success && arg.data.Source.toLowerCase().endsWith('.dmg')) {
|
if (arg.data.Success && arg.data.Source.toLowerCase().endsWith('.dmg')) {
|
||||||
this.waitForDependencyInstall(arg.data.URL);
|
this.waitForDependencyInstall(arg.data.URL);
|
||||||
@@ -572,11 +540,11 @@ class App extends IPCContainer {
|
|||||||
this.props.DisplayConfiguration &&
|
this.props.DisplayConfiguration &&
|
||||||
allowConfig;
|
allowConfig;
|
||||||
|
|
||||||
const showUpgrade = this.state.UpgradeAvailable &&
|
const showUpgrade = this.props.UpgradeAvailable &&
|
||||||
!this.state.DisplayError &&
|
!this.state.DisplayError &&
|
||||||
!showConfig &&
|
!showConfig &&
|
||||||
!this.state.DownloadActive &&
|
!this.state.DownloadActive &&
|
||||||
!this.state.UpgradeDismissed;
|
!this.props.UpgradeDismissed;
|
||||||
|
|
||||||
const showDependencies = !showUpgrade &&
|
const showDependencies = !showUpgrade &&
|
||||||
missingDependencies &&
|
missingDependencies &&
|
||||||
@@ -628,8 +596,7 @@ class App extends IPCContainer {
|
|||||||
if (showUpgrade) {
|
if (showUpgrade) {
|
||||||
upgradeDisplay = (
|
upgradeDisplay = (
|
||||||
<Modal>
|
<Modal>
|
||||||
<UpgradeUI cancel={()=>this.setState({UpgradeDismissed: true})}
|
<UpgradeUI upgrade={this.handleUIDownload}/>
|
||||||
upgrade={this.handleUIDownload}/>
|
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -647,11 +614,10 @@ class App extends IPCContainer {
|
|||||||
release={this.state.Release}
|
release={this.state.Release}
|
||||||
releaseChanged={this.handleReleaseChanged}
|
releaseChanged={this.handleReleaseChanged}
|
||||||
releaseExtracting={this.state.ExtractActive}
|
releaseExtracting={this.state.ExtractActive}
|
||||||
releaseTypes={this.state.ReleaseTypes}
|
|
||||||
version={this.state.Version}
|
version={this.state.Version}
|
||||||
versionAvailable={this.state.VersionAvailable}
|
versionAvailable={this.state.VersionAvailable}
|
||||||
versionChanged={this.handleVersionChanged}
|
versionChanged={this.handleVersionChanged}
|
||||||
versions={this.state.VersionLookup[this.state.ReleaseTypes[this.state.Release]]}/>
|
versions={this.state.VersionLookup[Constants.RELEASE_TYPES[this.state.Release]]}/>
|
||||||
</div>
|
</div>
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -694,12 +660,12 @@ class App extends IPCContainer {
|
|||||||
colSpan={'remain'}
|
colSpan={'remain'}
|
||||||
row={0}
|
row={0}
|
||||||
rowSpan={'remain'}
|
rowSpan={'remain'}
|
||||||
text={'Repertory UI v' + this.props.version}
|
text={'Repertory UI v' + this.props.Version}
|
||||||
textAlign={'center'}
|
textAlign={'center'}
|
||||||
type={'Heading1'}/>
|
type={'Heading1'}/>
|
||||||
<UpgradeIcon
|
<UpgradeIcon
|
||||||
available={this.state.UpgradeAvailable}
|
available={this.props.UpgradeAvailable}
|
||||||
clicked={()=>this.setState({UpgradeDismissed: false})}
|
clicked={()=>this.props.setDismissUIUpgrade(false)}
|
||||||
col={dimensions => dimensions.columns - 6}
|
col={dimensions => dimensions.columns - 6}
|
||||||
colSpan={5}
|
colSpan={5}
|
||||||
row={1}
|
row={1}
|
||||||
@@ -724,7 +690,18 @@ const mapStateToProps = state => {
|
|||||||
DisplayConfiguration: state.mounts.DisplayConfiguration,
|
DisplayConfiguration: state.mounts.DisplayConfiguration,
|
||||||
MountsBusy: state.mounts.MountsBusy,
|
MountsBusy: state.mounts.MountsBusy,
|
||||||
Platform: state.common.Platform,
|
Platform: state.common.Platform,
|
||||||
|
UpgradeAvailable: state.relver.UpgradeAvailable,
|
||||||
|
UpgradeData: state.relver.UpgradeData,
|
||||||
|
UpgradeDismissed: state.relver.UpgradeDismissed,
|
||||||
|
Version: state.common.Version,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps)(App);
|
const mapDispatchToProps = dispatch => {
|
||||||
|
return {
|
||||||
|
detectUIUpgrade: () => dispatch(detectUIUpgrade()),
|
||||||
|
setDismissUIUpgrade: dismiss => dispatch(setDismissUIUpgrade(dismiss)),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(App);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import './ReleaseVersionDisplay.css';
|
import './ReleaseVersionDisplay.css';
|
||||||
|
import * as Constants from '../../constants';
|
||||||
import DropDown from '../UI/DropDown/DropDown';
|
import DropDown from '../UI/DropDown/DropDown';
|
||||||
import Grid from '../UI/Grid/Grid';
|
import Grid from '../UI/Grid/Grid';
|
||||||
import Text from '../UI/Text/Text';
|
import Text from '../UI/Text/Text';
|
||||||
@@ -70,7 +71,7 @@ export default props => {
|
|||||||
<DropDown changed={props.releaseChanged}
|
<DropDown changed={props.releaseChanged}
|
||||||
colSpan={remain=>remain / 3 - 1}
|
colSpan={remain=>remain / 3 - 1}
|
||||||
disabled={props.disabled}
|
disabled={props.disabled}
|
||||||
items={props.releaseTypes}
|
items={Constants.RELEASE_TYPES}
|
||||||
row={5}
|
row={5}
|
||||||
rowSpan={7}
|
rowSpan={7}
|
||||||
selected={props.release}/>
|
selected={props.release}/>
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
|
import {connect} from 'react-redux';
|
||||||
import Button from '../UI/Button/Button';
|
import Button from '../UI/Button/Button';
|
||||||
import Box from '../UI/Box/Box';
|
import Box from '../UI/Box/Box';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import './UpgradeUI.css';
|
import './UpgradeUI.css';
|
||||||
|
import {setDismissUIUpgrade} from '../../redux/actions/release_version_actions';
|
||||||
|
|
||||||
export default props => {
|
const mapDispatchToProps = dispatch => {
|
||||||
|
return {
|
||||||
|
setDismissUIUpgrade: dismiss => dispatch(setDismissUIUpgrade(dismiss)),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default connect(null, mapDispatchToProps)(props => {
|
||||||
return (
|
return (
|
||||||
<Box dxStyle={{width: '180px', height: 'auto', padding: '5px'}}>
|
<Box dxStyle={{width: '180px', height: 'auto', padding: '5px'}}>
|
||||||
<div style={{width: '100%', height: 'auto'}}>
|
<div style={{width: '100%', height: 'auto'}}>
|
||||||
@@ -18,10 +26,10 @@ export default props => {
|
|||||||
</td>
|
</td>
|
||||||
<td width="50%">
|
<td width="50%">
|
||||||
<Button buttonStyles={{width: '100%'}}
|
<Button buttonStyles={{width: '100%'}}
|
||||||
clicked={props.cancel}>Cancel</Button>
|
clicked={() => props.setDismissUIUpgrade(true)}>Cancel</Button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</Box>);
|
</Box>);
|
||||||
};
|
});
|
||||||
@@ -58,6 +58,13 @@ exports.PROVIDER_ARG = {
|
|||||||
siaprime: '-sp'
|
siaprime: '-sp'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.RELEASE_TYPES = [
|
||||||
|
'Release',
|
||||||
|
'RC',
|
||||||
|
'Beta',
|
||||||
|
'Alpha',
|
||||||
|
];
|
||||||
|
|
||||||
exports.IPC_Browse_Directory = 'browse_directory';
|
exports.IPC_Browse_Directory = 'browse_directory';
|
||||||
|
|
||||||
exports.IPC_Check_Daemon_Version = 'check_daemon_version';
|
exports.IPC_Check_Daemon_Version = 'check_daemon_version';
|
||||||
@@ -98,9 +105,6 @@ exports.IPC_Get_State_Reply = 'get_state_reply';
|
|||||||
exports.IPC_Grab_Releases = 'grab_releases';
|
exports.IPC_Grab_Releases = 'grab_releases';
|
||||||
exports.IPC_Grab_Releases_Reply = 'grab_releases_reply';
|
exports.IPC_Grab_Releases_Reply = 'grab_releases_reply';
|
||||||
|
|
||||||
exports.IPC_Grab_UI_Releases = 'grab_ui_releases';
|
|
||||||
exports.IPC_Grab_UI_Releases_Reply = 'grab_ui_releases_reply';
|
|
||||||
|
|
||||||
exports.IPC_Install_Dependency = 'install_dependency';
|
exports.IPC_Install_Dependency = 'install_dependency';
|
||||||
exports.IPC_Install_Dependency_Reply = 'install_dependency_reply';
|
exports.IPC_Install_Dependency_Reply = 'install_dependency_reply';
|
||||||
|
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ if (!process.versions.hasOwnProperty('electron')) {
|
|||||||
root.style.setProperty('--default_font_size', '15px');
|
root.style.setProperty('--default_font_size', '15px');
|
||||||
}
|
}
|
||||||
|
|
||||||
const store = createAppStore(arg.Platform, arg.AppPlatform);
|
const store = createAppStore(arg.Platform, arg.AppPlatform, packageJson.version);
|
||||||
ReactDOM.render((
|
ReactDOM.render((
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<App version={packageJson.version}/>
|
<App />
|
||||||
</Provider>
|
</Provider>
|
||||||
), document.getElementById('root'));
|
), document.getElementById('root'));
|
||||||
serviceWorker.unregister();
|
serviceWorker.unregister();
|
||||||
|
|||||||
50
src/redux/actions/release_version_actions.js
Normal file
50
src/redux/actions/release_version_actions.js
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import axios from 'axios';
|
||||||
|
import * as Constants from '../../constants';
|
||||||
|
import {createAction} from 'redux-starter-kit';
|
||||||
|
|
||||||
|
export const CLEAR_UI_UPGRADE = 'relver/clearUIUpgrade';
|
||||||
|
export const clearUIUpgrade = () => {
|
||||||
|
return {
|
||||||
|
type: CLEAR_UI_UPGRADE,
|
||||||
|
payload: null,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const detectUIUpgrade = () => {
|
||||||
|
return (dispatch, getState) => {
|
||||||
|
axios
|
||||||
|
.get(Constants.UI_RELEASES_URL)
|
||||||
|
.then(response => {
|
||||||
|
const state = getState();
|
||||||
|
const appPlatform = state.common.AppPlatform;
|
||||||
|
const version = state.common.Version;
|
||||||
|
const data = response.data;
|
||||||
|
|
||||||
|
if (data.Versions &&
|
||||||
|
data.Versions[appPlatform] &&
|
||||||
|
(data.Versions[appPlatform].length > 0) &&
|
||||||
|
(data.Versions[appPlatform][0] !== version)) {
|
||||||
|
dispatch(setUIUpgradeData(data.Locations[appPlatform][data.Versions[appPlatform][0]]));
|
||||||
|
} else {
|
||||||
|
dispatch(clearUIUpgrade());
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
dispatch(clearUIUpgrade());
|
||||||
|
//TODO Display error
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const SET_ACTIVE_RELEASE = 'relver/setActiveRelease';
|
||||||
|
export const setActiveRelease = (release, version) => {
|
||||||
|
return {
|
||||||
|
type: SET_ACTIVE_RELEASE,
|
||||||
|
payload: {
|
||||||
|
release,
|
||||||
|
version
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const setDismissUIUpgrade = createAction('relver/setDismissUIUpgrade');
|
||||||
|
export const setUIUpgradeData = createAction('relver/setUIUpgradeData');
|
||||||
53
src/redux/reducers/release_version_reducer.js
Normal file
53
src/redux/reducers/release_version_reducer.js
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
import {createReducer} from 'redux-starter-kit';
|
||||||
|
import * as Actions from '../actions/release_version_actions';
|
||||||
|
import * as Constants from '../../constants';
|
||||||
|
|
||||||
|
const versionLookup = Constants.RELEASE_TYPES.map(k=> {
|
||||||
|
return {
|
||||||
|
[k]: ['unavailable']
|
||||||
|
};
|
||||||
|
}).reduce((map, obj) => {
|
||||||
|
return {
|
||||||
|
...map,
|
||||||
|
...obj,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
export const releaseVersionReducer = createReducer({
|
||||||
|
LocationsLookup: {},
|
||||||
|
Release: 2,
|
||||||
|
UpgradeAvailable: false,
|
||||||
|
UpgradeDismissed: false,
|
||||||
|
Version: -1,
|
||||||
|
VersionLookup: versionLookup,
|
||||||
|
}, {
|
||||||
|
[Actions.CLEAR_UI_UPGRADE]: state => {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
UpgradeAvailable: false,
|
||||||
|
UpgradeDismissed: false,
|
||||||
|
UpgradeData: null,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
[Actions.SET_ACTIVE_RELEASE]: (state, action) => {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
Release: action.payload.release,
|
||||||
|
Version: action.payload.version
|
||||||
|
};
|
||||||
|
},
|
||||||
|
[Actions.setDismissUIUpgrade]: (state, action) => {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
UpgradeDismissed: action.payload,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
[Actions.setUIUpgradeData]: (state, action) => {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
UpgradeAvailable: true,
|
||||||
|
UpgradeData: action.payload,
|
||||||
|
UpgradeDismissed: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -1,17 +1,20 @@
|
|||||||
import {configureStore, createReducer, getDefaultMiddleware} from 'redux-starter-kit';
|
import {configureStore, createReducer, getDefaultMiddleware} from 'redux-starter-kit';
|
||||||
import {mountReducer} from '../reducers/mount_reducer';
|
import {mountReducer} from '../reducers/mount_reducer';
|
||||||
|
import {releaseVersionReducer} from '../reducers/release_version_reducer';
|
||||||
|
|
||||||
export default function createAppStore(platform, appPlatform) {
|
export default function createAppStore(platform, appPlatform, version) {
|
||||||
const createCommonReducer = () => {
|
const createCommonReducer = () => {
|
||||||
return createReducer({
|
return createReducer({
|
||||||
AppPlatform: appPlatform,
|
AppPlatform: appPlatform,
|
||||||
Platform: platform,
|
Platform: platform,
|
||||||
|
Version: version,
|
||||||
}, {});
|
}, {});
|
||||||
};
|
};
|
||||||
|
|
||||||
const reducer = {
|
const reducer = {
|
||||||
common: createCommonReducer(platform, appPlatform),
|
common: createCommonReducer(platform, appPlatform, version),
|
||||||
mounts: mountReducer,
|
mounts: mountReducer,
|
||||||
|
relver: releaseVersionReducer,
|
||||||
};
|
};
|
||||||
|
|
||||||
const middleware = [...getDefaultMiddleware()];
|
const middleware = [...getDefaultMiddleware()];
|
||||||
|
|||||||
Reference in New Issue
Block a user