Display proper count in load more button

Co-authored-by: Andrew Watkins <andrew.watkinz@gmail.com>
Co-authored-by: Chris Henn <chris.henn@influxdata.com>
pull/10616/head
Andrew Watkins 2018-05-30 16:31:29 -07:00
parent a6e16c35de
commit 1c6ba204be
2 changed files with 9 additions and 2 deletions

View File

@ -256,6 +256,12 @@ export default class TagListItem extends PureComponent<Props, State> {
}
}
private get loadMoreCount(): number {
const {count, limit} = this.state
return Math.min(Math.abs(count - limit), explorer.TAG_VALUES_LIMIT)
}
private get isFetchable(): boolean {
const {isOpen, loadingAll} = this.state

View File

@ -13,6 +13,7 @@ interface Props {
isLoadingMoreValues: boolean
onLoadMoreValues: () => void
shouldShowMoreValues: boolean
loadMoreCount: number
}
export default class TagValueList extends PureComponent<Props> {
@ -60,12 +61,12 @@ export default class TagValueList extends PureComponent<Props> {
}
private get buttonValue(): string | JSX.Element {
const {isLoadingMoreValues} = this.props
const {isLoadingMoreValues, loadMoreCount} = this.props
if (isLoadingMoreValues) {
return <LoadingSpinner />
}
return `Load next ${explorer.TAG_VALUES_LIMIT} values`
return `Load next ${loadMoreCount} values`
}
}