#48: Support pinning files to cache [partial]
This commit is contained in:
13
src/App.js
13
src/App.js
@@ -36,6 +36,7 @@ import {createModalConditionally} from './utils';
|
||||
import SkynetImport from './containers/SkynetImport/SkynetImport';
|
||||
import ApplicationBusy from './components/ApplicationBusy/ApplicationBusy';
|
||||
import SkynetExport from './containers/SkynetExport/SkynetExport';
|
||||
import PinnedManager from './containers/PinnedManager/PinnedManager';
|
||||
|
||||
const Constants = require('./constants');
|
||||
const Scheduler = require('node-schedule');
|
||||
@@ -118,13 +119,18 @@ class App extends IPCContainer {
|
||||
const scPrimeSupported = this.props.LocationsLookup[selectedVersion] &&
|
||||
this.props.LocationsLookup[selectedVersion].siaprime_support;
|
||||
|
||||
const siaSupported = Constants.RELEASES_URL.endsWith('releases_1.1.json') || (this.props.LocationsLookup[selectedVersion] &&
|
||||
this.props.LocationsLookup[selectedVersion].sia_support);
|
||||
const siaSupported = this.props.LocationsLookup[selectedVersion] &&
|
||||
this.props.LocationsLookup[selectedVersion].sia_support;
|
||||
|
||||
const showConfig = !missingDependencies &&
|
||||
!this.props.DisplayPinnedManager &&
|
||||
this.props.DisplayConfiguration &&
|
||||
!this.props.RebootRequired;
|
||||
|
||||
const showPinnedManager = !missingDependencies &&
|
||||
!this.props.RebootRequired &&
|
||||
this.props.DisplayPinnedManager;
|
||||
|
||||
const showUpgrade = this.props.UpgradeAvailable &&
|
||||
!this.props.DisplayError &&
|
||||
!showConfig &&
|
||||
@@ -175,6 +181,7 @@ class App extends IPCContainer {
|
||||
version={selectedVersion}
|
||||
s3Supported={s3Supported}
|
||||
remoteSupported={remoteSupported}/>);
|
||||
const pinnedManagerDisplay = createModalConditionally(showPinnedManager, <PinnedManager/>)
|
||||
const confirmDisplay = createModalConditionally(this.props.DisplayConfirmYesNo, <YesNo/>);
|
||||
const dependencyDisplay = createModalConditionally(showDependencies,
|
||||
<DependencyList/>, false, this.props.InstallActive);
|
||||
@@ -266,6 +273,7 @@ class App extends IPCContainer {
|
||||
{selectAppPlatformDisplay}
|
||||
{dependencyDisplay}
|
||||
{upgradeDisplay}
|
||||
{pinnedManagerDisplay}
|
||||
{configDisplay}
|
||||
{infoDisplay}
|
||||
{confirmDisplay}
|
||||
@@ -293,6 +301,7 @@ const mapStateToProps = state => {
|
||||
DisplayExport: state.skynet.DisplayExport,
|
||||
DisplayImport: state.skynet.DisplayImport,
|
||||
DisplayInfo: state.error.DisplayInfo,
|
||||
DisplayPinnedManager: state.pinned.DisplayPinnedManager,
|
||||
DisplaySelectAppPlatform: state.common.DisplaySelectAppPlatform,
|
||||
DismissNewReleasesAvailable: state.relver.DismissNewReleasesAvailable,
|
||||
DownloadActive: state.download.DownloadActive,
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
"EventLevel": "Internally, events are fired during certain operations. This setting determines which events should be logged to repertory.log. Valid values are Error, Warn, Normal, Debug, and Verbose.",
|
||||
"EvictionDelaySeconds": "Number of seconds to wait after all file handles are closed before allowing file to be evicted from cache.",
|
||||
"EvictionDelayMinutes": "Number of minutes to wait after all file handles are closed before allowing file to be evicted from cache.",
|
||||
"EvictionUsesAccessedTime": "Use oldest accessed time instead of oldest modified time when evicting files.",
|
||||
"MaxCacheSizeBytes": "This value specifies the maximum amount of local space to consume before files are removed from cache. EnableMaxCacheSize must also be set to true for this value to take affect.",
|
||||
"MaxUploadCount": "Maximum number of simultaneous uploads.",
|
||||
"MinimumRedundancy": "Files are elected for removal once this value has been reached. Be aware that this value cannot be set to less than 1.5x.",
|
||||
|
||||
@@ -3,4 +3,8 @@
|
||||
height: calc(100vh - (var(--default_spacing) * 4));
|
||||
padding: var(--default_spacing);
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.ConfigurationLink {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import Modal from '../../components/UI/Modal/Modal';
|
||||
import IPCContainer from '../IPCContainer/IPCContainer';
|
||||
import {displayConfiguration} from '../../redux/actions/mount_actions';
|
||||
import {notifyError} from '../../redux/actions/error_actions';
|
||||
import {displayPinnedManager} from '../../redux/actions/pinned_manager_actions';
|
||||
|
||||
const Constants = require('../../constants');
|
||||
|
||||
@@ -339,7 +340,14 @@ class Configuration extends IPCContainer {
|
||||
<div className={'Configuration'}>
|
||||
{confirmSave}
|
||||
<Box dxDark dxStyle={{padding: 'var(--default_spacing)'}}>
|
||||
<div style={{float: 'right', margin: 0, padding: 0, marginTop: '-4px', boxSizing: 'border-box', display: 'block'}}>
|
||||
<div style={{
|
||||
float: 'right',
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
marginTop: '-4px',
|
||||
boxSizing: 'border-box',
|
||||
display: 'block'
|
||||
}}>
|
||||
<a href={'#'}
|
||||
onClick={this.checkSaveRequired}
|
||||
style={{cursor: 'pointer'}}>X</a>
|
||||
@@ -347,7 +355,13 @@ class Configuration extends IPCContainer {
|
||||
<h1 style={{width: '100%', textAlign: 'center'}}>{(
|
||||
this.props.DisplayRemoteConfiguration ?
|
||||
this.props.DisplayConfiguration.substr(6) :
|
||||
this.props.DisplayConfiguration) + ' Configuration'}</h1>
|
||||
this.props.DisplayConfiguration) + ' Configuration '}<a href={'#'}
|
||||
className={'ConfigurationLink'}
|
||||
onClick={() => {
|
||||
this.props.displayPinnedManager(true);
|
||||
return false;
|
||||
}}><u>Pinned Files</u></a>
|
||||
</h1>
|
||||
<div style={{overflowY: 'auto', height: '90%'}}>
|
||||
{objectItems}
|
||||
{(configurationItems.length > 0) ? <h2>Settings</h2> : null}
|
||||
@@ -370,6 +384,7 @@ const mapStateToProps = state => {
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
displayPinnedManager: display => dispatch(displayPinnedManager(display)),
|
||||
notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)),
|
||||
hideConfiguration: () => dispatch(displayConfiguration(null, false)),
|
||||
}
|
||||
|
||||
0
src/containers/PinnedManager/PinnedManager.css
Normal file
0
src/containers/PinnedManager/PinnedManager.css
Normal file
67
src/containers/PinnedManager/PinnedManager.js
Normal file
67
src/containers/PinnedManager/PinnedManager.js
Normal file
@@ -0,0 +1,67 @@
|
||||
import React from 'react';
|
||||
import './PinnedManager.css';
|
||||
import {connect} from 'react-redux';
|
||||
import IPCContainer from '../IPCContainer/IPCContainer';
|
||||
import {notifyApplicationBusy} from '../../redux/actions/common_actions';
|
||||
import {notifyError, notifyInfo} from '../../redux/actions/error_actions';
|
||||
import Box from '../../components/UI/Box/Box';
|
||||
import {displayPinnedManager} from '../../redux/actions/pinned_manager_actions';
|
||||
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
|
||||
import {
|
||||
faCheckSquare, faChevronDown,
|
||||
faChevronRight, faFile, faFolder, faFolderOpen,
|
||||
faHSquare, faMinusSquare, faPlusSquare,
|
||||
faSquare
|
||||
} from '@fortawesome/free-solid-svg-icons';
|
||||
import Button from '../../components/UI/Button/Button';
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
displayPinnedManager: display => dispatch(displayPinnedManager(display)),
|
||||
notifyApplicationBusy: busy => dispatch(notifyApplicationBusy(busy, true)),
|
||||
notifyError: msg => dispatch(notifyError(msg)),
|
||||
notifyInfo: (title, msg) => dispatch(notifyInfo(title, msg)),
|
||||
}
|
||||
};
|
||||
|
||||
export default connect(null, mapDispatchToProps)(class extends IPCContainer {
|
||||
state = {
|
||||
active_directory: '/',
|
||||
items: [],
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
super.componentWillUnmount();
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Box dxDark dxStyle={{
|
||||
height: 'calc(100vh - (var(--default_spacing) * 4)',
|
||||
padding: 'var(--default_spacing)',
|
||||
width: 'calc(100vw - (var(--default_spacing) * 4)'
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
float: 'right',
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
marginTop: '-4px',
|
||||
boxSizing: 'border-box',
|
||||
display: 'block'
|
||||
}}>
|
||||
<a href={'#'}
|
||||
onClick={() => this.props.displayPinnedManager(false)}
|
||||
style={{cursor: 'pointer'}}>X</a>
|
||||
</div>
|
||||
<h1 style={{width: '100%', textAlign: 'center'}}>{'Pinned File Manager'}</h1>
|
||||
<div className={'PinnedManagerItems'}>
|
||||
|
||||
</div>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
});
|
||||
4
src/redux/actions/pinned_manager_actions.js
Normal file
4
src/redux/actions/pinned_manager_actions.js
Normal file
@@ -0,0 +1,4 @@
|
||||
import {createAction} from '@reduxjs/toolkit';
|
||||
|
||||
export const displayPinnedManager = createAction('pinned/displayPinnedManager');
|
||||
|
||||
13
src/redux/reducers/pinned_manager_reducer.js
Normal file
13
src/redux/reducers/pinned_manager_reducer.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import {createReducer} from '@reduxjs/toolkit';
|
||||
import {displayPinnedManager} from '../actions/pinned_manager_actions';
|
||||
|
||||
export const pinnedManagerReducer = createReducer({
|
||||
DisplayPinnedManager: false,
|
||||
}, {
|
||||
[displayPinnedManager]: (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
DisplayPinnedManager: action.payload,
|
||||
};
|
||||
},
|
||||
});
|
||||
@@ -6,6 +6,7 @@ import {installReducer} from '../reducers/install_reducer';
|
||||
import {createMountReducer} from '../reducers/mount_reducer';
|
||||
import {releaseVersionReducer} from '../reducers/release_version_reducer';
|
||||
import {skynetReducer} from '../reducers/skynet_reducer';
|
||||
import {pinnedManagerReducer} from '../reducers/pinned_manager_reducer'
|
||||
|
||||
export default function createAppStore(platformInfo, version, state) {
|
||||
const reducer = {
|
||||
@@ -16,6 +17,7 @@ export default function createAppStore(platformInfo, version, state) {
|
||||
mounts: createMountReducer(state),
|
||||
relver: releaseVersionReducer,
|
||||
skynet: skynetReducer,
|
||||
pinned: pinnedManagerReducer,
|
||||
};
|
||||
|
||||
const middleware = [...getDefaultMiddleware()];
|
||||
|
||||
Reference in New Issue
Block a user