New: Refresh button on book page that bypasses cache

This commit is contained in:
ta264
2020-09-03 21:35:49 +01:00
parent b93bc1e5e5
commit 2f8ac793ff
11 changed files with 97 additions and 18 deletions
+12
View File
@@ -117,6 +117,7 @@ class BookDetails extends Component {
images,
links,
isSaving,
isRefreshing,
isFetching,
isPopulated,
bookFilesError,
@@ -127,6 +128,7 @@ class BookDetails extends Component {
nextBook,
isSearching,
onMonitorTogglePress,
onRefreshPress,
onSearchPress
} = this.props;
@@ -142,6 +144,15 @@ class BookDetails extends Component {
<PageContent title={title}>
<PageToolbar>
<PageToolbarSection>
<PageToolbarButton
label="Refresh"
iconName={icons.REFRESH}
spinningName={icons.REFRESH}
title="Refresh information"
isSpinning={isRefreshing}
onPress={onRefreshPress}
/>
<PageToolbarButton
label="Search Book"
iconName={icons.SEARCH}
@@ -473,6 +484,7 @@ BookDetails.propTypes = {
monitored: PropTypes.bool.isRequired,
shortDateFormat: PropTypes.string.isRequired,
isSaving: PropTypes.bool.isRequired,
isRefreshing: PropTypes.bool,
isSearching: PropTypes.bool,
isFetching: PropTypes.bool,
isPopulated: PropTypes.bool,
@@ -70,6 +70,12 @@ function createMapStateToProps() {
isSearchingCommand.body.bookIds.indexOf(book.id) > -1
);
const isRefreshingCommand = findCommand(commands, { name: commandNames.REFRESH_BOOK });
const isRefreshing = (
isCommandExecuting(isRefreshingCommand) &&
isRefreshingCommand.body.bookId === book.id
);
const isFetching = isBookFilesFetching;
const isPopulated = isBookFilesPopulated;
@@ -77,6 +83,7 @@ function createMapStateToProps() {
...book,
shortDateFormat: uiSettings.shortDateFormat,
author,
isRefreshing,
isSearching,
isFetching,
isPopulated,
@@ -147,6 +154,13 @@ class BookDetailsConnector extends Component {
});
}
onRefreshPress = () => {
this.props.executeCommand({
name: commandNames.REFRESH_BOOK,
bookId: this.props.id
});
}
onSearchPress = () => {
this.props.executeCommand({
name: commandNames.BOOK_SEARCH,
@@ -162,6 +176,7 @@ class BookDetailsConnector extends Component {
<BookDetails
{...this.props}
onMonitorTogglePress={this.onMonitorTogglePress}
onRefreshPress={this.onRefreshPress}
onSearchPress={this.onSearchPress}
/>
);