mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 20:12:41 +02:00
Fixed: Show error if adding root folder fails
(cherry picked from commit 6596d0b4dad7be4e3d974f723b1a19d9bbfdff1f) Co-authored-by: Mark McDowall <mark@mcdowall.ca>
This commit is contained in:
parent
0daa978fba
commit
ebf4425beb
@ -30,3 +30,9 @@
|
|||||||
.importButtonIcon {
|
.importButtonIcon {
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.addErrorAlert {
|
||||||
|
composes: alert from '~Components/Alert.css';
|
||||||
|
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import FieldSet from 'Components/FieldSet';
|
import FieldSet from 'Components/FieldSet';
|
||||||
import FileBrowserModal from 'Components/FileBrowser/FileBrowserModal';
|
import FileBrowserModal from 'Components/FileBrowser/FileBrowserModal';
|
||||||
import Icon from 'Components/Icon';
|
import Icon from 'Components/Icon';
|
||||||
@ -72,23 +73,29 @@ class ImportMovieSelectFolder extends Component {
|
|||||||
isWindows,
|
isWindows,
|
||||||
isFetching,
|
isFetching,
|
||||||
isPopulated,
|
isPopulated,
|
||||||
|
isSaving,
|
||||||
error,
|
error,
|
||||||
|
saveError,
|
||||||
items
|
items
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
const hasRootFolders = items.length > 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContent title={translate('ImportMovies')}>
|
<PageContent title={translate('ImportMovies')}>
|
||||||
<PageContentBody>
|
<PageContentBody>
|
||||||
{
|
{
|
||||||
isFetching && !isPopulated &&
|
isFetching && !isPopulated ?
|
||||||
<LoadingIndicator />
|
<LoadingIndicator /> :
|
||||||
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
!isFetching && !!error &&
|
!isFetching && error ?
|
||||||
<div>
|
<div>
|
||||||
{translate('UnableToLoadRootFolders')}
|
{translate('UnableToLoadRootFolders')}
|
||||||
</div>
|
</div> :
|
||||||
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -108,7 +115,7 @@ class ImportMovieSelectFolder extends Component {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{
|
{
|
||||||
items.length > 0 ?
|
hasRootFolders ?
|
||||||
<div className={styles.recentFolders}>
|
<div className={styles.recentFolders}>
|
||||||
<FieldSet legend={translate('RecentFolders')}>
|
<FieldSet legend={translate('RecentFolders')}>
|
||||||
<Table
|
<Table
|
||||||
@ -131,35 +138,51 @@ class ImportMovieSelectFolder extends Component {
|
|||||||
</TableBody>
|
</TableBody>
|
||||||
</Table>
|
</Table>
|
||||||
</FieldSet>
|
</FieldSet>
|
||||||
|
|
||||||
<Button
|
|
||||||
kind={kinds.PRIMARY}
|
|
||||||
size={sizes.LARGE}
|
|
||||||
onPress={this.onAddNewRootFolderPress}
|
|
||||||
>
|
|
||||||
<Icon
|
|
||||||
className={styles.importButtonIcon}
|
|
||||||
name={icons.DRIVE}
|
|
||||||
/>
|
|
||||||
{translate('ChooseAnotherFolder')}
|
|
||||||
</Button>
|
|
||||||
</div> :
|
</div> :
|
||||||
|
null
|
||||||
<div className={styles.startImport}>
|
|
||||||
<Button
|
|
||||||
kind={kinds.PRIMARY}
|
|
||||||
size={sizes.LARGE}
|
|
||||||
onPress={this.onAddNewRootFolderPress}
|
|
||||||
>
|
|
||||||
<Icon
|
|
||||||
className={styles.importButtonIcon}
|
|
||||||
name={icons.DRIVE}
|
|
||||||
/>
|
|
||||||
{translate('StartImport')}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
!isSaving && saveError ?
|
||||||
|
<Alert
|
||||||
|
className={styles.addErrorAlert}
|
||||||
|
kind={kinds.DANGER}
|
||||||
|
>
|
||||||
|
{translate('UnableToAddRootFolder')}
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
{
|
||||||
|
saveError.responseJSON.map((e, index) => {
|
||||||
|
return (
|
||||||
|
<li key={index}>
|
||||||
|
{e.errorMessage}
|
||||||
|
</li>
|
||||||
|
);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
</Alert> :
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
|
<div className={hasRootFolders ? undefined : styles.startImport}>
|
||||||
|
<Button
|
||||||
|
kind={kinds.PRIMARY}
|
||||||
|
size={sizes.LARGE}
|
||||||
|
onPress={this.onAddNewRootFolderPress}
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
className={styles.importButtonIcon}
|
||||||
|
name={icons.DRIVE}
|
||||||
|
/>
|
||||||
|
{
|
||||||
|
hasRootFolders ?
|
||||||
|
translate('ChooseAnotherFolder') :
|
||||||
|
translate('StartImport')
|
||||||
|
}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<FileBrowserModal
|
<FileBrowserModal
|
||||||
isOpen={this.state.isAddNewRootFolderModalOpen}
|
isOpen={this.state.isAddNewRootFolderModalOpen}
|
||||||
name="rootFolderPath"
|
name="rootFolderPath"
|
||||||
@ -179,7 +202,9 @@ ImportMovieSelectFolder.propTypes = {
|
|||||||
isWindows: PropTypes.bool.isRequired,
|
isWindows: PropTypes.bool.isRequired,
|
||||||
isFetching: PropTypes.bool.isRequired,
|
isFetching: PropTypes.bool.isRequired,
|
||||||
isPopulated: PropTypes.bool.isRequired,
|
isPopulated: PropTypes.bool.isRequired,
|
||||||
|
isSaving: PropTypes.bool.isRequired,
|
||||||
error: PropTypes.object,
|
error: PropTypes.object,
|
||||||
|
saveError: PropTypes.object,
|
||||||
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
onNewRootFolderSelect: PropTypes.func.isRequired,
|
onNewRootFolderSelect: PropTypes.func.isRequired,
|
||||||
onDeleteRootFolderPress: PropTypes.func.isRequired
|
onDeleteRootFolderPress: PropTypes.func.isRequired
|
||||||
|
@ -1010,6 +1010,7 @@
|
|||||||
"UnableToAddANewNotificationPleaseTryAgain": "Unable to add a new notification, please try again.",
|
"UnableToAddANewNotificationPleaseTryAgain": "Unable to add a new notification, please try again.",
|
||||||
"UnableToAddANewQualityProfilePleaseTryAgain": "Unable to add a new quality profile, please try again.",
|
"UnableToAddANewQualityProfilePleaseTryAgain": "Unable to add a new quality profile, please try again.",
|
||||||
"UnableToAddANewRemotePathMappingPleaseTryAgain": "Unable to add a new remote path mapping, please try again.",
|
"UnableToAddANewRemotePathMappingPleaseTryAgain": "Unable to add a new remote path mapping, please try again.",
|
||||||
|
"UnableToAddRootFolder": "Unable to add root folder",
|
||||||
"UnableToImportCheckLogs": "Downloaded - Unable to Import: check logs for details",
|
"UnableToImportCheckLogs": "Downloaded - Unable to Import: check logs for details",
|
||||||
"UnableToLoadAltTitle": "Unable to load alternative titles.",
|
"UnableToLoadAltTitle": "Unable to load alternative titles.",
|
||||||
"UnableToLoadBackups": "Unable to load backups",
|
"UnableToLoadBackups": "Unable to load backups",
|
||||||
|
Loading…
Reference in New Issue
Block a user