Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Aug 13, 2018

Conversation

tamaccount
Copy link
Contributor

No description provided.

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

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.

@@ -21,7 +21,7 @@ class UITable extends Component {
sortBy: defaultSortBy,
sortDirection: defaultSortDirection,
sortTime: null,
chunkNum: 1,
chunkNum: initialPageNumber || 1,

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}`)}

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.

@@ -34,6 +34,18 @@ class TaskHistoryTable extends Component {
};
}

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

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.
Copy link

@andyhuang91 andyhuang91 left a comment

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

@@ -34,6 +34,16 @@ class TaskHistoryTable extends Component {
};
}

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

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
Member

🚢

@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