New: Table options in page toolbar in addition to table header
This commit is contained in:
parent
21a92b62fd
commit
3b565d8bb1
|
@ -1,9 +1,10 @@
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { icons } from 'Helpers/Props';
|
import { align, icons } from 'Helpers/Props';
|
||||||
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';
|
||||||
|
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
||||||
import TablePager from 'Components/Table/TablePager';
|
import TablePager from 'Components/Table/TablePager';
|
||||||
import PageContent from 'Components/Page/PageContent';
|
import PageContent from 'Components/Page/PageContent';
|
||||||
import PageContentBodyConnector from 'Components/Page/PageContentBodyConnector';
|
import PageContentBodyConnector from 'Components/Page/PageContentBodyConnector';
|
||||||
|
@ -41,6 +42,18 @@ class Blacklist extends Component {
|
||||||
onPress={onClearBlacklistPress}
|
onPress={onClearBlacklistPress}
|
||||||
/>
|
/>
|
||||||
</PageToolbarSection>
|
</PageToolbarSection>
|
||||||
|
|
||||||
|
<PageToolbarSection alignContent={align.RIGHT}>
|
||||||
|
<TableOptionsModalWrapper
|
||||||
|
{...otherProps}
|
||||||
|
columns={columns}
|
||||||
|
>
|
||||||
|
<PageToolbarButton
|
||||||
|
label="Options"
|
||||||
|
iconName={icons.TABLE}
|
||||||
|
/>
|
||||||
|
</TableOptionsModalWrapper>
|
||||||
|
</PageToolbarSection>
|
||||||
</PageToolbar>
|
</PageToolbar>
|
||||||
|
|
||||||
<PageContentBodyConnector>
|
<PageContentBodyConnector>
|
||||||
|
|
|
@ -105,6 +105,14 @@ class BlacklistConnector extends Component {
|
||||||
this.props.executeCommand({ name: commandNames.CLEAR_BLACKLIST });
|
this.props.executeCommand({ name: commandNames.CLEAR_BLACKLIST });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onTableOptionChange = (payload) => {
|
||||||
|
this.props.setBlacklistTableOption(payload);
|
||||||
|
|
||||||
|
if (payload.pageSize) {
|
||||||
|
this.props.gotoBlacklistFirstPage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Render
|
// Render
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ 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';
|
||||||
|
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
||||||
import TablePager from 'Components/Table/TablePager';
|
import TablePager from 'Components/Table/TablePager';
|
||||||
import PageContent from 'Components/Page/PageContent';
|
import PageContent from 'Components/Page/PageContent';
|
||||||
import PageContentBodyConnector from 'Components/Page/PageContentBodyConnector';
|
import PageContentBodyConnector from 'Components/Page/PageContentBodyConnector';
|
||||||
|
@ -75,6 +76,16 @@ class History extends Component {
|
||||||
</PageToolbarSection>
|
</PageToolbarSection>
|
||||||
|
|
||||||
<PageToolbarSection alignContent={align.RIGHT}>
|
<PageToolbarSection alignContent={align.RIGHT}>
|
||||||
|
<TableOptionsModalWrapper
|
||||||
|
{...otherProps}
|
||||||
|
columns={columns}
|
||||||
|
>
|
||||||
|
<PageToolbarButton
|
||||||
|
label="Options"
|
||||||
|
iconName={icons.TABLE}
|
||||||
|
/>
|
||||||
|
</TableOptionsModalWrapper>
|
||||||
|
|
||||||
<FilterMenu
|
<FilterMenu
|
||||||
alignMenu={align.RIGHT}
|
alignMenu={align.RIGHT}
|
||||||
selectedFilterKey={selectedFilterKey}
|
selectedFilterKey={selectedFilterKey}
|
||||||
|
|
|
@ -117,6 +117,7 @@ class SeriesSearchInput extends Component {
|
||||||
if (!suggestions.length || highlightedSectionIndex) {
|
if (!suggestions.length || highlightedSectionIndex) {
|
||||||
this.props.onGoToAddNewSeries(value);
|
this.props.onGoToAddNewSeries(value);
|
||||||
this._autosuggest.input.blur();
|
this._autosuggest.input.blur();
|
||||||
|
this.reset();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -129,6 +130,9 @@ class SeriesSearchInput extends Component {
|
||||||
} else {
|
} else {
|
||||||
this.goToSeries(suggestions[highlightedSuggestionIndex]);
|
this.goToSeries(suggestions[highlightedSuggestionIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._autosuggest.input.blur();
|
||||||
|
this.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
onBlur = () => {
|
onBlur = () => {
|
||||||
|
|
|
@ -7,20 +7,22 @@ import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
import PageContent from 'Components/Page/PageContent';
|
import PageContent from 'Components/Page/PageContent';
|
||||||
import PageContentBodyConnector from 'Components/Page/PageContentBodyConnector';
|
import PageContentBodyConnector from 'Components/Page/PageContentBodyConnector';
|
||||||
import PageJumpBar from 'Components/Page/PageJumpBar';
|
import PageJumpBar from 'Components/Page/PageJumpBar';
|
||||||
|
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
||||||
import PageToolbar from 'Components/Page/Toolbar/PageToolbar';
|
import PageToolbar from 'Components/Page/Toolbar/PageToolbar';
|
||||||
import PageToolbarSeparator from 'Components/Page/Toolbar/PageToolbarSeparator';
|
import PageToolbarSeparator from 'Components/Page/Toolbar/PageToolbarSeparator';
|
||||||
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
|
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
|
||||||
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
||||||
import NoSeries from 'Series/NoSeries';
|
import NoSeries from 'Series/NoSeries';
|
||||||
import SeriesIndexTableConnector from './Table/SeriesIndexTableConnector';
|
import SeriesIndexTableConnector from './Table/SeriesIndexTableConnector';
|
||||||
|
import SeriesIndexTableOptionsConnector from './Table/SeriesIndexTableOptionsConnector';
|
||||||
import SeriesIndexPosterOptionsModal from './Posters/Options/SeriesIndexPosterOptionsModal';
|
import SeriesIndexPosterOptionsModal from './Posters/Options/SeriesIndexPosterOptionsModal';
|
||||||
import SeriesIndexPostersConnector from './Posters/SeriesIndexPostersConnector';
|
import SeriesIndexPostersConnector from './Posters/SeriesIndexPostersConnector';
|
||||||
import SeriesIndexOverviewOptionsModal from './Overview/Options/SeriesIndexOverviewOptionsModal';
|
import SeriesIndexOverviewOptionsModal from './Overview/Options/SeriesIndexOverviewOptionsModal';
|
||||||
import SeriesIndexOverviewsConnector from './Overview/SeriesIndexOverviewsConnector';
|
import SeriesIndexOverviewsConnector from './Overview/SeriesIndexOverviewsConnector';
|
||||||
import SeriesIndexFooter from './SeriesIndexFooter';
|
|
||||||
import SeriesIndexFilterMenu from './Menus/SeriesIndexFilterMenu';
|
import SeriesIndexFilterMenu from './Menus/SeriesIndexFilterMenu';
|
||||||
import SeriesIndexSortMenu from './Menus/SeriesIndexSortMenu';
|
import SeriesIndexSortMenu from './Menus/SeriesIndexSortMenu';
|
||||||
import SeriesIndexViewMenu from './Menus/SeriesIndexViewMenu';
|
import SeriesIndexViewMenu from './Menus/SeriesIndexViewMenu';
|
||||||
|
import SeriesIndexFooter from './SeriesIndexFooter';
|
||||||
import styles from './SeriesIndex.css';
|
import styles from './SeriesIndex.css';
|
||||||
|
|
||||||
function getViewComponent(view) {
|
function getViewComponent(view) {
|
||||||
|
@ -172,6 +174,7 @@ class SeriesIndex extends Component {
|
||||||
error,
|
error,
|
||||||
totalItems,
|
totalItems,
|
||||||
items,
|
items,
|
||||||
|
columns,
|
||||||
selectedFilterKey,
|
selectedFilterKey,
|
||||||
filters,
|
filters,
|
||||||
customFilters,
|
customFilters,
|
||||||
|
@ -229,25 +232,41 @@ class SeriesIndex extends Component {
|
||||||
alignContent={align.RIGHT}
|
alignContent={align.RIGHT}
|
||||||
collapseButtons={false}
|
collapseButtons={false}
|
||||||
>
|
>
|
||||||
|
{
|
||||||
|
view === 'table' ?
|
||||||
|
<TableOptionsModalWrapper
|
||||||
|
{...otherProps}
|
||||||
|
columns={columns}
|
||||||
|
optionsComponent={SeriesIndexTableOptionsConnector}
|
||||||
|
>
|
||||||
|
<PageToolbarButton
|
||||||
|
label="Options"
|
||||||
|
iconName={icons.TABLE}
|
||||||
|
/>
|
||||||
|
</TableOptionsModalWrapper> :
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
view === 'posters' &&
|
view === 'posters' ?
|
||||||
<PageToolbarButton
|
<PageToolbarButton
|
||||||
label="Options"
|
label="Options"
|
||||||
iconName={icons.POSTER}
|
iconName={icons.POSTER}
|
||||||
isDisabled={hasNoSeries}
|
isDisabled={hasNoSeries}
|
||||||
onPress={this.onPosterOptionsPress}
|
onPress={this.onPosterOptionsPress}
|
||||||
/>
|
/> :
|
||||||
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
view === 'overview' &&
|
view === 'overview' ?
|
||||||
<PageToolbarButton
|
<PageToolbarButton
|
||||||
label="Options"
|
label="Options"
|
||||||
iconName={icons.OVERVIEW}
|
iconName={icons.OVERVIEW}
|
||||||
isDisabled={hasNoSeries}
|
isDisabled={hasNoSeries}
|
||||||
onPress={this.onOverviewOptionsPress}
|
onPress={this.onOverviewOptionsPress}
|
||||||
/>
|
/> :
|
||||||
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -348,6 +367,7 @@ SeriesIndex.propTypes = {
|
||||||
error: PropTypes.object,
|
error: PropTypes.object,
|
||||||
totalItems: PropTypes.number.isRequired,
|
totalItems: PropTypes.number.isRequired,
|
||||||
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
|
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
selectedFilterKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
selectedFilterKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
||||||
filters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
filters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
customFilters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
customFilters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
|
|
|
@ -8,7 +8,7 @@ import createCommandExecutingSelector from 'Store/Selectors/createCommandExecuti
|
||||||
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
||||||
import { fetchSeries } from 'Store/Actions/seriesActions';
|
import { fetchSeries } from 'Store/Actions/seriesActions';
|
||||||
import scrollPositions from 'Store/scrollPositions';
|
import scrollPositions from 'Store/scrollPositions';
|
||||||
import { setSeriesSort, setSeriesFilter, setSeriesView } from 'Store/Actions/seriesIndexActions';
|
import { setSeriesSort, setSeriesFilter, setSeriesView, setSeriesTableOption } from 'Store/Actions/seriesIndexActions';
|
||||||
import { executeCommand } from 'Store/Actions/commandActions';
|
import { executeCommand } from 'Store/Actions/commandActions';
|
||||||
import * as commandNames from 'Commands/commandNames';
|
import * as commandNames from 'Commands/commandNames';
|
||||||
import withScrollPosition from 'Components/withScrollPosition';
|
import withScrollPosition from 'Components/withScrollPosition';
|
||||||
|
@ -59,13 +59,41 @@ function createMapStateToProps() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
function createMapDispatchToProps(dispatch, props) {
|
||||||
fetchSeries,
|
return {
|
||||||
setSeriesSort,
|
dispatchFetchSeries() {
|
||||||
setSeriesFilter,
|
dispatch(fetchSeries);
|
||||||
setSeriesView,
|
},
|
||||||
executeCommand
|
|
||||||
};
|
onTableOptionChange(payload) {
|
||||||
|
dispatch(setSeriesTableOption(payload));
|
||||||
|
},
|
||||||
|
|
||||||
|
onSortSelect(sortKey) {
|
||||||
|
dispatch(setSeriesSort({ sortKey }));
|
||||||
|
},
|
||||||
|
|
||||||
|
onFilterSelect(selectedFilterKey) {
|
||||||
|
dispatch(setSeriesFilter({ selectedFilterKey }));
|
||||||
|
},
|
||||||
|
|
||||||
|
dispatchSetSeriesView(view) {
|
||||||
|
dispatch(setSeriesView({ view }));
|
||||||
|
},
|
||||||
|
|
||||||
|
onRefreshSeriesPress() {
|
||||||
|
dispatch(executeCommand({
|
||||||
|
name: commandNames.REFRESH_SERIES
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
|
||||||
|
onRssSyncPress() {
|
||||||
|
dispatch(executeCommand({
|
||||||
|
name: commandNames.RSS_SYNC
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
class SeriesIndexConnector extends Component {
|
class SeriesIndexConnector extends Component {
|
||||||
|
|
||||||
|
@ -87,24 +115,16 @@ class SeriesIndexConnector extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.props.fetchSeries();
|
this.props.dispatchFetchSeries();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Listeners
|
// Listeners
|
||||||
|
|
||||||
onSortSelect = (sortKey) => {
|
|
||||||
this.props.setSeriesSort({ sortKey });
|
|
||||||
}
|
|
||||||
|
|
||||||
onFilterSelect = (selectedFilterKey) => {
|
|
||||||
this.props.setSeriesFilter({ selectedFilterKey });
|
|
||||||
}
|
|
||||||
|
|
||||||
onViewSelect = (view) => {
|
onViewSelect = (view) => {
|
||||||
// Reset the scroll position before changing the view
|
// Reset the scroll position before changing the view
|
||||||
this.setState({ scrollTop: 0 }, () => {
|
this.setState({ scrollTop: 0 }, () => {
|
||||||
this.props.setSeriesView({ view });
|
this.props.dispatchSetSeriesView({ view });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,18 +136,6 @@ class SeriesIndexConnector extends Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onRefreshSeriesPress = () => {
|
|
||||||
this.props.executeCommand({
|
|
||||||
name: commandNames.REFRESH_SERIES
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onRssSyncPress = () => {
|
|
||||||
this.props.executeCommand({
|
|
||||||
name: commandNames.RSS_SYNC
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Render
|
// Render
|
||||||
|
|
||||||
|
@ -136,12 +144,8 @@ class SeriesIndexConnector extends Component {
|
||||||
<SeriesIndex
|
<SeriesIndex
|
||||||
{...this.props}
|
{...this.props}
|
||||||
scrollTop={this.state.scrollTop}
|
scrollTop={this.state.scrollTop}
|
||||||
onSortSelect={this.onSortSelect}
|
|
||||||
onFilterSelect={this.onFilterSelect}
|
|
||||||
onViewSelect={this.onViewSelect}
|
onViewSelect={this.onViewSelect}
|
||||||
onScroll={this.onScroll}
|
onScroll={this.onScroll}
|
||||||
onRefreshSeriesPress={this.onRefreshSeriesPress}
|
|
||||||
onRssSyncPress={this.onRssSyncPress}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -151,14 +155,10 @@ SeriesIndexConnector.propTypes = {
|
||||||
isSmallScreen: PropTypes.bool.isRequired,
|
isSmallScreen: PropTypes.bool.isRequired,
|
||||||
view: PropTypes.string.isRequired,
|
view: PropTypes.string.isRequired,
|
||||||
scrollTop: PropTypes.number.isRequired,
|
scrollTop: PropTypes.number.isRequired,
|
||||||
fetchSeries: PropTypes.func.isRequired,
|
dispatchFetchSeries: PropTypes.func.isRequired
|
||||||
setSeriesSort: PropTypes.func.isRequired,
|
|
||||||
setSeriesFilter: PropTypes.func.isRequired,
|
|
||||||
setSeriesView: PropTypes.func.isRequired,
|
|
||||||
executeCommand: PropTypes.func.isRequired
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withScrollPosition(
|
export default withScrollPosition(
|
||||||
connect(createMapStateToProps, mapDispatchToProps)(SeriesIndexConnector),
|
connect(createMapStateToProps, createMapDispatchToProps)(SeriesIndexConnector),
|
||||||
'seriesIndex'
|
'seriesIndex'
|
||||||
);
|
);
|
||||||
|
|
|
@ -52,7 +52,7 @@ export const defaultState = {
|
||||||
isPopulated: false,
|
isPopulated: false,
|
||||||
error: null,
|
error: null,
|
||||||
sortKey: 'episodeNumber',
|
sortKey: 'episodeNumber',
|
||||||
sortDirection: sortDirections.DESCENDING,
|
sortDirection: sortDirections.ASCENDING,
|
||||||
items: []
|
items: []
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -80,25 +80,30 @@ export const defaultState = {
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
name: 'level',
|
name: 'level',
|
||||||
isSortable: true,
|
columnLabel: 'Level',
|
||||||
isVisible: true
|
isSortable: false,
|
||||||
|
isVisible: true,
|
||||||
|
isModifiable: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'logger',
|
name: 'logger',
|
||||||
label: 'Component',
|
label: 'Component',
|
||||||
isSortable: true,
|
isSortable: false,
|
||||||
isVisible: true
|
isVisible: true,
|
||||||
|
isModifiable: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'message',
|
name: 'message',
|
||||||
label: 'Message',
|
label: 'Message',
|
||||||
isVisible: true
|
isVisible: true,
|
||||||
|
isModifiable: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'time',
|
name: 'time',
|
||||||
label: 'Time',
|
label: 'Time',
|
||||||
isSortable: true,
|
isSortable: true,
|
||||||
isVisible: true
|
isVisible: true,
|
||||||
|
isModifiable: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'actions',
|
name: 'actions',
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { align, icons } from 'Helpers/Props';
|
||||||
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';
|
||||||
|
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
||||||
import TablePager from 'Components/Table/TablePager';
|
import TablePager from 'Components/Table/TablePager';
|
||||||
import PageContent from 'Components/Page/PageContent';
|
import PageContent from 'Components/Page/PageContent';
|
||||||
import PageContentBodyConnector from 'Components/Page/PageContentBodyConnector';
|
import PageContentBodyConnector from 'Components/Page/PageContentBodyConnector';
|
||||||
|
@ -51,6 +52,17 @@ function LogsTable(props) {
|
||||||
</PageToolbarSection>
|
</PageToolbarSection>
|
||||||
|
|
||||||
<PageToolbarSection alignContent={align.RIGHT}>
|
<PageToolbarSection alignContent={align.RIGHT}>
|
||||||
|
<TableOptionsModalWrapper
|
||||||
|
{...otherProps}
|
||||||
|
columns={columns}
|
||||||
|
canModifyColumns={false}
|
||||||
|
>
|
||||||
|
<PageToolbarButton
|
||||||
|
label="Options"
|
||||||
|
iconName={icons.TABLE}
|
||||||
|
/>
|
||||||
|
</TableOptionsModalWrapper>
|
||||||
|
|
||||||
<FilterMenu
|
<FilterMenu
|
||||||
alignMenu={align.RIGHT}
|
alignMenu={align.RIGHT}
|
||||||
selectedFilterKey={selectedFilterKey}
|
selectedFilterKey={selectedFilterKey}
|
||||||
|
|
Loading…
Reference in New Issue