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

Adds error messages to lazy tabs #619

Merged
merged 2 commits into from Jan 20, 2019
Merged

Conversation

samueldr
Copy link
Member

@samueldr samueldr commented Dec 1, 2018

On a fresh hydra development instance, I'm getting this unhelpful error message on My jobs.

image

This PR adds the ability for lazy tabs to show the error() given.

image


I am taking my first steps into the world of Perl, so this is possibly a bad implementation of a good idea. I am open to critique and to suggestion to make this better.

These are also my first steps in Hydra and its internals, which means the same, it might be unoptimally implemented. The idea here is to touch the smaller amount of things to implement this.

The way it is implemented, this allows error() in a "lazy" route to implicitly use a partial view for the error messages, and to document the fact that this is still to be rendered as-is using the custom header as the side-channel.

Ideally, I would like to instead use an attribute :Lazy on the route's method, but I have no idea how it works, if it's possible or if it's a good idea. Adding this attribute could also allow other automatisms, like using the full URL for the resource, with a special header (e.g. X-Hydra-Wants-Lazy), and render only the tab with the header, and the full layout with pre-baked tab on a normal navigation to the route. (Using HTML5 history navigation would allow us to change the URL when loading the tab via ajax.)

@edolstra edolstra merged commit e0d8dcf into NixOS:master Jan 20, 2019
@samueldr samueldr deleted the feature/lazy_errors branch January 20, 2019 23:28
samueldr added a commit to samueldr/hydra that referenced this pull request Jan 21, 2019
Once set, some semantics will change to allow better cooperation between
the server-side and client-side with regards to AJAX "Lazy" calls.

The only implemented semantic change is that error messages are given in
a partial view, allowing the "Lazy" initiator client-side to simply use
the error as given, instead of printing a generic error message.

This builds upon NixOS#619.
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.

None yet

2 participants