1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2025-01-03 05:35:29 +00:00

New: Reactive search button on Wanted pages

Closes #7449
This commit is contained in:
Stevie Robinson 2024-12-09 04:36:10 +01:00 committed by GitHub
parent 6c231cbe6a
commit e8c3aa20bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 18 additions and 31 deletions

View file

@ -153,12 +153,15 @@ class CutoffUnmet extends Component {
<PageToolbar> <PageToolbar>
<PageToolbarSection> <PageToolbarSection>
<PageToolbarButton <PageToolbarButton
label={translate('SearchSelected')} label={itemsSelected ? translate('SearchSelected') : translate('SearchAll')}
iconName={icons.SEARCH} iconName={icons.SEARCH}
isDisabled={!itemsSelected || isSearchingForCutoffUnmetEpisodes} isDisabled={isSearchingForCutoffUnmetEpisodes}
onPress={this.onSearchSelectedPress} isSpinning={isSearchingForCutoffUnmetEpisodes}
onPress={itemsSelected ? this.onSearchSelectedPress : this.onSearchAllCutoffUnmetPress}
/> />
<PageToolbarSeparator />
<PageToolbarButton <PageToolbarButton
label={isShowingMonitored ? translate('UnmonitorSelected') : translate('MonitorSelected')} label={isShowingMonitored ? translate('UnmonitorSelected') : translate('MonitorSelected')}
iconName={icons.MONITORED} iconName={icons.MONITORED}
@ -167,17 +170,6 @@ class CutoffUnmet extends Component {
onPress={this.onToggleSelectedPress} onPress={this.onToggleSelectedPress}
/> />
<PageToolbarSeparator />
<PageToolbarButton
label={translate('SearchAll')}
iconName={icons.SEARCH}
isDisabled={!items.length}
isSpinning={isSearchingForCutoffUnmetEpisodes}
onPress={this.onSearchAllCutoffUnmetPress}
/>
<PageToolbarSeparator />
</PageToolbarSection> </PageToolbarSection>
<PageToolbarSection alignContent={align.RIGHT}> <PageToolbarSection alignContent={align.RIGHT}>

View file

@ -18,9 +18,10 @@ function createMapStateToProps() {
return createSelector( return createSelector(
(state) => state.wanted.cutoffUnmet, (state) => state.wanted.cutoffUnmet,
createCommandExecutingSelector(commandNames.CUTOFF_UNMET_EPISODE_SEARCH), createCommandExecutingSelector(commandNames.CUTOFF_UNMET_EPISODE_SEARCH),
(cutoffUnmet, isSearchingForCutoffUnmetEpisodes) => { createCommandExecutingSelector(commandNames.EPISODE_SEARCH),
(cutoffUnmet, isSearchingForAllCutoffUnmetEpisodes, isSearchingForSelectedCutoffUnmetEpisodes) => {
return { return {
isSearchingForCutoffUnmetEpisodes, isSearchingForCutoffUnmetEpisodes: isSearchingForAllCutoffUnmetEpisodes || isSearchingForSelectedCutoffUnmetEpisodes,
isSaving: cutoffUnmet.items.filter((m) => m.isSaving).length > 1, isSaving: cutoffUnmet.items.filter((m) => m.isSaving).length > 1,
...cutoffUnmet ...cutoffUnmet
}; };

View file

@ -159,12 +159,15 @@ class Missing extends Component {
<PageToolbar> <PageToolbar>
<PageToolbarSection> <PageToolbarSection>
<PageToolbarButton <PageToolbarButton
label={translate('SearchSelected')} label={itemsSelected ? translate('SearchSelected') : translate('SearchAll')}
iconName={icons.SEARCH} iconName={icons.SEARCH}
isDisabled={!itemsSelected || isSearchingForMissingEpisodes} isSpinning={isSearchingForMissingEpisodes}
onPress={this.onSearchSelectedPress} isDisabled={isSearchingForMissingEpisodes}
onPress={itemsSelected ? this.onSearchSelectedPress : this.onSearchAllMissingPress}
/> />
<PageToolbarSeparator />
<PageToolbarButton <PageToolbarButton
label={isShowingMonitored ? translate('UnmonitorSelected') : translate('MonitorSelected')} label={isShowingMonitored ? translate('UnmonitorSelected') : translate('MonitorSelected')}
iconName={icons.MONITORED} iconName={icons.MONITORED}
@ -175,16 +178,6 @@ class Missing extends Component {
<PageToolbarSeparator /> <PageToolbarSeparator />
<PageToolbarButton
label={translate('SearchAll')}
iconName={icons.SEARCH}
isDisabled={!items.length}
isSpinning={isSearchingForMissingEpisodes}
onPress={this.onSearchAllMissingPress}
/>
<PageToolbarSeparator />
<PageToolbarButton <PageToolbarButton
label={translate('ManualImport')} label={translate('ManualImport')}
iconName={icons.INTERACTIVE} iconName={icons.INTERACTIVE}

View file

@ -17,9 +17,10 @@ function createMapStateToProps() {
return createSelector( return createSelector(
(state) => state.wanted.missing, (state) => state.wanted.missing,
createCommandExecutingSelector(commandNames.MISSING_EPISODE_SEARCH), createCommandExecutingSelector(commandNames.MISSING_EPISODE_SEARCH),
(missing, isSearchingForMissingEpisodes) => { createCommandExecutingSelector(commandNames.EPISODE_SEARCH),
(missing, isSearchingForAllMissingEpisodes, isSearchingForSelectedMissingEpisodes) => {
return { return {
isSearchingForMissingEpisodes, isSearchingForMissingEpisodes: isSearchingForAllMissingEpisodes || isSearchingForSelectedMissingEpisodes,
isSaving: missing.items.filter((m) => m.isSaving).length > 1, isSaving: missing.items.filter((m) => m.isSaving).length > 1,
...missing ...missing
}; };