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

Permalink request within group #1748

Merged
merged 3 commits into from Mar 2, 2018

Conversation

Projects
None yet
4 participants
@benheng
Contributor

benheng commented Feb 28, 2018

Previously, request groups didn't support permalinks for requests within the group. It would simply select the first request and display that.

You'd have link that looked like this:

localhost/singularity/ui/group/RequestGroup1

Which would contain some requests: RequestGroup1-foo1, RequestGroup1-foo2, RequestGroup1-foo3

Now you can link them directly:

localhost/singularity/ui/group/RequestGroup1/RequestGroup1-foo1
localhost/singularity/ui/group/RequestGroup1/RequestGroup1-foo2
localhost/singularity/ui/group/RequestGroup1/RequestGroup1-foo3

The default behavior is maintained, no request ID means display the first request. Incorrect request ID will still load the selected group page, but the request data will not be displayed since there is none.

@@ -1,5 +1,6 @@
import React, {PropTypes, Component} from 'react';
import { connect } from 'react-redux';
import { LinkContainer } from 'react-router-bootstrap';

This comment has been minimized.

@kwm4385

kwm4385 Feb 28, 2018

Contributor

What's the reasoning behind using LinkContainer over the standard react-router Link or an onclick handler?

This comment has been minimized.

@benheng

benheng Feb 28, 2018

Contributor

Link doesn't play nice with bootstrap components. I also wanted the URL to change when a user clicked on a request ID which is why I went with LinkContainer. Would it have been better to have an onClick handler and wrap the component using withRouter?

This comment has been minimized.

@kwm4385

kwm4385 Feb 28, 2018

Contributor

If we were already using react-router-bootstrap I'd say this is the best solution, however, I'm hesitant to add another dependency for this single use case since we already have so many. For that reason I'd say go with handling it via onClick and withRouter.

</NavItem>
<LinkContainer
eventKey={requestId}
key={index}

This comment has been minimized.

@andyhuang91

andyhuang91 Feb 28, 2018

requestId is a logical key here

@@ -13,7 +14,7 @@ class GroupDetail extends Component {
constructor(props) {
super(props);
this.state = {
showRequestId: _.first(props.group.requestIds)
showRequestId: props.params.requestId || _.first(props.group.requestIds),

This comment has been minimized.

@andyhuang91

andyhuang91 Feb 28, 2018

component state isn't needed anymore, and you can get rid of onSelect={this.handleRequestSelect} on the Nav component

@ssalinas ssalinas added the UI label Mar 1, 2018

@benheng benheng added the hs_staging label Mar 2, 2018

@kwm4385

This comment has been minimized.

Contributor

kwm4385 commented Mar 2, 2018

🚢

@benheng benheng merged commit a2eca5a into master Mar 2, 2018

1 of 2 checks passed

continuous-integration/travis-ci/push The Travis CI build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@benheng benheng deleted the permalink-request-within-group branch Mar 2, 2018

@ssalinas ssalinas added this to the 0.19.2 milestone Mar 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment