|
|
|
@ -4,8 +4,12 @@ import FieldSet from 'Components/FieldSet';
|
|
|
|
|
import Icon from 'Components/Icon';
|
|
|
|
|
import Link from 'Components/Link/Link';
|
|
|
|
|
import PageSectionContent from 'Components/Page/PageSectionContent';
|
|
|
|
|
import Table from 'Components/Table/Table';
|
|
|
|
|
import TableBody from 'Components/Table/TableBody';
|
|
|
|
|
import { icons } from 'Helpers/Props';
|
|
|
|
|
import translate from 'Utilities/String/translate';
|
|
|
|
|
import selectAll from 'Utilities/Table/selectAll';
|
|
|
|
|
import toggleSelected from 'Utilities/Table/toggleSelected';
|
|
|
|
|
import EditImportListExclusionModalConnector from './EditImportListExclusionModalConnector';
|
|
|
|
|
import ImportListExclusion from './ImportListExclusion';
|
|
|
|
|
import styles from './ImportListExclusions.css';
|
|
|
|
@ -19,6 +23,10 @@ class ImportListExclusions extends Component {
|
|
|
|
|
super(props, context);
|
|
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
|
allSelected: false,
|
|
|
|
|
allUnselected: false,
|
|
|
|
|
lastToggled: null,
|
|
|
|
|
selectedState: {},
|
|
|
|
|
isAddImportExclusionModalOpen: false
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
@ -26,6 +34,16 @@ class ImportListExclusions extends Component {
|
|
|
|
|
//
|
|
|
|
|
// Listeners
|
|
|
|
|
|
|
|
|
|
onSelectAllChange = ({ value }) => {
|
|
|
|
|
this.setState(selectAll(this.state.selectedState, value));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onSelectedChange = ({ id, value, shiftKey = false }) => {
|
|
|
|
|
this.setState((state) => {
|
|
|
|
|
return toggleSelected(state, this.props.items, id, value, shiftKey);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onAddImportExclusionPress = () => {
|
|
|
|
|
this.setState({ isAddImportExclusionModalOpen: true });
|
|
|
|
|
};
|
|
|
|
@ -41,41 +59,50 @@ class ImportListExclusions extends Component {
|
|
|
|
|
const {
|
|
|
|
|
items,
|
|
|
|
|
onConfirmDeleteImportExclusion,
|
|
|
|
|
columns,
|
|
|
|
|
...otherProps
|
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
|
|
const {
|
|
|
|
|
allSelected,
|
|
|
|
|
allUnselected,
|
|
|
|
|
selectedState
|
|
|
|
|
} = this.state;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<FieldSet legend={translate('ListExclusions')}>
|
|
|
|
|
<PageSectionContent
|
|
|
|
|
errorMessage={translate('UnableToLoadListExclusions')}
|
|
|
|
|
{...otherProps}
|
|
|
|
|
>
|
|
|
|
|
<div className={styles.importListExclusionsHeader}>
|
|
|
|
|
<div className={styles.tmdbId}>
|
|
|
|
|
TMDb Id
|
|
|
|
|
</div>
|
|
|
|
|
<div className={styles.title}>
|
|
|
|
|
{translate('Title')}
|
|
|
|
|
</div>
|
|
|
|
|
<div className={styles.movieYear}>
|
|
|
|
|
{translate('Year')}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
{
|
|
|
|
|
items.map((item, index) => {
|
|
|
|
|
return (
|
|
|
|
|
<ImportListExclusion
|
|
|
|
|
key={item.id}
|
|
|
|
|
{...item}
|
|
|
|
|
{...otherProps}
|
|
|
|
|
index={index}
|
|
|
|
|
onConfirmDeleteImportExclusion={onConfirmDeleteImportExclusion}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
<Table
|
|
|
|
|
selectAll={true}
|
|
|
|
|
allSelected={allSelected}
|
|
|
|
|
allUnselected={allUnselected}
|
|
|
|
|
columns={columns}
|
|
|
|
|
{...otherProps}
|
|
|
|
|
onSelectAllChange={this.onSelectAllChange}
|
|
|
|
|
>
|
|
|
|
|
<TableBody>
|
|
|
|
|
{
|
|
|
|
|
items.map((item, index) => {
|
|
|
|
|
return (
|
|
|
|
|
<ImportListExclusion
|
|
|
|
|
key={item.id}
|
|
|
|
|
isSelected={selectedState[item.id] || false}
|
|
|
|
|
{...item}
|
|
|
|
|
{...otherProps}
|
|
|
|
|
columns={columns}
|
|
|
|
|
index={index}
|
|
|
|
|
onSelectedChange={this.onSelectedChange}
|
|
|
|
|
onConfirmDeleteImportExclusion={onConfirmDeleteImportExclusion}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</TableBody>
|
|
|
|
|
</Table>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className={styles.addImportExclusion}>
|
|
|
|
@ -101,6 +128,7 @@ class ImportListExclusions extends Component {
|
|
|
|
|
ImportListExclusions.propTypes = {
|
|
|
|
|
isFetching: PropTypes.bool.isRequired,
|
|
|
|
|
error: PropTypes.object,
|
|
|
|
|
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
|
|
|
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
|
|
|
onConfirmDeleteImportExclusion: PropTypes.func.isRequired
|
|
|
|
|
};
|
|
|
|
|