#48: Support pinning files to cache [partial]

This commit is contained in:
2020-12-11 08:14:51 -06:00
parent 23faef33fe
commit d88b77b46a
9 changed files with 120 additions and 5 deletions

View File

@@ -36,6 +36,7 @@ import {createModalConditionally} from './utils';
import SkynetImport from './containers/SkynetImport/SkynetImport'; import SkynetImport from './containers/SkynetImport/SkynetImport';
import ApplicationBusy from './components/ApplicationBusy/ApplicationBusy'; import ApplicationBusy from './components/ApplicationBusy/ApplicationBusy';
import SkynetExport from './containers/SkynetExport/SkynetExport'; import SkynetExport from './containers/SkynetExport/SkynetExport';
import PinnedManager from './containers/PinnedManager/PinnedManager';
const Constants = require('./constants'); const Constants = require('./constants');
const Scheduler = require('node-schedule'); const Scheduler = require('node-schedule');
@@ -118,13 +119,18 @@ class App extends IPCContainer {
const scPrimeSupported = this.props.LocationsLookup[selectedVersion] && const scPrimeSupported = this.props.LocationsLookup[selectedVersion] &&
this.props.LocationsLookup[selectedVersion].siaprime_support; this.props.LocationsLookup[selectedVersion].siaprime_support;
const siaSupported = Constants.RELEASES_URL.endsWith('releases_1.1.json') || (this.props.LocationsLookup[selectedVersion] && const siaSupported = this.props.LocationsLookup[selectedVersion] &&
this.props.LocationsLookup[selectedVersion].sia_support); this.props.LocationsLookup[selectedVersion].sia_support;
const showConfig = !missingDependencies && const showConfig = !missingDependencies &&
!this.props.DisplayPinnedManager &&
this.props.DisplayConfiguration && this.props.DisplayConfiguration &&
!this.props.RebootRequired; !this.props.RebootRequired;
const showPinnedManager = !missingDependencies &&
!this.props.RebootRequired &&
this.props.DisplayPinnedManager;
const showUpgrade = this.props.UpgradeAvailable && const showUpgrade = this.props.UpgradeAvailable &&
!this.props.DisplayError && !this.props.DisplayError &&
!showConfig && !showConfig &&
@@ -175,6 +181,7 @@ class App extends IPCContainer {
version={selectedVersion} version={selectedVersion}
s3Supported={s3Supported} s3Supported={s3Supported}
remoteSupported={remoteSupported}/>); remoteSupported={remoteSupported}/>);
const pinnedManagerDisplay = createModalConditionally(showPinnedManager, <PinnedManager/>)
const confirmDisplay = createModalConditionally(this.props.DisplayConfirmYesNo, <YesNo/>); const confirmDisplay = createModalConditionally(this.props.DisplayConfirmYesNo, <YesNo/>);
const dependencyDisplay = createModalConditionally(showDependencies, const dependencyDisplay = createModalConditionally(showDependencies,
<DependencyList/>, false, this.props.InstallActive); <DependencyList/>, false, this.props.InstallActive);
@@ -266,6 +273,7 @@ class App extends IPCContainer {
{selectAppPlatformDisplay} {selectAppPlatformDisplay}
{dependencyDisplay} {dependencyDisplay}
{upgradeDisplay} {upgradeDisplay}
{pinnedManagerDisplay}
{configDisplay} {configDisplay}
{infoDisplay} {infoDisplay}
{confirmDisplay} {confirmDisplay}
@@ -293,6 +301,7 @@ const mapStateToProps = state => {
DisplayExport: state.skynet.DisplayExport, DisplayExport: state.skynet.DisplayExport,
DisplayImport: state.skynet.DisplayImport, DisplayImport: state.skynet.DisplayImport,
DisplayInfo: state.error.DisplayInfo, DisplayInfo: state.error.DisplayInfo,
DisplayPinnedManager: state.pinned.DisplayPinnedManager,
DisplaySelectAppPlatform: state.common.DisplaySelectAppPlatform, DisplaySelectAppPlatform: state.common.DisplaySelectAppPlatform,
DismissNewReleasesAvailable: state.relver.DismissNewReleasesAvailable, DismissNewReleasesAvailable: state.relver.DismissNewReleasesAvailable,
DownloadActive: state.download.DownloadActive, DownloadActive: state.download.DownloadActive,

View File

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

View File

@@ -3,4 +3,8 @@
height: calc(100vh - (var(--default_spacing) * 4)); height: calc(100vh - (var(--default_spacing) * 4));
padding: var(--default_spacing); padding: var(--default_spacing);
margin: 0; margin: 0;
} }
.ConfigurationLink {
cursor: pointer;
}

