Import/export skeleton
This commit is contained in:
16
src/App.js
16
src/App.js
@@ -33,6 +33,8 @@ import {
|
|||||||
} from './redux/actions/release_version_actions';
|
} from './redux/actions/release_version_actions';
|
||||||
import YesNo from './components/YesNo/YesNo';
|
import YesNo from './components/YesNo/YesNo';
|
||||||
import {createModalConditionally} from './utils';
|
import {createModalConditionally} from './utils';
|
||||||
|
import SkynetImport from './containers/SkynetImport/SkynetImport';
|
||||||
|
import {displaySkynetImport} from './redux/actions/skynet_actions';
|
||||||
|
|
||||||
const Constants = require('./constants');
|
const Constants = require('./constants');
|
||||||
const Scheduler = require('node-schedule');
|
const Scheduler = require('node-schedule');
|
||||||
@@ -138,6 +140,17 @@ class App extends IPCContainer {
|
|||||||
!this.props.DismissNewReleasesAvailable &&
|
!this.props.DismissNewReleasesAvailable &&
|
||||||
(this.props.NewReleasesAvailable.length > 0);
|
(this.props.NewReleasesAvailable.length > 0);
|
||||||
|
|
||||||
|
const showSkynetImport = !showConfig &&
|
||||||
|
!showDependencies &&
|
||||||
|
!this.props.DownloadActive &&
|
||||||
|
!this.props.DisplayError &&
|
||||||
|
!this.props.DisplayInfo &&
|
||||||
|
!showNewReleases &&
|
||||||
|
!this.props.RebootRequired &&
|
||||||
|
!this.props.DisplaySelectAppPlatform &&
|
||||||
|
!showUpgrade &&
|
||||||
|
this.props.DisplayImport;
|
||||||
|
|
||||||
const configDisplay = createModalConditionally(showConfig, <Configuration version={selectedVersion} remoteSupported={remoteSupported} />);
|
const configDisplay = createModalConditionally(showConfig, <Configuration version={selectedVersion} remoteSupported={remoteSupported} />);
|
||||||
const confirmDisplay = createModalConditionally(this.props.DisplayConfirmYesNo, <YesNo/>);
|
const confirmDisplay = createModalConditionally(this.props.DisplayConfirmYesNo, <YesNo/>);
|
||||||
const dependencyDisplay = createModalConditionally(showDependencies, <DependencyList/>, false, this.props.InstallActive);
|
const dependencyDisplay = createModalConditionally(showDependencies, <DependencyList/>, false, this.props.InstallActive);
|
||||||
@@ -148,6 +161,7 @@ class App extends IPCContainer {
|
|||||||
const rebootDisplay = createModalConditionally(this.props.RebootRequired, <Reboot />);
|
const rebootDisplay = createModalConditionally(this.props.RebootRequired, <Reboot />);
|
||||||
const selectAppPlatformDisplay = createModalConditionally(this.props.DisplaySelectAppPlatform, <SelectAppPlatform/>);
|
const selectAppPlatformDisplay = createModalConditionally(this.props.DisplaySelectAppPlatform, <SelectAppPlatform/>);
|
||||||
const upgradeDisplay = createModalConditionally(showUpgrade, <UpgradeUI/>);
|
const upgradeDisplay = createModalConditionally(showUpgrade, <UpgradeUI/>);
|
||||||
|
const importDisplay = createModalConditionally(showSkynetImport, <SkynetImport/>);
|
||||||
|
|
||||||
let mainContent = [];
|
let mainContent = [];
|
||||||
if (this.props.DisplaySelectAppPlatform || !this.props.AppReady) {
|
if (this.props.DisplaySelectAppPlatform || !this.props.AppReady) {
|
||||||
@@ -211,6 +225,7 @@ class App extends IPCContainer {
|
|||||||
{mainContent}
|
{mainContent}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{importDisplay}
|
||||||
{newReleasesDisplay}
|
{newReleasesDisplay}
|
||||||
{selectAppPlatformDisplay}
|
{selectAppPlatformDisplay}
|
||||||
{dependencyDisplay}
|
{dependencyDisplay}
|
||||||
@@ -236,6 +251,7 @@ const mapStateToProps = state => {
|
|||||||
DisplayConfiguration: state.mounts.DisplayConfiguration,
|
DisplayConfiguration: state.mounts.DisplayConfiguration,
|
||||||
DisplayConfirmYesNo: state.common.DisplayConfirmYesNo,
|
DisplayConfirmYesNo: state.common.DisplayConfirmYesNo,
|
||||||
DisplayError: state.error.DisplayError,
|
DisplayError: state.error.DisplayError,
|
||||||
|
DisplayImport: state.skynet.DisplayImport,
|
||||||
DisplayInfo: state.error.DisplayInfo,
|
DisplayInfo: state.error.DisplayInfo,
|
||||||
DisplaySelectAppPlatform: state.common.DisplaySelectAppPlatform,
|
DisplaySelectAppPlatform: state.common.DisplaySelectAppPlatform,
|
||||||
DismissNewReleasesAvailable: state.relver.DismissNewReleasesAvailable,
|
DismissNewReleasesAvailable: state.relver.DismissNewReleasesAvailable,
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(class extends Compon
|
|||||||
const displayAdd = createModalConditionally(this.state.Display, (
|
const displayAdd = createModalConditionally(this.state.Display, (
|
||||||
<Box dxDark
|
<Box dxDark
|
||||||
dxStyle={{width: 'auto', height: 'auto', padding: 'var(--default_spacing)'}}>
|
dxStyle={{width: 'auto', height: 'auto', padding: 'var(--default_spacing)'}}>
|
||||||
<h1 style={{color: 'var(--text_color_error)', textAlign: 'center', paddingBottom: 'var(--default_spacing)'}}>Add Remote Mount</h1>
|
<h1 style={{textAlign: 'center', paddingBottom: 'var(--default_spacing)'}}>Add Remote Mount</h1>
|
||||||
<Text text={'Hostname or IP'}
|
<Text text={'Hostname or IP'}
|
||||||
textAlign={'left'}
|
textAlign={'left'}
|
||||||
type={'Heading2'}/>
|
type={'Heading2'}/>
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = dispatch => {
|
||||||
return {
|
return {
|
||||||
displayConfiguration: (provider, remote) => dispatch(displayConfiguration(provider, remote)),
|
displayConfiguration: (provider, remote) => dispatch(displayConfiguration(provider, remote)),
|
||||||
displaySkynetExport: () => dispatch(displaySkynetExport()),
|
displaySkynetExport: display => dispatch(displaySkynetExport(display)),
|
||||||
displaySkynetImport: () => dispatch(displaySkynetImport()),
|
displaySkynetImport: display => dispatch(displaySkynetImport(display)),
|
||||||
removeRemoteMount: provider => dispatch(removeRemoteMount(provider)),
|
removeRemoteMount: provider => dispatch(removeRemoteMount(provider)),
|
||||||
setProviderState: (provider, state) => dispatch(setProviderState(provider, state)),
|
setProviderState: (provider, state) => dispatch(setProviderState(provider, state)),
|
||||||
}
|
}
|
||||||
@@ -185,7 +185,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => {
|
|||||||
{(props.provider === 'Skynet') ? (
|
{(props.provider === 'Skynet') ? (
|
||||||
<a href={'#'}
|
<a href={'#'}
|
||||||
col={configButton ? 24 : 18}
|
col={configButton ? 24 : 18}
|
||||||
onClick={props.MState.AllowMount ? () => props.displaySkynetExport() : e => {e.preventDefault();}}
|
onClick={props.MState.AllowMount ? () => props.displaySkynetExport(true) : e => {e.preventDefault();}}
|
||||||
rowSpan={5}
|
rowSpan={5}
|
||||||
style={{...pointer, fontWeight: 'normal'}}>
|
style={{...pointer, fontWeight: 'normal'}}>
|
||||||
<u>Export</u>
|
<u>Export</u>
|
||||||
@@ -194,7 +194,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => {
|
|||||||
{(props.provider === 'Skynet') ? (
|
{(props.provider === 'Skynet') ? (
|
||||||
<a href={'#'}
|
<a href={'#'}
|
||||||
col={configButton ? 24 + 13 : 18 + 13}
|
col={configButton ? 24 + 13 : 18 + 13}
|
||||||
onClick={props.MState.AllowMount ? () => props.displaySkynetImport() : e => {e.preventDefault();}}
|
onClick={props.MState.AllowMount ? () => props.displaySkynetImport(true) : e => {e.preventDefault();}}
|
||||||
rowSpan={5}
|
rowSpan={5}
|
||||||
style={{...pointer, fontWeight: 'normal'}}>
|
style={{...pointer, fontWeight: 'normal'}}>
|
||||||
<u>Import</u>
|
<u>Import</u>
|
||||||
|
|||||||
0
src/containers/SkynetImport/Format/Format.css
Normal file
0
src/containers/SkynetImport/Format/Format.css
Normal file
0
src/containers/SkynetImport/Format/Format.js
Normal file
0
src/containers/SkynetImport/Format/Format.js
Normal file
27
src/containers/SkynetImport/SkynetImport.css
Normal file
27
src/containers/SkynetImport/SkynetImport.css
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
.SkynetImportTextArea {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 2px;
|
||||||
|
border-radius: var(--border_radius);
|
||||||
|
background: var(--control_background);
|
||||||
|
border: none;
|
||||||
|
box-shadow: none;
|
||||||
|
outline: none;
|
||||||
|
color: var(--text_color);
|
||||||
|
box-sizing: border-box;
|
||||||
|
resize: none;
|
||||||
|
overflow-y: scroll;
|
||||||
|
overflow:-moz-scrollbars-horizontal;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.SkynetImportButtons {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.SkynetImportHeading {
|
||||||
|
text-align: center;
|
||||||
|
padding-bottom: var(--default_spacing);
|
||||||
|
}
|
||||||
46
src/containers/SkynetImport/SkynetImport.js
Normal file
46
src/containers/SkynetImport/SkynetImport.js
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import {Component} from 'react';
|
||||||
|
import {connect} from 'react-redux';
|
||||||
|
import './SkynetImport.css'
|
||||||
|
import Box from '../../components/UI/Box/Box';
|
||||||
|
import Button from '../../components/UI/Button/Button';
|
||||||
|
import {displaySkynetImport} from '../../redux/actions/skynet_actions';
|
||||||
|
|
||||||
|
const mapDispatchToProps = dispatch => {
|
||||||
|
return {
|
||||||
|
displaySkynetImport: display => dispatch(displaySkynetImport(display)),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default connect(null, mapDispatchToProps)(class extends Component {
|
||||||
|
|
||||||
|
state = {
|
||||||
|
import_list: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<Box dxDark dxStyle={{height: 'auto', 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.displaySkynetImport(false)}
|
||||||
|
style={{cursor: 'pointer'}}>X</a>
|
||||||
|
</div>
|
||||||
|
<h1 className={'SkynetImportHeading'}>Import List</h1>
|
||||||
|
<textarea autoFocus={true}
|
||||||
|
className={'SkynetImportTextArea'}
|
||||||
|
onChange={e => this.setState({
|
||||||
|
...this.state,
|
||||||
|
import_list: e.target.value,
|
||||||
|
})}
|
||||||
|
value={this.state.import_list}
|
||||||
|
rows={10} />
|
||||||
|
|
||||||
|
<div className={'SkynetImportButtons'}>
|
||||||
|
<Button buttonStyles={{height: 'auto', marginTop: 'var(--default_spacing)', width: 'auto'}}>Import Syntax...</Button>
|
||||||
|
<Button buttonStyles={{height: 'auto', marginLeft: 'var(--default_spacing)', marginTop: 'var(--default_spacing)', width: 'auto'}}>Next</Button>
|
||||||
|
</div>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -1,13 +1,5 @@
|
|||||||
|
import {createAction} from '@reduxjs/toolkit';
|
||||||
|
|
||||||
|
|
||||||
export const displaySkynetExport = () => {
|
export const displaySkynetExport = createAction('skynet/displaySkynetExport');
|
||||||
return dispatch => {
|
export const displaySkynetImport = createAction('skynet/displaySkynetImport');
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const displaySkynetImport = () => {
|
|
||||||
return dispatch => {
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|||||||
20
src/redux/reducers/skynet_reducer.js
Normal file
20
src/redux/reducers/skynet_reducer.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import {createReducer} from '@reduxjs/toolkit';
|
||||||
|
import * as Actions from '../actions/skynet_actions';
|
||||||
|
|
||||||
|
export const skynetReducer = createReducer({
|
||||||
|
DisplayExport: false,
|
||||||
|
DisplayImport: false,
|
||||||
|
}, {
|
||||||
|
[Actions.displaySkynetExport]: (state, action) => {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
DisplayExport: action.payload,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[Actions.displaySkynetImport]: (state, action) => {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
DisplayImport: action.payload,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -5,6 +5,7 @@ import {errorReducer} from '../reducers/error_reducer';
|
|||||||
import {installReducer} from '../reducers/install_reducer';
|
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';
|
||||||
|
|
||||||
export default function createAppStore(platformInfo, version, state) {
|
export default function createAppStore(platformInfo, version, state) {
|
||||||
const reducer = {
|
const reducer = {
|
||||||
@@ -14,6 +15,7 @@ export default function createAppStore(platformInfo, version, state) {
|
|||||||
install: installReducer,
|
install: installReducer,
|
||||||
mounts: createMountReducer(state),
|
mounts: createMountReducer(state),
|
||||||
relver: releaseVersionReducer,
|
relver: releaseVersionReducer,
|
||||||
|
skynet: skynetReducer,
|
||||||
};
|
};
|
||||||
|
|
||||||
const middleware = [...getDefaultMiddleware()];
|
const middleware = [...getDefaultMiddleware()];
|
||||||
|
|||||||
Reference in New Issue
Block a user