Skip to content

Conversation

@labkey-ankurj
Copy link
Contributor

@labkey-ankurj labkey-ankurj commented Sep 22, 2020

Rationale

This is the continued work of error page redesign.

Related Pull Requests

Changes

  • View details section on Error Page

@cnathe cnathe requested a review from labkey-nicka September 23, 2020 21:20
Copy link
Contributor

@cnathe cnathe left a comment

Choose a reason for hiding this comment

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

Just some quick comments. I'll do a more thorough code review after manual testing.

Comment on lines 16 to 23
If you are subscribed to LabKey, then reach out to your account manager for immediate help. If you are using
the community edition, your support ticket will be resolved within the next 2 to 3 weeks.
</div>
<br />
<div className="labkey-error-details">
{helpLinkNode('default', 'LabKey support documentation')} is another immediate resource that is available to
all users. A search through the documentation or previous forum questions may also help troubleshoot your
issue.
Copy link
Contributor

Choose a reason for hiding this comment

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

Does anyone know if this text has been reviewed by the support team? Looking at this page, it looks like the response time of community forum posts is "as time allows". Ankur, if you haven't chatted with the support team and reviewed these pages with them yet, I'm happy to do so.

Copy link
Contributor Author

@labkey-ankurj labkey-ankurj Sep 24, 2020

Choose a reason for hiding this comment

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

I asked the services team around the wording of config exception in the specs but not all the pages. Yes, it'd be great if you don't mind chatting with the team. Thanks.

labkey-ankurj and others added 8 commits September 25, 2020 07:14
# Conflicts:
#	assay/package-lock.json
#	assay/package.json
#	core/package-lock.json
#	core/package.json
#	experiment/package-lock.json
#	experiment/package.json
#	issues/package-lock.json
#	issues/package.json
#	list/package-lock.json
#	list/package.json
#	query/package-lock.json
#	query/package.json
#	study/package-lock.json
#	study/package.json
</li>
</ul>
</div>
{getServerContext().impersonatingUser !== undefined && (
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to get some jest tests for the various different displays here for the permissions error with and without the impersonate user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure how to impersonate in jest tests, do you have any pointers to existing example?

Copy link
Contributor

Choose a reason for hiding this comment

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

If it is just a matter of setting some specific context on the LABKEY object for a certain test case (i.e. the LABKEY.impersonatingUser in this case), then we have an example of that in labkey-ui-components which might work here:
labkey-ui-components/packages/components/src/internal/app/utils.spec.ts

@labkey-nicka
Copy link
Contributor

@labkey-ankurj I've closed the related @labkey/components PR so this branch can just update to the latest version of that package (which might result in no diff from develop).

Copy link
Contributor

@labkey-nicka labkey-nicka left a comment

Choose a reason for hiding this comment

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

I'd like to discuss the different usages of ErrorView and see if we can consolidate them so that the implementation that is specific to the view isn't the callers responsibility.

super.setStatus(HttpServletResponse.SC_OK);
}
}
else if (CONTENT_TYPE_HTML.equals(getRequest().getHeader("Content-Type)")) ||
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@labkey-nicka Let me know if this looks right. I tried to test through the URL link that you showed yesterday and it renders the error page in browser since the content type is text/html but returns json when apt content type is passed in the request.
Screen Shot 2020-09-29 at 10 43 03 AM

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this is now appropriately scoped and looks to still respond with JSON.

It is now assuming that the response code is 404 (not found) but then returning a status of 400 (bad request). What happens if a different type of error occurs? If is a 404 shouldn't we respond as such?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated the status code here, but error type here I think should always be not found as this is being utilized only for not found pages.

super.setStatus(HttpServletResponse.SC_OK);
}
}
else if (CONTENT_TYPE_HTML.equals(getRequest().getHeader("Content-Type)")) ||
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this is now appropriately scoped and looks to still respond with JSON.

It is now assuming that the response code is 404 (not found) but then returning a status of 400 (bad request). What happens if a different type of error occurs? If is a 404 shouldn't we respond as such?

Copy link
Contributor

@labkey-nicka labkey-nicka left a comment

Choose a reason for hiding this comment

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

Looks good to me. Only a couple nit items. I'll let @cnathe approve the PR once he's reviewed again.

LABKEY.requiresScript('core/gen/errorHandler.js', function() {
// LABKEY.requiresScript('http://localhost:3001/errorHandler.js', function() {
LABKEY.App.__app__.isDOMContentLoaded = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

@labkey-ankurj Can you open a ticket to me about this. It's fine to leave this "as-is" in this PR but the app loader should correctly identify when the DOM is loaded so you don't have to touch it's "private" state.

message: "<%=unsafe(model.getHeading())%>",
errorType: "<%=unsafe(model.getErrorType())%>"
// pulling in theme based css for the not found pages to still respect the site's theme
LABKEY.requiresCss(<%=q("/core/css/" + PageFlowUtil.resolveThemeName(getContainer()) + ".css")%>);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I might further update this comment to state why the CSS is being pulled in here rather than in the client dependencies for the JSP. Something like:

This error page may be invoked without the themes having been loaded for this container. We load the theme artifact for this container here to ensure the correct theme is loaded as this cannot be resolved during "addClientDependencies()" for this view.

catch (Exception e)
{
// config exceptions that occur before jsps have been initialized
if (ex instanceof ConfigurationException && e instanceof NullPointerException)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we do a more direct check if JSPs are ready to render? What's null that's causing this exception?

@labkey-ankurj labkey-ankurj merged commit 6f95e4d into develop Oct 9, 2020
@labkey-ankurj labkey-ankurj deleted the fb_ErrorPage_7767 branch October 9, 2020 18:05
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.

6 participants