#40: Support for remote Windows mounts - partial
This commit is contained in:
@@ -68,10 +68,15 @@ export const saveState = () => {
|
||||
if (state.common.AppReady) {
|
||||
let currentState = {
|
||||
Release: state.relver.Release,
|
||||
RemoteMounts: state.mounts.RemoteMounts,
|
||||
Version: state.relver.Version,
|
||||
};
|
||||
|
||||
for (const provider of Constants.PROVIDER_LIST) {
|
||||
const providerList = [
|
||||
...Constants.PROVIDER_LIST,
|
||||
...state.mounts.RemoteMounts,
|
||||
];
|
||||
for (const provider of providerList) {
|
||||
currentState[provider] = state.mounts.ProviderState[provider];
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,16 @@ import * as Constants from '../../constants';
|
||||
import {createAction} from 'redux-starter-kit';
|
||||
import {getIPCRenderer} from '../../utils';
|
||||
|
||||
export const displayConfiguration = createAction('mounts/displayConfiguration');
|
||||
export const DISPLAY_CONFIGURATION = 'mounts/displayConfiguration';
|
||||
export const displayConfiguration = (provider, remote) => {
|
||||
return {
|
||||
type: DISPLAY_CONFIGURATION,
|
||||
payload: {
|
||||
provider,
|
||||
remote,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const RESET_MOUNTS_STATE = 'mounts/resetMountsState';
|
||||
export const resetMountsState = () => {
|
||||
|
||||
@@ -7,13 +7,13 @@ import {
|
||||
SET_DISPLAY_SELECT_APPPLATFORM
|
||||
} from '../actions/common_actions';
|
||||
|
||||
export const createCommonReducer = (platform, appPlatform, version) => {
|
||||
export const createCommonReducer = (platformInfo, version) => {
|
||||
return createReducer({
|
||||
AllowMount: false,
|
||||
AppPlatform: appPlatform,
|
||||
AppPlatform: platformInfo.AppPlatform,
|
||||
AppReady: false,
|
||||
DisplaySelectAppPlatform: false,
|
||||
Platform: platform,
|
||||
Platform: platformInfo.Platform,
|
||||
RebootRequired: false,
|
||||
Version: version,
|
||||
}, {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as Constants from '../../constants';
|
||||
import {createReducer} from 'redux-starter-kit';
|
||||
import {
|
||||
displayConfiguration,
|
||||
DISPLAY_CONFIGURATION,
|
||||
RESET_MOUNTS_STATE,
|
||||
SET_ALLOW_MOUNT,
|
||||
setAutoMountProcessed,
|
||||
@@ -11,115 +11,123 @@ import {
|
||||
SET_PROVIDER_STATE
|
||||
} from '../actions/mount_actions';
|
||||
|
||||
const providerState = Constants.PROVIDER_LIST.map(provider=> {
|
||||
return {
|
||||
[provider]: {
|
||||
AutoMount: false,
|
||||
AutoRestart: false,
|
||||
MountLocation: '',
|
||||
export const createMountReducer = state => {
|
||||
let providerList = [
|
||||
...Constants.PROVIDER_LIST,
|
||||
...(state.RemoteMounts||['Remotelocalhost:20000']),
|
||||
];
|
||||
const providerState = providerList.map(provider=> {
|
||||
return {
|
||||
[provider]: {
|
||||
AutoMount: false,
|
||||
AutoRestart: false,
|
||||
MountLocation: '',
|
||||
}
|
||||
}
|
||||
}
|
||||
}).reduce((map, obj) => {
|
||||
return {
|
||||
...map,
|
||||
...obj
|
||||
}
|
||||
});
|
||||
}).reduce((map, obj) => {
|
||||
return {
|
||||
...map,
|
||||
...obj
|
||||
}
|
||||
});
|
||||
|
||||
const mountState = Constants.PROVIDER_LIST.map(provider => {
|
||||
return {
|
||||
[provider]: {
|
||||
AllowMount: false,
|
||||
DriveLetters: [],
|
||||
Mounted: false,
|
||||
const mountState = providerList.map(provider => {
|
||||
return {
|
||||
[provider]: {
|
||||
AllowMount: false,
|
||||
DriveLetters: [],
|
||||
Mounted: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
}).reduce((map, obj) => {
|
||||
return {
|
||||
...map,
|
||||
...obj
|
||||
}
|
||||
});
|
||||
}).reduce((map, obj) => {
|
||||
return {
|
||||
...map,
|
||||
...obj
|
||||
}
|
||||
});
|
||||
|
||||
export const mountReducer = createReducer({
|
||||
AutoMountProcessed: false,
|
||||
DisplayConfiguration: null,
|
||||
MountsBusy: false,
|
||||
MountState: mountState,
|
||||
ProviderState: providerState,
|
||||
RemoteMounts: [],
|
||||
}, {
|
||||
[displayConfiguration]: (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
DisplayConfiguration: action.payload
|
||||
};
|
||||
},
|
||||
[RESET_MOUNTS_STATE]: (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
MountsBusy: false,
|
||||
MountState: mountState,
|
||||
return createReducer({
|
||||
AutoMountProcessed: false,
|
||||
DisplayConfiguration: null,
|
||||
DisplayRemoteConfiguration: false,
|
||||
MountsBusy: false,
|
||||
MountState: mountState,
|
||||
ProviderState: providerState,
|
||||
RemoteMounts: state.RemoteMounts ? state.RemoteMounts : ['Remotelocalhost:20000'],
|
||||
}, {
|
||||
[DISPLAY_CONFIGURATION]: (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
DisplayConfiguration: action.payload.provider,
|
||||
DisplayRemoteConfiguration: action.payload.remote,
|
||||
};
|
||||
},
|
||||
[RESET_MOUNTS_STATE]: (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
MountsBusy: false,
|
||||
MountState: mountState,
|
||||
}
|
||||
},
|
||||
[setAutoMountProcessed]: (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
AutoMountProcessed: action.payload
|
||||
};
|
||||
},
|
||||
[SET_ALLOW_MOUNT]: (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
MountState: {
|
||||
...state.MountState,
|
||||
[action.payload.provider]: {
|
||||
...state.MountState[action.payload.provider],
|
||||
AllowMount: action.payload.allow,
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
[setBusy]: (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
MountsBusy: action.payload
|
||||
};
|
||||
},
|
||||
[SET_MOUNT_STATE]: (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
MountState: {
|
||||
...state.MountState,
|
||||
[action.payload.provider]: {
|
||||
...state.MountState[action.payload.provider],
|
||||
...action.payload.state
|
||||
},
|
||||
}
|
||||
};
|
||||
},
|
||||
[SET_MOUNTED]: (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
MountState: {
|
||||
...state.MountState,
|
||||
[action.payload.provider]: {
|
||||
...state.MountState[action.payload.provider],
|
||||
Mounted: action.payload.mounted,
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
[SET_PROVIDER_STATE]: (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
ProviderState: {
|
||||
...state.ProviderState,
|
||||
[action.payload.provider]: {
|
||||
...state.ProviderState[action.payload.provider],
|
||||
...action.payload.state
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
[setAutoMountProcessed]: (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
AutoMountProcessed: action.payload
|
||||
};
|
||||
},
|
||||
[SET_ALLOW_MOUNT]: (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
MountState: {
|
||||
...state.MountState,
|
||||
[action.payload.provider]: {
|
||||
...state.MountState[action.payload.provider],
|
||||
AllowMount: action.payload.allow,
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
[setBusy]: (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
MountsBusy: action.payload
|
||||
};
|
||||
},
|
||||
[SET_MOUNT_STATE]: (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
MountState: {
|
||||
...state.MountState,
|
||||
[action.payload.provider]: {
|
||||
...state.MountState[action.payload.provider],
|
||||
...action.payload.state
|
||||
},
|
||||
}
|
||||
};
|
||||
},
|
||||
[SET_MOUNTED]: (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
MountState: {
|
||||
...state.MountState,
|
||||
[action.payload.provider]: {
|
||||
...state.MountState[action.payload.provider],
|
||||
Mounted: action.payload.mounted,
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
[SET_PROVIDER_STATE]: (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
ProviderState: {
|
||||
...state.ProviderState,
|
||||
[action.payload.provider]: {
|
||||
...state.ProviderState[action.payload.provider],
|
||||
...action.payload.state
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -3,16 +3,16 @@ import {createCommonReducer} from '../reducers/common_reducer';
|
||||
import {downloadReducer} from '../reducers/download_reducer';
|
||||
import {errorReducer} from '../reducers/error_reducer';
|
||||
import {installReducer} from '../reducers/install_reducer';
|
||||
import {mountReducer} from '../reducers/mount_reducer';
|
||||
import {createMountReducer} from '../reducers/mount_reducer';
|
||||
import {releaseVersionReducer} from '../reducers/release_version_reducer';
|
||||
|
||||
export default function createAppStore(platform, appPlatform, version) {
|
||||
export default function createAppStore(platformInfo, version, state) {
|
||||
const reducer = {
|
||||
common: createCommonReducer(platform, appPlatform, version),
|
||||
common: createCommonReducer(platformInfo, version),
|
||||
download: downloadReducer,
|
||||
error: errorReducer,
|
||||
install: installReducer,
|
||||
mounts: mountReducer,
|
||||
mounts: createMountReducer(state),
|
||||
relver: releaseVersionReducer,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user