Fixed: Don't die on info indexer when the definition is missing

pull/1925/head v1.10.4.4088
Bogdan 7 months ago
parent 709dfe453b
commit 343d7088c9

@ -3,6 +3,7 @@ import React, { useCallback, useState } from 'react';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { Tab, TabList, TabPanel, Tabs } from 'react-tabs'; import { Tab, TabList, TabPanel, Tabs } from 'react-tabs';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import Alert from 'Components/Alert';
import DescriptionList from 'Components/DescriptionList/DescriptionList'; import DescriptionList from 'Components/DescriptionList/DescriptionList';
import DescriptionListItem from 'Components/DescriptionList/DescriptionListItem'; import DescriptionListItem from 'Components/DescriptionList/DescriptionListItem';
import DescriptionListItemDescription from 'Components/DescriptionList/DescriptionListItemDescription'; import DescriptionListItemDescription from 'Components/DescriptionList/DescriptionListItemDescription';
@ -23,7 +24,7 @@ import TagListConnector from 'Components/TagListConnector';
import { kinds } from 'Helpers/Props'; import { kinds } from 'Helpers/Props';
import DeleteIndexerModal from 'Indexer/Delete/DeleteIndexerModal'; import DeleteIndexerModal from 'Indexer/Delete/DeleteIndexerModal';
import EditIndexerModalConnector from 'Indexer/Edit/EditIndexerModalConnector'; import EditIndexerModalConnector from 'Indexer/Edit/EditIndexerModalConnector';
import Indexer from 'Indexer/Indexer'; import Indexer, { IndexerCapabilities } from 'Indexer/Indexer';
import { createIndexerSelectorForHook } from 'Store/Selectors/createIndexerSelector'; import { createIndexerSelectorForHook } from 'Store/Selectors/createIndexerSelector';
import translate from 'Utilities/String/translate'; import translate from 'Utilities/String/translate';
import IndexerHistory from './History/IndexerHistory'; import IndexerHistory from './History/IndexerHistory';
@ -63,7 +64,7 @@ function IndexerInfoModalContent(props: IndexerInfoModalContentProps) {
fields, fields,
tags, tags,
protocol, protocol,
capabilities, capabilities = {} as IndexerCapabilities,
} = indexer as Indexer; } = indexer as Indexer;
const { onModalClose } = props; const { onModalClose } = props;
@ -207,7 +208,7 @@ function IndexerInfoModalContent(props: IndexerInfoModalContentProps) {
descriptionClassName={styles.description} descriptionClassName={styles.description}
title={translate('RawSearchSupported')} title={translate('RawSearchSupported')}
data={ data={
capabilities.supportsRawSearch capabilities?.supportsRawSearch
? translate('Yes') ? translate('Yes')
: translate('No') : translate('No')
} }
@ -216,12 +217,12 @@ function IndexerInfoModalContent(props: IndexerInfoModalContentProps) {
descriptionClassName={styles.description} descriptionClassName={styles.description}
title={translate('SearchTypes')} title={translate('SearchTypes')}
data={ data={
capabilities.searchParams.length === 0 ? ( capabilities?.searchParams?.length > 0 ? (
translate('NotSupported')
) : (
<Label kind={kinds.PRIMARY}> <Label kind={kinds.PRIMARY}>
{capabilities.searchParams[0]} {capabilities.searchParams[0]}
</Label> </Label>
) : (
translate('NotSupported')
) )
} }
/> />
@ -229,60 +230,60 @@ function IndexerInfoModalContent(props: IndexerInfoModalContentProps) {
descriptionClassName={styles.description} descriptionClassName={styles.description}
title={translate('TVSearchTypes')} title={translate('TVSearchTypes')}
data={ data={
capabilities.tvSearchParams.length === 0 capabilities?.tvSearchParams?.length > 0
? translate('NotSupported') ? capabilities.tvSearchParams.map((p) => {
: capabilities.tvSearchParams.map((p) => {
return ( return (
<Label key={p} kind={kinds.PRIMARY}> <Label key={p} kind={kinds.PRIMARY}>
{p} {p}
</Label> </Label>
); );
}) })
: translate('NotSupported')
} }
/> />
<DescriptionListItem <DescriptionListItem
descriptionClassName={styles.description} descriptionClassName={styles.description}
title={translate('MovieSearchTypes')} title={translate('MovieSearchTypes')}
data={ data={
capabilities.movieSearchParams.length === 0 capabilities?.movieSearchParams?.length > 0
? translate('NotSupported') ? capabilities.movieSearchParams.map((p) => {
: capabilities.movieSearchParams.map((p) => {
return ( return (
<Label key={p} kind={kinds.PRIMARY}> <Label key={p} kind={kinds.PRIMARY}>
{p} {p}
</Label> </Label>
); );
}) })
: translate('NotSupported')
} }
/> />
<DescriptionListItem <DescriptionListItem
descriptionClassName={styles.description} descriptionClassName={styles.description}
title={translate('BookSearchTypes')} title={translate('BookSearchTypes')}
data={ data={
capabilities.bookSearchParams.length === 0 capabilities?.bookSearchParams?.length > 0
? translate('NotSupported') ? capabilities.bookSearchParams.map((p) => {
: capabilities.bookSearchParams.map((p) => {
return ( return (
<Label key={p} kind={kinds.PRIMARY}> <Label key={p} kind={kinds.PRIMARY}>
{p} {p}
</Label> </Label>
); );
}) })
: translate('NotSupported')
} }
/> />
<DescriptionListItem <DescriptionListItem
descriptionClassName={styles.description} descriptionClassName={styles.description}
title={translate('MusicSearchTypes')} title={translate('MusicSearchTypes')}
data={ data={
capabilities.musicSearchParams.length === 0 capabilities?.musicSearchParams?.length > 0
? translate('NotSupported') ? capabilities.musicSearchParams.map((p) => {
: capabilities.musicSearchParams.map((p) => {
return ( return (
<Label key={p} kind={kinds.PRIMARY}> <Label key={p} kind={kinds.PRIMARY}>
{p} {p}
</Label> </Label>
); );
}) })
: translate('NotSupported')
} }
/> />
</DescriptionList> </DescriptionList>
@ -338,7 +339,11 @@ function IndexerInfoModalContent(props: IndexerInfoModalContentProps) {
})} })}
</Table> </Table>
</FieldSet> </FieldSet>
) : null} ) : (
<Alert kind={kinds.INFO}>
{translate('NoIndexerCategories')}
</Alert>
)}
</div> </div>
</TabPanel> </TabPanel>
<TabPanel> <TabPanel>

