Notify import success

This commit is contained in:
2020-06-18 12:58:02 -05:00
parent 117aefcf05
commit 4c5e364a3d

View File

@@ -25,7 +25,7 @@ const mapDispatchToProps = dispatch => {
displaySkynetImport: display => dispatch(displaySkynetImport(display)), displaySkynetImport: display => dispatch(displaySkynetImport(display)),
notifyApplicationBusy: busy => dispatch(notifyApplicationBusy(busy, true)), notifyApplicationBusy: busy => dispatch(notifyApplicationBusy(busy, true)),
notifyError: msg => dispatch(notifyError(msg)), notifyError: msg => dispatch(notifyError(msg)),
notifyInfo: msg => dispatch(notifyInfo('Import Syntax', msg)), notifyInfo: (title, msg) => dispatch(notifyInfo(title, msg)),
} }
}; };
@@ -71,7 +71,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(class extends IPCCon
' "token": "My Password"\n' + ' "token": "My Password"\n' +
' }\n' + ' }\n' +
' ]'; ' ]';
this.props.notifyInfo(msg) this.props.notifyInfo('Import Syntax', msg)
} }
handleNavigation = () => { handleNavigation = () => {
@@ -144,13 +144,16 @@ export default connect(mapStateToProps, mapDispatchToProps)(class extends IPCCon
const failedImportsArray = this.state.imports_array.filter(i => { const failedImportsArray = this.state.imports_array.filter(i => {
return arg.data.Result.failed.includes(i.skylink); return arg.data.Result.failed.includes(i.skylink);
}); });
const count = this.state.imports_array.length;
this.setState({ this.setState({
import_text: failedImportsArray.length > 0 ? JSON.stringify(failedImportsArray, null, 2) : '', import_text: failedImportsArray.length > 0 ? JSON.stringify(failedImportsArray, null, 2) : '',
imports_array: [], imports_array: [],
second_stage: false, second_stage: false,
}, () => { }, () => {
if (failedImportsArray.length > 0) { 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)`);
} }
}); });
} else { } else {