Commit Graph

167 Commits

Author SHA1 Message Date
Beverly Nguyen
d4a46ae552 installing chart.js via npm 2024-05-15 15:40:15 -07:00
Beverly Nguyen
6855a6ebe4 installing chart.js via npm 2024-05-15 15:35:39 -07:00
Jonathan Bobel
ccfc1166a7 commit before branch switch 2024-05-15 14:48:46 -04:00
Beverly Nguyen
5546de66c4 testing chart plain vanilla 2024-05-15 11:39:03 -07:00
Jonathan Bobel
f517180581 Experimenting with chart.js 2024-05-14 15:45:33 -04:00
Jonathan Bobel
d5f40dffe1 Commit before merge 2024-02-27 11:53:51 -05:00
stvnrlly
d3783e70eb delete deleted files 2023-12-18 16:43:05 -05:00
stvnrlly
f600dd95d6 remove email branding 2023-12-18 16:10:12 -05:00
Jonathan Bobel
06a15c5afc 927 - Updates to math in Dashboard area 2023-11-16 12:02:59 -05:00
Andrew Shumway
559965c479 Merge branch 'main' of https://github.com/GSA/notifications-admin into notify-678 2023-09-07 08:39:14 -06:00
Andrew Shumway
8712d7d822 Functionality for session timer display 2023-09-07 08:38:41 -06:00
Jonathan Bobel
2675760f4d Still trying to strip out sass and have it build 2023-08-29 09:48:10 -04:00
Jonathan Bobel
7a100a68f2 Checking to see if this is the reason the build is failing 2023-08-28 16:01:47 -04:00
Jonathan Bobel
d66ff27bae Merge branch 'main' of https://github.com/GSA/notifications-admin into 686-remove-uk-styles
# Conflicts:
#	app/assets/stylesheets/main.scss
#	app/templates/views/find-users/user-information.html
#	app/templates/views/two-factor-webauthn.html
#	app/templates/views/user-profile/manage-security-key.html
#	app/templates/views/user-profile/security-keys.html
#	gulpfile.js
2023-08-15 13:29:39 -04:00
Carlo Costino
9e609efa1c Remove webauthn hooks
This changeset removes webauthn from the Notify.gov admin app.  We are not using webauthn at all in our implementation and will be looking at an entirely different authentication system in the near future.

Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
2023-08-14 16:59:38 -04:00
Jonathan Bobel
348e29fb40 - Removed links to the gov uk stylesheets
- Deleted /stylesheets folder
- Removed sass build from gulpfile
- Changed gov links to usa links
- Changed other govuk styles, like breadcrumbs
- Changed name of uk_components file to us_components
- Fixed a few tests that broke on account of the changes
2023-08-08 16:19:17 -04:00
Jonathan Bobel
bbc03d2ddb Deleting instead of commenting out 2023-07-14 10:39:12 -04:00
Jonathan Bobel
1da906279f Removed links to the sticky javascript, but didn't remove altogether 2023-07-12 15:43:21 -04:00
Steven Reilly
da623c87d6 Add Google Tag Manager for analytics (#541) 2023-06-12 13:52:38 -04:00
Jonathan Bobel
e0d2d74067 Update dashboard and template flow (#514)
* Updated header and footer
* Moved files around and updated gulpfile to correct the build process when it goes to production
* Updated fonts
* Adjusted grid templating
* Adding images to assets
* Updated account pages, dashboard, and pages in message sending flow
* Updated the styling for the landing pages in the account section once logged in
2023-06-08 13:12:00 -04:00
Jonathan Bobel
f342e0fb6c Updating site to use USWDS styles (#509)
* Updated header and footer
* Updated fonts
* Moved files around and updated gulpfile to correct the build process when it goes to production
* Adjusted grid templating
* Added images to assets
* Update app/templates/components/uk_components/footer/template.njk

Co-authored-by: Steven Reilly <stvnrlly@users.noreply.github.com>
2023-06-06 15:28:24 -04:00
Steven Reilly
454b778582 Cookie streamlining (#493)
* remove cookie banner
* remove form from cookies.html
* move cookie content to privacy page
2023-05-03 15:33:27 -04:00
Jonathan Bobel
3bc273eced - Added support for default gulp/build commands
- Moved some folders around to align with gulp copy functions
2023-04-27 13:32:23 -04:00
Jonathan Bobel
eaf3681ae1 Initial USWDS install 2023-04-24 14:57:35 -04:00
stvnrlly
7391b9d17e still copy fonts to static 2022-12-14 13:30:46 -05:00
stvnrlly
8a415bc31b remove leaflet - it was for broadcasts 2022-12-14 13:30:27 -05:00
stvnrlly
11440076e1 fonts were already moved to assets 2022-12-14 13:17:23 -05:00
stvnrlly
dee6ef1c16 put some things back for simplicity 2022-12-14 13:14:35 -05:00
stvnrlly
ac1d5f0983 move vendored uk components to templates 2022-12-14 11:55:21 -05:00
stvnrlly
7613cd2747 remove static and re-add to .gitignore 2022-12-06 10:20:22 -05:00
jimmoffet
315931605a freeze assets 2022-08-03 17:16:35 -07:00
James Moffet
c782d5d80b images and overrides 2022-07-21 18:25:23 -07:00
Katie Smith
f9c551a558 Add and use textarea component from GOV.UK Frontend
For the "Something else" branding form we want the form label to be the
title. This brings in the textarea component from GOV.UK Frontend in
order to do this since that contains code to set a the textarea label as
the page heading in an accessible way.

The rest of the textarea fields have not been switched to use the new
component yet.
2022-02-03 09:59:21 +00:00
Tom Byers
77f7d1453c Replace domdiff library with morphdom
We added domdiff to replace the DiffDOM library
here:

87f54d1e88

DiffDOM had updated its code to be written to the
ECMAScript 6 (ES6) standard and so needed extra
work to work with the older browsers in our
support matrix. This was recorded as an issue
here:

https://www.pivotaltracker.com/n/projects/1443052/stories/165380360

Domdiff didn't work (see below for more details)
so this replaces it with the morphdom library.
Morphdom supports the same browsers as us and is
relied on by a range of large open source
projects:

https://github.com/patrick-steele-idem/morphdom#what-projects-are-using-morphdom

It was tricky to find alternatives to DiffDOM so
if we have to source alternatives in future, other
options could be:
- https://github.com/choojs/nanomorph
- https://diffhtml.org/index.html (using its
  outerHTML method)

Why domdiff didn't work

Turns out that domdiff was replacing the page HTML
with the HTML from the AJAX response every time,
not just when they differed. This isn't a bug.
Domdiff is bare bones enough that it compares old
DOM nodes to new DOM nodes with ===. With our
code, this always results to false because our new
nodes are made from HTML strings from AJAX
response so are never the same node as the old
one.
2022-01-27 11:37:53 +00:00
Tom Byers
87f54d1e88 Replace diffDOM library with domdiff
A while ago diffDOM moved its code to use ES6
modules and started using various language
features specific to ES6. These two things
happened independently btw.

The result of this is that the version of diffDOM
suitable for our build pipeline, structured as an
immediately invoked function evocation (IIFE),
now requires polyfills of some ES6 features to
work in the older browsers we support, like IE11.

It's also worth noting that in the move to ES6
the maintainers of diffDOM have adopted a process
whereby users who need to support older browsers
now have to add polyfill code for any ES6 features
they choose to use.

This commmit proposes a move to the domdiff
library instead because:
- it runs on all javascript runtimes with no
  polyfills
- it is 2KB instead of diffDOM's 25KB

Domdiff takes a different approach to diffDOM, in
that it compares existing nodes and new nodes and
replaces the existing ones with the new ones if
there are differences. By contrast, diffDOM will
make in-place changes to nodes if there are enough
similarities. In other words, in most situations,
diffDOM won't change the node in $component
whereas domdiff will.

Because of this, I've had to change the
updateContent.js code to cache the data-key
attribute's value so we don't lose access to it by
overwrite the $component variable with a different
jQuery selection.
2021-09-22 12:05:47 +01:00
Tom Byers
bec77a2c66 Bump gulp-sass
Intended to deal with this security vulnerability:

https://github.blog/2021-09-08-github-security-update-vulnerabilities-tar-npmcli-arborist/

Bumping gulp-sass to version 5 removes its
dependency on the tar package mentioned in that
article.

Version 5 requires you to specify a compiler
directly in the gulpfile so that code is changed
in line with this guidance:

https://github.com/dlmanning/gulp-sass/tree/master#migrating-to-version-5

Note: node-sass is now deprecated so this also
changes the sass compiler gulp-sass uses to
dart-sass (aka 'sass'), the compiler now
recommended by the Sass project:

https://sass-lang.com/dart-sass

This also bumps gulp and all its plugin modules to
their latest versions, for parity.
2021-09-22 12:05:47 +01:00
Leo Hemsted
c96a1dc0b7 add new error banner module for showing users js errors
this ensures it's reusable by other components, and easier to unit test
by isolating the separate concerns

note: this is not in Modules since that's designed for classes that are
then bound to an element in the DOM as indicated by a data-module
attribute. This will just live at the window.GOVUK level since we want
there to only ever be one `.banner-dangerous` warning.
2021-09-14 18:43:25 +01:00
Leo Hemsted
a231738a16 Merge pull request #3989 from alphagov/update-pricing-pages
Add a billing details page
2021-09-08 16:31:38 +01:00
Leo Hemsted
85f6881a56 rename api key component to copy_to_clipboard
does what it says on the tin, and is also consistent with prior art:
https://components.publishing.service.gov.uk/component-guide/copy_to_clipboard
2021-09-08 10:18:17 +01:00
Tom Byers
388edeef5d Accessibility fixes for map
Makes the controls and links inside it match GOVUK
Frontend styles and:
- gives the map container a focus style matching
  that for GOVUK Frontend text inputs
- makes it all work in high contrast modes (on
  Windows and Firefox)

Note: the focus style for the container is applied
with :focus-visible so only appears when it gets
focus directly, not when it does due to child
elements (like the controls or links) getting
focused. Browsers without support for
:focus-visible get the same styling for all forms
of focus.
2021-08-25 15:32:11 +01:00
Leo Hemsted
907a7dc363 create webauthn 2fa page
if user has `webauthn_auth` as their auth type, then redirect them to an
interstitial that prompts them to click on a button which right now just
logs to the JS console, but in a future commit will open up the webauthn
browser prompt

content is unsurprisingly not final.
2021-06-01 18:44:54 +01:00
Ben Thorner
e2cf3e2c70 Support registering a new authenticator
This adds Yubico's FIDO2 library and two APIs for working with the
"navigator.credentials.create()" function in JavaScript. The GET
API uses the library to generate options for the "create()" function,
and the POST API decodes and verifies the resulting credential. While
the options and response are dict-like, CBOR is necessary to encode
some of the byte-level values, which can't be represented in JSON.

Much of the code here is based on the Yubico library example [1][2].

Implementation notes:

- There are definitely better ways to alert the user about failure, but
window.alert() will do for the time being. Using location.reload() is
also a bit jarring if the page scrolls, but not a major issue.

- Ideally we would use window.fetch() to do AJAX calls, but we don't
have a polyfill for this, and we use $.ajax() elsewhere [3]. We need
to do a few weird tricks [6] to stop jQuery trashing the data.

- The FIDO2 server doesn't serve web requests; it's just a "server" in
the sense of WebAuthn terminology. It lives in its own module, since it
needs to be initialised with the app / config.

- $.ajax returns a promise-like object. Although we've used ".fail()"
elsewhere [3], I couldn't find a stub object that supports it, so I've
gone for ".catch()", and used a Promise stub object in tests.

- WebAuthn only works over HTTPS, but there's an exception for "localhost"
[4].  However, the library is a bit too strict [5], so we have to disable
origin verification to avoid needing HTTPS for dev work.

[1]: c42d9628a4/examples/server/server.py
[2]: c42d9628a4/examples/server/static/register.html
[3]: 91453d3639/app/assets/javascripts/updateContent.js (L33)
[4]: https://stackoverflow.com/questions/55971593/navigator-credentials-is-null-on-local-server
[5]: c42d9628a4/fido2/rpid.py (L69)
[6]: https://stackoverflow.com/questions/12394622/does-jquery-ajax-or-load-allow-for-responsetype-arraybuffer
2021-05-13 10:22:23 +01:00
Ben Thorner
ebb82b2e80 Add page for security keys with stubbed data
This adds a new platform admin settings row, leading a page which
shows any existing keys and allows a new one to be registered. Until
the APIs for this are implemented, the user API client just returns
some stubbed data for manual testing.

This also includes a basic JavaScript module to do the main work of
registering a new authenticator, to be implemented in the next commits.

Some more minor notes:

- Setting the headings in the mapping_table is necessary to get the
horizontal rule along the top (to match the design).

- Setting caption to False in the mapping_table is necessary to stop
an extra margin appearing at the top.
2021-05-12 13:41:53 +01:00
Katie Smith
79a0a14b38 Copy inset-text component from GOV.UK Frontend 2021-02-23 13:02:50 +00:00
Chris Hill-Scott
7463510378 Progressively enhance the proposition illustration
When users with Javascript enabled request it we can show a higher
quality SVG image which will look better in certain circumstances.
2021-02-11 17:03:13 +00:00
Chris Hill-Scott
3fdaa29f35 Fetch template length message as user types
This commit adds some Javascript that makes AJAX requests as the users
changes the content of their template.

It then takes the content returned by the backend and inserts it in the
page.
2021-01-07 17:11:43 +00:00
Chris Hill-Scott
a2f4abf0d3 Remove inlining of images
In very old browsers it used to be that you could only make 2 concurrent
requests from the same origin.

So base64 encoding of images into CSS was an optimisation that became
popular because it reduced the number of separate requests.

However base64 encoding images has a few disadvantages:
- it increases the size of the image by about 30%
- it increases the size of the CSS file, which is a
  [render blocking resource](https://web.dev/render-blocking-resources/)
  so makes the page appear to load more slowly for the sake of some
  images which, on most pages, never get used
- GZipping things that are already compressed (for example PNG data) is
  very CPU intensive, and might be why Cloudfront sometimes gives up

Removing the inlining of images reduces the size of the CSS we’re
sending to the browser considerably:

–| Before | After | Saving
---|---|---|---
Uncompressed | 198kb | 164kb | 17%
Compressed | 38kb | 23kb | 39%
2020-12-29 18:40:16 +00:00
Tom Byers
24db85684c Revert "Merge pull request #3738 from alphagov/test-pre-compressed-asset"
This reverts commit 2a817024a1, reversing
changes made to d5f54d2d78.
2020-12-21 21:12:16 +00:00
Tom Byers
80f34d8c3d Generate asset to test CDN compression config
Cloudfront, our CDN, sometimes decides not to gzip
assets. Because of this, we're going to gzip them
ourselves prior to upload instead.

This will involve:
1. adding gzipping to the make task that uploads
   them
2. turning compression off in Cloudfront

There is already a pull request up for number 1:

https://github.com/alphagov/notifications-admin/pull/3733

Because deploying all this will, at some point,
create a state where Cloudfront is set to compress
assets that are already compressed, we need to
test that it doesn't re-compress them.

This adds a frontend build task that generates a
test asset which is:
- a copy of app/static/stylesheets/main.css
- renamed to include a MD5 SHA of its contents
- already gzipped

Once deployed, the test will be to:
1. download the asset from the live environment
2. unzip it
3. diff it against app/static/stylesheets/main.css
2020-12-09 10:24:36 +00:00
Tom Byers
48499f0c00 Bring in Jinja and Sass for radios component 2020-11-11 10:21:32 +00:00