mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-18 00:09:37 +02:00
New: Limit recent folders in Manual import to 10 and descending order
Closes #3491
This commit is contained in:
parent
6f115d2db3
commit
cf6e993a4d
@ -93,7 +93,7 @@ class InteractiveImportSelectFolderModalContent extends Component {
|
||||
>
|
||||
<TableBody>
|
||||
{
|
||||
recentFolders.map((recentFolder) => {
|
||||
recentFolders.slice(0).reverse().map((recentFolder) => {
|
||||
return (
|
||||
<RecentFolderRow
|
||||
key={recentFolder.folder}
|
||||
|
@ -13,6 +13,8 @@ import { set, update } from './baseActions';
|
||||
|
||||
export const section = 'interactiveImport';
|
||||
|
||||
const MAXIMUM_RECENT_FOLDERS = 10;
|
||||
|
||||
//
|
||||
// State
|
||||
|
||||
@ -155,12 +157,14 @@ export const reducers = createHandleActions({
|
||||
const index = recentFolders.findIndex((r) => r.folder === folder);
|
||||
|
||||
if (index > -1) {
|
||||
recentFolders.splice(index, 1, recentFolder);
|
||||
} else {
|
||||
recentFolders.push(recentFolder);
|
||||
recentFolders.splice(index, 1);
|
||||
}
|
||||
|
||||
return Object.assign({}, state, { recentFolders });
|
||||
recentFolders.push(recentFolder);
|
||||
|
||||
const sliceIndex = Math.max(recentFolders.length - MAXIMUM_RECENT_FOLDERS, 0);
|
||||
|
||||
return Object.assign({}, state, { recentFolders: recentFolders.slice(sliceIndex) });
|
||||
},
|
||||
|
||||
[REMOVE_RECENT_FOLDER]: function(state, { payload }) {
|
||||
|
Loading…
Reference in New Issue
Block a user