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

Banners 9223 #12959

Merged
merged 21 commits into from
Jun 15, 2020
Merged

Banners 9223 #12959

merged 21 commits into from
Jun 15, 2020

Conversation

kelsonic
Copy link
Contributor

@kelsonic kelsonic commented Jun 4, 2020

Description

Issue: department-of-veterans-affairs/va.gov-team#9223

This PR implements the first version of a new site-wide banners management folder. This folder currently contains the Maintenance Banner and the Homepage Banner (aka Emergency Banner). It may include other banners in the future should the need arise.

Testing done

Created unit + e2e tests. The e2e tests don't run currently as we need to have the ability to change the system clock the e2e test suite runs in to test this code with Nightwatch.

Screenshots

Before

image

Pre-Downtime (defaults to 12 hours before startsAt) (1+ days of downtime)

image

Pre-Downtime (defaults to 12 hours before startsAt) (less than 1 day of downtime)

image

During Downtime (1+ days of downtime)

image

During Downtime (less than 1 day of downtime)

image

After

image

What about mobile?

image (3)

Acceptance criteria

  • Implement first version of system maintenance banner.

Definition of done

  • Events are logged appropriately
  • Documentation has been updated, if applicable
  • A link has been provided to the originating GitHub issue (or connected to it via ZenHub)
  • No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs

@kelsonic kelsonic requested review from ncksllvn and a team June 4, 2020 17:47
@kelsonic kelsonic requested a review from a team as a code owner June 4, 2020 17:47
@kelsonic kelsonic self-assigned this Jun 4, 2020
Copy link
Contributor

@ncksllvn ncksllvn left a comment

Choose a reason for hiding this comment

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

Loving it!

src/platform/site-wide/maintenance-banner/config.js Outdated Show resolved Hide resolved
src/platform/site-wide/maintenance-banner/config.js Outdated Show resolved Hide resolved
src/site/includes/header.html Outdated Show resolved Hide resolved
Comment on lines 11 to 20
const {
content,
expiresAt,
id,
startsAt,
title,
warnContent,
warnStartsAt,
warnTitle,
} = config;

Choose a reason for hiding this comment

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

It would be more idiomatic to pass these in as props.

We should fetch this information from pager duty using something like getCurrentGlobalDowntime in src/platform/monitoring/DowntimeNotification/util/helpers.js. The parent component for this could transform that data into the view props (e.g. I think you only get the downtime window but you'd need to turn that into stuff like warnStartsAt).

If we use that helper then we don't need to do a site deploy to turn this on- we can set a maintenance window for the global downtime in PagerDuty.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh nice! I'll check that out 🙂

@va-vfs-bot va-vfs-bot requested a review from a team June 5, 2020 20:38
Copy link

@va-vfs-bot va-vfs-bot left a comment

Choose a reason for hiding this comment

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

ESLint is disabled

vets-website uses ESLint to help enforce code quality. In most situations we would like ESLint to remain enabled.

What you can do

See if the code can be refactored to avoid disabling ESLint, or wait for a VSP review.

Copy link
Contributor

@ncksllvn ncksllvn left a comment

Choose a reason for hiding this comment

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

Fantastic work! 👏

src/site/includes/header.html Show resolved Hide resolved
id: PropTypes.string.isRequired,
startsAt: PropTypes.object.isRequired,
title: PropTypes.string.isRequired,
warnContent: PropTypes.string,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we were asked to add some enforcement for the 300-length limit on the content so maybe we could throw an explicit error if the text length exceeds that. That could make sense as a follow-up PR though and to ahve this lay the foundation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh you're right! As the timestamp changes that length will change, too 🤔 Hmm...

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, and the length also doesn't include HTML tags (only the text content itself) so it's not actually a super easy problem

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ooo, do you think I should set inner html here? I wasn't planning on the maintenance banner having jsx elements in it other than just a plain string with formatted startsAt, etc. Currently it just shows this non-html string.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good question. I'm a little torn because on one hand we want to standardize the messaging but we also want to cap the message at a 300-character limit, which suggests we do intend to customize the message every now and then. How you have it now as a plain string seems totally fine as a starting point

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The maintenance banner content shouldn't change after this implementation (theoretically of course...), so isn't putting a length limit on it a little overkill if it's not going to change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could see a length limit being useful for the homepage banner

@va-vfs-bot va-vfs-bot temporarily deployed to master/banners-9223 June 8, 2020 19:42 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to master/banners-9223 June 8, 2020 23:18 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to master/banners-9223 June 9, 2020 14:24 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to master/banners-9223 June 9, 2020 17:06 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to master/banners-9223 June 9, 2020 20:48 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to master/banners-9223 June 10, 2020 14:51 Inactive
@kelsonic
Copy link
Contributor Author

@department-of-veterans-affairs/frontend-review-group ready for review! 🎉

@kelsonic
Copy link
Contributor Author

Can't seem to figure out which unit tests are failing here, they all seem to pass locally 🤔 http://jenkins.vfs.va.gov/blue/organizations/jenkins/testing%2Fvets-website/detail/banners-9223/28/tests

@va-vfs-bot va-vfs-bot temporarily deployed to master/banners-9223 June 15, 2020 15:43 Inactive
@kelsonic kelsonic merged commit 71cc549 into master Jun 15, 2020
@kelsonic kelsonic deleted the banners-9223 branch June 15, 2020 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants