From 59ad33b3811e3cde938a1f2c27e1be1e489ed935 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Thu, 18 Mar 2021 23:57:03 -0500 Subject: [PATCH] Import Skylinks from json file --- CHANGELOG.md | 1 + src/constants.js | 5 +++- src/containers/SkynetImport/SkynetImport.js | 20 ++++++++++++++ src/renderer/ipc/FilesystemIPC.js | 29 ++++++++++++++++++++- src/utils.jsx | 18 +++++++++++-- 5 files changed, 69 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f509f72..1c4f3e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - \#55: Enable 'Activate' release instead of 'Install' in notification pop-up - Ability to export Skylink's to json file +- Ability to import Skylink's from json file ## 1.3.3 diff --git a/src/constants.js b/src/constants.js index 4db3261..5c76a33 100644 --- a/src/constants.js +++ b/src/constants.js @@ -109,9 +109,10 @@ exports.INSTALL_TYPES = { }; exports.IPC_Browse_Directory = 'browse_directory'; - exports.IPC_Browse_File = 'browse_file'; +exports.IPC_Select_File = 'select_file'; + exports.IPC_Check_Daemon_Version = 'check_daemon_version'; exports.IPC_Check_Daemon_Version_Reply = 'check_daemon_version_reply'; @@ -176,6 +177,8 @@ exports.IPC_Install_Upgrade_Reply = 'install_upgrade_reply'; exports.IPC_Mount_Drive = 'mount_drive'; exports.IPC_Mount_Drive_Reply = 'mount_drive_reply'; +exports.IPC_Read_File = 'read_file'; + exports.IPC_Remove_Mount = 'remove_mount'; exports.IPC_Remove_Mount_Reply = 'remove_mount_reply'; diff --git a/src/containers/SkynetImport/SkynetImport.js b/src/containers/SkynetImport/SkynetImport.js index 39edfe9..633501b 100644 --- a/src/containers/SkynetImport/SkynetImport.js +++ b/src/containers/SkynetImport/SkynetImport.js @@ -8,6 +8,7 @@ import ImportList from './ImportList/ImportList'; import IPCContainer from '../IPCContainer/IPCContainer'; import { notifyApplicationBusy } from '../../redux/actions/common_actions'; import { notifyError, notifyInfo } from '../../redux/actions/error_actions'; +import { promptLocationAndReadFile } from '../../utils'; const Constants = require('../../constants'); @@ -79,6 +80,13 @@ export default connect( this.props.notifyInfo('Import Syntax', msg); }; + handleLoadFile = () => { + const data = promptLocationAndReadFile(this.props.notifyError); + if (data) { + this.setState({ import_text: data }); + } + }; + handleNavigation = () => { if (this.state.second_stage) { try { @@ -253,6 +261,18 @@ export default connect( {'Back'} ) : null} + {!this.state.second_stage ? ( + + ) : null}