@ -2,8 +2,8 @@
"About": "About", "About": "About",
"AcceptConfirmationModal": "Accept Confirmation Modal", "AcceptConfirmationModal": "Accept Confirmation Modal",
"Actions": "Actions", "Actions": "Actions",
"ActiveIndexers": "Active Indexers",
"ActiveApps": "Active Apps", "ActiveApps": "Active Apps",
"ActiveIndexers": "Active Indexers",
"Add": "Add", "Add": "Add",
"AddApplication": "Add Application", "AddApplication": "Add Application",
"AddApplicationImplementation": "Add Application - {implementationName}", "AddApplicationImplementation": "Add Application - {implementationName}",
@ -339,8 +339,9 @@
"NoChanges": "No Changes", "NoChanges": "No Changes",
"NoDownloadClientsFound": "No download clients found", "NoDownloadClientsFound": "No download clients found",
"NoHistoryFound": "No history found", "NoHistoryFound": "No history found",
"NoIndexersFound": "No indexers found", "NoIndexerCategories": "No categories found for this indexer",
"NoIndexerHistory": "No history found for this indexer", "NoIndexerHistory": "No history found for this indexer",
"NoIndexersFound": "No indexers found",
"NoLeaveIt": "No, Leave It", "NoLeaveIt": "No, Leave It",
"NoLinks": "No Links", "NoLinks": "No Links",
"NoLogFiles": "No log files", "NoLogFiles": "No log files",

Loading…
Cancel
Save