[LG-256] Add spinner when presenting piv/cac cert#2258
Conversation
| @@ -0,0 +1,7 @@ | |||
| document.addEventListener('DOMContentLoaded', () => { | |||
There was a problem hiding this comment.
Why put this in app/assets instead of app/javascripts?
There was a problem hiding this comment.
Probably in order to use ERB, but this is a bit of an anti-pattern compared to most of our JS. Perhaps instead of having the inline erb/html in the js, that can be moved to a slim template and be hidden by default. Then js is only responsible for showing/hiding the necessary html and can be handled via webpack like the rest of the js.
There was a problem hiding this comment.
Template could work. Or CSS. I just needed to get the path to the image and ERB seemed to simplest way for me in the moment, but definitely not the cleanest.
There was a problem hiding this comment.
Webpacker supports ERB files. Here is how to do it:
- Run
bundle exec rake webpacker:install:erb - Move the file to
app/javascripts - Add
.erbto theextensionslist inwebpacker.yml
There was a problem hiding this comment.
If that doesn't work out of the box, try defining <% helpers = ActionController::Base.helpers %> and then refer to the image like this:
helpers.asset_path('spinner@2x.gif')
|
@jgsmith-usds Have you had a chance to think about the feedback I left? |
|
@monfresh I agree with what you suggested - just getting some other things built out first. I'll circle back around to this in a week or so. |
|
Thanks for the update. I will flip this to work in progress. |
6603b65 to
ae36ee3
Compare
config/initializers/assets.rb
Outdated
There was a problem hiding this comment.
Where does this spinner.js come from?
There was a problem hiding this comment.
It's from an earlier commit. Thanks for pointing it out!
app/views/shared/_spinner.html.slim
Outdated
There was a problem hiding this comment.
Looks like Circle CI is failing because this line is too long.
cb01f2f to
4314986
Compare
|
What's the easiest way to test this locally? |
|
The easiest is to get the piv/cac service up and running through nginx with a self-signed cert that is marked as trusted in your browser. Then set Or I can demo in a hangout or at Friday's demo day. |
|
Thanks. It would be great to have more detailed instructions documented somewhere. |
|
True. I have a ticket in the backlog to set up a docker config for the piv/cac service to make it easier. I may pull that in as a tech debt type task soon. Doesn't solve the signing certificate issues, but gets things a lot simpler otherwise. |
**Why**: The browser UX might take a while, and we don't want the user to feel that everything is frozen up. **How**: When the user clicks on the button to present their piv/cac cert, we intercept the event and change the content to be a GIF spinner. We let the event continue so the browser follows through with the request.
4314986 to
c4a6c5f
Compare
Why:
The browser UX might take a while, and we don't want the
user to feel that everything is frozen up.
How:
When the user clicks on the button to present their piv/cac
cert, we intercept the event and change the content to be a
GIF spinner. We let the event continue so the browser follows
through with the request.
Hi! Before submitting your PR for review, and/or before merging it, please
go through the following checklist:
For DB changes, check for missing indexes, check to see if the changes
affect other apps (such as the dashboard), make sure the DB columns in the
various environments are properly populated, coordinate with devops, plan
migrations in separate steps.
For route changes, make sure GET requests don't change state or result in
destructive behavior. GET requests should only result in information being
read, not written.
For encryption changes, make sure it is compatible with data that was
encrypted with the old code.
For secrets changes, make sure to update the S3 secrets bucket with the
new configs in all environments.
Do not disable Rubocop or Reek offenses unless you are absolutely sure
they are false positives. If you're not sure how to fix the offense, please
ask a teammate.
When reading data, write tests for nil values, empty strings,
and invalid formats.
When calling
redirect_toin a controller, use_url, not_path.When adding user data to the session, use the
user_sessionhelperinstead of the
sessionhelper so the data does not persist beyond the user'ssession.
When adding a new controller that requires the user to be fully
authenticated, make sure to add
before_action :confirm_two_factor_authenticated.