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

Handle 404 properly #1179

Merged
merged 9 commits into from Aug 2, 2016
Merged

Handle 404 properly #1179

merged 9 commits into from Aug 2, 2016

Conversation

@Calvinp
Copy link
Contributor

@Calvinp Calvinp commented Jul 29, 2016

Handles 404s on pages for specific requests, deploys, and tasks by showing the 404 page rather than rendering something meaningless and showing an error.

The following pages are affected:

  • DeployDetail
  • RequestDetail
  • TaskDetail
  • New Deploy Form
  • Edit Request Form

Please let me know if I've missed any @tpetr @kwm4385 @wolfd

@Calvinp
Copy link
Contributor Author

@Calvinp Calvinp commented Jul 29, 2016

Looks like it's not going to be possible to detect 404 on Task Search right now.
The server responds with an empty array rather than a 404, even when using the /request/:requestId/task-search URL.
@ssalinas a possible future improvement to the Task Search API would be to 404 when the request isn't found in this case.

@tpetr @kwm4385 @wolfd This PR is good to be reviewed/merged from my perspective now.

@Calvinp Calvinp changed the title Handle 404 properly (WIP) Handle 404 properly Jul 29, 2016
url: `/history/task/${taskId}`
(taskId, isMainApiCall) => ({
url: `/history/task/${taskId}`,
isMainApiCall

This comment has been minimized.

@wolfd

wolfd Aug 1, 2016
Contributor

What does this mean?

This comment has been minimized.

@Calvinp

Calvinp Aug 1, 2016
Author Contributor

Unfortunately the meaning snuck into another PR - that's on me, I implemented it with the Deploy Detail page fixes.
It's basically an idiomatic way of saying it ignores 404s. It signifies that if the API call fails with a 404 then the page should 404 (but it can also be extended to mean other things later).

This comment has been minimized.

@tpetr

tpetr Aug 1, 2016
Member

isMainApiCall doesn't convey that information at all -- if that's all that this variable controls, can we think of a more descriptive name for it?

This comment has been minimized.

@Calvinp

Calvinp Aug 1, 2016
Author Contributor

Naming things isn't my strong suit. Maybe pageCantRenderIfThisFails? I don't really like that name either though.

This comment has been minimized.

@Calvinp

Calvinp Aug 1, 2016
Author Contributor

Or page404sIfThis404s.

This comment has been minimized.

@tpetr

tpetr Aug 1, 2016
Member

It's cool, naming is hard 😄 -- I'd suggest something like renderNotFoundIf404

@@ -346,6 +342,7 @@ function mapStateToProps(state) {
return {
notFound: state.api.deploy.statusCode === 404,
pathname: ownProps.location.pathname,

This comment has been minimized.

@wolfd

wolfd Aug 1, 2016
Contributor

hm, not sure how I feel about this. Even though the web api doesn't capitalize pathname, it also doesn't capitalize onClick, etc. Maybe we should use pathName? @tpetr

This comment has been minimized.

@Calvinp

Calvinp Aug 1, 2016
Author Contributor

I was following the wording/capitalization of react-router here.

EDIT - Oh, that's what you're saying. I personally think it makes sense to keep it consistent, but I'm fine with changing it if I'm outvoted.

@wolfd
Copy link
Contributor

@wolfd wolfd commented Aug 2, 2016

LGTM

1 similar comment
@tpetr
Copy link
Member

@tpetr tpetr commented Aug 2, 2016

LGTM

@Calvinp Calvinp merged commit 373ac53 into decaf Aug 2, 2016
1 of 2 checks passed
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
@Calvinp Calvinp deleted the handle_404_properly branch Aug 2, 2016
@tpetr tpetr modified the milestone: 0.10.0 Aug 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.