mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-18 16:29:41 +02:00
New: Warn if UI won't update due to SignalR errors
This commit is contained in:
parent
6463befc79
commit
e52005fa35
@ -120,7 +120,7 @@ class SignalRConnector extends Component {
|
||||
|
||||
this.connection.on('receiveMessage', this.onReceiveMessage);
|
||||
|
||||
this.connection.start().then(this.onConnected);
|
||||
this.connection.start().then(this.onStart, this.onStartFail);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
@ -242,7 +242,19 @@ class SignalRConnector extends Component {
|
||||
//
|
||||
// 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');
|
||||
|
||||
this.props.dispatchSetAppValue({
|
||||
|
24
frontend/src/Store/Selectors/createHealthCheckSelector.js
Normal file
24
frontend/src/Store/Selectors/createHealthCheckSelector.js
Normal file
@ -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 { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import createHealthCheckSelector from 'Store/Selectors/createHealthCheckSelector';
|
||||
import { fetchHealth } from 'Store/Actions/systemActions';
|
||||
import { testAllDownloadClients, testAllIndexers } from 'Store/Actions/settingsActions';
|
||||
import Health from './Health';
|
||||
|
||||
function createMapStateToProps() {
|
||||
return createSelector(
|
||||
createHealthCheckSelector(),
|
||||
(state) => state.system.health,
|
||||
(state) => state.settings.downloadClients.isTestingAll,
|
||||
(state) => state.settings.indexers.isTestingAll,
|
||||
(health, isTestingAllDownloadClients, isTestingAllIndexers) => {
|
||||
(items, health, isTestingAllDownloadClients, isTestingAllIndexers) => {
|
||||
const {
|
||||
isFetching,
|
||||
isPopulated,
|
||||
items
|
||||
isPopulated
|
||||
} = health;
|
||||
|
||||
return {
|
||||
|
@ -2,19 +2,21 @@ import PropTypes from 'prop-types';
|
||||
import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import createHealthCheckSelector from 'Store/Selectors/createHealthCheckSelector';
|
||||
import { fetchHealth } from 'Store/Actions/systemActions';
|
||||
import PageSidebarStatus from 'Components/Page/Sidebar/PageSidebarStatus';
|
||||
|
||||
function createMapStateToProps() {
|
||||
return createSelector(
|
||||
(state) => state.app,
|
||||
createHealthCheckSelector(),
|
||||
(state) => state.system.health,
|
||||
(app, health) => {
|
||||
const count = health.items.length;
|
||||
(app, items, health) => {
|
||||
const count = items.length;
|
||||
let errors = false;
|
||||
let warnings = false;
|
||||
|
||||
health.items.forEach((item) => {
|
||||
items.forEach((item) => {
|
||||
if (item.type === 'error') {
|
||||
errors = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user