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

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