New: Rewrite Indexer Flags Implementation

This commit is contained in:
Qstick
2021-05-21 00:25:46 -04:00
parent cebdcd6065
commit dd66d7845c
18 changed files with 127 additions and 142 deletions

View File

@@ -7,7 +7,7 @@ import { saveDimensions, setIsSidebarVisible } from 'Store/Actions/appActions';
import { fetchCustomFilters } from 'Store/Actions/customFilterActions';
import { fetchIndexers } from 'Store/Actions/indexerActions';
import { fetchIndexerStatus } from 'Store/Actions/indexerStatusActions';
import { fetchGeneralSettings, fetchIndexerCategories, fetchIndexerFlags, fetchLanguages, fetchUISettings } from 'Store/Actions/settingsActions';
import { fetchGeneralSettings, fetchIndexerCategories, fetchLanguages, fetchUISettings } from 'Store/Actions/settingsActions';
import { fetchStatus } from 'Store/Actions/systemActions';
import { fetchTags } from 'Store/Actions/tagActions';
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
@@ -52,7 +52,6 @@ const selectIsPopulated = createSelector(
(state) => state.indexers.isPopulated,
(state) => state.indexerStatus.isPopulated,
(state) => state.settings.indexerCategories.isPopulated,
(state) => state.settings.indexerFlags.isPopulated,
(state) => state.system.status.isPopulated,
(
customFiltersIsPopulated,
@@ -63,7 +62,6 @@ const selectIsPopulated = createSelector(
indexersIsPopulated,
indexerStatusIsPopulated,
indexerCategoriesIsPopulated,
indexerFlagsIsPopulated,
systemStatusIsPopulated
) => {
return (
@@ -75,7 +73,6 @@ const selectIsPopulated = createSelector(
indexersIsPopulated &&
indexerStatusIsPopulated &&
indexerCategoriesIsPopulated &&
indexerFlagsIsPopulated &&
systemStatusIsPopulated
);
}
@@ -90,7 +87,6 @@ const selectErrors = createSelector(
(state) => state.indexers.error,
(state) => state.indexerStatus.error,
(state) => state.settings.indexerCategories.error,
(state) => state.settings.indexerFlags.error,
(state) => state.system.status.error,
(
customFiltersError,
@@ -101,7 +97,6 @@ const selectErrors = createSelector(
indexersError,
indexerStatusError,
indexerCategoriesError,
indexerFlagsError,
systemStatusError
) => {
const hasError = !!(
@@ -113,7 +108,6 @@ const selectErrors = createSelector(
indexersError ||
indexerStatusError ||
indexerCategoriesError ||
indexerFlagsError ||
systemStatusError
);
@@ -127,7 +121,6 @@ const selectErrors = createSelector(
indexersError,
indexerStatusError,
indexerCategoriesError,
indexerFlagsError,
systemStatusError
};
}
@@ -178,9 +171,6 @@ function createMapDispatchToProps(dispatch, props) {
dispatchFetchIndexerCategories() {
dispatch(fetchIndexerCategories());
},
dispatchFetchIndexerFlags() {
dispatch(fetchIndexerFlags());
},
dispatchFetchUISettings() {
dispatch(fetchUISettings());
},
@@ -220,7 +210,6 @@ class PageConnector extends Component {
this.props.dispatchFetchIndexers();
this.props.dispatchFetchIndexerStatus();
this.props.dispatchFetchIndexerCategories();
this.props.dispatchFetchIndexerFlags();
this.props.dispatchFetchUISettings();
this.props.dispatchFetchGeneralSettings();
this.props.dispatchFetchStatus();
@@ -246,7 +235,6 @@ class PageConnector extends Component {
dispatchFetchIndexers,
dispatchFetchIndexerStatus,
dispatchFetchIndexerCategories,
dispatchFetchIndexerFlags,
dispatchFetchUISettings,
dispatchFetchGeneralSettings,
dispatchFetchStatus,
@@ -287,7 +275,6 @@ PageConnector.propTypes = {
dispatchFetchIndexers: PropTypes.func.isRequired,
dispatchFetchIndexerStatus: PropTypes.func.isRequired,
dispatchFetchIndexerCategories: PropTypes.func.isRequired,
dispatchFetchIndexerFlags: PropTypes.func.isRequired,
dispatchFetchUISettings: PropTypes.func.isRequired,
dispatchFetchGeneralSettings: PropTypes.func.isRequired,
dispatchFetchStatus: PropTypes.func.isRequired,

View File

@@ -10,6 +10,7 @@ import { icons, kinds, tooltipPositions } from 'Helpers/Props';
import formatDateTime from 'Utilities/Date/formatDateTime';
import formatAge from 'Utilities/Number/formatAge';
import formatBytes from 'Utilities/Number/formatBytes';
import titleCase from 'Utilities/String/titleCase';
import translate from 'Utilities/String/translate';
import CategoryLabel from './CategoryLabel';
import Peers from './Peers';
@@ -249,7 +250,7 @@ class SearchIndexRow extends Component {
indexerFlags.map((flag, index) => {
return (
<li key={index}>
{flag}
{titleCase(flag)}
</li>
);
})

View File

@@ -1,48 +0,0 @@
import createFetchHandler from 'Store/Actions/Creators/createFetchHandler';
import { createThunk } from 'Store/thunks';
//
// Variables
const section = 'settings.indexerFlags';
//
// Actions Types
export const FETCH_INDEXER_FLAGS = 'settings/indexerFlags/fetchIndexerFlags';
//
// Action Creators
export const fetchIndexerFlags = createThunk(FETCH_INDEXER_FLAGS);
//
// Details
export default {
//
// State
defaultState: {
isFetching: false,
isPopulated: false,
error: null,
items: []
},
//
// Action Handlers
actionHandlers: {
[FETCH_INDEXER_FLAGS]: createFetchHandler(section, '/indexerFlag')
},
//
// Reducers
reducers: {
}
};

View File

@@ -6,7 +6,6 @@ import development from './Settings/development';
import downloadClients from './Settings/downloadClients';
import general from './Settings/general';
import indexerCategories from './Settings/indexerCategories';
import indexerFlags from './Settings/indexerFlags';
import languages from './Settings/languages';
import notifications from './Settings/notifications';
import ui from './Settings/ui';
@@ -14,7 +13,6 @@ import ui from './Settings/ui';
export * from './Settings/downloadClients';
export * from './Settings/general';
export * from './Settings/indexerCategories';
export * from './Settings/indexerFlags';
export * from './Settings/languages';
export * from './Settings/notifications';
export * from './Settings/applications';
@@ -35,7 +33,6 @@ export const defaultState = {
downloadClients: downloadClients.defaultState,
general: general.defaultState,
indexerCategories: indexerCategories.defaultState,
indexerFlags: indexerFlags.defaultState,
languages: languages.defaultState,
notifications: notifications.defaultState,
applications: applications.defaultState,
@@ -64,7 +61,6 @@ export const actionHandlers = handleThunks({
...downloadClients.actionHandlers,
...general.actionHandlers,
...indexerCategories.actionHandlers,
...indexerFlags.actionHandlers,
...languages.actionHandlers,
...notifications.actionHandlers,
...applications.actionHandlers,
@@ -84,7 +80,6 @@ export const reducers = createHandleActions({
...downloadClients.reducers,
...general.reducers,
...indexerCategories.reducers,
...indexerFlags.reducers,
...languages.reducers,
...notifications.reducers,
...applications.reducers,