Skip to content

Add deep link page number to task history page.#1801

Merged
tamaccount merged 5 commits into
masterfrom
deep-link-task-history
Aug 13, 2018
Merged

Add deep link page number to task history page.#1801
tamaccount merged 5 commits into
masterfrom
deep-link-task-history

Conversation

@tamaccount

Copy link
Copy Markdown
Contributor

No description provided.

@tamaccount tamaccount requested a review from andyhuang91 May 18, 2018 20:52
@andyhuang91

Copy link
Copy Markdown

It looks like this doesn't automatically update the query param when the user clicks through the pagination buttons. We should add that so that these links become discoverable.

sortDirection: defaultSortDirection,
sortTime: null,
chunkNum: 1,
chunkNum: initialPageNumber || 1,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also be done with default props.

{deleted || (
<TaskHistoryTable
requestId={requestId}
onPageChange={num => router.replace(`${location.pathname}?taskHistoryPage=${num}`)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works. You could also pass in a location object with a query prop for react-router. That might be a little safer in terms of ensuring that you don't override any other existing query parameters or the location hash.


componentDidMount() {
const { requestId, initialPageNumber } = this.props;
if (initialPageNumber) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is the data loaded if there is no initialPageNumber? The code for both cases should probably be in a single place.

…askHistoryTable's componentDidMount now that RequestDetailPage now passes the component a default initialPageNumber. Pass router.replace a location object in onPageChage prop for TaskHistoryTable.

@andyhuang91 andyhuang91 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there's a merge conflict now. Aside from that, LGTM


componentDidMount() {
const { requestId, initialPageNumber } = this.props;
this.setState({ loading: true });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be set as part of the initial state in the constructor

@ssalinas ssalinas added this to the 0.21.0 milestone Jul 9, 2018
@tamaccount tamaccount merged commit 9003962 into master Aug 13, 2018
@ssalinas

Copy link
Copy Markdown
Contributor

🚢

@ssalinas ssalinas deleted the deep-link-task-history branch August 16, 2018 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants