1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-29 23:12:39 +01:00

New: Display tags on import list cards

This commit is contained in:
Bogdan 2024-10-27 00:17:18 +03:00 committed by GitHub
parent 1e89a1a3cb
commit 57534db2f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 5 deletions

View File

@ -3,6 +3,7 @@ import React, { Component } from 'react';
import Card from 'Components/Card'; import Card from 'Components/Card';
import Label from 'Components/Label'; import Label from 'Components/Label';
import ConfirmModal from 'Components/Modal/ConfirmModal'; import ConfirmModal from 'Components/Modal/ConfirmModal';
import TagList from 'Components/TagList';
import { kinds } from 'Helpers/Props'; import { kinds } from 'Helpers/Props';
import formatShortTimeSpan from 'Utilities/Date/formatShortTimeSpan'; import formatShortTimeSpan from 'Utilities/Date/formatShortTimeSpan';
import translate from 'Utilities/String/translate'; import translate from 'Utilities/String/translate';
@ -57,6 +58,8 @@ class ImportList extends Component {
id, id,
name, name,
enableAutomaticAdd, enableAutomaticAdd,
tags,
tagList,
minRefreshInterval minRefreshInterval
} = this.props; } = this.props;
@ -72,16 +75,21 @@ class ImportList extends Component {
<div className={styles.enabled}> <div className={styles.enabled}>
{ {
enableAutomaticAdd && enableAutomaticAdd ?
<Label kind={kinds.SUCCESS}> <Label kind={kinds.SUCCESS}>
{translate('AutomaticAdd')} {translate('AutomaticAdd')}
</Label> </Label> :
null
} }
</div> </div>
<TagList
tags={tags}
tagList={tagList}
/>
<div className={styles.enabled}> <div className={styles.enabled}>
<Label kind={kinds.INFO} title='List Refresh Interval'> <Label kind={kinds.DEFAULT} title='List Refresh Interval'>
{`${translate('Refresh')}: ${formatShortTimeSpan(minRefreshInterval)}`} {`${translate('Refresh')}: ${formatShortTimeSpan(minRefreshInterval)}`}
</Label> </Label>
</div> </div>
@ -111,6 +119,8 @@ ImportList.propTypes = {
id: PropTypes.number.isRequired, id: PropTypes.number.isRequired,
name: PropTypes.string.isRequired, name: PropTypes.string.isRequired,
enableAutomaticAdd: PropTypes.bool.isRequired, enableAutomaticAdd: PropTypes.bool.isRequired,
tags: PropTypes.arrayOf(PropTypes.number).isRequired,
tagList: PropTypes.arrayOf(PropTypes.object).isRequired,
minRefreshInterval: PropTypes.string.isRequired, minRefreshInterval: PropTypes.string.isRequired,
onConfirmDeleteImportList: PropTypes.func.isRequired onConfirmDeleteImportList: PropTypes.func.isRequired
}; };

View File

@ -49,6 +49,7 @@ class ImportLists extends Component {
render() { render() {
const { const {
items, items,
tagList,
onConfirmDeleteImportList, onConfirmDeleteImportList,
...otherProps ...otherProps
} = this.props; } = this.props;
@ -71,6 +72,7 @@ class ImportLists extends Component {
<ImportList <ImportList
key={item.id} key={item.id}
{...item} {...item}
tagList={tagList}
onConfirmDeleteImportList={onConfirmDeleteImportList} onConfirmDeleteImportList={onConfirmDeleteImportList}
/> />
); );
@ -109,6 +111,7 @@ ImportLists.propTypes = {
isFetching: PropTypes.bool.isRequired, isFetching: PropTypes.bool.isRequired,
error: PropTypes.object, error: PropTypes.object,
items: PropTypes.arrayOf(PropTypes.object).isRequired, items: PropTypes.arrayOf(PropTypes.object).isRequired,
tagList: PropTypes.arrayOf(PropTypes.object).isRequired,
onConfirmDeleteImportList: PropTypes.func.isRequired onConfirmDeleteImportList: PropTypes.func.isRequired
}; };

View File

@ -5,13 +5,20 @@ import { createSelector } from 'reselect';
import { fetchRootFolders } from 'Store/Actions/rootFolderActions'; import { fetchRootFolders } from 'Store/Actions/rootFolderActions';
import { deleteImportList, fetchImportLists } from 'Store/Actions/settingsActions'; import { deleteImportList, fetchImportLists } from 'Store/Actions/settingsActions';
import createSortedSectionSelector from 'Store/Selectors/createSortedSectionSelector'; import createSortedSectionSelector from 'Store/Selectors/createSortedSectionSelector';
import createTagsSelector from 'Store/Selectors/createTagsSelector';
import sortByProp from 'Utilities/Array/sortByProp'; import sortByProp from 'Utilities/Array/sortByProp';
import ImportLists from './ImportLists'; import ImportLists from './ImportLists';
function createMapStateToProps() { function createMapStateToProps() {
return createSelector( return createSelector(
createSortedSectionSelector('settings.importLists', sortByProp('name')), createSortedSectionSelector('settings.importLists', sortByProp('name')),
(importLists) => importLists createTagsSelector(),
(importLists, tagList) => {
return {
...importLists,
tagList
};
}
); );
} }