Appease linter

This commit is contained in:
Mark McDowall 2023-04-11 08:55:51 -07:00
parent 513b746fc3
commit 3b5e83670b
3 changed files with 25 additions and 13 deletions

View File

@ -1,9 +1,9 @@
import { reduce } from 'lodash';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import LoadingIndicator from 'Components/Loading/LoadingIndicator'; import LoadingIndicator from 'Components/Loading/LoadingIndicator';
import PageContent from 'Components/Page/PageContent'; import PageContent from 'Components/Page/PageContent';
import PageContentBody from 'Components/Page/PageContentBody'; import PageContentBody from 'Components/Page/PageContentBody';
import getSelectedIds from 'Utilities/Table/getSelectedIds';
import selectAll from 'Utilities/Table/selectAll'; import selectAll from 'Utilities/Table/selectAll';
import toggleSelected from 'Utilities/Table/toggleSelected'; import toggleSelected from 'Utilities/Table/toggleSelected';
import ImportSeriesFooterConnector from './ImportSeriesFooterConnector'; import ImportSeriesFooterConnector from './ImportSeriesFooterConnector';
@ -31,7 +31,17 @@ class ImportSeries extends Component {
// Listeners // Listeners
getSelectedIds = () => { getSelectedIds = () => {
return getSelectedIds(this.state.selectedState, { parseIds: false }); return reduce(
this.state.selectedState,
(result, value, id) => {
if (value) {
result.push(id);
}
return result;
},
[]
);
}; };
onSelectAllChange = ({ value }) => { onSelectAllChange = ({ value }) => {

View File

@ -23,6 +23,15 @@ import ChangeMonitoringModal from './SeasonPass/ChangeMonitoringModal';
import TagsModal from './Tags/TagsModal'; import TagsModal from './Tags/TagsModal';
import styles from './SeriesIndexSelectFooter.css'; import styles from './SeriesIndexSelectFooter.css';
interface SavePayload {
monitored?: boolean;
qualityProfileId?: number;
seriesType?: string;
seasonFolder?: boolean;
rootFolderPath?: string;
moveFiles?: boolean;
}
const seriesEditorSelector = createSelector( const seriesEditorSelector = createSelector(
(state: AppState) => state.series, (state: AppState) => state.series,
(series) => { (series) => {
@ -74,7 +83,7 @@ function SeriesIndexSelectFooter() {
}, [setIsEditModalOpen]); }, [setIsEditModalOpen]);
const onSavePress = useCallback( const onSavePress = useCallback(
(payload: any) => { (payload: SavePayload) => {
setIsSavingSeries(true); setIsSavingSeries(true);
setIsEditModalOpen(false); setIsEditModalOpen(false);
@ -161,7 +170,6 @@ function SeriesIndexSelectFooter() {
useEffect(() => { useEffect(() => {
if (previousIsDeleting && !isDeleting && !deleteError) { if (previousIsDeleting && !isDeleting && !deleteError) {
selectDispatch({ type: 'unselectAll' }); selectDispatch({ type: 'unselectAll' });
} }
}, [previousIsDeleting, isDeleting, deleteError, selectDispatch]); }, [previousIsDeleting, isDeleting, deleteError, selectDispatch]);

View File

@ -1,18 +1,12 @@
import { reduce } from 'lodash'; import { reduce } from 'lodash';
import { SelectedState } from 'Helpers/Hooks/useSelectState'; import { SelectedState } from 'Helpers/Hooks/useSelectState';
// TODO: This needs to handle string IDs as well function getSelectedIds(selectedState: SelectedState): number[] {
function getSelectedIds(
selectedState: SelectedState,
{ parseIds = true } = {}
): number[] {
return reduce( return reduce(
selectedState, selectedState,
(result: any[], value, id) => { (result: number[], value, id) => {
if (value) { if (value) {
const parsedId = parseIds ? parseInt(id) : id; result.push(parseInt(id));
result.push(parsedId);
} }
return result; return result;