fix(ui): show request as option even if there are no radarr/sonarr servers

pull/839/head
sct 4 years ago
parent e4a50c33f1
commit b116281196

@ -185,7 +185,7 @@ const AdvancedRequester: React.FC<AdvancedRequesterProps> = ({
]); ]);
useEffect(() => { useEffect(() => {
if (selectedServer !== null) { if (selectedServer !== null || selectedUser) {
onChange({ onChange({
folder: selectedFolder !== '' ? selectedFolder : undefined, folder: selectedFolder !== '' ? selectedFolder : undefined,
profile: selectedProfile !== -1 ? selectedProfile : undefined, profile: selectedProfile !== -1 ? selectedProfile : undefined,
@ -203,7 +203,7 @@ const AdvancedRequester: React.FC<AdvancedRequesterProps> = ({
); );
} }
if (!data || selectedServer === null) { if ((!data || selectedServer === null) && !selectedUser) {
return null; return null;
} }
@ -222,6 +222,8 @@ const AdvancedRequester: React.FC<AdvancedRequesterProps> = ({
{intl.formatMessage(messages.advancedoptions)} {intl.formatMessage(messages.advancedoptions)}
</div> </div>
<div className="p-4 bg-gray-600 rounded-md shadow"> <div className="p-4 bg-gray-600 rounded-md shadow">
{!!data && selectedServer !== null && (
<>
<div className="flex flex-col items-center justify-between md:flex-row"> <div className="flex flex-col items-center justify-between md:flex-row">
<div className="flex-grow flex-shrink-0 w-full mb-2 md:w-1/3 md:pr-4 md:mb-0"> <div className="flex-grow flex-shrink-0 w-full mb-2 md:w-1/3 md:pr-4 md:mb-0">
<label htmlFor="server" className="text-label"> <label htmlFor="server" className="text-label">
@ -265,7 +267,10 @@ const AdvancedRequester: React.FC<AdvancedRequesterProps> = ({
{!isValidating && {!isValidating &&
serverData && serverData &&
serverData.profiles.map((profile) => ( serverData.profiles.map((profile) => (
<option key={`profile-list${profile.id}`} value={profile.id}> <option
key={`profile-list${profile.id}`}
value={profile.id}
>
{profile.name} {profile.name}
{isAnime && {isAnime &&
serverData.server.activeAnimeProfileId === profile.id serverData.server.activeAnimeProfileId === profile.id
@ -298,7 +303,10 @@ const AdvancedRequester: React.FC<AdvancedRequesterProps> = ({
{!isValidating && {!isValidating &&
serverData && serverData &&
serverData.rootFolders.map((folder) => ( serverData.rootFolders.map((folder) => (
<option key={`folder-list${folder.id}`} value={folder.path}> <option
key={`folder-list${folder.id}`}
value={folder.path}
>
{folder.path} ({formatBytes(folder.freeSpace ?? 0)}) {folder.path} ({formatBytes(folder.freeSpace ?? 0)})
{isAnime && {isAnime &&
serverData.server.activeAnimeDirectory === folder.path serverData.server.activeAnimeDirectory === folder.path
@ -312,6 +320,8 @@ const AdvancedRequester: React.FC<AdvancedRequesterProps> = ({
</select> </select>
</div> </div>
</div> </div>
</>
)}
{hasPermission(Permission.MANAGE_REQUESTS) && {hasPermission(Permission.MANAGE_REQUESTS) &&
hasPermission(Permission.MANAGE_USERS) && hasPermission(Permission.MANAGE_USERS) &&
selectedUser && ( selectedUser && (

Loading…
Cancel
Save