diff --git a/frontend/src/Components/SignalRConnector.js b/frontend/src/Components/SignalRConnector.js index 9e5bc8277..c4766d149 100644 --- a/frontend/src/Components/SignalRConnector.js +++ b/frontend/src/Components/SignalRConnector.js @@ -7,6 +7,7 @@ import { setAppValue, setVersion } from 'Store/Actions/appActions'; import { removeItem, update, updateItem } from 'Store/Actions/baseActions'; import { fetchCommands, finishCommand, updateCommand } from 'Store/Actions/commandActions'; import { fetchIndexers } from 'Store/Actions/indexerActions'; +import { fetchIndexerStatus } from 'Store/Actions/indexerStatusActions'; import { fetchHealth } from 'Store/Actions/systemActions'; import { fetchTagDetails, fetchTags } from 'Store/Actions/tagActions'; import { repopulatePage } from 'Utilities/pagePopulator'; @@ -43,6 +44,7 @@ const mapDispatchToProps = { dispatchRemoveItem: removeItem, dispatchFetchHealth: fetchHealth, dispatchFetchIndexers: fetchIndexers, + dispatchFetchIndexerStatus: fetchIndexerStatus, dispatchFetchTags: fetchTags, dispatchFetchTagDetails: fetchTagDetails }; @@ -162,6 +164,10 @@ class SignalRConnector extends Component { this.props.dispatchFetchHealth(); } + handleIndexerstatus = () => { + this.props.dispatchFetchIndexerStatus(); + } + handleMovie = (body) => { const action = body.action; const section = 'movies'; @@ -274,6 +280,7 @@ SignalRConnector.propTypes = { dispatchRemoveItem: PropTypes.func.isRequired, dispatchFetchHealth: PropTypes.func.isRequired, dispatchFetchIndexers: PropTypes.func.isRequired, + dispatchFetchIndexerStatus: PropTypes.func.isRequired, dispatchFetchTags: PropTypes.func.isRequired, dispatchFetchTagDetails: PropTypes.func.isRequired }; diff --git a/src/Prowlarr.Api.V1/Indexers/IndexerStatusModule.cs b/src/Prowlarr.Api.V1/Indexers/IndexerStatusModule.cs index 017a107c1..dcfb8ab3c 100644 --- a/src/Prowlarr.Api.V1/Indexers/IndexerStatusModule.cs +++ b/src/Prowlarr.Api.V1/Indexers/IndexerStatusModule.cs @@ -1,14 +1,20 @@ using System.Collections.Generic; +using NzbDrone.Core.Datastore.Events; using NzbDrone.Core.Indexers; +using NzbDrone.Core.Messaging.Events; +using NzbDrone.Core.ThingiProvider.Events; +using NzbDrone.SignalR; using Prowlarr.Http; namespace Prowlarr.Api.V1.Indexers { - public class IndexerStatusModule : ProwlarrRestModule + public class IndexerStatusModule : ProwlarrRestModuleWithSignalR, + IHandle> { private readonly IIndexerStatusService _indexerStatusService; - public IndexerStatusModule(IIndexerStatusService indexerStatusService) + public IndexerStatusModule(IBroadcastSignalRMessage signalRBroadcaster, IIndexerStatusService indexerStatusService) + : base(signalRBroadcaster) { _indexerStatusService = indexerStatusService; @@ -19,5 +25,10 @@ namespace Prowlarr.Api.V1.Indexers { return _indexerStatusService.GetBlockedProviders().ToResource(); } + + public void Handle(ProviderStatusChangedEvent message) + { + BroadcastResourceChange(ModelAction.Sync); + } } }