|
|
@ -3,7 +3,7 @@ import React, { Component } from 'react';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { withRouter } from 'react-router-dom';
|
|
|
|
import { withRouter } from 'react-router-dom';
|
|
|
|
import { createSelector } from 'reselect';
|
|
|
|
import { createSelector } from 'reselect';
|
|
|
|
import { saveDimensions, setIsSidebarVisible } from 'Store/Actions/appActions';
|
|
|
|
import { fetchTranslations, saveDimensions, setIsSidebarVisible } from 'Store/Actions/appActions';
|
|
|
|
import { fetchArtist } from 'Store/Actions/artistActions';
|
|
|
|
import { fetchArtist } from 'Store/Actions/artistActions';
|
|
|
|
import { fetchCustomFilters } from 'Store/Actions/customFilterActions';
|
|
|
|
import { fetchCustomFilters } from 'Store/Actions/customFilterActions';
|
|
|
|
import { fetchImportLists, fetchLanguages, fetchMetadataProfiles, fetchQualityProfiles, fetchUISettings } from 'Store/Actions/settingsActions';
|
|
|
|
import { fetchImportLists, fetchLanguages, fetchMetadataProfiles, fetchQualityProfiles, fetchUISettings } from 'Store/Actions/settingsActions';
|
|
|
@ -51,6 +51,7 @@ const selectIsPopulated = createSelector(
|
|
|
|
(state) => state.settings.metadataProfiles.isPopulated,
|
|
|
|
(state) => state.settings.metadataProfiles.isPopulated,
|
|
|
|
(state) => state.settings.importLists.isPopulated,
|
|
|
|
(state) => state.settings.importLists.isPopulated,
|
|
|
|
(state) => state.system.status.isPopulated,
|
|
|
|
(state) => state.system.status.isPopulated,
|
|
|
|
|
|
|
|
(state) => state.app.translations.isPopulated,
|
|
|
|
(
|
|
|
|
(
|
|
|
|
customFiltersIsPopulated,
|
|
|
|
customFiltersIsPopulated,
|
|
|
|
tagsIsPopulated,
|
|
|
|
tagsIsPopulated,
|
|
|
@ -59,7 +60,8 @@ const selectIsPopulated = createSelector(
|
|
|
|
qualityProfilesIsPopulated,
|
|
|
|
qualityProfilesIsPopulated,
|
|
|
|
metadataProfilesIsPopulated,
|
|
|
|
metadataProfilesIsPopulated,
|
|
|
|
importListsIsPopulated,
|
|
|
|
importListsIsPopulated,
|
|
|
|
systemStatusIsPopulated
|
|
|
|
systemStatusIsPopulated,
|
|
|
|
|
|
|
|
translationsIsPopulated
|
|
|
|
) => {
|
|
|
|
) => {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
customFiltersIsPopulated &&
|
|
|
|
customFiltersIsPopulated &&
|
|
|
@ -69,7 +71,8 @@ const selectIsPopulated = createSelector(
|
|
|
|
qualityProfilesIsPopulated &&
|
|
|
|
qualityProfilesIsPopulated &&
|
|
|
|
metadataProfilesIsPopulated &&
|
|
|
|
metadataProfilesIsPopulated &&
|
|
|
|
importListsIsPopulated &&
|
|
|
|
importListsIsPopulated &&
|
|
|
|
systemStatusIsPopulated
|
|
|
|
systemStatusIsPopulated &&
|
|
|
|
|
|
|
|
translationsIsPopulated
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -83,6 +86,7 @@ const selectErrors = createSelector(
|
|
|
|
(state) => state.settings.metadataProfiles.error,
|
|
|
|
(state) => state.settings.metadataProfiles.error,
|
|
|
|
(state) => state.settings.importLists.error,
|
|
|
|
(state) => state.settings.importLists.error,
|
|
|
|
(state) => state.system.status.error,
|
|
|
|
(state) => state.system.status.error,
|
|
|
|
|
|
|
|
(state) => state.app.translations.error,
|
|
|
|
(
|
|
|
|
(
|
|
|
|
customFiltersError,
|
|
|
|
customFiltersError,
|
|
|
|
tagsError,
|
|
|
|
tagsError,
|
|
|
@ -91,7 +95,8 @@ const selectErrors = createSelector(
|
|
|
|
qualityProfilesError,
|
|
|
|
qualityProfilesError,
|
|
|
|
metadataProfilesError,
|
|
|
|
metadataProfilesError,
|
|
|
|
importListsError,
|
|
|
|
importListsError,
|
|
|
|
systemStatusError
|
|
|
|
systemStatusError,
|
|
|
|
|
|
|
|
translationsError
|
|
|
|
) => {
|
|
|
|
) => {
|
|
|
|
const hasError = !!(
|
|
|
|
const hasError = !!(
|
|
|
|
customFiltersError ||
|
|
|
|
customFiltersError ||
|
|
|
@ -101,7 +106,8 @@ const selectErrors = createSelector(
|
|
|
|
qualityProfilesError ||
|
|
|
|
qualityProfilesError ||
|
|
|
|
metadataProfilesError ||
|
|
|
|
metadataProfilesError ||
|
|
|
|
importListsError ||
|
|
|
|
importListsError ||
|
|
|
|
systemStatusError
|
|
|
|
systemStatusError ||
|
|
|
|
|
|
|
|
translationsError
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
@ -113,7 +119,8 @@ const selectErrors = createSelector(
|
|
|
|
qualityProfilesError,
|
|
|
|
qualityProfilesError,
|
|
|
|
metadataProfilesError,
|
|
|
|
metadataProfilesError,
|
|
|
|
importListsError,
|
|
|
|
importListsError,
|
|
|
|
systemStatusError
|
|
|
|
systemStatusError,
|
|
|
|
|
|
|
|
translationsError
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -172,6 +179,9 @@ function createMapDispatchToProps(dispatch, props) {
|
|
|
|
dispatchFetchStatus() {
|
|
|
|
dispatchFetchStatus() {
|
|
|
|
dispatch(fetchStatus());
|
|
|
|
dispatch(fetchStatus());
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
dispatchFetchTranslations() {
|
|
|
|
|
|
|
|
dispatch(fetchTranslations());
|
|
|
|
|
|
|
|
},
|
|
|
|
onResize(dimensions) {
|
|
|
|
onResize(dimensions) {
|
|
|
|
dispatch(saveDimensions(dimensions));
|
|
|
|
dispatch(saveDimensions(dimensions));
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -205,6 +215,7 @@ class PageConnector extends Component {
|
|
|
|
this.props.dispatchFetchImportLists();
|
|
|
|
this.props.dispatchFetchImportLists();
|
|
|
|
this.props.dispatchFetchUISettings();
|
|
|
|
this.props.dispatchFetchUISettings();
|
|
|
|
this.props.dispatchFetchStatus();
|
|
|
|
this.props.dispatchFetchStatus();
|
|
|
|
|
|
|
|
this.props.dispatchFetchTranslations();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -220,7 +231,6 @@ class PageConnector extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
const {
|
|
|
|
hasTranslationsError,
|
|
|
|
|
|
|
|
isPopulated,
|
|
|
|
isPopulated,
|
|
|
|
hasError,
|
|
|
|
hasError,
|
|
|
|
dispatchFetchArtist,
|
|
|
|
dispatchFetchArtist,
|
|
|
@ -231,15 +241,15 @@ class PageConnector extends Component {
|
|
|
|
dispatchFetchImportLists,
|
|
|
|
dispatchFetchImportLists,
|
|
|
|
dispatchFetchUISettings,
|
|
|
|
dispatchFetchUISettings,
|
|
|
|
dispatchFetchStatus,
|
|
|
|
dispatchFetchStatus,
|
|
|
|
|
|
|
|
dispatchFetchTranslations,
|
|
|
|
...otherProps
|
|
|
|
...otherProps
|
|
|
|
} = this.props;
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
|
|
|
|
if (hasTranslationsError || hasError || !this.state.isLocalStorageSupported) {
|
|
|
|
if (hasError || !this.state.isLocalStorageSupported) {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<ErrorPage
|
|
|
|
<ErrorPage
|
|
|
|
{...this.state}
|
|
|
|
{...this.state}
|
|
|
|
{...otherProps}
|
|
|
|
{...otherProps}
|
|
|
|
hasTranslationsError={hasTranslationsError}
|
|
|
|
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -260,7 +270,6 @@ class PageConnector extends Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PageConnector.propTypes = {
|
|
|
|
PageConnector.propTypes = {
|
|
|
|
hasTranslationsError: PropTypes.bool.isRequired,
|
|
|
|
|
|
|
|
isPopulated: PropTypes.bool.isRequired,
|
|
|
|
isPopulated: PropTypes.bool.isRequired,
|
|
|
|
hasError: PropTypes.bool.isRequired,
|
|
|
|
hasError: PropTypes.bool.isRequired,
|
|
|
|
isSidebarVisible: PropTypes.bool.isRequired,
|
|
|
|
isSidebarVisible: PropTypes.bool.isRequired,
|
|
|
@ -273,6 +282,7 @@ PageConnector.propTypes = {
|
|
|
|
dispatchFetchImportLists: PropTypes.func.isRequired,
|
|
|
|
dispatchFetchImportLists: PropTypes.func.isRequired,
|
|
|
|
dispatchFetchUISettings: PropTypes.func.isRequired,
|
|
|
|
dispatchFetchUISettings: PropTypes.func.isRequired,
|
|
|
|
dispatchFetchStatus: PropTypes.func.isRequired,
|
|
|
|
dispatchFetchStatus: PropTypes.func.isRequired,
|
|
|
|
|
|
|
|
dispatchFetchTranslations: PropTypes.func.isRequired,
|
|
|
|
onSidebarVisibleChange: PropTypes.func.isRequired
|
|
|
|
onSidebarVisibleChange: PropTypes.func.isRequired
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|