#29: Mounts aren't being detected properly when switching releases

This commit is contained in:
Scott E. Graves
2019-07-16 14:10:32 -05:00
parent 8eda25a2a7
commit fc5b9e0a86
5 changed files with 27 additions and 16 deletions

View File

@@ -1,5 +1,6 @@
# Changelog # # Changelog #
## 1.0.5 ## ## 1.0.5 ##
* \#29: Mounts aren't being detected properly when switching releases
* Display window when dependencies are missing * Display window when dependencies are missing
* Display window when UI upgrade is available * Display window when UI upgrade is available

View File

@@ -12,14 +12,6 @@ import {notifyError} from '../../redux/actions/error_actions';
const Constants = require('../../constants'); const Constants = require('../../constants');
class Configuration extends IPCContainer { class Configuration extends IPCContainer {
constructor(props) {
super(props);
this.setRequestHandler(Constants.IPC_Get_Config_Template_Reply, this.onGetConfigTemplateReply);
this.setRequestHandler(Constants.IPC_Get_Config_Reply, this.onGetConfigReply);
this.setRequestHandler(Constants.IPC_Set_Config_Values_Reply, this.onSetConfigValuesReply);
}
_isMounted = false; _isMounted = false;
state = { state = {
@@ -73,6 +65,9 @@ class Configuration extends IPCContainer {
componentDidMount() { componentDidMount() {
this._isMounted = true; this._isMounted = true;
this.setRequestHandler(Constants.IPC_Get_Config_Template_Reply, this.onGetConfigTemplateReply);
this.setRequestHandler(Constants.IPC_Get_Config_Reply, this.onGetConfigReply);
this.setRequestHandler(Constants.IPC_Set_Config_Values_Reply, this.onSetConfigValuesReply);
this.sendRequest(Constants.IPC_Get_Config_Template, { this.sendRequest(Constants.IPC_Get_Config_Template, {
Provider: this.props.DisplayConfiguration, Provider: this.props.DisplayConfiguration,
Version: this.props.version, Version: this.props.version,

View File

@@ -7,6 +7,7 @@ import Modal from '../../components/UI/Modal/Modal';
import MountItem from '../../components/MountItem/MountItem'; import MountItem from '../../components/MountItem/MountItem';
import IPCContainer from '../IPCContainer/IPCContainer'; import IPCContainer from '../IPCContainer/IPCContainer';
import { import {
resetMountsState,
setAllowMount, setAllowMount,
setAutoMountProcessed, setAutoMountProcessed,
setBusy, setBusy,
@@ -19,14 +20,6 @@ import {notifyError} from '../../redux/actions/error_actions';
const Constants = require('../../constants'); const Constants = require('../../constants');
class MountItems extends IPCContainer { class MountItems extends IPCContainer {
constructor(props) {
super(props);
this.setRequestHandler(Constants.IPC_Detect_Mounts_Reply, this.onDetectMountsReply);
this.setRequestHandler(Constants.IPC_Mount_Drive_Reply, this.onMountDriveReply);
this.setRequestHandler(Constants.IPC_Unmount_Drive_Reply, this.onUnmountDriveReply);
}
retryIntervals = {}; retryIntervals = {};
state = { state = {
@@ -56,6 +49,10 @@ class MountItems extends IPCContainer {
}; };
componentDidMount() { componentDidMount() {
this.setRequestHandler(Constants.IPC_Detect_Mounts_Reply, this.onDetectMountsReply);
this.setRequestHandler(Constants.IPC_Mount_Drive_Reply, this.onMountDriveReply);
this.setRequestHandler(Constants.IPC_Unmount_Drive_Reply, this.onUnmountDriveReply);
this.props.resetMountsState();
this.detectMounts(); this.detectMounts();
} }
@@ -66,6 +63,7 @@ class MountItems extends IPCContainer {
} }
} }
this.props.resetMountsState();
super.componentWillUnmount(); super.componentWillUnmount();
}; };
@@ -318,6 +316,7 @@ const mapStateToProps = state => {
AutoMountProcessed: state.mounts.AutoMountProcessed, AutoMountProcessed: state.mounts.AutoMountProcessed,
InstalledVersion: state.relver.InstalledVersion, InstalledVersion: state.relver.InstalledVersion,
MountState: state.mounts.MountState, MountState: state.mounts.MountState,
MountsBusy: state.mounts.MountsBusy,
Platform: state.common.Platform, Platform: state.common.Platform,
ProviderState: state.mounts.ProviderState, ProviderState: state.mounts.ProviderState,
} }
@@ -326,6 +325,7 @@ const mapStateToProps = state => {
const mapDispatchToProps = dispatch => { const mapDispatchToProps = dispatch => {
return { return {
notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)), notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)),
resetMountsState: () => dispatch(resetMountsState()),
setAllowMount: (provider, allow) => dispatch(setAllowMount(provider, allow)), setAllowMount: (provider, allow) => dispatch(setAllowMount(provider, allow)),
setAutoMountProcessed: processed => dispatch(setAutoMountProcessed(processed)), setAutoMountProcessed: processed => dispatch(setAutoMountProcessed(processed)),
setMounted: (provider, mounted) => dispatch(setMounted(provider, mounted)), setMounted: (provider, mounted) => dispatch(setMounted(provider, mounted)),

View File

@@ -2,6 +2,13 @@ import {createAction} from 'redux-starter-kit';
export const displayConfiguration = createAction('mounts/displayConfiguration'); export const displayConfiguration = createAction('mounts/displayConfiguration');
export const RESET_MOUNTS_STATE = 'mounts/resetMountsState';
export const resetMountsState = () => {
return {
type: RESET_MOUNTS_STATE,
payload: null,
}
};
export const SET_ALLOW_MOUNT = 'mounts/setAllowMount'; export const SET_ALLOW_MOUNT = 'mounts/setAllowMount';
export const setAllowMount = (provider, allow) => { export const setAllowMount = (provider, allow) => {
return { return {

View File

@@ -2,6 +2,7 @@ import * as Constants from '../../constants';
import {createReducer} from 'redux-starter-kit'; import {createReducer} from 'redux-starter-kit';
import { import {
displayConfiguration, displayConfiguration,
RESET_MOUNTS_STATE,
SET_ALLOW_MOUNT, SET_ALLOW_MOUNT,
setAutoMountProcessed, setAutoMountProcessed,
setBusy, setBusy,
@@ -53,6 +54,13 @@ export const mountReducer = createReducer({
DisplayConfiguration: action.payload DisplayConfiguration: action.payload
}; };
}, },
[RESET_MOUNTS_STATE]: (state, action) => {
return {
...state,
MountsBusy: false,
MountState: mountState,
}
},
[setAutoMountProcessed]: (state, action) => { [setAutoMountProcessed]: (state, action) => {
return { return {
...state, ...state,