mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-16 23:39:44 +02:00
Fixed: Show errors when adding Root Folder
(cherry picked from commit 16d60a6586aeb458601214258da021ee154e5b6e) Closes #9527
This commit is contained in:
parent
e29717ec6c
commit
b788464487
@ -148,7 +148,7 @@ class ImportMovieSelectFolder extends Component {
|
|||||||
className={styles.addErrorAlert}
|
className={styles.addErrorAlert}
|
||||||
kind={kinds.DANGER}
|
kind={kinds.DANGER}
|
||||||
>
|
>
|
||||||
{translate('UnableToAddRootFolder')}
|
{translate('AddRootFolderError')}
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ function RootFolders() {
|
|||||||
|
|
||||||
if (!isFetching && !!error) {
|
if (!isFetching && !!error) {
|
||||||
return (
|
return (
|
||||||
<Alert kind={kinds.DANGER}>{translate('UnableToLoadRootFolders')}</Alert>
|
<Alert kind={kinds.DANGER}>{translate('RootFoldersLoadError')}</Alert>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,18 @@
|
|||||||
import React, { useCallback, useState } from 'react';
|
import React, { useCallback, useState } from 'react';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import FileBrowserModal from 'Components/FileBrowser/FileBrowserModal';
|
import FileBrowserModal from 'Components/FileBrowser/FileBrowserModal';
|
||||||
import Icon from 'Components/Icon';
|
import Icon from 'Components/Icon';
|
||||||
import Button from 'Components/Link/Button';
|
import Button from 'Components/Link/Button';
|
||||||
import { icons, kinds, sizes } from 'Helpers/Props';
|
import { icons, kinds, sizes } from 'Helpers/Props';
|
||||||
import { addRootFolder } from 'Store/Actions/rootFolderActions';
|
import { addRootFolder } from 'Store/Actions/rootFolderActions';
|
||||||
|
import createRootFoldersSelector from 'Store/Selectors/createRootFoldersSelector';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
import styles from './AddRootFolder.css';
|
import styles from './AddRootFolder.css';
|
||||||
|
|
||||||
function AddRootFolder() {
|
function AddRootFolder() {
|
||||||
|
const { isSaving, saveError } = useSelector(createRootFoldersSelector());
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
const [isAddNewRootFolderModalOpen, setIsAddNewRootFolderModalOpen] =
|
const [isAddNewRootFolderModalOpen, setIsAddNewRootFolderModalOpen] =
|
||||||
@ -30,24 +34,42 @@ function AddRootFolder() {
|
|||||||
}, [setIsAddNewRootFolderModalOpen]);
|
}, [setIsAddNewRootFolderModalOpen]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.addRootFolderButtonContainer}>
|
<>
|
||||||
<Button
|
{!isSaving && saveError ? (
|
||||||
kind={kinds.PRIMARY}
|
<Alert kind={kinds.DANGER}>
|
||||||
size={sizes.LARGE}
|
{translate('AddRootFolderError')}
|
||||||
onPress={onAddNewRootFolderPress}
|
|
||||||
>
|
|
||||||
<Icon className={styles.importButtonIcon} name={icons.DRIVE} />
|
|
||||||
{translate('AddRootFolder')}
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<FileBrowserModal
|
<ul>
|
||||||
isOpen={isAddNewRootFolderModalOpen}
|
{Array.isArray(saveError.responseJSON) ? (
|
||||||
name="rootFolderPath"
|
saveError.responseJSON.map((e, index) => {
|
||||||
value=""
|
return <li key={index}>{e.errorMessage}</li>;
|
||||||
onChange={onNewRootFolderSelect}
|
})
|
||||||
onModalClose={onAddRootFolderModalClose}
|
) : (
|
||||||
/>
|
<li>{JSON.stringify(saveError.responseJSON)}</li>
|
||||||
</div>
|
)}
|
||||||
|
</ul>
|
||||||
|
</Alert>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
<div className={styles.addRootFolderButtonContainer}>
|
||||||
|
<Button
|
||||||
|
kind={kinds.PRIMARY}
|
||||||
|
size={sizes.LARGE}
|
||||||
|
onPress={onAddNewRootFolderPress}
|
||||||
|
>
|
||||||
|
<Icon className={styles.importButtonIcon} name={icons.DRIVE} />
|
||||||
|
{translate('AddRootFolder')}
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<FileBrowserModal
|
||||||
|
isOpen={isAddNewRootFolderModalOpen}
|
||||||
|
name="rootFolderPath"
|
||||||
|
value=""
|
||||||
|
onChange={onNewRootFolderSelect}
|
||||||
|
onModalClose={onAddRootFolderModalClose}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
"AddRemotePathMapping": "Add Remote Path Mapping",
|
"AddRemotePathMapping": "Add Remote Path Mapping",
|
||||||
"AddRestriction": "Add Restriction",
|
"AddRestriction": "Add Restriction",
|
||||||
"AddRootFolder": "Add Root Folder",
|
"AddRootFolder": "Add Root Folder",
|
||||||
|
"AddRootFolderError": "Unable to add root folder",
|
||||||
"AddToDownloadQueue": "Add to download queue",
|
"AddToDownloadQueue": "Add to download queue",
|
||||||
"Added": "Added",
|
"Added": "Added",
|
||||||
"AddedToDownloadQueue": "Added to download queue",
|
"AddedToDownloadQueue": "Added to download queue",
|
||||||
@ -1253,7 +1254,6 @@
|
|||||||
"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",
|
|
||||||
"UnableToLoadAltTitle": "Unable to load alternative titles.",
|
"UnableToLoadAltTitle": "Unable to load alternative titles.",
|
||||||
"UnableToLoadAutoTagging": "Unable to load auto tagging",
|
"UnableToLoadAutoTagging": "Unable to load auto tagging",
|
||||||
"UnableToLoadCollections": "Unable to load collections",
|
"UnableToLoadCollections": "Unable to load collections",
|
||||||
|
Loading…
Reference in New Issue
Block a user