New: Warn if UI won't update due to SignalR errors

pull/4443/head
ta264 5 years ago
parent 6463befc79
commit e52005fa35

@ -120,7 +120,7 @@ class SignalRConnector extends Component {
this.connection.on('receiveMessage', this.onReceiveMessage); this.connection.on('receiveMessage', this.onReceiveMessage);
this.connection.start().then(this.onConnected); this.connection.start().then(this.onStart, this.onStartFail);
} }
componentWillUnmount() { componentWillUnmount() {
@ -242,7 +242,19 @@ class SignalRConnector extends Component {
// //
// Listeners // Listeners
onConnected = () => { onStartFail = (error) => {
console.error('[signalR] failed to connect');
console.error(error);
this.props.dispatchSetAppValue({
isConnected: false,
isReconnecting: false,
isDisconnected: false,
isRestarting: false
});
}
onStart = () => {
console.debug('[signalR] connected'); console.debug('[signalR] connected');
this.props.dispatchSetAppValue({ this.props.dispatchSetAppValue({

@ -0,0 +1,24 @@
import { createSelector } from 'reselect';
function createHealthCheckSelector() {
return createSelector(
(state) => state.system.health,
(state) => state.app,
(health, app) => {
const items = [...health.items];
if (!app.isConnected) {
items.push({
source: 'UI',
type: 'warning',
message: 'Could not connect to SignalR, UI won\'t update',
wikiUrl: 'https://github.com/Radarr/Radarr/wiki/Health-Checks#could-not-connect-to-signalr'
});
}
return items;
}
);
}
export default createHealthCheckSelector;

@ -2,20 +2,21 @@ import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import createHealthCheckSelector from 'Store/Selectors/createHealthCheckSelector';
import { fetchHealth } from 'Store/Actions/systemActions'; import { fetchHealth } from 'Store/Actions/systemActions';
import { testAllDownloadClients, testAllIndexers } from 'Store/Actions/settingsActions'; import { testAllDownloadClients, testAllIndexers } from 'Store/Actions/settingsActions';
import Health from './Health'; import Health from './Health';
function createMapStateToProps() { function createMapStateToProps() {
return createSelector( return createSelector(
createHealthCheckSelector(),
(state) => state.system.health, (state) => state.system.health,
(state) => state.settings.downloadClients.isTestingAll, (state) => state.settings.downloadClients.isTestingAll,
(state) => state.settings.indexers.isTestingAll, (state) => state.settings.indexers.isTestingAll,
(health, isTestingAllDownloadClients, isTestingAllIndexers) => { (items, health, isTestingAllDownloadClients, isTestingAllIndexers) => {
const { const {
isFetching, isFetching,
isPopulated, isPopulated
items
} = health; } = health;
return { return {

@ -2,19 +2,21 @@ import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import createHealthCheckSelector from 'Store/Selectors/createHealthCheckSelector';
import { fetchHealth } from 'Store/Actions/systemActions'; import { fetchHealth } from 'Store/Actions/systemActions';
import PageSidebarStatus from 'Components/Page/Sidebar/PageSidebarStatus'; import PageSidebarStatus from 'Components/Page/Sidebar/PageSidebarStatus';
function createMapStateToProps() { function createMapStateToProps() {
return createSelector( return createSelector(
(state) => state.app, (state) => state.app,
createHealthCheckSelector(),
(state) => state.system.health, (state) => state.system.health,
(app, health) => { (app, items, health) => {
const count = health.items.length; const count = items.length;
let errors = false; let errors = false;
let warnings = false; let warnings = false;
health.items.forEach((item) => { items.forEach((item) => {
if (item.type === 'error') { if (item.type === 'error') {
errors = true; errors = true;
} }

Loading…
Cancel
Save