mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-08 05:51:47 -07:00
New: Ability to test all Indexers, Lists, Clients
Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
This commit is contained in:
parent
6103afcc09
commit
029a0e4e20
17 changed files with 304 additions and 48 deletions
|
@ -3,7 +3,8 @@ import React, { Component } from 'react';
|
|||
import titleCase from 'Utilities/String/titleCase';
|
||||
import { icons, kinds } from 'Helpers/Props';
|
||||
import Icon from 'Components/Icon';
|
||||
import Link from 'Components/Link/Link';
|
||||
import IconButton from 'Components/Link/IconButton';
|
||||
import SpinnerIconButton from 'Components/Link/SpinnerIconButton';
|
||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||
import FieldSet from 'Components/FieldSet';
|
||||
import Table from 'Components/Table/Table';
|
||||
|
@ -18,36 +19,68 @@ function getInternalLink(source) {
|
|||
case 'IndexerSearchCheck':
|
||||
case 'IndexerStatusCheck':
|
||||
return (
|
||||
<Link to="/settings/indexers">
|
||||
Settings
|
||||
</Link>
|
||||
<IconButton
|
||||
name={icons.SETTINGS}
|
||||
title="Settings"
|
||||
to="/settings/indexers"
|
||||
/>
|
||||
);
|
||||
case 'DownloadClientCheck':
|
||||
case 'ImportMechanismCheck':
|
||||
return (
|
||||
<Link to="/settings/downloadclients">
|
||||
Settings
|
||||
</Link>
|
||||
<IconButton
|
||||
name={icons.SETTINGS}
|
||||
title="Settings"
|
||||
to="/settings/downloadclients"
|
||||
/>
|
||||
);
|
||||
case 'RootFolderCheck':
|
||||
return (
|
||||
<div>
|
||||
<Link to="/artisteditor">
|
||||
Artist Editor
|
||||
</Link>
|
||||
</div>
|
||||
<IconButton
|
||||
name={icons.ARTIST}
|
||||
title="Artist Editor"
|
||||
to="/artisteditor"
|
||||
/>
|
||||
);
|
||||
case 'UpdateCheck':
|
||||
return (
|
||||
<Link to="/system/updates">
|
||||
Updates
|
||||
</Link>
|
||||
<IconButton
|
||||
name={icons.UPDATE}
|
||||
title="Updates"
|
||||
to="/system/updates"
|
||||
/>
|
||||
);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function getTestLink(source, props) {
|
||||
switch (source) {
|
||||
case 'IndexerStatusCheck':
|
||||
return (
|
||||
<SpinnerIconButton
|
||||
name={icons.TEST}
|
||||
title="Test All"
|
||||
isSpinning={props.isTestingAllIndexers}
|
||||
onPress={props.dispatchTestAllIndexers}
|
||||
/>
|
||||
);
|
||||
case 'DownloadClientCheck':
|
||||
return (
|
||||
<SpinnerIconButton
|
||||
name={icons.TEST}
|
||||
title="Test All"
|
||||
isSpinning={props.isTestingAllDownloadClients}
|
||||
onPress={props.dispatchTestAllDownloadClients}
|
||||
/>
|
||||
);
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const columns = [
|
||||
{
|
||||
className: styles.status,
|
||||
|
@ -60,12 +93,8 @@ const columns = [
|
|||
isVisible: true
|
||||
},
|
||||
{
|
||||
name: 'wikiLink',
|
||||
label: 'Wiki',
|
||||
isVisible: true
|
||||
},
|
||||
{
|
||||
name: 'internalLink',
|
||||
name: 'actions',
|
||||
label: 'Actions',
|
||||
isVisible: true
|
||||
}
|
||||
];
|
||||
|
@ -121,6 +150,7 @@ class Health extends Component {
|
|||
{
|
||||
items.map((item) => {
|
||||
const internalLink = getInternalLink(item.source);
|
||||
const testLink = getTestLink(item.source, this.props);
|
||||
|
||||
return (
|
||||
<TableRow key={`health${item.message}`}>
|
||||
|
@ -135,18 +165,20 @@ class Health extends Component {
|
|||
<TableRowCell>{item.message}</TableRowCell>
|
||||
|
||||
<TableRowCell>
|
||||
<Link
|
||||
<IconButton
|
||||
name={icons.WIKI}
|
||||
to={item.wikiUrl}
|
||||
title="Read the Wiki for more information"
|
||||
>
|
||||
Wiki
|
||||
</Link>
|
||||
</TableRowCell>
|
||||
/>
|
||||
|
||||
<TableRowCell>
|
||||
{
|
||||
internalLink
|
||||
}
|
||||
|
||||
{
|
||||
!!testLink &&
|
||||
testLink
|
||||
}
|
||||
</TableRowCell>
|
||||
</TableRow>
|
||||
);
|
||||
|
@ -164,7 +196,11 @@ class Health extends Component {
|
|||
Health.propTypes = {
|
||||
isFetching: PropTypes.bool.isRequired,
|
||||
isPopulated: PropTypes.bool.isRequired,
|
||||
items: PropTypes.array.isRequired
|
||||
items: PropTypes.array.isRequired,
|
||||
isTestingAllDownloadClients: PropTypes.bool.isRequired,
|
||||
isTestingAllIndexers: PropTypes.bool.isRequired,
|
||||
dispatchTestAllDownloadClients: PropTypes.func.isRequired,
|
||||
dispatchTestAllIndexers: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default Health;
|
||||
|
|
|
@ -3,12 +3,15 @@ import React, { Component } from 'react';
|
|||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import { fetchHealth } from 'Store/Actions/systemActions';
|
||||
import { testAllDownloadClients, testAllIndexers } from 'Store/Actions/settingsActions';
|
||||
import Health from './Health';
|
||||
|
||||
function createMapStateToProps() {
|
||||
return createSelector(
|
||||
(state) => state.system.health,
|
||||
(health) => {
|
||||
(state) => state.settings.downloadClients.isTestingAll,
|
||||
(state) => state.settings.indexers.isTestingAll,
|
||||
(health, isTestingAllDownloadClients, isTestingAllIndexers) => {
|
||||
const {
|
||||
isFetching,
|
||||
isPopulated,
|
||||
|
@ -18,14 +21,18 @@ function createMapStateToProps() {
|
|||
return {
|
||||
isFetching,
|
||||
isPopulated,
|
||||
items
|
||||
items,
|
||||
isTestingAllDownloadClients,
|
||||
isTestingAllIndexers
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
const mapDispatchToProps = {
|
||||
fetchHealth
|
||||
dispatchFetchHealth: fetchHealth,
|
||||
dispatchTestAllDownloadClients: testAllDownloadClients,
|
||||
dispatchTestAllIndexers: testAllIndexers
|
||||
};
|
||||
|
||||
class HealthConnector extends Component {
|
||||
|
@ -34,23 +41,28 @@ class HealthConnector extends Component {
|
|||
// Lifecycle
|
||||
|
||||
componentDidMount() {
|
||||
this.props.fetchHealth();
|
||||
this.props.dispatchFetchHealth();
|
||||
}
|
||||
|
||||
//
|
||||
// Render
|
||||
|
||||
render() {
|
||||
const {
|
||||
dispatchFetchHealth,
|
||||
...otherProps
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<Health
|
||||
{...this.props}
|
||||
{...otherProps}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
HealthConnector.propTypes = {
|
||||
fetchHealth: PropTypes.func.isRequired
|
||||
dispatchFetchHealth: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default connect(createMapStateToProps, mapDispatchToProps)(HealthConnector);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue