New: Add test all action for apps and download clients to status health

This commit is contained in:
Bogdan
2023-08-05 14:06:05 +03:00
parent 5cbbffb018
commit 765f354c51
3 changed files with 37 additions and 2 deletions

View File

@@ -42,6 +42,25 @@ function getInternalLink(source) {
function getTestLink(source, props) { function getTestLink(source, props) {
switch (source) { switch (source) {
case 'ApplicationStatusCheck':
case 'ApplicationLongTermStatusCheck':
return (
<SpinnerIconButton
name={icons.TEST}
title={translate('TestAll')}
isSpinning={props.isTestingAllApplications}
onPress={props.dispatchTestAllApplications}
/>
);
case 'DownloadClientStatusCheck':
return (
<SpinnerIconButton
name={icons.TEST}
title={translate('TestAll')}
isSpinning={props.isTestingAllDownloadClients}
onPress={props.dispatchTestAllDownloadClients}
/>
);
case 'IndexerStatusCheck': case 'IndexerStatusCheck':
case 'IndexerLongTermStatusCheck': case 'IndexerLongTermStatusCheck':
return ( return (
@@ -52,7 +71,6 @@ function getTestLink(source, props) {
onPress={props.dispatchTestAllIndexers} onPress={props.dispatchTestAllIndexers}
/> />
); );
default: default:
break; break;
} }
@@ -188,7 +206,11 @@ Health.propTypes = {
isFetching: PropTypes.bool.isRequired, isFetching: PropTypes.bool.isRequired,
isPopulated: PropTypes.bool.isRequired, isPopulated: PropTypes.bool.isRequired,
items: PropTypes.array.isRequired, items: PropTypes.array.isRequired,
isTestingAllApplications: PropTypes.bool.isRequired,
isTestingAllDownloadClients: PropTypes.bool.isRequired,
isTestingAllIndexers: PropTypes.bool.isRequired, isTestingAllIndexers: PropTypes.bool.isRequired,
dispatchTestAllApplications: PropTypes.func.isRequired,
dispatchTestAllDownloadClients: PropTypes.func.isRequired,
dispatchTestAllIndexers: PropTypes.func.isRequired dispatchTestAllIndexers: PropTypes.func.isRequired
}; };

View File

@@ -3,6 +3,8 @@ import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import { testAllIndexers } from 'Store/Actions/indexerActions'; import { testAllIndexers } from 'Store/Actions/indexerActions';
import { testAllApplications } from 'Store/Actions/Settings/applications';
import { testAllDownloadClients } from 'Store/Actions/Settings/downloadClients';
import { fetchHealth } from 'Store/Actions/systemActions'; import { fetchHealth } from 'Store/Actions/systemActions';
import createHealthCheckSelector from 'Store/Selectors/createHealthCheckSelector'; import createHealthCheckSelector from 'Store/Selectors/createHealthCheckSelector';
import Health from './Health'; import Health from './Health';
@@ -11,8 +13,10 @@ function createMapStateToProps() {
return createSelector( return createSelector(
createHealthCheckSelector(), createHealthCheckSelector(),
(state) => state.system.health, (state) => state.system.health,
(state) => state.settings.applications.isTestingAll,
(state) => state.settings.downloadClients.isTestingAll,
(state) => state.indexers.isTestingAll, (state) => state.indexers.isTestingAll,
(items, health, isTestingAllIndexers) => { (items, health, isTestingAllApplications, isTestingAllDownloadClients, isTestingAllIndexers) => {
const { const {
isFetching, isFetching,
isPopulated isPopulated
@@ -22,6 +26,8 @@ function createMapStateToProps() {
isFetching, isFetching,
isPopulated, isPopulated,
items, items,
isTestingAllApplications,
isTestingAllDownloadClients,
isTestingAllIndexers isTestingAllIndexers
}; };
} }
@@ -30,6 +36,8 @@ function createMapStateToProps() {
const mapDispatchToProps = { const mapDispatchToProps = {
dispatchFetchHealth: fetchHealth, dispatchFetchHealth: fetchHealth,
dispatchTestAllApplications: testAllApplications,
dispatchTestAllDownloadClients: testAllDownloadClients,
dispatchTestAllIndexers: testAllIndexers dispatchTestAllIndexers: testAllIndexers
}; };

View File

@@ -42,6 +42,11 @@ namespace NzbDrone.Core.Applications
return enabledClients.ToList(); return enabledClients.ToList();
} }
protected override List<ApplicationDefinition> Active()
{
return base.Active().Where(c => c.Enable).ToList();
}
private IEnumerable<IApplication> FilterBlockedApplications(IEnumerable<IApplication> applications) private IEnumerable<IApplication> FilterBlockedApplications(IEnumerable<IApplication> applications)
{ {
var blockedApplications = _applicationStatusService.GetBlockedProviders().ToDictionary(v => v.ProviderId, v => v); var blockedApplications = _applicationStatusService.GetBlockedProviders().ToDictionary(v => v.ProviderId, v => v);