View File

@@ -8,6 +8,7 @@ import Modal from '../../components/UI/Modal/Modal';
import IPCContainer from '../IPCContainer/IPCContainer'; import IPCContainer from '../IPCContainer/IPCContainer';
import {displayConfiguration} from '../../redux/actions/mount_actions'; import {displayConfiguration} from '../../redux/actions/mount_actions';
import {notifyError} from '../../redux/actions/error_actions'; import {notifyError} from '../../redux/actions/error_actions';
import {displayPinnedManager} from '../../redux/actions/pinned_manager_actions';
const Constants = require('../../constants'); const Constants = require('../../constants');
@@ -339,7 +340,14 @@ class Configuration extends IPCContainer {
<div className={'Configuration'}> <div className={'Configuration'}>
{confirmSave} {confirmSave}
<Box dxDark dxStyle={{padding: 'var(--default_spacing)'}}> <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={'#'} <a href={'#'}
onClick={this.checkSaveRequired} onClick={this.checkSaveRequired}
style={{cursor: 'pointer'}}>X</a> style={{cursor: 'pointer'}}>X</a>
@@ -347,7 +355,13 @@ class Configuration extends IPCContainer {
<h1 style={{width: '100%', textAlign: 'center'}}>{( <h1 style={{width: '100%', textAlign: 'center'}}>{(
this.props.DisplayRemoteConfiguration ? this.props.DisplayRemoteConfiguration ?
this.props.DisplayConfiguration.substr(6) : 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%'}}> <div style={{overflowY: 'auto', height: '90%'}}>
{objectItems} {objectItems}
{(configurationItems.length > 0) ? <h2>Settings</h2> : null} {(configurationItems.length > 0) ? <h2>Settings</h2> : null}
@@ -370,6 +384,7 @@ const mapStateToProps = state => {
const mapDispatchToProps = dispatch => { const mapDispatchToProps = dispatch => {
return { 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)), hideConfiguration: () => dispatch(displayConfiguration(null, false)),
} }

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

View File

@@ -0,0 +1,4 @@
import {createAction} from '@reduxjs/toolkit';
export const displayPinnedManager = createAction('pinned/displayPinnedManager');

View 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,
};
},
});

View File

@@ -6,6 +6,7 @@ import {installReducer} from '../reducers/install_reducer';
import {createMountReducer} from '../reducers/mount_reducer'; import {createMountReducer} from '../reducers/mount_reducer';
import {releaseVersionReducer} from '../reducers/release_version_reducer'; import {releaseVersionReducer} from '../reducers/release_version_reducer';
import {skynetReducer} from '../reducers/skynet_reducer'; import {skynetReducer} from '../reducers/skynet_reducer';
import {pinnedManagerReducer} from '../reducers/pinned_manager_reducer'
export default function createAppStore(platformInfo, version, state) { export default function createAppStore(platformInfo, version, state) {
const reducer = { const reducer = {
@@ -16,6 +17,7 @@ export default function createAppStore(platformInfo, version, state) {
mounts: createMountReducer(state), mounts: createMountReducer(state),
relver: releaseVersionReducer, relver: releaseVersionReducer,
skynet: skynetReducer, skynet: skynetReducer,
pinned: pinnedManagerReducer,
}; };
const middleware = [...getDefaultMiddleware()]; const middleware = [...getDefaultMiddleware()];