Update prettier/eslint
This commit is contained in:
@@ -21,14 +21,7 @@ export const setDownloadBegin = (name, type, url) => {
|
||||
export const setDownloadEnd = createAction('download/setDownloadEnd');
|
||||
export const setDownloadProgress = createAction('download/setDownloadProgress');
|
||||
|
||||
export const downloadItem = (
|
||||
name,
|
||||
type,
|
||||
urls,
|
||||
isWinFSP,
|
||||
testVersion,
|
||||
appPlatform
|
||||
) => {
|
||||
export const downloadItem = (name, type, urls, isWinFSP, testVersion, appPlatform) => {
|
||||
return (dispatch, getState) => {
|
||||
if (!Array.isArray(urls)) {
|
||||
urls = [urls];
|
||||
@@ -38,35 +31,20 @@ export const downloadItem = (
|
||||
if (result.Success) {
|
||||
switch (type) {
|
||||
case Constants.INSTALL_TYPES.Dependency:
|
||||
dispatch(
|
||||
installDependency(result.Destination, result.URL, isWinFSP)
|
||||
);
|
||||
dispatch(installDependency(result.Destination, result.URL, isWinFSP));
|
||||
break;
|
||||
case Constants.INSTALL_TYPES.Release:
|
||||
dispatch(installRelease(result.Destination));
|
||||
break;
|
||||
case Constants.INSTALL_TYPES.TestRelease:
|
||||
dispatch(
|
||||
installAndTestRelease(
|
||||
result.Destination,
|
||||
testVersion,
|
||||
appPlatform
|
||||
)
|
||||
);
|
||||
dispatch(installAndTestRelease(result.Destination, testVersion, appPlatform));
|
||||
break;
|
||||
case Constants.INSTALL_TYPES.Upgrade:
|
||||
// const info =
|
||||
// this.props.LocationsLookup[this.props.AppPlatform][this.props.VersionLookup[this.props.AppPlatform][0]];
|
||||
//const sha256 = null; // info.sha256;
|
||||
//const signature = null; // info.sig;
|
||||
dispatch(
|
||||
installUpgrade(
|
||||
result.Destination,
|
||||
null,
|
||||
null,
|
||||
!!result.SkipVerification
|
||||
)
|
||||
);
|
||||
dispatch(installUpgrade(result.Destination, null, null, !!result.SkipVerification));
|
||||
break;
|
||||
default:
|
||||
dispatch(notifyError('Unknown download type: ' + type));
|
||||
@@ -83,10 +61,7 @@ export const downloadItem = (
|
||||
const downloadAtIndex = (index) => {
|
||||
const url = urls[index];
|
||||
const state = getState();
|
||||
if (
|
||||
index > 0 ||
|
||||
(!state.download.DownloadActive && state.download.AllowDownload)
|
||||
) {
|
||||
if (index > 0 || (!state.download.DownloadActive && state.download.AllowDownload)) {
|
||||
const ipcRenderer = getIPCRenderer();
|
||||
if (ipcRenderer) {
|
||||
dispatch(setDownloadBegin(name, type, url));
|
||||
@@ -96,10 +71,7 @@ export const downloadItem = (
|
||||
};
|
||||
|
||||
const downloadFileComplete = (_, arg) => {
|
||||
ipcRenderer.removeListener(
|
||||
Constants.IPC_Download_File_Progress,
|
||||
downloadFileProgress
|
||||
);
|
||||
ipcRenderer.removeListener(Constants.IPC_Download_File_Progress, downloadFileProgress);
|
||||
if (!arg.data.Success && ++index < urls.length) {
|
||||
downloadAtIndex(index);
|
||||
} else {
|
||||
@@ -108,14 +80,8 @@ export const downloadItem = (
|
||||
}
|
||||
};
|
||||
|
||||
ipcRenderer.on(
|
||||
Constants.IPC_Download_File_Progress,
|
||||
downloadFileProgress
|
||||
);
|
||||
ipcRenderer.once(
|
||||
Constants.IPC_Download_File_Complete,
|
||||
downloadFileComplete
|
||||
);
|
||||
ipcRenderer.on(Constants.IPC_Download_File_Progress, downloadFileProgress);
|
||||
ipcRenderer.once(Constants.IPC_Download_File_Complete, downloadFileComplete);
|
||||
|
||||
ipcRenderer.send(Constants.IPC_Download_File, {
|
||||
Filename: name,
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
let addEditHostResolvers = [];
|
||||
|
||||
export const addEditHost = (display, host_data, cb) => {
|
||||
export const addEditHost = (display, host_list, host_data, cb) => {
|
||||
return (dispatch) => {
|
||||
if (cb) {
|
||||
dispatch(addEditHost(display, host_data)).then(({ changed, host_data }) =>
|
||||
dispatch(addEditHost(display, host_list, host_data)).then(({ changed, host_data }) =>
|
||||
cb(changed, host_data)
|
||||
);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
dispatch(handleDisplayAddEditHost(display, host_data, resolve));
|
||||
dispatch(handleDisplayAddEditHost(display, host_list, host_data, resolve));
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const handleDisplayAddEditHost = (display, host_data, resolve) => {
|
||||
const handleDisplayAddEditHost = (display, host_list, host_data, resolve) => {
|
||||
return (dispatch) => {
|
||||
if (display) {
|
||||
addEditHostResolvers.push(resolve);
|
||||
dispatch(displayAddEditHost(display, host_data));
|
||||
dispatch(displayAddEditHost(display, host_list, host_data));
|
||||
} else {
|
||||
dispatch(completeAddEditHost(false));
|
||||
}
|
||||
@@ -36,6 +36,6 @@ export const completeAddEditHost = (changed, host_data) => {
|
||||
};
|
||||
|
||||
export const DISPLAY_ADD_EDIT_HOST = 'host/displayAddEditHost';
|
||||
export const displayAddEditHost = (display, host_data) => {
|
||||
return { type: DISPLAY_ADD_EDIT_HOST, payload: { display, host_data } };
|
||||
export const displayAddEditHost = (display, host_list, host_data) => {
|
||||
return { type: DISPLAY_ADD_EDIT_HOST, payload: { display, host_data, host_list } };
|
||||
};
|
||||
|
||||
@@ -31,8 +31,7 @@ export const checkInstalled = (dependencies, version) => {
|
||||
const checkInstalledComplete = (_, arg) => {
|
||||
const result = arg.data;
|
||||
const updateState = () => {
|
||||
const installedVersion =
|
||||
result.Success && result.Exists ? result.Version : 'none';
|
||||
const installedVersion = result.Success && result.Exists ? result.Version : 'none';
|
||||
const state = getState();
|
||||
|
||||
const release = state.relver.Release;
|
||||
@@ -41,8 +40,7 @@ export const checkInstalled = (dependencies, version) => {
|
||||
let upgradeAvailable = false;
|
||||
if (installedVersion !== 'none') {
|
||||
const latestVersion =
|
||||
state.relver.VersionLookup[Constants.RELEASE_TYPES[release]]
|
||||
.length - 1;
|
||||
state.relver.VersionLookup[Constants.RELEASE_TYPES[release]].length - 1;
|
||||
if (version === -1) {
|
||||
version = latestVersion;
|
||||
dispatch(setActiveRelease(release, version));
|
||||
@@ -63,14 +61,12 @@ export const checkInstalled = (dependencies, version) => {
|
||||
dispatch(showWindow());
|
||||
} else if (installedVersion === 'none' && autoInstallRelease) {
|
||||
dispatch(setAllowMount(false));
|
||||
const versionString = getState().relver.VersionLookup[
|
||||
Constants.RELEASE_TYPES[release]
|
||||
][version];
|
||||
const versionString = getState().relver.VersionLookup[Constants.RELEASE_TYPES[release]][
|
||||
version
|
||||
];
|
||||
const urls = getState().relver.LocationsLookup[versionString].urls;
|
||||
const fileName = versionString + '.zip';
|
||||
dispatch(
|
||||
downloadItem(fileName, Constants.INSTALL_TYPES.Release, urls)
|
||||
);
|
||||
dispatch(downloadItem(fileName, Constants.INSTALL_TYPES.Release, urls));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -81,10 +77,7 @@ export const checkInstalled = (dependencies, version) => {
|
||||
}
|
||||
};
|
||||
|
||||
ipcRenderer.once(
|
||||
Constants.IPC_Check_Installed_Reply,
|
||||
checkInstalledComplete
|
||||
);
|
||||
ipcRenderer.once(Constants.IPC_Check_Installed_Reply, checkInstalledComplete);
|
||||
ipcRenderer.send(Constants.IPC_Check_Installed, {
|
||||
Dependencies: dependencies,
|
||||
Version: version,
|
||||
@@ -104,8 +97,7 @@ export const checkVersionInstalled = () => {
|
||||
state.relver.LocationsLookup[selectedVersion] &&
|
||||
state.relver.LocationsLookup[selectedVersion].dependencies
|
||||
) {
|
||||
dependencies =
|
||||
state.relver.LocationsLookup[selectedVersion].dependencies;
|
||||
dependencies = state.relver.LocationsLookup[selectedVersion].dependencies;
|
||||
}
|
||||
dispatch(checkInstalled(dependencies, selectedVersion));
|
||||
} else {
|
||||
@@ -139,12 +131,9 @@ export const installDependency = (source, url, isWinFSP) => {
|
||||
return d.download === url;
|
||||
});
|
||||
const i = setInterval(() => {
|
||||
const ret = ipcRenderer.sendSync(
|
||||
Constants.IPC_Check_Dependency_Installed + '_sync',
|
||||
{
|
||||
File: dep.file,
|
||||
}
|
||||
);
|
||||
const ret = ipcRenderer.sendSync(Constants.IPC_Check_Dependency_Installed + '_sync', {
|
||||
File: dep.file,
|
||||
});
|
||||
|
||||
if (ret.data.Exists) {
|
||||
clearInterval(i);
|
||||
@@ -158,10 +147,7 @@ export const installDependency = (source, url, isWinFSP) => {
|
||||
}
|
||||
};
|
||||
|
||||
ipcRenderer.once(
|
||||
Constants.IPC_Install_Dependency_Reply,
|
||||
installDependencyComplete
|
||||
);
|
||||
ipcRenderer.once(Constants.IPC_Install_Dependency_Reply, installDependencyComplete);
|
||||
ipcRenderer.send(Constants.IPC_Install_Dependency, {
|
||||
Source: source,
|
||||
URL: url,
|
||||
@@ -199,10 +185,7 @@ export const installAndTestRelease = (source, version, appPlatform) => {
|
||||
});
|
||||
};
|
||||
|
||||
ipcRenderer.once(
|
||||
Constants.IPC_Extract_Release_Complete,
|
||||
extractReleaseComplete
|
||||
);
|
||||
ipcRenderer.once(Constants.IPC_Extract_Release_Complete, extractReleaseComplete);
|
||||
ipcRenderer.send(Constants.IPC_Extract_Release, {
|
||||
Source: source,
|
||||
Version: version,
|
||||
@@ -214,10 +197,7 @@ export const installAndTestRelease = (source, version, appPlatform) => {
|
||||
export const installReleaseByVersion = (release, version) => {
|
||||
return (dispatch, getState) => {
|
||||
const install = () => {
|
||||
if (
|
||||
getState().download.AllowDownload &&
|
||||
!getState().download.DownloadActive
|
||||
) {
|
||||
if (getState().download.AllowDownload && !getState().download.DownloadActive) {
|
||||
dispatch(setAutoInstallRelease(true));
|
||||
dispatch(setActiveRelease(release, version));
|
||||
} else {
|
||||
@@ -251,10 +231,7 @@ export const installRelease = (source) => {
|
||||
});
|
||||
|
||||
if (arg.data.Success) {
|
||||
localStorage.setItem(
|
||||
'previous_releases',
|
||||
localStorage.getItem('releases')
|
||||
);
|
||||
localStorage.setItem('previous_releases', localStorage.getItem('releases'));
|
||||
dispatch(setNewReleasesAvailable2([]));
|
||||
}
|
||||
|
||||
@@ -262,10 +239,7 @@ export const installRelease = (source) => {
|
||||
dispatch(checkVersionInstalled());
|
||||
};
|
||||
|
||||
ipcRenderer.once(
|
||||
Constants.IPC_Extract_Release_Complete,
|
||||
extractReleaseComplete
|
||||
);
|
||||
ipcRenderer.once(Constants.IPC_Extract_Release_Complete, extractReleaseComplete);
|
||||
ipcRenderer.send(Constants.IPC_Extract_Release, {
|
||||
Source: source,
|
||||
Version: version,
|
||||
@@ -303,10 +277,7 @@ export const installUpgrade = (source, sha256, signature, skipVerification) => {
|
||||
}
|
||||
};
|
||||
|
||||
ipcRenderer.once(
|
||||
Constants.IPC_Install_Upgrade_Reply,
|
||||
installUpgradeComplete
|
||||
);
|
||||
ipcRenderer.once(Constants.IPC_Install_Upgrade_Reply, installUpgradeComplete);
|
||||
ipcRenderer.send(Constants.IPC_Install_Upgrade, {
|
||||
Sha256: sha256,
|
||||
Signature: signature,
|
||||
@@ -317,17 +288,9 @@ export const installUpgrade = (source, sha256, signature, skipVerification) => {
|
||||
};
|
||||
};
|
||||
|
||||
export const setAutoInstallRelease = createAction(
|
||||
'install/setAutoInstallRelease'
|
||||
);
|
||||
export const setDismissDependencies = createAction(
|
||||
'install/setDismissDependencies'
|
||||
);
|
||||
export const setAutoInstallRelease = createAction('install/setAutoInstallRelease');
|
||||
export const setDismissDependencies = createAction('install/setDismissDependencies');
|
||||
export const setInstallActive = createAction('install/setInstallActive');
|
||||
export const setInstallTestActive = createAction(
|
||||
'install/setInstallTestActive'
|
||||
);
|
||||
export const setInstallTestActive = createAction('install/setInstallTestActive');
|
||||
export const setInstallComplete = createAction('install/setInstallComplete');
|
||||
export const setMissingDependencies = createAction(
|
||||
'install/setMissingDependencies'
|
||||
);
|
||||
export const setMissingDependencies = createAction('install/setMissingDependencies');
|
||||
|
||||
@@ -23,9 +23,7 @@ export const addRemoteMount = (hostNameOrIp, port, token) => {
|
||||
Version: getState().relver.InstalledVersion,
|
||||
});
|
||||
} else {
|
||||
dispatch(
|
||||
notifyError('Failed to create S3 instance: ' + arg.data.Error)
|
||||
);
|
||||
dispatch(notifyError('Failed to create S3 instance: ' + arg.data.Error));
|
||||
dispatch(setBusy(false));
|
||||
}
|
||||
});
|
||||
@@ -44,14 +42,7 @@ export const addRemoteMount = (hostNameOrIp, port, token) => {
|
||||
};
|
||||
};
|
||||
|
||||
export const addS3Mount = (
|
||||
name,
|
||||
accessKey,
|
||||
secretKey,
|
||||
region,
|
||||
bucketName,
|
||||
url
|
||||
) => {
|
||||
export const addS3Mount = (name, accessKey, secretKey, region, bucketName, url) => {
|
||||
return (dispatch, getState) => {
|
||||
const ipcRenderer = getIPCRenderer();
|
||||
const provider = 'S3' + name;
|
||||
@@ -67,9 +58,7 @@ export const addS3Mount = (
|
||||
Version: getState().relver.InstalledVersion,
|
||||
});
|
||||
} else {
|
||||
dispatch(
|
||||
notifyError('Failed to create S3 instance: ' + arg.data.Error)
|
||||
);
|
||||
dispatch(notifyError('Failed to create S3 instance: ' + arg.data.Error));
|
||||
dispatch(setBusy(false));
|
||||
}
|
||||
});
|
||||
@@ -107,13 +96,13 @@ export const displayConfiguration = (provider, remote, s3) => {
|
||||
export const removeMount = (provider) => {
|
||||
return (dispatch) => {
|
||||
const isRemote = provider.startsWith('Remote');
|
||||
dispatch(
|
||||
confirmYesNo('Delete [' + provider.substr(isRemote ? 6 : 2) + ']?')
|
||||
).then((confirmed) => {
|
||||
if (confirmed) {
|
||||
dispatch(removeMount2(provider));
|
||||
dispatch(confirmYesNo('Delete [' + provider.substr(isRemote ? 6 : 2) + ']?')).then(
|
||||
(confirmed) => {
|
||||
if (confirmed) {
|
||||
dispatch(removeMount2(provider));
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -9,17 +9,9 @@ import {
|
||||
getSelectedVersionFromState,
|
||||
} from '../../utils.jsx';
|
||||
|
||||
import {
|
||||
saveState,
|
||||
setAllowMount,
|
||||
setApplicationReady,
|
||||
showWindow,
|
||||
} from './common_actions';
|
||||
import { saveState, setAllowMount, setApplicationReady, showWindow } from './common_actions';
|
||||
import { notifyError } from './error_actions';
|
||||
import {
|
||||
checkVersionInstalled,
|
||||
setDismissDependencies,
|
||||
} from './install_actions';
|
||||
import { checkVersionInstalled, setDismissDependencies } from './install_actions';
|
||||
import { unmountAll } from './mount_actions';
|
||||
|
||||
export const CLEAR_UI_UPGRADE = 'relver/clearUIUpgrade';
|
||||
@@ -85,19 +77,12 @@ export const loadReleases = () => {
|
||||
release = Constants.DEFAULT_RELEASE;
|
||||
}
|
||||
|
||||
let latestVersion =
|
||||
versionLookup[Constants.RELEASE_TYPES[release]].length - 1;
|
||||
let latestVersion = versionLookup[Constants.RELEASE_TYPES[release]].length - 1;
|
||||
let version = state.Version;
|
||||
if (
|
||||
versionLookup[Constants.RELEASE_TYPES[release]][0] === 'unavailable'
|
||||
) {
|
||||
if (versionLookup[Constants.RELEASE_TYPES[release]][0] === 'unavailable') {
|
||||
release = Constants.DEFAULT_RELEASE;
|
||||
version = latestVersion =
|
||||
versionLookup[Constants.RELEASE_TYPES[release]].length - 1;
|
||||
} else if (
|
||||
version === -1 ||
|
||||
!versionLookup[Constants.RELEASE_TYPES[release]][version]
|
||||
) {
|
||||
version = latestVersion = versionLookup[Constants.RELEASE_TYPES[release]].length - 1;
|
||||
} else if (version === -1 || !versionLookup[Constants.RELEASE_TYPES[release]][version]) {
|
||||
version = latestVersion;
|
||||
}
|
||||
|
||||
@@ -109,9 +94,7 @@ export const loadReleases = () => {
|
||||
dispatch(detectUIUpgrade());
|
||||
if (processAllowDismiss) {
|
||||
dispatch(
|
||||
setAllowDismissDependencies(
|
||||
versionLookup[Constants.RELEASE_TYPES[release]].length > 1
|
||||
)
|
||||
setAllowDismissDependencies(versionLookup[Constants.RELEASE_TYPES[release]].length > 1)
|
||||
);
|
||||
}
|
||||
dispatch(checkVersionInstalled());
|
||||
@@ -176,9 +159,7 @@ export const loadReleases = () => {
|
||||
localStorage.setItem('previous_releases', storedReleases);
|
||||
dispatch(showWindow());
|
||||
} else if (
|
||||
(newReleases = checkNewReleases(
|
||||
getSelectedVersionFromState(getState())
|
||||
)).length > 0
|
||||
(newReleases = checkNewReleases(getSelectedVersionFromState(getState()))).length > 0
|
||||
) {
|
||||
dispatch(setNewReleasesAvailable2(newReleases));
|
||||
}
|
||||
@@ -225,20 +206,12 @@ export const setActiveRelease = (release, version) => {
|
||||
};
|
||||
};
|
||||
|
||||
export const setAllowDismissDependencies = createAction(
|
||||
'relver/setAllowDismissDependencies'
|
||||
);
|
||||
export const setDismissNewReleasesAvailable = createAction(
|
||||
'relver/setDismissNewReleasesAvailable'
|
||||
);
|
||||
export const setAllowDismissDependencies = createAction('relver/setAllowDismissDependencies');
|
||||
export const setDismissNewReleasesAvailable = createAction('relver/setDismissNewReleasesAvailable');
|
||||
export const setDismissUIUpgrade = createAction('relver/setDismissUIUpgrade');
|
||||
export const setInstalledVersion = createAction('relver/setInstalledVersion');
|
||||
export const setNewReleasesAvailable = createAction(
|
||||
'relver/setNewReleasesAvailable'
|
||||
);
|
||||
export const setNewReleasesAvailable2 = createAction(
|
||||
'relver/setNewReleasesAvailable2'
|
||||
);
|
||||
export const setNewReleasesAvailable = createAction('relver/setNewReleasesAvailable');
|
||||
export const setNewReleasesAvailable2 = createAction('relver/setNewReleasesAvailable2');
|
||||
|
||||
export const SET_RELEASE_DATA = 'relver/setReleaseData';
|
||||
export const setReleaseData = (locationsLookup, versionLookup) => {
|
||||
@@ -251,9 +224,7 @@ export const setReleaseData = (locationsLookup, versionLookup) => {
|
||||
};
|
||||
};
|
||||
|
||||
export const setReleaseUpgradeAvailable = createAction(
|
||||
'relver/setReleaseUpgradeAvailable'
|
||||
);
|
||||
export const setReleaseUpgradeAvailable = createAction('relver/setReleaseUpgradeAvailable');
|
||||
|
||||
export const SET_UI_UPGRADE_DATA = 'relver/setUIUpgradeData';
|
||||
export const setUIUpgradeData = (upgradeData, version) => {
|
||||
|
||||
Reference in New Issue
Block a user