Update prettier/eslint

This commit is contained in:
2021-05-03 16:51:50 -05:00
parent 9246b33440
commit 7cb3094305
52 changed files with 312 additions and 968 deletions

View File

@@ -20,18 +20,12 @@ import {
setNewReleasesAvailable,
} from './redux/actions/release_version_actions';
import ReleaseVersionDisplay from './components/ReleaseVersionDisplay/ReleaseVersionDisplay';
import {
displaySelectAppPlatform,
saveState,
} from './redux/actions/common_actions';
import { displaySelectAppPlatform, saveState } from './redux/actions/common_actions';
import SelectAppPlatform from './containers/SelectAppPlatform/SelectAppPlatform';
import Text from './components/UI/Text/Text';
import UpgradeIcon from './components/UpgradeIcon/UpgradeIcon';
import UpgradeUI from './components/UpgradeUI/UpgradeUI';
import {
loadReleases,
setDismissUIUpgrade,
} from './redux/actions/release_version_actions';
import { loadReleases, setDismissUIUpgrade } from './redux/actions/release_version_actions';
import YesNo from './components/YesNo/YesNo';
import { createModalConditionally } from './utils.jsx';
import SkynetImport from './containers/SkynetImport/SkynetImport';
@@ -106,8 +100,7 @@ class App extends IPCContainer {
!this.props.DownloadActive &&
selectedVersion !== 'unavailable' &&
selectedVersion !== this.props.InstalledVersion;
const missingDependencies =
this.props.MissingDependencies.length > 0 && this.props.AllowMount;
const missingDependencies = this.props.MissingDependencies.length > 0 && this.props.AllowMount;
const allowMount =
this.props.AllowMount &&
@@ -142,9 +135,7 @@ class App extends IPCContainer {
!this.props.RebootRequired;
const showPinnedManager =
!missingDependencies &&
!this.props.RebootRequired &&
this.props.DisplayPinnedManager;
!missingDependencies && !this.props.RebootRequired && this.props.DisplayPinnedManager;
const showUpgrade =
this.props.UpgradeAvailable &&
@@ -214,18 +205,12 @@ class App extends IPCContainer {
remoteSupported={remoteSupported}
/>
);
const addEditHostDisplay = createModalConditionally(
showAddEditHost,
<AddEditHost />
);
const addEditHostDisplay = createModalConditionally(showAddEditHost, <AddEditHost />);
const pinnedManagerDisplay = createModalConditionally(
showPinnedManager,
<PinnedManager version={selectedVersion} />
);
const confirmDisplay = createModalConditionally(
this.props.DisplayConfirmYesNo,
<YesNo />
);
const confirmDisplay = createModalConditionally(this.props.DisplayConfirmYesNo, <YesNo />);
const dependencyDisplay = createModalConditionally(
showDependencies,
<DependencyList />,
@@ -238,24 +223,10 @@ class App extends IPCContainer {
false,
true
);
const errorDisplay = createModalConditionally(
this.props.DisplayError,
<ErrorDetails />,
true
);
const infoDisplay = createModalConditionally(
this.props.DisplayInfo,
<InfoDetails />,
true
);
const newReleasesDisplay = createModalConditionally(
showNewReleases,
<NewReleases />
);
const rebootDisplay = createModalConditionally(
this.props.RebootRequired,
<Reboot />
);
const errorDisplay = createModalConditionally(this.props.DisplayError, <ErrorDetails />, true);
const infoDisplay = createModalConditionally(this.props.DisplayInfo, <InfoDetails />, true);
const newReleasesDisplay = createModalConditionally(showNewReleases, <NewReleases />);
const rebootDisplay = createModalConditionally(this.props.RebootRequired, <Reboot />);
const selectAppPlatformDisplay = createModalConditionally(
this.props.DisplaySelectAppPlatform,
<SelectAppPlatform />
@@ -294,10 +265,7 @@ class App extends IPCContainer {
rowSpan={'17'}
key={'md_' + key++}
dxStyle={{ padding: 'var(--default_spacing)' }}>
<ReleaseVersionDisplay
downloadDisabled={!downloadEnabled}
version={selectedVersion}
/>
<ReleaseVersionDisplay downloadDisabled={!downloadEnabled} version={selectedVersion} />
</Box>
);
if (allowMount) {
@@ -349,8 +317,7 @@ class App extends IPCContainer {
<UpgradeIcon
available={
!missingDependencies &&
(this.props.UpgradeAvailable ||
this.props.NewReleasesAvailable2.length > 0)
(this.props.UpgradeAvailable || this.props.NewReleasesAvailable2.length > 0)
}
newReleases={
!missingDependencies &&
@@ -428,16 +395,12 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return {
displaySelectAppPlatform: (display) =>
dispatch(displaySelectAppPlatform(display)),
displaySelectAppPlatform: (display) => dispatch(displaySelectAppPlatform(display)),
loadReleases: () => dispatch(loadReleases()),
notifyError: (msg, critical, callback) =>
dispatch(notifyError(msg, critical, callback)),
notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)),
saveState: () => dispatch(saveState()),
setDismissNewReleasesAvailable: (dismiss) =>
dispatch(setDismissNewReleasesAvailable(dismiss)),
setNewReleasesAvailable: (items) =>
dispatch(setNewReleasesAvailable(items)),
setDismissNewReleasesAvailable: (dismiss) => dispatch(setDismissNewReleasesAvailable(dismiss)),
setNewReleasesAvailable: (items) => dispatch(setNewReleasesAvailable(items)),
setDismissUIUpgrade: (dismiss) => dispatch(setDismissUIUpgrade(dismiss)),
};
};

View File

@@ -7,22 +7,13 @@ import PropTypes from 'prop-types';
const ApplicationBusy = ({ title }) => {
return (
<Box dxStyle={{ padding: 'var(--default_spacing)' }}>
<Text
text={title || 'Please Wait...'}
textAlign={'center'}
type={'Heading1'}
/>
<Text text={title || 'Please Wait...'} textAlign={'center'} type={'Heading1'} />
<div
style={{
paddingLeft: 'calc(50% - 16px)',
paddingTop: 'var(--default_spacing)',
}}>
<Loader
color={'var(--heading_text_color)'}
height={32}
width={32}
type="TailSpin"
/>
<Loader color={'var(--heading_text_color)'} height={32} width={32} type="TailSpin" />
</div>
</Box>
);

View File

@@ -18,10 +18,8 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return {
downloadItem: (name, type, url, isWinFSP) =>
dispatch(downloadItem(name, type, url, isWinFSP)),
setDismissDependencies: (dismiss) =>
dispatch(setDismissDependencies(dismiss)),
downloadItem: (name, type, url, isWinFSP) => dispatch(downloadItem(name, type, url, isWinFSP)),
setDismissDependencies: (dismiss) => dispatch(setDismissDependencies(dismiss)),
};
};

View File

@@ -7,8 +7,7 @@ import './ErrorDetails.css';
const mapStateToProps = (state) => {
return {
ErrorMessage:
state.error.ErrorStack.length > 0 ? state.error.ErrorStack[0] : '',
ErrorMessage: state.error.ErrorStack.length > 0 ? state.error.ErrorStack[0] : '',
};
};

View File

@@ -8,8 +8,7 @@ import { promptLocationAndSaveFile } from '../../utils';
const mapStateToProps = (state) => {
return {
InfoMessage:
state.error.InfoStack.length > 0 ? state.error.InfoStack[0] : '',
InfoMessage: state.error.InfoStack.length > 0 ? state.error.InfoStack[0] : '',
};
};
@@ -75,9 +74,7 @@ export default connect(
clicked={() => {
if (
promptLocationAndSaveFile(
props.InfoMessage.fileName +
'.' +
props.InfoMessage.extension,
props.InfoMessage.fileName + '.' + props.InfoMessage.extension,
msg,
props.notifyError
)

View File

@@ -2,10 +2,7 @@ import React from 'react';
import { connect } from 'react-redux';
import * as Constants from '../../../constants';
import Button from '../../UI/Button/Button';
import {
formatLinesForDisplay,
getChangesForRepertoryVersion,
} from '../../../utils.jsx';
import { formatLinesForDisplay, getChangesForRepertoryVersion } from '../../../utils.jsx';
import { notifyError, notifyInfo } from '../../../redux/actions/error_actions';
import { setActiveRelease } from '../../../redux/actions/release_version_actions';
import { unmountAll } from '../../../redux/actions/mount_actions';
@@ -19,8 +16,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return {
setActiveRelease: (release, version) =>
dispatch(setActiveRelease(release, version)),
setActiveRelease: (release, version) => dispatch(setActiveRelease(release, version)),
notifyError: (msg) => dispatch(notifyError(msg)),
notifyInfo: (title, msg) => dispatch(notifyInfo(title, msg)),
unmountAll: (completedCallback) => dispatch(unmountAll(completedCallback)),
@@ -42,21 +38,17 @@ export default connect(
setActiveRelease,
unmountAll,
}) => {
const title =
'[' + Constants.RELEASE_TYPES[release.Release] + '] ' + release.Display;
const title = '[' + Constants.RELEASE_TYPES[release.Release] + '] ' + release.Display;
const displayChanges = async () => {
try {
const lines = await getChangesForRepertoryVersion(
release.VersionString
);
const lines = await getChangesForRepertoryVersion(release.VersionString);
notifyInfo(title, formatLinesForDisplay(lines));
} catch (e) {
notifyError(e);
}
};
const isActiveRelease =
release.Release === ActiveRelease && release.Version === ActiveVersion;
const isActiveRelease = release.Release === ActiveRelease && release.Version === ActiveVersion;
const setReleaseAndVersion = () => {
dismiss();
unmountAll(() => {
@@ -72,9 +64,7 @@ export default connect(
<tr style={{ height: '4px' }} />
<tr>
<td width="50%">
<Button
buttonStyles={{ width: '100%' }}
clicked={displayChanges}>
<Button buttonStyles={{ width: '100%' }} clicked={displayChanges}>
Changes
</Button>
</td>
@@ -83,17 +73,13 @@ export default connect(
</td>
<td width="50%">
{!isActiveRelease ? (
<Button
buttonStyles={{ width: '100%' }}
clicked={setReleaseAndVersion}>
<Button buttonStyles={{ width: '100%' }} clicked={setReleaseAndVersion}>
Activate
</Button>
) : null}
</td>
</tr>
{lastItem ? null : (
<tr style={{ height: 'var(--default_spacing)' }} />
)}
{lastItem ? null : <tr style={{ height: 'var(--default_spacing)' }} />}
</tbody>
</table>
</div>

View File

@@ -14,8 +14,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return {
dismissNewReleasesAvailable: () =>
dispatch(setDismissNewReleasesAvailable(true)),
dismissNewReleasesAvailable: () => dispatch(setDismissNewReleasesAvailable(true)),
};
};

View File

@@ -30,10 +30,8 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return {
downloadItem: (name, type, urls) =>
dispatch(downloadItem(name, type, urls)),
setActiveRelease: (release, version) =>
dispatch(setActiveRelease(release, version)),
downloadItem: (name, type, urls) => dispatch(downloadItem(name, type, urls)),
setActiveRelease: (release, version) => dispatch(setActiveRelease(release, version)),
};
};
@@ -44,9 +42,7 @@ export default connect(
const getSelectedVersion = () => {
return props.ReleaseVersion === -1
? 'unavailable'
: props.VersionLookup[Constants.RELEASE_TYPES[props.Release]][
props.ReleaseVersion
];
: props.VersionLookup[Constants.RELEASE_TYPES[props.Release]][props.ReleaseVersion];
};
const handleDownloadRelease = () => {
@@ -60,15 +56,14 @@ export default connect(
const handleReleaseChanged = (e) => {
const release = Constants.RELEASE_TYPES.indexOf(e.target.value);
const releaseVersion =
props.VersionLookup[Constants.RELEASE_TYPES[release]].length - 1;
const releaseVersion = props.VersionLookup[Constants.RELEASE_TYPES[release]].length - 1;
props.setActiveRelease(release, releaseVersion);
};
const handleVersionChanged = (e) => {
const releaseVersion = props.VersionLookup[
Constants.RELEASE_TYPES[props.Release]
].indexOf(e.target.value);
const releaseVersion = props.VersionLookup[Constants.RELEASE_TYPES[props.Release]].indexOf(
e.target.value
);
props.setActiveRelease(props.Release, releaseVersion);
};
@@ -78,8 +73,7 @@ export default connect(
props.InstallActive ||
props.MountsBusy ||
(!props.AllowMount && getSelectedVersion() !== 'unavailable');
const releaseExtracting =
props.InstallType === Constants.INSTALL_TYPES.Release;
const releaseExtracting = props.InstallType === Constants.INSTALL_TYPES.Release;
let optionsDisplay = [];
let key = 0;
@@ -185,11 +179,7 @@ export default connect(
items={props.VersionLookup[Constants.RELEASE_TYPES[props.Release]]}
row={5}
rowSpan={7}
selected={
props.VersionLookup[Constants.RELEASE_TYPES[props.Release]][
props.ReleaseVersion
]
}
selected={props.VersionLookup[Constants.RELEASE_TYPES[props.Release]][props.ReleaseVersion]}
/>
{optionsDisplay}
</Grid>

View File

@@ -17,10 +17,7 @@ const Box = (props) => {
}
return (
<div
onClick={props.clicked}
className={styleList.join(' ')}
style={{ ...props.dxStyle }}>
<div onClick={props.clicked} className={styleList.join(' ')} style={{ ...props.dxStyle }}>
{props.children}
</div>
);

View File

@@ -13,11 +13,7 @@ const DropDown = (props) => {
return (
<div className={'DropDown'}>
<select
className={
'DropDownSelect' +
(props.auto ? ' Auto ' : '') +
(props.alt ? ' Alt ' : '')
}
className={'DropDownSelect' + (props.auto ? ' Auto ' : '') + (props.alt ? ' Alt ' : '')}
autoFocus={props.autoFocus}
disabled={props.disabled}
onChange={props.changed}

View File

@@ -98,24 +98,11 @@ export default class Grid extends Component {
colSpan = colSpan(dimensions.columns - col, dimensions.columns);
}
rowSpan = rowSpan
? rowSpan === 'remain'
? dimensions.rows - row
: rowSpan
: null;
colSpan = colSpan
? colSpan === 'remain'
? dimensions.columns - col
: colSpan
: null;
rowSpan = rowSpan ? (rowSpan === 'remain' ? dimensions.rows - row : rowSpan) : null;
colSpan = colSpan ? (colSpan === 'remain' ? dimensions.columns - col : colSpan) : null;
return (
<GridComponent
row={row}
col={col}
rowSpan={rowSpan}
colSpan={colSpan}
key={'gc_' + i}>
<GridComponent row={row} col={col} rowSpan={rowSpan} colSpan={colSpan} key={'gc_' + i}>
{child}
</GridComponent>
);

View File

@@ -6,12 +6,7 @@ const Loading = () => {
return (
<div className={'Loading'}>
<div className={'LoadingContent'}>
<Loader
color={'var(--heading_text_color)'}
height={28}
width={28}
type="ThreeDots"
/>
<Loader color={'var(--heading_text_color)'} height={28} width={28} type="ThreeDots" />
</div>
</div>
);

View File

@@ -17,8 +17,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return {
downloadItem: (name, type, urls) =>
dispatch(downloadItem(name, type, urls)),
downloadItem: (name, type, urls) => dispatch(downloadItem(name, type, urls)),
setDismissUIUpgrade: (dismiss) => dispatch(setDismissUIUpgrade(dismiss)),
};
};
@@ -34,19 +33,13 @@ export default connect(
: props.Platform === 'darwin'
? 'upgrade.dmg'
: 'repertory-ui_' + props.UpgradeVersion + '_linux_x86_64.AppImage';
props.downloadItem(
name,
Constants.INSTALL_TYPES.Upgrade,
props.UpgradeData.urls
);
props.downloadItem(name, Constants.INSTALL_TYPES.Upgrade, props.UpgradeData.urls);
};
return (
<Box dxStyle={{ width: '180px', height: 'auto', padding: '5px' }}>
<div style={{ width: '100%', height: 'auto' }}>
<h1 style={{ width: '100%', textAlign: 'center' }}>
UI Upgrade Available
</h1>
<h1 style={{ width: '100%', textAlign: 'center' }}>UI Upgrade Available</h1>
</div>
<table cellSpacing={5} width="100%">
<tbody>

View File

@@ -35,9 +35,7 @@ export default connect(
<tbody>
<tr>
<td width="50%">
<Button
buttonStyles={{ width: '100%' }}
clicked={() => props.hideConfirmYesNo(true)}>
<Button buttonStyles={{ width: '100%' }} clicked={() => props.hideConfirmYesNo(true)}>
Yes
</Button>
</td>

View File

@@ -33,18 +33,12 @@ exports.REPERTORY_BRANCH = _REPERTORY_BRANCH;
exports.REPERTORY_UI_BRANCH = _REPERTORY_UI_BRANCH;
exports.RELEASES_URL =
'https://bitbucket.org/blockstorage/repertory/raw/' +
_REPERTORY_BRANCH +
'/releases_1.3.json';
'https://bitbucket.org/blockstorage/repertory/raw/' + _REPERTORY_BRANCH + '/releases_1.3.json';
exports.UI_RELEASES_URL =
'https://bitbucket.org/blockstorage/repertory-ui/raw/' +
_REPERTORY_UI_BRANCH +
'/releases.json';
'https://bitbucket.org/blockstorage/repertory-ui/raw/' + _REPERTORY_UI_BRANCH + '/releases.json';
exports.LINUX_DETECT_SCRIPT_URL =
'https://bitbucket.org/blockstorage/repertory/raw/' +
_REPERTORY_BRANCH +
'/detect_linux2.sh';
'https://bitbucket.org/blockstorage/repertory/raw/' + _REPERTORY_BRANCH + '/detect_linux2.sh';
exports.LINUX_SELECTABLE_PLATFORMS = ['centos7'];

View File

@@ -5,10 +5,7 @@ import DropDown from '../../components/UI/DropDown/DropDown';
import PropTypes from 'prop-types';
import Text from '../../components/UI/Text/Text';
import { Component } from 'react';
import {
addEditHost,
completeAddEditHost,
} from '../../redux/actions/host_actions';
import { addEditHost, completeAddEditHost } from '../../redux/actions/host_actions';
import { connect } from 'react-redux';
import { createDismissDisplay } from '../../utils.jsx';
import { notifyError } from '../../redux/actions/error_actions';
@@ -77,9 +74,7 @@ class AddEditHost extends Component {
</div>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<input
onChange={(e) =>
this.setState({ HostNameOrIp: e.target.value.trim() })
}
onChange={(e) => this.setState({ HostNameOrIp: e.target.value.trim() })}
className={'ConfigurationItemInput'}
style={{ width: '100%' }}
type={'text'}
@@ -103,9 +98,7 @@ class AddEditHost extends Component {
<div style={{ width: 'var(--default_spacing)' }} />
<div style={{ width: 'var(--default_spacing)' }} />
<input
onChange={(e) =>
this.setState({ ApiPort: parseInt(e.target.value) })
}
onChange={(e) => this.setState({ ApiPort: parseInt(e.target.value) })}
className={'ConfigurationItemInput'}
style={{ width: '100%' }}
type={'number'}
@@ -116,9 +109,7 @@ class AddEditHost extends Component {
<div style={{ width: 'var(--default_spacing)' }} />
<div style={{ width: 'var(--default_spacing)' }} />
<input
onChange={(e) =>
this.setState({ TimeoutMs: parseInt(e.target.value) })
}
onChange={(e) => this.setState({ TimeoutMs: parseInt(e.target.value) })}
className={'ConfigurationItemInput'}
style={{ width: '100%' }}
type={'number'}
@@ -129,17 +120,9 @@ class AddEditHost extends Component {
</div>
<div style={{ height: 'var(--default_spacing)' }} />
<div style={{ display: 'flex', flexDirection: 'row' }}>
<Text
text={'Agent String (optional)'}
textAlign={'left'}
type={'Heading2'}
/>
<Text text={'Agent String (optional)'} textAlign={'left'} type={'Heading2'} />
<div style={{ width: 'var(--default_spacing)' }} />
<Text
text={'API Key (optional)'}
textAlign={'left'}
type={'Heading2'}
/>
<Text text={'API Key (optional)'} textAlign={'left'} type={'Heading2'} />
</div>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<input
@@ -160,11 +143,7 @@ class AddEditHost extends Component {
</div>
<div style={{ height: 'var(--default_spacing)' }} />
<div style={{ display: 'flex', flexDirection: 'row' }}>
<Text
text={'Authentication URL (premium)'}
textAlign={'left'}
type={'Heading2'}
/>
<Text text={'Authentication URL (premium)'} textAlign={'left'} type={'Heading2'} />
</div>
<div style={{ display: 'flex', flexDirection: 'column' }}>
<input
@@ -176,17 +155,9 @@ class AddEditHost extends Component {
</div>
<div style={{ height: 'var(--default_spacing)' }} />
<div style={{ display: 'flex', flexDirection: 'row' }}>
<Text
text={'User Name (premium)'}
textAlign={'left'}
type={'Heading2'}
/>
<Text text={'User Name (premium)'} textAlign={'left'} type={'Heading2'} />
<div style={{ width: 'var(--default_spacing)' }} />
<Text
text={'Password (premium)'}
textAlign={'left'}
type={'Heading2'}
/>
<Text text={'Password (premium)'} textAlign={'left'} type={'Heading2'} />
</div>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<input
@@ -235,8 +206,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return {
Close: () => dispatch(addEditHost(false)),
completeAddEditHost: (host_data) =>
dispatch(completeAddEditHost(true, host_data)),
completeAddEditHost: (host_data) => dispatch(completeAddEditHost(true, host_data)),
notifyError: (msg) => dispatch(notifyError(msg)),
};
};

View File

@@ -24,8 +24,7 @@ const mapDispatchToProps = (dispatch) => {
dispatch(addRemoteMount(hostNameOrIp, port, token)),
addS3Mount: (name, accessKey, secretKey, region, bucketName, url) =>
dispatch(addS3Mount(name, accessKey, secretKey, region, bucketName, url)),
notifyError: (msg, critical, callback) =>
dispatch(notifyError(msg, critical, callback)),
notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)),
};
};
@@ -56,8 +55,7 @@ export default connect(
if (this.state.HostNameOrIp.length === 0) {
this.props.notifyError('Hostname or IP cannot be empty.');
} else {
const provider =
'Remote' + this.state.HostNameOrIp + ':' + this.state.Port;
const provider = 'Remote' + this.state.HostNameOrIp + ':' + this.state.Port;
if (this.props.RemoteMounts.includes(provider)) {
this.props.notifyError('Remote host already exists');
} else {
@@ -66,11 +64,7 @@ export default connect(
DisplayRemote: false,
},
() => {
this.props.addRemoteMount(
this.state.HostNameOrIp,
this.state.Port,
this.state.Token
);
this.props.addRemoteMount(this.state.HostNameOrIp, this.state.Port, this.state.Token);
this.setState({
...default_state,
});
@@ -147,9 +141,7 @@ export default connect(
</h1>
<Text text={'Hostname or IP'} textAlign={'left'} type={'Heading2'} />
<input
onChange={(e) =>
this.setState({ HostNameOrIp: e.target.value.trim() })
}
onChange={(e) => this.setState({ HostNameOrIp: e.target.value.trim() })}
className={'ConfigurationItemInput'}
type={'text'}
value={this.state.HostNameOrIp}
@@ -174,9 +166,7 @@ export default connect(
/>
<div style={{ paddingTop: 'var(--default_spacing)' }} />
<div style={{ display: 'flex', flexDirection: 'row' }}>
<Button
buttonStyles={{ width: '100%' }}
clicked={() => this.addRemoteMount()}>
<Button buttonStyles={{ width: '100%' }} clicked={() => this.addRemoteMount()}>
OK
</Button>
<div style={{ paddingLeft: 'var(--default_spacing)' }} />
@@ -227,11 +217,7 @@ export default connect(
</div>
<div style={{ paddingTop: 'var(--default_spacing)' }} />
<div style={{ display: 'flex', flexDirection: 'row' }}>
<Text
text={'Bucket Name (optional)'}
textAlign={'left'}
type={'Heading2'}
/>
<Text text={'Bucket Name (optional)'} textAlign={'left'} type={'Heading2'} />
<div style={{ paddingLeft: 'var(--default_spacing)' }} />
<Text text={'Region'} textAlign={'left'} type={'Heading2'} />
</div>
@@ -275,9 +261,7 @@ export default connect(
<div style={{ paddingTop: 'calc(var(--default_spacing) * 2)' }} />
<div style={{ display: 'flex', flexDirection: 'row' }}>
<div style={{ width: '200%' }} />
<Button
buttonStyles={{ width: '100%' }}
clicked={() => this.addS3Mount()}>
<Button buttonStyles={{ width: '100%' }} clicked={() => this.addS3Mount()}>
OK
</Button>
<div style={{ paddingLeft: 'var(--default_spacing)' }} />
@@ -296,9 +280,7 @@ export default connect(
{displayAddS3}
<div className={'AddMountButtons'}>
{this.props.remoteSupported ? (
<Button
className={'AddMountButton'}
clicked={this.handleAddRemoteMount}>
<Button className={'AddMountButton'} clicked={this.handleAddRemoteMount}>
Add Remote Mount
</Button>
) : null}
@@ -306,9 +288,7 @@ export default connect(
<div style={{ paddingRight: 'var(--default_spacing)' }} />
) : null}
{this.props.s3Supported ? (
<Button
className={'AddMountButton'}
clicked={this.handleAddS3Mount}>
<Button className={'AddMountButton'} clicked={this.handleAddS3Mount}>
Add S3 Mount
</Button>
) : null}

View File

@@ -74,9 +74,7 @@ class Configuration extends IPCContainer {
const changedObjectItems = [];
let j = 0;
for (const item of this.state.ObjectLookup[key]) {
if (
this.checkItemChanged(this.state.OriginalObjectLookup[key][j++], item)
) {
if (this.checkItemChanged(this.state.OriginalObjectLookup[key][j++], item)) {
changedObjectItems.push(item);
}
}
@@ -101,18 +99,9 @@ class Configuration extends IPCContainer {
componentDidMount() {
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.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, {
Provider: this.props.DisplayConfiguration,
Remote: this.props.DisplayRemoteConfiguration,
@@ -138,8 +127,7 @@ class Configuration extends IPCContainer {
type: template[key] ? template[key].type : null,
value:
template[key] &&
(template[key].type === 'string_array' ||
template[key].type === 'object')
(template[key].type === 'string_array' || template[key].type === 'object')
? config[key]
: template[key] && template[key].type === 'host_list'
? config[key]
@@ -198,19 +186,13 @@ class Configuration extends IPCContainer {
let objectLookup = {};
for (const obj of list.ObjectList) {
const list2 = this.createItemList(
obj.value,
this.state.Template[obj.label].template
);
const list2 = this.createItemList(obj.value, this.state.Template[obj.label].template);
objectLookup[obj.label] = list2.ItemList;
}
const isRemoteMount =
this.props.remoteSupported &&
JSON.parse(
objectLookup['RemoteMount'].find((s) => s.label === 'IsRemoteMount')
.value
);
JSON.parse(objectLookup['RemoteMount'].find((s) => s.label === 'IsRemoteMount').value);
if (isRemoteMount) {
for (const obj of list.ObjectList) {
if (obj.hide_remote) {
@@ -316,14 +298,10 @@ class Configuration extends IPCContainer {
this.props.remoteSupported &&
item.label !== 'IsRemoteMount'
) {
const isRemoteMount = JSON.parse(
itemList.find((s) => s.label === 'IsRemoteMount').value
);
const isRemoteMount = JSON.parse(itemList.find((s) => s.label === 'IsRemoteMount').value);
const enableRemoteMount =
!isRemoteMount &&
JSON.parse(itemList.find((s) => s.label === 'EnableRemoteMount').value);
return item.label === 'RemoteHostNameOrIp' ||
item.label === 'RemoteMaxConnections'
!isRemoteMount && JSON.parse(itemList.find((s) => s.label === 'EnableRemoteMount').value);
return item.label === 'RemoteHostNameOrIp' || item.label === 'RemoteMaxConnections'
? isRemoteMount
: item.label === 'RemoteReceiveTimeoutSeconds' ||
item.label === 'RemoteSendTimeoutSeconds' ||
@@ -343,23 +321,17 @@ class Configuration extends IPCContainer {
confirmSave = (
<Modal>
<Box dxStyle={{ width: '40vw', padding: 'var(--default_spacing)' }}>
<h1 style={{ width: '100%', textAlign: 'center' }}>
Save Changes?
</h1>
<h1 style={{ width: '100%', textAlign: 'center' }}>Save Changes?</h1>
<table width="100%">
<tbody>
<tr>
<td align="center" width="50%">
<Button
clicked={this.saveAndClose}
disabled={this.state.Saving}>
<Button clicked={this.saveAndClose} disabled={this.state.Saving}>
Yes
</Button>
</td>
<td align="center" width="50%">
<Button
clicked={this.props.hideConfiguration}
disabled={this.state.Saving}>
<Button clicked={this.props.hideConfiguration} disabled={this.state.Saving}>
No
</Button>
</td>
@@ -401,8 +373,7 @@ class Configuration extends IPCContainer {
label={k.label}
readOnly={
this.state.IsRemoteMount &&
(k.label === 'RemoteHostNameOrIp' ||
k.label === 'RemotePort')
(k.label === 'RemoteHostNameOrIp' || k.label === 'RemotePort')
}
template={this.state.Template[key].template[k.label]}
value={k.value}
@@ -485,8 +456,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return {
displayPinnedManager: (display) => dispatch(displayPinnedManager(display)),
notifyError: (msg, critical, callback) =>
dispatch(notifyError(msg, critical, callback)),
notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)),
hideConfiguration: () => dispatch(displayConfiguration(null, false)),
};
};

View File

@@ -26,9 +26,7 @@ export default connect(
if (target.type === 'checkbox') {
target.value = e.target.checked ? 'true' : 'false';
} else if (target.type === 'textarea') {
e.target.string_array = String(e.target.value)
.replace(/\r\n/g, '\n')
.split('\n');
e.target.string_array = String(e.target.value).replace(/\r\n/g, '\n').split('\n');
}
props.changed(target);
};

View File

@@ -11,20 +11,21 @@ import { faTrashAlt, faEdit } from '@fortawesome/free-solid-svg-icons';
//
const mapDispatchToProps = (dispatch) => {
return {
addEditHost: (host_data, cb) => dispatch(addEditHost(true, host_data, cb)),
addEditHost: (host_list, host_data, cb) =>
dispatch(addEditHost(true, host_list, host_data, cb)),
};
};
const Host = ({ allowDelete, addEditHost, value, onChange, onDelete }) => {
const Host = ({ allowDelete, addEditHost, host_list, host_data, onChange, onDelete }) => {
const handleEditHost = () => {
addEditHost(value, (changed, host_data) => {
addEditHost(host_list, host_data, (changed, host_data) => {
if (changed) {
onChange(host_data);
}
});
};
const premium = value.AuthURL && value.AuthUser;
const premium = host_data.AuthURL && host_data.AuthUser;
return (
<div style={{ display: 'flex', flexDirection: 'row' }}>
<div
@@ -51,20 +52,20 @@ const Host = ({ allowDelete, addEditHost, value, onChange, onDelete }) => {
<p>
<b>
{'(premium) ' +
value.HostNameOrIp +
((value.Protocol === 'http' && value.ApiPort === 80) ||
(value.Protocol === 'https' && value.ApiPort === 443)
host_data.HostNameOrIp +
((host_data.Protocol === 'http' && host_data.ApiPort === 80) ||
(host_data.Protocol === 'https' && host_data.ApiPort === 443)
? ''
: ':' + value.ApiPort)}
: ':' + host_data.ApiPort)}
</b>
</p>
) : (
<p>
{value.HostNameOrIp +
((value.Protocol === 'http' && value.ApiPort === 80) ||
(value.Protocol === 'https' && value.ApiPort === 443)
{host_data.HostNameOrIp +
((host_data.Protocol === 'http' && host_data.ApiPort === 80) ||
(host_data.Protocol === 'https' && host_data.ApiPort === 443)
? ''
: ':' + value.ApiPort)}
: ':' + host_data.ApiPort)}
</p>
)}
</div>
@@ -76,7 +77,8 @@ Host.propTypes = {
addEditHost: PropTypes.func.isRequired,
onChange: PropTypes.func.isRequired,
onDelete: PropTypes.func.isRequired,
value: PropTypes.object.isRequired,
host_data: PropTypes.object.isRequired,
host_list: PropTypes.array.isRequired,
};
export default connect(null, mapDispatchToProps)(Host);

View File

@@ -28,7 +28,7 @@ class HostList extends Component {
};
handleAddHost = () => {
this.props.addEditHost((changed, host_data) => {
this.props.addEditHost(this.state.items, (changed, host_data) => {
if (changed) {
const items = [...this.state.items, host_data];
this.updateItems(items);
@@ -86,7 +86,8 @@ class HostList extends Component {
onChange={(host_data) => this.handleChanged(host_data, index)}
onDelete={() => this.handleDeleted(index)}
allowDelete={this.state.items.length > 1}
value={v}
host_data={v}
host_list={this.state.items}
/>
);
})}
@@ -107,7 +108,7 @@ class HostList extends Component {
const mapDispatchToProps = (dispatch) => {
return {
addEditHost: (cb) => dispatch(addEditHost(true, null, cb)),
addEditHost: (list, cb) => dispatch(addEditHost(true, list, null, cb)),
ConfirmRemoveHost: (title, cb) => dispatch(confirmYesNo(title, cb)),
};
};

View File

@@ -13,10 +13,7 @@ import {
removeMount,
setProviderState,
} from '../../../redux/actions/mount_actions';
import {
displaySkynetExport,
displaySkynetImport,
} from '../../../redux/actions/skynet_actions';
import { displaySkynetExport, displaySkynetImport } from '../../../redux/actions/skynet_actions';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faTrashAlt } from '@fortawesome/free-solid-svg-icons';
import CheckBox from '../../../components/UI/CheckBox/CheckBox';
@@ -36,8 +33,7 @@ const mapDispatchToProps = (dispatch) => {
displaySkynetExport: (display) => dispatch(displaySkynetExport(display)),
displaySkynetImport: (display) => dispatch(displaySkynetImport(display)),
removeMount: (provider) => dispatch(removeMount(provider)),
setProviderState: (provider, state) =>
dispatch(setProviderState(provider, state)),
setProviderState: (provider, state) => dispatch(setProviderState(provider, state)),
};
};
@@ -70,12 +66,7 @@ export default connect(
height={'16px'}
onClick={
props.MState.AllowMount
? () =>
props.displayConfiguration(
props.provider,
props.remote,
props.s3
)
? () => props.displayConfiguration(props.provider, props.remote, props.s3)
: (e) => {
e.preventDefault();
}
@@ -108,11 +99,7 @@ export default connect(
inputControls = [];
let key = 0;
inputControls.push(
<RootElem
colSpan={inputColumnSpan - 8}
key={'i' + key++}
row={secondRow}
rowSpan={7}>
<RootElem colSpan={inputColumnSpan - 8} key={'i' + key++} row={secondRow} rowSpan={7}>
<input
disabled={!props.MState.AllowMount || props.MState.Mounted}
maxLength={4096}
@@ -126,9 +113,7 @@ export default connect(
);
inputControls.push(
<Button
clicked={() =>
props.browseClicked(props.provider, props.PState.MountLocation)
}
clicked={() => props.browseClicked(props.provider, props.PState.MountLocation)}
col={inputColumnSpan - 7}
colSpan={7}
disabled={props.MState.Mounted || !props.MState.AllowMount}
@@ -147,12 +132,7 @@ export default connect(
'Mount'
)
) : (
<Loader
color={'var(--heading_text_color)'}
height={19}
type="Circles"
width={19}
/>
<Loader color={'var(--heading_text_color)'} height={19} type="Circles" width={19} />
);
const actionsDisplay = (
@@ -176,11 +156,7 @@ export default connect(
);
const autoMountControl = (
<RootElem
col={inputColumnSpan + 24}
colSpan={28}
row={secondRow}
rowSpan={7}>
<RootElem col={inputColumnSpan + 24} colSpan={28} row={secondRow} rowSpan={7}>
<CheckBox
changed={handleAutoMountChanged}
checked={props.PState.AutoMount}
@@ -190,11 +166,7 @@ export default connect(
);
const autoRestartControl = (
<RootElem
col={inputColumnSpan + 24 + 28}
colSpan={24}
row={secondRow}
rowSpan={7}>
<RootElem col={inputColumnSpan + 24 + 28} colSpan={24} row={secondRow} rowSpan={7}>
<CheckBox
changed={handleAutoRestartChanged}
checked={props.PState.AutoRestart}
@@ -215,9 +187,7 @@ export default connect(
}
};
removeControl = (
<RootElem
col={(dimensions) => dimensions.columns - 6}
row={secondRow + 3}>
<RootElem col={(dimensions) => dimensions.columns - 6} row={secondRow + 3}>
<a href={'#'} onClick={handleRemoveMount} style={removeStyle}>
<FontAwesomeIcon icon={faTrashAlt} />
</a>

View File

@@ -59,18 +59,9 @@ class MountItems extends IPCContainer {
};
componentDidMount() {
this.setRequestHandler(
Constants.IPC_Detect_Mount_Reply,
this.onDetectMountReply
);
this.setRequestHandler(
Constants.IPC_Mount_Drive_Reply,
this.onMountDriveReply
);
this.setRequestHandler(
Constants.IPC_Unmount_Drive_Reply,
this.onUnmountDriveReply
);
this.setRequestHandler(Constants.IPC_Detect_Mount_Reply, this.onDetectMountReply);
this.setRequestHandler(Constants.IPC_Mount_Drive_Reply, this.onMountDriveReply);
this.setRequestHandler(Constants.IPC_Unmount_Drive_Reply, this.onUnmountDriveReply);
this.props.resetMountsState();
this.detectMounts();
}
@@ -136,13 +127,7 @@ class MountItems extends IPCContainer {
const retrySeconds = retryItems[provider].RetrySeconds - 1;
if (retrySeconds === 0) {
this.cancelRetryMount(provider, () => {
this.handleMountUnMount(
provider,
remote,
s3,
true,
mountLocation
);
this.handleMountUnMount(provider, remote, s3, true, mountLocation);
});
} else {
retryItems[provider].RetrySeconds = retrySeconds;
@@ -192,12 +177,9 @@ class MountItems extends IPCContainer {
if (result.Success) {
if (result.Valid) {
if (this.props.Platform !== 'win32') {
result = this.sendSyncRequest(
Constants.IPC_Check_Mount_Location,
{
Location: location,
}
);
result = this.sendSyncRequest(Constants.IPC_Check_Mount_Location, {
Location: location,
});
if (!result.Success) {
allowAction = false;
this.props.notifyError(result.Error.toString());
@@ -225,11 +207,7 @@ class MountItems extends IPCContainer {
remote,
s3,
location,
'Incompatible ' +
provider +
' daemon. Please upgrade ' +
provider +
'.'
'Incompatible ' + provider + ' daemon. Please upgrade ' + provider + '.'
);
} else {
this.displayRetryMount(
@@ -319,8 +297,7 @@ class MountItems extends IPCContainer {
if (!this.state.RetryItems[provider]) {
if (
arg.data.Success &&
(!arg.data.Active ||
(arg.data.Location && arg.data.Location.length > 0))
(!arg.data.Active || (arg.data.Location && arg.data.Location.length > 0))
) {
const mountState = {
AllowMount: true,
@@ -358,11 +335,7 @@ class MountItems extends IPCContainer {
arg.data.Location &&
this.props.ProviderState[arg.data.Provider].AutoRestart
) {
this.displayRetryMount(
arg.data.Provider,
arg.data.Remote,
arg.data.Location
);
this.displayRetryMount(arg.data.Provider, arg.data.Remote, arg.data.Location);
} else {
this.detectMount(arg.data.Provider);
}
@@ -374,9 +347,7 @@ class MountItems extends IPCContainer {
if (idx > -1) {
this.activeDetections.splice(idx, 1);
}
this.props.setMountsBusy(
this.activeDetections.length > 0 || this.hasActiveMount()
);
this.props.setMountsBusy(this.activeDetections.length > 0 || this.hasActiveMount());
};
updateMountLocation = (provider, location, mounted, driveLetters) => {
@@ -384,8 +355,7 @@ class MountItems extends IPCContainer {
if (location.length === 0) {
location =
this.props.Platform === 'win32'
? !providerState.MountLocation ||
providerState.MountLocation.trim().length === 0
? !providerState.MountLocation || providerState.MountLocation.trim().length === 0
? driveLetters[0]
: providerState.MountLocation
: providerState.MountLocation;
@@ -420,19 +390,14 @@ class MountItems extends IPCContainer {
if (this.state.RetryItems.hasOwnProperty(provider)) {
if (this.state.RetryItems[provider].RetryMessage) {
retryList.push(
<p key={'rl_' + retryList.length}>
{this.state.RetryItems[provider].RetryMessage}
</p>
<p key={'rl_' + retryList.length}>{this.state.RetryItems[provider].RetryMessage}</p>
);
}
retryList.push(
<Button
clicked={() =>
this.cancelRetryMount(provider, () => this.detectMounts())
}
clicked={() => this.cancelRetryMount(provider, () => this.detectMounts())}
key={'rl_' + retryList.length}>
Cancel {provider} Remount (
{this.state.RetryItems[provider].RetrySeconds}s)
Cancel {provider} Remount ({this.state.RetryItems[provider].RetrySeconds}s)
</Button>
);
if (++retryCount < Object.keys(this.state.RetryItems).length) {
@@ -448,9 +413,7 @@ class MountItems extends IPCContainer {
retryDisplay = (
<Modal>
<Box
dxDark
dxStyle={{ padding: 'var(--default_spacing)', minWidth: '70vw' }}>
<Box dxDark dxStyle={{ padding: 'var(--default_spacing)', minWidth: '70vw' }}>
<h1
style={{
textAlign: 'center',
@@ -475,9 +438,7 @@ class MountItems extends IPCContainer {
/>
);
} else {
footerItems.push(
<div key={'hi_' + footerItems.length} style={{ height: '27px' }} />
);
footerItems.push(<div key={'hi_' + footerItems.length} style={{ height: '27px' }} />);
}
let mountItems = [];
@@ -495,9 +456,7 @@ class MountItems extends IPCContainer {
<MountItem
allowRemove={remote || s3}
browseClicked={this.handleBrowseLocation}
changed={(e) =>
this.handleMountLocationChanged(provider, e.target.value)
}
changed={(e) => this.handleMountLocationChanged(provider, e.target.value)}
clicked={this.handleMountUnMount}
key={'it_' + mountItems.length}
provider={provider}
@@ -528,9 +487,7 @@ class MountItems extends IPCContainer {
{retryDisplay}
<div
className={
this.props.remoteSupported || this.props.s3Supported
? 'MountItemsRemote'
: 'MountItems'
this.props.remoteSupported || this.props.s3Supported ? 'MountItemsRemote' : 'MountItems'
}>
{mountItems}
</div>
@@ -556,19 +513,15 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
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: (provider, processed) =>
dispatch(setAutoMountProcessed(provider, processed)),
setMounted: (provider, mounted) => dispatch(setMounted(provider, mounted)),
setMountsBusy: (busy) => dispatch(setBusy(busy)),
setMountState: (provider, state) =>
dispatch(setMountState(provider, state)),
setProviderState: (provider, state) =>
dispatch(setProviderState(provider, state)),
setMountState: (provider, state) => dispatch(setMountState(provider, state)),
setProviderState: (provider, state) => dispatch(setProviderState(provider, state)),
};
};

View File

@@ -24,8 +24,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return {
displayPinnedManager: (display) => dispatch(displayPinnedManager(display)),
notifyApplicationBusy: (busy) =>
dispatch(notifyApplicationBusy(busy, true)),
notifyApplicationBusy: (busy) => dispatch(notifyApplicationBusy(busy, true)),
notifyError: (msg, cb) => dispatch(notifyError(msg, false, cb)),
notifyInfo: (title, msg) => dispatch(notifyInfo(title, msg)),
};
@@ -68,15 +67,11 @@ export default connect(
if (data.Success) {
const items = data.Items.filter(
(i) =>
i.path !== '.' &&
(this.state.active_directory !== '/' || i.path.substr(0, 1) !== '.')
i.path !== '.' && (this.state.active_directory !== '/' || i.path.substr(0, 1) !== '.')
).map((i) => {
return {
...i,
name:
i.path === '..'
? i.path
: i.path.substr(i.path.lastIndexOf('/') + 1),
name: i.path === '..' ? i.path : i.path.substr(i.path.lastIndexOf('/') + 1),
meta: {
...i.meta,
pinned: i.meta.pinned === '1',
@@ -143,8 +138,7 @@ export default connect(
checked={pinned}
changed={() => {
const items = JSON.parse(JSON.stringify(this.state.items));
const pinned = (items[item_idx].meta.pinned = !items[item_idx]
.meta.pinned);
const pinned = (items[item_idx].meta.pinned = !items[item_idx].meta.pinned);
this.setState(
{
items,
@@ -187,9 +181,7 @@ export default connect(
X
</a>
</div>
<h1 style={{ width: '100%', textAlign: 'center' }}>
{'Pinned File Manager'}
</h1>
<h1 style={{ width: '100%', textAlign: 'center' }}>{'Pinned File Manager'}</h1>
<div className={'PinnedManagerActiveDirectory'}>
<b>&nbsp;{this.state.active_directory}</b>
</div>
@@ -198,13 +190,7 @@ export default connect(
<div className={'PinnedManagerItems'}>
{this.state.items.map((i, k) => {
return i.directory
? this.createDirectory(
i.name,
i.path,
idx++,
this.state.items.length,
k
)
? this.createDirectory(i.name, i.path, idx++, this.state.items.length, k)
: this.createFile(
i.name,
i.path,

View File

@@ -5,10 +5,7 @@ import { connect } from 'react-redux';
import * as Constants from '../../constants';
import Box from '../../components/UI/Box/Box';
import Button from '../../components/UI/Button/Button';
import {
downloadItem,
setAllowDownload,
} from '../../redux/actions/download_actions';
import { downloadItem, setAllowDownload } from '../../redux/actions/download_actions';
import DropDown from '../../components/UI/DropDown/DropDown';
import IPCContainer from '../IPCContainer/IPCContainer';
import { notifyError } from '../../redux/actions/error_actions';
@@ -52,9 +49,7 @@ class SelectAppPlatform extends IPCContainer {
handleTestClicked = () => {
this.props.setInstallTestActive(true);
this.props.setAllowDownload(true);
this.grabLatestRelease(
Constants.LINUX_SELECTABLE_PLATFORMS[this.state.Selected]
);
this.grabLatestRelease(Constants.LINUX_SELECTABLE_PLATFORMS[this.state.Selected]);
};
handleChanged = (e) => {
@@ -70,8 +65,8 @@ class SelectAppPlatform extends IPCContainer {
<h1 className={'SAPHeading'}>Select Linux Platform</h1>
<div className={'SAPContent'}>
<p>
Repertory was unable to detect your Linux distribution. Please
select one of the following and click <b>Test</b> to continue:
Repertory was unable to detect your Linux distribution. Please select one of the
following and click <b>Test</b> to continue:
</p>
</div>
<div className={'SAPActions'}>
@@ -81,9 +76,7 @@ class SelectAppPlatform extends IPCContainer {
items={Constants.LINUX_SELECTABLE_PLATFORMS}
selected={Constants.LINUX_SELECTABLE_PLATFORMS[this.state.Selected]}
/>
<Button
clicked={this.handleTestClicked}
disabled={this.props.InstallTestActive}>
<Button clicked={this.handleTestClicked} disabled={this.props.InstallTestActive}>
Test
</Button>
</div>
@@ -101,9 +94,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return {
downloadItem: (name, type, urls, isWinFSP, testVersion, appPlatform) =>
dispatch(
downloadItem(name, type, urls, isWinFSP, testVersion, appPlatform)
),
dispatch(downloadItem(name, type, urls, isWinFSP, testVersion, appPlatform)),
notifyError: (msg) => dispatch(notifyError(msg)),
setAllowDownload: (allow) => dispatch(setAllowDownload(allow)),
setInstallTestActive: (active) => dispatch(setInstallTestActive(active)),

View File

@@ -33,11 +33,9 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return {
displaySkynetExport: (display) => dispatch(displaySkynetExport(display)),
notifyApplicationBusy: (busy) =>
dispatch(notifyApplicationBusy(busy, true)),
notifyApplicationBusy: (busy) => dispatch(notifyApplicationBusy(busy, true)),
notifyError: (msg) => dispatch(notifyError(msg)),
notifyInfo: (title, msg) =>
dispatch(notifyInfo(title, msg, true, 'skynet_export', 'json')),
notifyInfo: (title, msg) => dispatch(notifyInfo(title, msg, true, 'skynet_export', 'json')),
};
};
@@ -55,14 +53,8 @@ export default connect(
};
componentDidMount() {
this.setRequestHandler(
Constants.IPC_Grab_Skynet_Tree_Reply,
this.onGrabSkynetTreeReply
);
this.setRequestHandler(
Constants.IPC_Export_Skylinks_Reply,
this.onExportSkylinksReply
);
this.setRequestHandler(Constants.IPC_Grab_Skynet_Tree_Reply, this.onGrabSkynetTreeReply);
this.setRequestHandler(Constants.IPC_Export_Skylinks_Reply, this.onExportSkylinksReply);
this.sendRequest(Constants.IPC_Grab_Skynet_Tree, {
Version: this.props.version,
});
@@ -86,12 +78,7 @@ export default connect(
const treeItem = {
label: item.name,
path: item.path,
value:
item.name === '/'
? 0
: item.path
? item.path
: JSON.stringify(item),
value: item.name === '/' ? 0 : item.path ? item.path : JSON.stringify(item),
};
if (item.directory) {
@@ -136,8 +123,7 @@ export default connect(
() => {
this.props.notifyInfo(
'Skylink Exports',
'!alternate!!copyable!' +
JSON.stringify(arg.data.Result.success, null, 2)
'!alternate!!copyable!' + JSON.stringify(arg.data.Result.success, null, 2)
);
this.sendRequest(Constants.IPC_Grab_Skynet_Tree, {
Version: this.props.version,
@@ -200,10 +186,7 @@ export default connect(
<h1 className={'SkynetExportHeading'}>
{this.state.second_stage ? 'Verify Exports' : 'Export Files'}
</h1>
<div
className={
this.state.second_stage ? 'SkynetExportList' : 'SkynetExportTree'
}>
<div className={this.state.second_stage ? 'SkynetExportList' : 'SkynetExportTree'}>
{this.state.second_stage ? (
this.state.checked.map((path) => {
return (
@@ -235,11 +218,7 @@ export default connect(
/>
),
uncheck: (
<FontAwesomeIcon
icon={faSquare}
fixedWidth
style={{ padding: 0, margin: 0 }}
/>
<FontAwesomeIcon icon={faSquare} fixedWidth style={{ padding: 0, margin: 0 }} />
),
halfCheck: (
<FontAwesomeIcon

View File

@@ -18,11 +18,7 @@ const ImportList = ({ imports_array }) => {
text={'Skylink'}
style={{ minWidth: '33.33%', maxWidth: '33.33%' }}
/>
<Text
type={'Heading1'}
text={'Token'}
style={{ minWidth: '33.33%', maxWidth: '33.33%' }}
/>
<Text type={'Heading1'} text={'Token'} style={{ minWidth: '33.33%', maxWidth: '33.33%' }} />
</div>
<hr />
<div className={'ImportListOwner'}>

View File

@@ -21,8 +21,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return {
displaySkynetImport: (display) => dispatch(displaySkynetImport(display)),
notifyApplicationBusy: (busy) =>
dispatch(notifyApplicationBusy(busy, true)),
notifyApplicationBusy: (busy) => dispatch(notifyApplicationBusy(busy, true)),
notifyError: (msg) => dispatch(notifyError(msg)),
notifyInfo: (title, msg) => dispatch(notifyInfo(title, msg)),
};
@@ -40,10 +39,7 @@ export default connect(
};
componentDidMount() {
this.setRequestHandler(
Constants.IPC_Import_Skylinks_Reply,
this.onImportSkylinksReply
);
this.setRequestHandler(Constants.IPC_Import_Skylinks_Reply, this.onImportSkylinksReply);
}
componentWillUnmount() {
@@ -119,9 +115,7 @@ export default connect(
part = part.trim();
const pair = part.split('=');
if (pair.length !== 2) {
throw new Error(
'Invalid syntax for import: directory="",skylink="",token=""'
);
throw new Error('Invalid syntax for import: directory="",skylink="",token=""');
}
importItem = {
...importItem,
@@ -129,9 +123,7 @@ export default connect(
};
}
if (!importItem.skylink) {
throw new Error(
'Invalid syntax for import: directory="",skylink="",token=""'
);
throw new Error('Invalid syntax for import: directory="",skylink="",token=""');
}
importsArray.push(importItem);
} else if (item.length > 0) {
@@ -165,22 +157,15 @@ export default connect(
this.setState(
{
import_text:
failedImportsArray.length > 0
? JSON.stringify(failedImportsArray, null, 2)
: '',
failedImportsArray.length > 0 ? JSON.stringify(failedImportsArray, null, 2) : '',
imports_array: [],
second_stage: false,
},
() => {
if (failedImportsArray.length > 0) {
this.props.notifyError(
`Failed to import ${failedImportsArray.length} item(s)`
);
this.props.notifyError(`Failed to import ${failedImportsArray.length} item(s)`);
} else {
this.props.notifyInfo(
'Import Result',
`Successfully imported ${count} item(s)`
);
this.props.notifyInfo('Import Result', `Successfully imported ${count} item(s)`);
}
}
);

View File

@@ -48,10 +48,7 @@ export default class Password extends Component {
this.props.changed(this.state.password);
this.setState({
...this.state,
button_text:
this.state.password && this.state.password.length > 0
? 'clear'
: 'set',
button_text: this.state.password && this.state.password.length > 0 ? 'clear' : 'set',
password2: '',
});
} else {
@@ -119,10 +116,7 @@ export default class Password extends Component {
return (
<div className={'PasswordOwner'} style={{ ...this.props.style }}>
{this.props.readOnly ? null : (
<a
href={'#'}
className={'PasswordLink'}
onClick={this.handleActionClick}>
<a href={'#'} className={'PasswordLink'} onClick={this.handleActionClick}>
<u>{this.state.button_text}</u>
</a>
)}
@@ -134,20 +128,10 @@ export default class Password extends Component {
onChange={this.handlePasswordChanged}
onKeyUp={this.handlePasswordKeyUp}
type={this.state.show_password ? 'text' : 'password'}
value={
this.state.button_text === 'confirm'
? this.state.password2
: this.state.password
}
value={this.state.button_text === 'confirm' ? this.state.password2 : this.state.password}
/>
<a
href={'#'}
className={'PasswordShowHide'}
onClick={this.handleShowHideClick}>
<FontAwesomeIcon
icon={this.state.show_password ? faEye : faEyeSlash}
fixedWidth
/>
<a href={'#'} className={'PasswordShowHide'} onClick={this.handleShowHideClick}>
<FontAwesomeIcon icon={this.state.show_password ? faEye : faEyeSlash} fixedWidth />
</a>
</div>
);

View File

@@ -40,12 +40,7 @@ const _vcRuntimeExists = () => {
args2.push('REG_SZ');
_execProcessGetOutput(cmd, null, args2)
.then((lines) => {
const value = lines[2]
.trim()
.substr(args2[3].length)
.trim()
.substr(6)
.trim();
const value = lines[2].trim().substr(args2[3].length).trim().substr(6).trim();
if (
value.includes(
IS_64BIT
@@ -84,20 +79,14 @@ const _createTreeNodes = (fileList) => {
let tree = {};
const directorySort = (a, b) => {
return !!a.directory === !!b.directory
? a.name.localeCompare(b.name)
: a.directory
? -1
: 1;
return !!a.directory === !!b.directory ? a.name.localeCompare(b.name) : a.directory ? -1 : 1;
};
const addNode = (obj) => {
let fullPath;
const idx = obj.skylink.indexOf('/');
if (idx > -1) {
fullPath = path
.join(obj.directory, obj.skylink.substr(idx + 1))
.replace(/\\/g, '/');
fullPath = path.join(obj.directory, obj.skylink.substr(idx + 1)).replace(/\\/g, '/');
} else {
fullPath = path.join(obj.directory, obj.filename).replace(/\\/g, '/');
}
@@ -403,8 +392,7 @@ module.exports.detectRepertoryMounts = (version, providerList) => {
provider,
!Constants.PROVIDER_LIST.includes(provider) &&
provider.toLowerCase().startsWith('remote'),
!Constants.PROVIDER_LIST.includes(provider) &&
provider.toLowerCase().startsWith('s3')
!Constants.PROVIDER_LIST.includes(provider) && provider.toLowerCase().startsWith('s3')
);
args.push('-status');
@@ -420,12 +408,10 @@ module.exports.detectRepertoryMounts = (version, providerList) => {
});
process.on('exit', () => {
mountState[provider] =
_tryParse(result, defaultData)[provider] || defaultData;
mountState[provider] = _tryParse(result, defaultData)[provider] || defaultData;
if (
mountState[provider].Active &&
(mountState[provider].Location === 'elevating' ||
mountState[provider].Location === '')
(mountState[provider].Location === 'elevating' || mountState[provider].Location === '')
) {
setTimeout(() => {
grabStatus(index);
@@ -441,12 +427,7 @@ module.exports.detectRepertoryMounts = (version, providerList) => {
});
};
module.exports.downloadFile = (
url,
destination,
progressCallback,
completeCallback
) => {
module.exports.downloadFile = (url, destination, progressCallback, completeCallback) => {
try {
if (fs.existsSync(destination)) {
fs.unlinkSync(destination);
@@ -482,9 +463,7 @@ module.exports.downloadFile = (
if (downloaded === 0) {
completeCallback(new Error('Received 0 bytes'));
} else if (downloaded !== total) {
completeCallback(
new Error('Received incorrect number of bytes')
);
completeCallback(new Error('Received incorrect number of bytes'));
} else {
completeCallback();
}
@@ -536,9 +515,7 @@ module.exports.executeAsync = (command, args = []) => {
const launchProcess = (count, timeout) => {
let cmd = path.basename(command);
const working =
cmd.length === command.length
? null
: command.substr(0, command.length - cmd.length);
cmd.length === command.length ? null : command.substr(0, command.length - cmd.length);
let processOptions = {
detached: true,
shell: false,
@@ -626,14 +603,7 @@ module.exports.executeScript = (script) => {
});
};
module.exports.executeMount = (
version,
provider,
remote,
s3,
location,
exitCallback
) => {
module.exports.executeMount = (version, provider, remote, s3, location, exitCallback) => {
return new Promise((resolve) => {
const repertoryExec = _getRepertoryExec(version);
const processOptions = {
@@ -876,12 +846,7 @@ module.exports.getMissingDependencies = (dependencies) => {
} else {
for (const dep of dependencies) {
try {
if (
!(
fs.lstatSync(dep.file).isFile() ||
fs.lstatSync(dep.file).isSymbolicLink()
)
) {
if (!(fs.lstatSync(dep.file).isFile() || fs.lstatSync(dep.file).isSymbolicLink())) {
missing.push(dep);
}
} catch (e) {
@@ -1037,10 +1002,7 @@ module.exports.importSkylinks = (version, jsonArray) => {
};
// https://stackoverflow.com/questions/31645738/how-to-create-full-path-with-nodes-fs-mkdirsync
module.exports.mkDirByPathSync = (
targetDir,
{ isRelativeToScript = false } = {}
) => {
module.exports.mkDirByPathSync = (targetDir, { isRelativeToScript = false } = {}) => {
const sep = path.sep;
const initDir = path.isAbsolute(targetDir) ? sep : '';
const baseDir = isRelativeToScript ? __dirname : '.';
@@ -1099,20 +1061,11 @@ module.exports.performWindowsUninstall = (names) => {
args2.push('REG_SZ');
_execProcessGetOutput(cmd, null, args2)
.then((lines) => {
const value = lines[2]
.trim()
.substr(args2[3].length)
.trim()
.substr(6)
.trim();
const value = lines[2].trim().substr(args2[3].length).trim().substr(6).trim();
if (names.includes(value)) {
const items = line.split('\\');
const productCode = items[items.length - 1];
_executeProcess('msiexec.exe', null, [
'/x',
productCode,
'/norestart',
])
_executeProcess('msiexec.exe', null, ['/x', productCode, '/norestart'])
.then((code) => {
if (code === 0 || code === 3010 || code === 1641) {
resolve(true);
@@ -1150,14 +1103,7 @@ module.exports.removeDirectoryRecursively = _removeDirectoryRecursively;
module.exports.resolvePath = _resolvePath;
module.exports.setConfigValue = (
name,
value,
provider,
remote,
s3,
version
) => {
module.exports.setConfigValue = (name, value, provider, remote, s3, version) => {
return new Promise((resolve, reject) => {
const repertoryExec = _getRepertoryExec(version);
const processOptions = {
@@ -1290,15 +1236,7 @@ module.exports.verifySignature = (file, signatureFile, publicKeyFile) => {
const executeVerify = (openssl) => {
execFile(
openssl,
[
'dgst',
'-sha256',
'-verify',
publicKeyFile,
'-signature',
signatureFile,
file,
],
['dgst', '-sha256', '-verify', publicKeyFile, '-signature', signatureFile, file],
(err, stdout) => {
if (err) {
reject(err);

View File

@@ -31,10 +31,7 @@ test('create temp signature files', () => {
encoding: 'utf8',
})
.replace(/(\r\n|\n|\r)/gm, '');
const data = helpers.createSignatureFiles(
b64signature,
Constants.DEV_PUBLIC_KEY
);
const data = helpers.createSignatureFiles(b64signature, Constants.DEV_PUBLIC_KEY);
expect(data).toBeDefined();
expect(data.PublicKeyFile).toBeDefined();
expect(data.SignatureFile).toBeDefined();

View File

@@ -44,9 +44,7 @@ if (ipcRenderer) {
}
store.dispatch(setProviderState(provider, state));
}
store.dispatch(
setActiveRelease(result.data.Release, result.data.Version)
);
store.dispatch(setActiveRelease(result.data.Release, result.data.Version));
} else {
store = createAppStore(platformInfo, packageJson.version, {});
}

View File

@@ -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,

View File

@@ -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 } };
};

View File

@@ -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');

View File

@@ -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));
}
}
});
);
};
};

View File

@@ -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) => {

View File

@@ -1,10 +1,5 @@
import { createReducer } from '@reduxjs/toolkit';
import {
CLEAR_ERROR,
CLEAR_INFO,
SET_ERROR_INFO,
SET_INFO,
} from '../actions/error_actions';
import { CLEAR_ERROR, CLEAR_INFO, SET_ERROR_INFO, SET_INFO } from '../actions/error_actions';
export const errorReducer = createReducer(
{
@@ -16,8 +11,7 @@ export const errorReducer = createReducer(
},
{
[CLEAR_ERROR]: (state) => {
const errorStack =
state.ErrorStack.length > 0 ? state.ErrorStack.slice(1) : [];
const errorStack = state.ErrorStack.length > 0 ? state.ErrorStack.slice(1) : [];
return {
...state,
DisplayError: errorStack.length > 0,
@@ -25,8 +19,7 @@ export const errorReducer = createReducer(
};
},
[CLEAR_INFO]: (state) => {
const infoStack =
state.InfoStack.length > 0 ? state.InfoStack.slice(1) : [];
const infoStack = state.InfoStack.length > 0 ? state.InfoStack.slice(1) : [];
return {
...state,
DisplayInfo: infoStack.length > 0,

View File

@@ -140,9 +140,7 @@ export const createMountReducer = (state) => {
let autoMountProcessed = { ...state.AutoMountProcessed };
delete autoMountProcessed[action.payload];
const remoteMounts = state.RemoteMounts.filter(
(i) => i !== action.payload
);
const remoteMounts = state.RemoteMounts.filter((i) => i !== action.payload);
const s3Mounts = state.S3Mounts.filter((i) => i !== action.payload);
return {
...state,

View File

@@ -11,12 +11,7 @@ const addListeners = (ipcMain, { standardIPCReply }) => {
Config: data.Data,
});
} else {
standardIPCReply(
event,
Constants.IPC_Get_Config_Reply,
{},
data.Code
);
standardIPCReply(event, Constants.IPC_Get_Config_Reply, {}, data.Code);
}
})
.catch((error) => {
@@ -33,12 +28,7 @@ const addListeners = (ipcMain, { standardIPCReply }) => {
});
})
.catch((error) => {
standardIPCReply(
event,
Constants.IPC_Get_Config_Template_Reply,
{},
error
);
standardIPCReply(event, Constants.IPC_Get_Config_Template_Reply, {}, error);
});
});
@@ -58,12 +48,7 @@ const addListeners = (ipcMain, { standardIPCReply }) => {
setConfigValue(++i);
})
.catch((error) => {
standardIPCReply(
event,
Constants.IPC_Set_Config_Values_Reply,
{},
error
);
standardIPCReply(event, Constants.IPC_Set_Config_Values_Reply, {}, error);
});
} else {
standardIPCReply(event, Constants.IPC_Set_Config_Values_Reply, {});

View File

@@ -20,23 +20,20 @@ const addListeners = (ipcMain, { standardIPCReply }) => {
}
});
ipcMain.on(
Constants.IPC_Check_Dependency_Installed + '_sync',
(event, data) => {
try {
const ls = fs.lstatSync(data.File);
event.returnValue = {
data: {
Exists: ls.isFile() || ls.isSymbolicLink(),
},
};
} catch (e) {
event.returnValue = {
data: { Exists: false },
};
}
ipcMain.on(Constants.IPC_Check_Dependency_Installed + '_sync', (event, data) => {
try {
const ls = fs.lstatSync(data.File);
event.returnValue = {
data: {
Exists: ls.isFile() || ls.isSymbolicLink(),
},
};
} catch (e) {
event.returnValue = {
data: { Exists: false },
};
}
);
});
ipcMain.on(Constants.IPC_Install_Dependency, (event, data) => {
if (data.Source.toLowerCase().endsWith('.dmg')) {

View File

@@ -17,14 +17,7 @@ const clearManualMountDetection = (provider) => {
}
};
const monitorMount = (
sender,
provider,
providerList,
version,
pid,
location
) => {
const monitorMount = (sender, provider, providerList, version, pid, location) => {
manualMountDetection[provider] = setInterval(() => {
helpers
.detectRepertoryMounts(version, providerList)
@@ -62,12 +55,7 @@ const unmountAllDrives = () => {
// Unmount all items
for (const mountLocation of mountedLocations) {
const data = mountedData[mountLocation];
helpers.stopMountProcessSync(
data.Version,
data.Provider,
data.Remote,
data.S3
);
helpers.stopMountProcessSync(data.Version, data.Provider, data.Remote, data.S3);
}
mountedLocations = [];
@@ -79,10 +67,7 @@ const addListeners = (ipcMain, { setTrayImage, standardIPCReply }) => {
let response = { Success: true, Error: '' };
try {
if (
fs.existsSync(data.Location) &&
fs.statSync(data.Location).isDirectory()
) {
if (fs.existsSync(data.Location) && fs.statSync(data.Location).isDirectory()) {
if (fs.readdirSync(data.Location).length !== 0) {
response.Success = false;
response.Error = 'Directory not empty: ' + data.Location;
@@ -102,11 +87,7 @@ const addListeners = (ipcMain, { setTrayImage, standardIPCReply }) => {
const provider = data.Provider;
let driveLetters = {};
const providerList = [
...Constants.PROVIDER_LIST,
...data.RemoteMounts,
...data.S3Mounts,
];
const providerList = [...Constants.PROVIDER_LIST, ...data.RemoteMounts, ...data.S3Mounts];
for (const provider of providerList) {
driveLetters[provider] = [];
}
@@ -283,12 +264,7 @@ const addListeners = (ipcMain, { setTrayImage, standardIPCReply }) => {
data.Name = data.Name.replace(':', '_');
}
const dataDirectory = path.resolve(
path.join(
helpers.getDataDirectory(),
'..',
data.Remote ? 'remote' : 's3',
data.Name
)
path.join(helpers.getDataDirectory(), '..', data.Remote ? 'remote' : 's3', data.Name)
);
try {

View File

@@ -4,13 +4,7 @@ const helpers = require('../../helpers');
const addListeners = (ipcMain, { standardIPCReply }) => {
ipcMain.on(Constants.IPC_Get_Directory_Items, (event, data) => {
helpers
.grabDirectoryItems(
data.Path,
data.Version,
data.Provider,
data.Remote,
data.S3
)
.grabDirectoryItems(data.Path, data.Version, data.Provider, data.Remote, data.S3)
.then((data) => {
standardIPCReply(event, Constants.IPC_Get_Directory_Items_Reply, {
Items: data.items,
@@ -23,13 +17,7 @@ const addListeners = (ipcMain, { standardIPCReply }) => {
ipcMain.on(Constants.IPC_Get_Pinned_Files, (event, data) => {
helpers
.grabDirectoryItems(
data.Path,
data.Version,
data.Provider,
data.Remote,
data.S3
)
.grabDirectoryItems(data.Path, data.Version, data.Provider, data.Remote, data.S3)
.then((data) => {
standardIPCReply(event, Constants.IPC_Get_Directory_Items_Reply, {
Items: data.items,
@@ -44,14 +32,7 @@ const addListeners = (ipcMain, { standardIPCReply }) => {
ipcMain.on(Constants.IPC_Set_Pinned + '_sync', (event, data) => {
helpers
.setPinned(
data.Path,
data.Pinned,
data.Version,
data.Provider,
data.Remote,
data.S3
)
.setPinned(data.Path, data.Pinned, data.Version, data.Provider, data.Remote, data.S3)
.then((success) => {
event.returnValue = success;
})

View File

@@ -36,26 +36,21 @@ const addListeners = (ipcMain, { detectScript, saveUiSettings }) => {
.then((data) => {
let appPlatform = data.replace(/(\r\n|\n|\r)/gm, '');
if (appPlatform === 'unknown') {
helpers.downloadFile(
Constants.LINUX_DETECT_SCRIPT_URL,
scriptFile,
null,
(err) => {
if (err) {
sendResponse(appPlatform, platform);
} else {
helpers
.executeScript(scriptFile)
.then((data) => {
appPlatform = data.replace(/(\r\n|\n|\r)/gm, '');
sendResponse(appPlatform, platform);
})
.catch(() => {
sendResponse(appPlatform, platform);
});
}
helpers.downloadFile(Constants.LINUX_DETECT_SCRIPT_URL, scriptFile, null, (err) => {
if (err) {
sendResponse(appPlatform, platform);
} else {
helpers
.executeScript(scriptFile)
.then((data) => {
appPlatform = data.replace(/(\r\n|\n|\r)/gm, '');
sendResponse(appPlatform, platform);
})
.catch(() => {
sendResponse(appPlatform, platform);
});
}
);
});
} else {
sendResponse(appPlatform, platform);
}

View File

@@ -13,9 +13,7 @@ const addListeners = (ipcMain, { getCleanupReleases, standardIPCReply }) => {
.then((dependencies) => {
let exists = false;
try {
exists =
fs.existsSync(destination) &&
fs.lstatSync(destination).isDirectory();
exists = fs.existsSync(destination) && fs.lstatSync(destination).isDirectory();
} catch (e) {}
standardIPCReply(event, Constants.IPC_Check_Installed_Reply, {
Dependencies: dependencies,
@@ -70,9 +68,7 @@ const addListeners = (ipcMain, { getCleanupReleases, standardIPCReply }) => {
stream.close();
if (os.platform() !== 'win32') {
helpers
.executeAndWait(
'chmod +x "' + path.join(destination, 'repertory') + '"'
)
.executeAndWait('chmod +x "' + path.join(destination, 'repertory') + '"')
.then(() => {
standardIPCReply(event, Constants.IPC_Extract_Release_Complete, {
Source: data.Source,

View File

@@ -24,12 +24,7 @@ const addListeners = (ipcMain, { standardIPCReply }) => {
});
})
.catch((error) => {
standardIPCReply(
event,
Constants.IPC_Grab_Skynet_Tree_Reply,
{},
error
);
standardIPCReply(event, Constants.IPC_Grab_Skynet_Tree_Reply, {}, error);
});
});

View File

@@ -40,9 +40,7 @@ const addListeners = (ipcMain) => {
data.RemoteMounts = data.RemoteMounts || [];
data.S3Mounts = data.S3Mounts || [];
const remoteItems = getDirectories(
path.join(helpers.getRepertoryDirectory(), 'remote')
);
const remoteItems = getDirectories(path.join(helpers.getRepertoryDirectory(), 'remote'));
for (const dir of remoteItems) {
const name = 'Remote' + dir.replace('_', ':');
if (!data.RemoteMounts || data.RemoteMounts.indexOf(name) === -1) {
@@ -55,9 +53,7 @@ const addListeners = (ipcMain) => {
}
}
const s3Items = getDirectories(
path.join(helpers.getRepertoryDirectory(), 's3')
);
const s3Items = getDirectories(path.join(helpers.getRepertoryDirectory(), 's3'));
for (const dir of s3Items) {
const name = 'S3' + dir;
if (!data.S3Mounts || data.S3Mounts.indexOf(name) === -1) {

View File

@@ -3,10 +3,7 @@ const fs = require('fs');
const helpers = require('../../helpers');
const os = require('os');
const addListeners = (
ipcMain,
{ setIsInstalling, unmountAllDrives, standardIPCReply }
) => {
const addListeners = (ipcMain, { setIsInstalling, unmountAllDrives, standardIPCReply }) => {
ipcMain.on(Constants.IPC_Install_Upgrade, (event, data) => {
let allowSkipVerification = true;
@@ -46,10 +43,7 @@ const addListeners = (
//! (data.Sha256.length > 0);
if (hasSignature) {
try {
const files = helpers.createSignatureFiles(
data.Signature,
Constants.DEV_PUBLIC_KEY
);
const files = helpers.createSignatureFiles(data.Signature, Constants.DEV_PUBLIC_KEY);
tempPub = files.PublicKeyFile;
tempSig = files.SignatureFile;
} catch (e) {
@@ -99,9 +93,7 @@ const addListeners = (
executeInstall();
})
.catch(() => {
errorHandler(
Error('Failed to verify installation package signature')
);
errorHandler(Error('Failed to verify installation package signature'));
});
} else if (hasHash) {
helpers

View File

@@ -15,9 +15,7 @@ const isLocalhost = Boolean(
// [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' ||
// 127.0.0.1/8 is considered localhost for IPv4.
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)
);
export function register(config) {
@@ -120,9 +118,7 @@ function checkValidServiceWorker(swUrl, config) {
}
})
.catch(() => {
console.log(
'No internet connection found. App is running in offline mode.'
);
console.log('No internet connection found. App is running in offline mode.');
});
}

View File

@@ -100,9 +100,7 @@ export const getChangesForRepertoryVersion = (version) => {
return (
!ended &&
l.length > 0 &&
(found
? !(ended = l.startsWith('## '))
: (found = l.startsWith(`## ${version}`)))
(found ? !(ended = l.startsWith('## ')) : (found = l.startsWith(`## ${version}`)))
);
});
resolve(lines);
@@ -120,11 +118,7 @@ export const getIPCRenderer = () => {
return ipcRenderer;
};
export const getNewReleases = (
existingLocations,
newLocations,
selectedVersion
) => {
export const getNewReleases = (existingLocations, newLocations, selectedVersion) => {
const ret = [];
if (existingLocations && newLocations) {
Constants.RELEASE_TYPES.forEach((release) => {