mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fix UI issues with no indexers exist
This commit is contained in:
@@ -429,7 +429,10 @@ class IndexerIndex extends Component {
|
|||||||
|
|
||||||
{
|
{
|
||||||
!error && isPopulated && !items.length &&
|
!error && isPopulated && !items.length &&
|
||||||
<NoIndexer totalItems={totalItems} />
|
<NoIndexer
|
||||||
|
totalItems={totalItems}
|
||||||
|
onAddIndexerPress={this.onAddIndexerPress}
|
||||||
|
/>
|
||||||
}
|
}
|
||||||
</PageContentBody>
|
</PageContentBody>
|
||||||
|
|
||||||
|
@@ -6,7 +6,10 @@ import translate from 'Utilities/String/translate';
|
|||||||
import styles from './NoIndexer.css';
|
import styles from './NoIndexer.css';
|
||||||
|
|
||||||
function NoIndexer(props) {
|
function NoIndexer(props) {
|
||||||
const { totalItems } = props;
|
const {
|
||||||
|
totalItems,
|
||||||
|
onAddIndexerPress
|
||||||
|
} = props;
|
||||||
|
|
||||||
if (totalItems > 0) {
|
if (totalItems > 0) {
|
||||||
return (
|
return (
|
||||||
@@ -26,7 +29,7 @@ function NoIndexer(props) {
|
|||||||
|
|
||||||
<div className={styles.buttonContainer}>
|
<div className={styles.buttonContainer}>
|
||||||
<Button
|
<Button
|
||||||
to="/add/new"
|
onPress={onAddIndexerPress}
|
||||||
kind={kinds.PRIMARY}
|
kind={kinds.PRIMARY}
|
||||||
>
|
>
|
||||||
{translate('AddNewIndexer')}
|
{translate('AddNewIndexer')}
|
||||||
@@ -37,7 +40,8 @@ function NoIndexer(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
NoIndexer.propTypes = {
|
NoIndexer.propTypes = {
|
||||||
totalItems: PropTypes.number.isRequired
|
totalItems: PropTypes.number.isRequired,
|
||||||
|
onAddIndexerPress: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export default NoIndexer;
|
export default NoIndexer;
|
||||||
|
@@ -51,7 +51,8 @@ class SearchFooter extends Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
isFetching
|
isFetching,
|
||||||
|
hasIndexers
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -97,7 +98,7 @@ class SearchFooter extends Component {
|
|||||||
<SpinnerButton
|
<SpinnerButton
|
||||||
className={styles.deleteSelectedButton}
|
className={styles.deleteSelectedButton}
|
||||||
isSpinning={isFetching}
|
isSpinning={isFetching}
|
||||||
isDisabled={isFetching}
|
isDisabled={isFetching || !hasIndexers}
|
||||||
onPress={this.onSearchPress}
|
onPress={this.onSearchPress}
|
||||||
>
|
>
|
||||||
Search
|
Search
|
||||||
@@ -113,6 +114,7 @@ class SearchFooter extends Component {
|
|||||||
SearchFooter.propTypes = {
|
SearchFooter.propTypes = {
|
||||||
isFetching: PropTypes.bool.isRequired,
|
isFetching: PropTypes.bool.isRequired,
|
||||||
onSearchPress: PropTypes.func.isRequired,
|
onSearchPress: PropTypes.func.isRequired,
|
||||||
|
hasIndexers: PropTypes.bool.isRequired,
|
||||||
searchError: PropTypes.object
|
searchError: PropTypes.object
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -12,6 +12,8 @@ import PageToolbarSeparator from 'Components/Page/Toolbar/PageToolbarSeparator';
|
|||||||
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
||||||
import { align, icons, sortDirections } from 'Helpers/Props';
|
import { align, icons, sortDirections } from 'Helpers/Props';
|
||||||
import NoIndexer from 'Indexer/NoIndexer';
|
import NoIndexer from 'Indexer/NoIndexer';
|
||||||
|
import AddIndexerModal from 'Settings/Indexers/Indexers/AddIndexerModal';
|
||||||
|
import EditIndexerModalConnector from 'Settings/Indexers/Indexers/EditIndexerModalConnector';
|
||||||
import * as keyCodes from 'Utilities/Constants/keyCodes';
|
import * as keyCodes from 'Utilities/Constants/keyCodes';
|
||||||
import getErrorMessage from 'Utilities/Object/getErrorMessage';
|
import getErrorMessage from 'Utilities/Object/getErrorMessage';
|
||||||
import hasDifferentItemsOrOrder from 'Utilities/Object/hasDifferentItemsOrOrder';
|
import hasDifferentItemsOrOrder from 'Utilities/Object/hasDifferentItemsOrOrder';
|
||||||
@@ -39,6 +41,8 @@ class SearchIndex extends Component {
|
|||||||
scroller: null,
|
scroller: null,
|
||||||
jumpBarItems: { order: [] },
|
jumpBarItems: { order: [] },
|
||||||
jumpToCharacter: null,
|
jumpToCharacter: null,
|
||||||
|
isAddIndexerModalOpen: false,
|
||||||
|
isEditIndexerModalOpen: false,
|
||||||
searchType: null,
|
searchType: null,
|
||||||
lastToggled: null
|
lastToggled: null
|
||||||
};
|
};
|
||||||
@@ -123,6 +127,21 @@ class SearchIndex extends Component {
|
|||||||
//
|
//
|
||||||
// Listeners
|
// Listeners
|
||||||
|
|
||||||
|
onAddIndexerPress = () => {
|
||||||
|
this.setState({ isAddIndexerModalOpen: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
onAddIndexerModalClose = ({ indexerSelected = false } = {}) => {
|
||||||
|
this.setState({
|
||||||
|
isAddIndexerModalOpen: false,
|
||||||
|
isEditIndexerModalOpen: indexerSelected
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onEditIndexerModalClose = () => {
|
||||||
|
this.setState({ isEditIndexerModalOpen: false });
|
||||||
|
}
|
||||||
|
|
||||||
onJumpBarItemPress = (jumpToCharacter) => {
|
onJumpBarItemPress = (jumpToCharacter) => {
|
||||||
this.setState({ jumpToCharacter });
|
this.setState({ jumpToCharacter });
|
||||||
}
|
}
|
||||||
@@ -169,6 +188,8 @@ class SearchIndex extends Component {
|
|||||||
const {
|
const {
|
||||||
scroller,
|
scroller,
|
||||||
jumpBarItems,
|
jumpBarItems,
|
||||||
|
isAddIndexerModalOpen,
|
||||||
|
isEditIndexerModalOpen,
|
||||||
jumpToCharacter
|
jumpToCharacter
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
@@ -248,7 +269,10 @@ class SearchIndex extends Component {
|
|||||||
|
|
||||||
{
|
{
|
||||||
!error && !isFetching && !hasIndexers &&
|
!error && !isFetching && !hasIndexers &&
|
||||||
<NoIndexer />
|
<NoIndexer
|
||||||
|
totalItems={0}
|
||||||
|
onAddIndexerPress={this.onAddIndexerPress}
|
||||||
|
/>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -268,8 +292,19 @@ class SearchIndex extends Component {
|
|||||||
|
|
||||||
<SearchFooter
|
<SearchFooter
|
||||||
isFetching={isFetching}
|
isFetching={isFetching}
|
||||||
|
hasIndexers={hasIndexers}
|
||||||
onSearchPress={this.onSearchPress}
|
onSearchPress={this.onSearchPress}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<AddIndexerModal
|
||||||
|
isOpen={isAddIndexerModalOpen}
|
||||||
|
onModalClose={this.onAddIndexerModalClose}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<EditIndexerModalConnector
|
||||||
|
isOpen={isEditIndexerModalOpen}
|
||||||
|
onModalClose={this.onEditIndexerModalClose}
|
||||||
|
/>
|
||||||
</PageContent>
|
</PageContent>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -6,13 +6,12 @@ import withScrollPosition from 'Components/withScrollPosition';
|
|||||||
import { fetchReleases, setReleasesFilter, setReleasesSort, setReleasesTableOption } from 'Store/Actions/releaseActions';
|
import { fetchReleases, setReleasesFilter, setReleasesSort, setReleasesTableOption } from 'Store/Actions/releaseActions';
|
||||||
import scrollPositions from 'Store/scrollPositions';
|
import scrollPositions from 'Store/scrollPositions';
|
||||||
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
||||||
import createIndexerClientSideCollectionItemsSelector from 'Store/Selectors/createIndexerClientSideCollectionItemsSelector';
|
|
||||||
import createReleaseClientSideCollectionItemsSelector from 'Store/Selectors/createReleaseClientSideCollectionItemsSelector';
|
import createReleaseClientSideCollectionItemsSelector from 'Store/Selectors/createReleaseClientSideCollectionItemsSelector';
|
||||||
import SearchIndex from './SearchIndex';
|
import SearchIndex from './SearchIndex';
|
||||||
|
|
||||||
function createMapStateToProps() {
|
function createMapStateToProps() {
|
||||||
return createSelector(
|
return createSelector(
|
||||||
createIndexerClientSideCollectionItemsSelector('indexerIndex'),
|
(state) => state.indexers,
|
||||||
createReleaseClientSideCollectionItemsSelector('releases'),
|
createReleaseClientSideCollectionItemsSelector('releases'),
|
||||||
createDimensionsSelector(),
|
createDimensionsSelector(),
|
||||||
(
|
(
|
||||||
|
@@ -30,7 +30,6 @@ class AddIndexerItem extends Component {
|
|||||||
const {
|
const {
|
||||||
name,
|
name,
|
||||||
implementation,
|
implementation,
|
||||||
implementationName,
|
|
||||||
infoLink,
|
infoLink,
|
||||||
presets,
|
presets,
|
||||||
onIndexerSelect
|
onIndexerSelect
|
||||||
@@ -105,7 +104,6 @@ class AddIndexerItem extends Component {
|
|||||||
AddIndexerItem.propTypes = {
|
AddIndexerItem.propTypes = {
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
implementation: PropTypes.string.isRequired,
|
implementation: PropTypes.string.isRequired,
|
||||||
implementationName: PropTypes.string.isRequired,
|
|
||||||
infoLink: PropTypes.string.isRequired,
|
infoLink: PropTypes.string.isRequired,
|
||||||
presets: PropTypes.arrayOf(PropTypes.object),
|
presets: PropTypes.arrayOf(PropTypes.object),
|
||||||
onIndexerSelect: PropTypes.func.isRequired
|
onIndexerSelect: PropTypes.func.isRequired
|
||||||
|
Reference in New Issue
Block a user