mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-06 21:12:15 -07:00
Misc UI Updates
This commit is contained in:
parent
1b64171b30
commit
cb9af37c39
6 changed files with 65 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { align, icons } from 'Helpers/Props';
|
import { align, icons } from 'Helpers/Props';
|
||||||
|
import hasDifferentItems from 'Utilities/Object/hasDifferentItems';
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
import Table from 'Components/Table/Table';
|
import Table from 'Components/Table/Table';
|
||||||
import TableBody from 'Components/Table/TableBody';
|
import TableBody from 'Components/Table/TableBody';
|
||||||
|
@ -17,6 +18,27 @@ import HistoryRowConnector from './HistoryRowConnector';
|
||||||
|
|
||||||
class History extends Component {
|
class History extends Component {
|
||||||
|
|
||||||
|
//
|
||||||
|
// Lifecycle
|
||||||
|
|
||||||
|
shouldComponentUpdate(nextProps) {
|
||||||
|
// Don't update when fetching has completed if items have changed,
|
||||||
|
// before albums start fetching or when albums start fetching.
|
||||||
|
|
||||||
|
if (
|
||||||
|
(
|
||||||
|
this.props.isFetching &&
|
||||||
|
nextProps.isPopulated &&
|
||||||
|
hasDifferentItems(this.props.items, nextProps.items)
|
||||||
|
) ||
|
||||||
|
(!this.props.isAlbumsFetching && nextProps.isAlbumsFetching)
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Render
|
// Render
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,24 @@ class Queue extends Component {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shouldComponentUpdate(nextProps) {
|
||||||
|
// Don't update when fetching has completed if items have changed,
|
||||||
|
// before albums start fetching or when albums start fetching.
|
||||||
|
|
||||||
|
if (
|
||||||
|
(
|
||||||
|
this.props.isFetching &&
|
||||||
|
nextProps.isPopulated &&
|
||||||
|
hasDifferentItems(this.props.items, nextProps.items)
|
||||||
|
) ||
|
||||||
|
(!this.props.isAlbumsFetching && nextProps.isAlbumsFetching)
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
componentDidUpdate(prevProps) {
|
||||||
if (hasDifferentItems(prevProps.items, this.props.items)) {
|
if (hasDifferentItems(prevProps.items, this.props.items)) {
|
||||||
this.setState({ selectedState: {} });
|
this.setState({ selectedState: {} });
|
||||||
|
|
|
@ -95,6 +95,7 @@
|
||||||
margin: 5px 10px 5px 0;
|
margin: 5px 10px 5px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.path,
|
||||||
.sizeOnDisk,
|
.sizeOnDisk,
|
||||||
.qualityProfileName,
|
.qualityProfileName,
|
||||||
.links,
|
.links,
|
||||||
|
@ -104,6 +105,12 @@
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.path {
|
||||||
|
vertical-align: text-top;
|
||||||
|
font-size: $defaultFontSize;
|
||||||
|
font-family: $monoSpaceFontFamily;
|
||||||
|
}
|
||||||
|
|
||||||
.contentContainer {
|
.contentContainer {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -347,7 +347,6 @@ class ArtistDetails extends Component {
|
||||||
<div className={styles.detailsLabels}>
|
<div className={styles.detailsLabels}>
|
||||||
<Label
|
<Label
|
||||||
className={styles.detailsLabel}
|
className={styles.detailsLabel}
|
||||||
title={trackFilesCountMessage}
|
|
||||||
size={sizes.LARGE}
|
size={sizes.LARGE}
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon
|
||||||
|
@ -355,7 +354,7 @@ class ArtistDetails extends Component {
|
||||||
size={17}
|
size={17}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<span className={styles.sizeOnDisk}>
|
<span className={styles.path}>
|
||||||
{path}
|
{path}
|
||||||
</span>
|
</span>
|
||||||
</Label>
|
</Label>
|
||||||
|
|
|
@ -56,6 +56,8 @@ function createMapStateToProps() {
|
||||||
return {
|
return {
|
||||||
...artist,
|
...artist,
|
||||||
alternateTitles,
|
alternateTitles,
|
||||||
|
isArtistRefreshing,
|
||||||
|
allArtistRefreshing,
|
||||||
isRefreshing,
|
isRefreshing,
|
||||||
isSearching,
|
isSearching,
|
||||||
isRenamingFiles,
|
isRenamingFiles,
|
||||||
|
@ -94,13 +96,15 @@ class ArtistDetailsConnector extends Component {
|
||||||
componentDidUpdate(prevProps) {
|
componentDidUpdate(prevProps) {
|
||||||
const {
|
const {
|
||||||
id,
|
id,
|
||||||
isRefreshing,
|
isArtistRefreshing,
|
||||||
|
allArtistRefreshing,
|
||||||
isRenamingFiles,
|
isRenamingFiles,
|
||||||
isRenamingArtist
|
isRenamingArtist
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(prevProps.isRefreshing && !isRefreshing) ||
|
(prevProps.isArtistRefreshing && !isArtistRefreshing) ||
|
||||||
|
(prevProps.allArtistRefreshing && !allArtistRefreshing) ||
|
||||||
(prevProps.isRenamingFiles && !isRenamingFiles) ||
|
(prevProps.isRenamingFiles && !isRenamingFiles) ||
|
||||||
(prevProps.isRenamingArtist && !isRenamingArtist)
|
(prevProps.isRenamingArtist && !isRenamingArtist)
|
||||||
) {
|
) {
|
||||||
|
@ -172,6 +176,8 @@ class ArtistDetailsConnector extends Component {
|
||||||
ArtistDetailsConnector.propTypes = {
|
ArtistDetailsConnector.propTypes = {
|
||||||
id: PropTypes.number.isRequired,
|
id: PropTypes.number.isRequired,
|
||||||
nameSlug: PropTypes.string.isRequired,
|
nameSlug: PropTypes.string.isRequired,
|
||||||
|
isArtistRefreshing: PropTypes.bool.isRequired,
|
||||||
|
allArtistRefreshing: PropTypes.bool.isRequired,
|
||||||
isRefreshing: PropTypes.bool.isRequired,
|
isRefreshing: PropTypes.bool.isRequired,
|
||||||
isRenamingFiles: PropTypes.bool.isRequired,
|
isRenamingFiles: PropTypes.bool.isRequired,
|
||||||
isRenamingArtist: PropTypes.bool.isRequired,
|
isRenamingArtist: PropTypes.bool.isRequired,
|
||||||
|
|
|
@ -90,6 +90,12 @@ class SignalRConnector extends Component {
|
||||||
// Control
|
// Control
|
||||||
|
|
||||||
retryConnection = () => {
|
retryConnection = () => {
|
||||||
|
if (this.retryInterval >= 30) {
|
||||||
|
this.setState({
|
||||||
|
isDisconnected: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.retryTimeoutId = setTimeout(() => {
|
this.retryTimeoutId = setTimeout(() => {
|
||||||
this.signalRconnection.start(this.signalRconnectionOptions);
|
this.signalRconnection.start(this.signalRconnectionOptions);
|
||||||
this.retryInterval = Math.min(this.retryInterval + 5, 30);
|
this.retryInterval = Math.min(this.retryInterval + 5, 30);
|
||||||
|
@ -328,8 +334,9 @@ class SignalRConnector extends Component {
|
||||||
|
|
||||||
this.props.setAppValue({
|
this.props.setAppValue({
|
||||||
isConnected: false,
|
isConnected: false,
|
||||||
isReconnecting: true,
|
isReconnecting: true
|
||||||
isDisconnected: true
|
// Don't set isDisconnected yet, it'll be set it if it's disconnected
|
||||||
|
// for ~105 seconds (retry interval reaches 30 seconds)
|
||||||
});
|
});
|
||||||
|
|
||||||
this.retryConnection();
|
this.retryConnection();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue