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

[CMSP-992] UI changes #272

Merged
merged 203 commits into from
May 23, 2024
Merged

[CMSP-992] UI changes #272

merged 203 commits into from
May 23, 2024

Conversation

jazzsequence
Copy link
Contributor

@jazzsequence jazzsequence commented May 20, 2024

This PR:

  • updates some of the language in the notices and alerts
  • adds a new build pipeline using Gulp and Sass (and removes old NPM dependencies that weren't being used)
  • adds build_node_assets to the build-tag-release workflow
  • adds styling for Pantheon Page Cache Max Age field (uses selectors added in [CMSP-992] Add CSS selectors for updating styles in PAPC pantheon-mu-plugin#46)
  • adds new elements and overrides default HTML elements (based on hooks added in [CMSP-992] Add CSS selectors for updating styles in PAPC pantheon-mu-plugin#46)
  • adds styles (and a filter that is commented-out) for an info bar in the Max Age setting per the Figma designs (disabled because we aren't using it)
  • adds other styles and text per the Figma designs
  • changes the input box to a select (dropdown) if the value is not filtered and not manually set. (a warning is displayed if a custom value is saved that is not one of the recommended (default) options
  • fixes some logic around warnings and alerts
  • adds tests for new components

Demo

https://www.loom.com/share/686250ad45b3493fa5f8f250cf233345

Screenshots

Global notice when max age of 600 is reset to the default
Screenshot 2024-05-20 at 2 37 35 PM

Pantheon Page Cache warning when max age is far less than the recommended value (Note: max-age is now max age in the code)
Screenshot 2024-05-20 at 2 37 28 PM

Site Health recommendation when max age is far less than the recommended value (Note: all instances of max-age/Max-Age have been replaced with their equivalent without the - in the code)
Screenshot 2024-05-21 at 9 14 44 AM

Pantheon Page Cache warning when max age is closer, but still less than, the recommended value (Note: max-age is now max age in the code)
Screenshot 2024-05-20 at 2 37 07 PM

Site Health recommendation when max age is closer, but still less than, the recommended value (Note: all instances of max-age/Max-Age have been replaced with their equivalent without the - in the code)
Screenshot 2024-05-21 at 9 11 43 AM

Pantheon Page Cache options page with new settings
Screenshot 2024-05-21 at 9 09 00 AM

Pantheon Page Cache Max Age dropdown
Screenshot 2024-05-21 at 9 09 15 AM

Pantheon Page Cache Max Age with custom value (Note: This would only occur if a value other than 600 and any of the default options had been set previously.)
Screenshot 2024-05-21 at 1 59 30 PM

Pantheon Page Cache Max Age with filtered value (Note: If a custom/different value is saved in the database, the filtered value replaces it in the (disabled) input)
Screenshot 2024-05-21 at 3 28 41 PM

Pantheon Cache Max Age with info bar (Note: This is controlled via a filter that can be hooked to __return_true/__return_false to toggle. By default it is not displayed. Styles are included in this PR per the Figma and in case we choose to use it in the future.
Screenshot 2024-05-21 at 3 30 20 PM

hook to mu-plugin > 1.4.0
this is either set in the mu-plugin or empty. if empty, it should default to 1 week
there's no reason to make this a class since we're not using any class features
and be specific that we're talking about seconds
because it could be something different
this is helpful so we can always return the filtered value
don't say it's "very low" unless that's actually accurate.
@jazzsequence jazzsequence requested a review from a team as a code owner May 21, 2024 20:11
@scottbuscemi
Copy link

Screenshot 2024-05-21 at 3 00 43 PM

Looks like "Recommended Setting" is using the hardcoded value rather than just saying '1 day'

@jazzsequence
Copy link
Contributor Author

jazzsequence commented May 21, 2024

@scottbuscemi

Looks like "Recommended Setting" is using the hardcoded value rather than just saying '1 day'

Explained in the demo. If a value is filtered, the filtered value takes the place of the recommendation/becomes the new recommendation. If this is different than what you would like, we can change it, but the assumption is, if you're filtering it, you're breaking the seal on the warranty.

@scottbuscemi
Copy link

Let's remove the "Value range" sentence

@scottbuscemi
Copy link

If someone is doing their own thing, we can just not recommend something anymore :)

@jazzsequence
Copy link
Contributor Author

If someone is doing their own thing, we can just not recommend something anymore :)

Sure can.

@jazzsequence
Copy link
Contributor Author

Screenshot 2024-05-21 at 4 07 26 PM

@scottbuscemi

Copy link
Member

@pwtyler pwtyler left a comment

Choose a reason for hiding this comment

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

A few comments. have not watched recording yet.

.gitattributes Show resolved Hide resolved
inc/admin-interface.php Outdated Show resolved Hide resolved
inc/admin-interface.php Outdated Show resolved Hide resolved
inc/admin-interface.php Outdated Show resolved Hide resolved
jazzsequence and others added 5 commits May 21, 2024 16:17
filtered displays the grayed out input box
custom adds to the dropdown
Co-authored-by: Phil Tyler <[email protected]>
@jazzsequence
Copy link
Contributor Author

jazzsequence commented May 22, 2024

Cache max age recommendation message updates:

Current value is above the recommendation
Screenshot 2024-05-22 at 9 05 20 AM

Current value is set to the recommendation
Screenshot 2024-05-22 at 9 05 38 AM

Current value is below the recommendation
Screenshot 2024-05-22 at 9 06 08 AM

Current value is filtered below the recommendation
Screenshot 2024-05-22 at 9 06 37 AM

Current value is filtered above the recommendation
Screenshot 2024-05-22 at 9 07 05 AM

Note: Updated to remove duplicative "current" in the message(s).

Copy link
Member

@pwtyler pwtyler left a comment

Choose a reason for hiding this comment

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

I would love some cleanup and clarity as described in a couple places, but will leave at your discretion.

inc/admin-interface.php Outdated Show resolved Hide resolved
inc/admin-interface.php Outdated Show resolved Hide resolved
`$is_filtered` instead of `$filtered`
`$has_custom_ttl` instead of `$custom` and `$custom_ttl`
@jazzsequence jazzsequence merged commit a399b1a into develop May 23, 2024
9 checks passed
@jazzsequence jazzsequence deleted the cmsp-992-ui branch May 23, 2024 20:03
jazzsequence added a commit that referenced this pull request May 28, 2024
* [CMSP-995] Notices for low max age values in Page Cache Options (#268)

* add initial admin interface class
hook to mu-plugin > 1.4.0

* some more scaffolding

* require at least 6.4

* don't show notices if wp_admin_notice doesn't exist

* add notice if mu-plugin was not found

* add notice if the mu-plugin is old

* fix link and change decimal to string

* use spaces instead of line breaks

* add helper function to get current max age
this is either set in the mu-plugin or empty. if empty, it should default to 1 week

* add notice if less than 1 week but not == 600 seconds

* add docblock

* add translator comments

* update tested up to and requires at least values in readmes

* version bump

* bump composer deps

* don't display the warnings if we aren't on the pantheon cache admin page

* convert static class to a namespace
there's no reason to make this a class since we're not using any class features

* add a bootstrapper for namespace-only files

* lint

* escape the wp_die message

* use a helper for humanized time calculations

* we still need to test the current max age

* pass the current max age to the message, too
and be specific that we're talking about seconds

* use the filterable value for default max age
because it could be something different

* add a helper function for retrieving the default max age
this is helpful so we can always return the filtered value

* also display the seconds in the successful test

* rank the max age value
don't say it's "very low" unless that's actually accurate.

* add caching to the ranked compare

* make the color more severe if it's a bigger issue

* change the color of the admin notice based on the severity of the diff

* clear the transient when the option is updated

* break notice type into a variable

* fix the translator note

* keep the rank but hide it from the dom

* add unit tests

* add initial behat test
let's just see if we can assume this will work

* fix failing test

* specify the element where the notices are

* add site health check test

* actually save the changes

* remove max age check
only exists in an html comment anyway

* simplify the site health check

* add the message when you expand the accordion

* add other site health things

* change press to click?

* add "open the accordion" as a custom step

* move behat stuff around

* move stuff around again

* update the behat.yml

* remove custom context and try "when I follow"

* move to checking the text inside the elements

* target the hidden element

* use hidden='hidden'

* call it a div

* simplify the tests

* remove press
since we can't actually press

* it did actually find the right heading
maybe it will find the right text?

* add @\since tags

* add changelog and upgrade notice

* let's try checking for some of the hidden text

* period at the end of the sentence

* add the ranks back
this shows us that our ranking function is working

* add the messages

* remove age rank tests
because goutte doesn't natively interpret html comments

* add github testing badge
since phpunit is no longer run on circle

* add script to maybe skip behat tests if we don't need to run them

* add step to workflow

* do not run if the circle config changes

* also ignore if scripts (that aren't behat-related) have changed

* fix the logic (again)

* one more flippity flip

* remove the "ignoring" message
it's actually implied by the fact that is_ignored is checked

* use function to determine if a file should be ignored

Co-authored-by: Phil Tyler <[email protected]>

* update changelog to note mu-plugin updates

* Update tests/phpunit/test-admin-interface.php

* use data providers to simplify the tests

---------

Co-authored-by: Phil Tyler <[email protected]>

* [CMSP-994] Automatically update the `default_ttl` value if it was set to 600 (#269)

* add initial admin interface class
hook to mu-plugin > 1.4.0

* some more scaffolding

* require at least 6.4

* don't show notices if wp_admin_notice doesn't exist

* add notice if mu-plugin was not found

* add notice if the mu-plugin is old

* fix link and change decimal to string

* use spaces instead of line breaks

* add helper function to get current max age
this is either set in the mu-plugin or empty. if empty, it should default to 1 week

* add notice if less than 1 week but not == 600 seconds

* add docblock

* add translator comments

* update tested up to and requires at least values in readmes

* version bump

* bump composer deps

* don't display the warnings if we aren't on the pantheon cache admin page

* convert static class to a namespace
there's no reason to make this a class since we're not using any class features

* add a bootstrapper for namespace-only files

* lint

* escape the wp_die message

* use a helper for humanized time calculations

* we still need to test the current max age

* pass the current max age to the message, too
and be specific that we're talking about seconds

* use the filterable value for default max age
because it could be something different

* add a helper function for retrieving the default max age
this is helpful so we can always return the filtered value

* also display the seconds in the successful test

* rank the max age value
don't say it's "very low" unless that's actually accurate.

* add caching to the ranked compare

* make the color more severe if it's a bigger issue

* change the color of the admin notice based on the severity of the diff

* clear the transient when the option is updated

* break notice type into a variable

* fix the translator note

* keep the rank but hide it from the dom

* add unit tests

* add initial behat test
let's just see if we can assume this will work

* fix failing test

* specify the element where the notices are

* add site health check test

* actually save the changes

* remove max age check
only exists in an html comment anyway

* simplify the site health check

* add the message when you expand the accordion

* add other site health things

* change press to click?

* add "open the accordion" as a custom step

* move behat stuff around

* move stuff around again

* update the behat.yml

* remove custom context and try "when I follow"

* move to checking the text inside the elements

* target the hidden element

* use hidden='hidden'

* call it a div

* simplify the tests

* remove press
since we can't actually press

* it did actually find the right heading
maybe it will find the right text?

* add @\since tags

* add changelog and upgrade notice

* let's try checking for some of the hidden text

* period at the end of the sentence

* add the ranks back
this shows us that our ranking function is working

* add the messages

* remove age rank tests
because goutte doesn't natively interpret html comments

* add github testing badge
since phpunit is no longer run on circle

* add script to maybe skip behat tests if we don't need to run them

* add step to workflow

* do not run if the circle config changes

* also ignore if scripts (that aren't behat-related) have changed

* fix the logic (again)

* one more flippity flip

* remove the "ignoring" message
it's actually implied by the fact that is_ignored is checked

* use function to determine if a file should be ignored

Co-authored-by: Phil Tyler <[email protected]>

* update changelog to note mu-plugin updates

* add functionality to automatically set the default_ttl if it was set to 600

* trigger the setting change and display an admin notice informing users it was done
only show the notice to users who haven't already seen it and who can manage_options

* add unit tests for set_max_age_to_default

* move the max age update notice to the bootstrap

* remove the set_max_age_updated helper
this wasn't working and meant that we were needing to make multiple update options in a short space of time. we might have actually been running into race conditions where one update was overwriting the other one.

* use a new option for the updated flag

* add _notice to the user meta key so it's distinct from the new option

* update tests for new changes

* add translator note

* user notice about 600 second update is not dismissable
because it only appears once

* don't show seconds in updated notice

* pass the function into the apply_filter hook
so you can selectively disable specific notices

* add docblock

* add test for the notice

* return the value of disable_notices
rather than hard-coded "false"

* Add scenario to set max-age to 600 and auto-update to the default value

* here's a behat test that might not work
not sure if it will know what pantheon-cache[default-ttl] is without giving it an element to look at.

* fixed it based on upstream tests

* refresh the page

* go to instead of refresh
since refresh isn't a thing ¯\_(ツ)_/¯

* add additional test failure messaging

* break up tests

---------

Co-authored-by: Phil Tyler <[email protected]>

* [CMSP-995] one more notice (#271)

* add a global admin notice that appears once

* remove seconds from the notice

* test the new notice

* set dismissable depending on which notice we're showing

* show the max age rank html comment

* fix the conditionals for cs

* update behat tests for new notice language

* bugfix: don't update user meta that max_age was updated if it hasn't been

* add one more thing to test in behat

* add a test for the error, specifically

* add a test for the warning

* simplify the conditionals

* lint

* specify the pages that we're on?

* remove specific element

* fix typo

* take out the dashboard main page goto

* validate the setting was saved

* let's just remove the 5 days notice

* just remove the test
we have similar things being tested in phpunit

* we can actually remove current_max_age >= WEEK_IN_SECONDS
this is covered by max_age_rank. if max_age_rank is 0 it, by definition, means that the current max age is >= WEEK_IN_SECONDS

* if we're only comparing two things, we don't need to break the if clauses up

* we do want to warn users if they have manually set their max age to 600
we just don't want to warn them if we're about to (or just did) change it to a week for them

* [CMSP-992] UI changes (#272)

* add initial admin interface class
hook to mu-plugin > 1.4.0

* some more scaffolding

* require at least 6.4

* don't show notices if wp_admin_notice doesn't exist

* add notice if mu-plugin was not found

* add notice if the mu-plugin is old

* fix link and change decimal to string

* use spaces instead of line breaks

* add helper function to get current max age
this is either set in the mu-plugin or empty. if empty, it should default to 1 week

* add notice if less than 1 week but not == 600 seconds

* add docblock

* add translator comments

* update tested up to and requires at least values in readmes

* version bump

* bump composer deps

* don't display the warnings if we aren't on the pantheon cache admin page

* convert static class to a namespace
there's no reason to make this a class since we're not using any class features

* add a bootstrapper for namespace-only files

* lint

* escape the wp_die message

* use a helper for humanized time calculations

* we still need to test the current max age

* pass the current max age to the message, too
and be specific that we're talking about seconds

* use the filterable value for default max age
because it could be something different

* add a helper function for retrieving the default max age
this is helpful so we can always return the filtered value

* also display the seconds in the successful test

* rank the max age value
don't say it's "very low" unless that's actually accurate.

* add caching to the ranked compare

* make the color more severe if it's a bigger issue

* change the color of the admin notice based on the severity of the diff

* clear the transient when the option is updated

* break notice type into a variable

* fix the translator note

* keep the rank but hide it from the dom

* add unit tests

* add initial behat test
let's just see if we can assume this will work

* fix failing test

* specify the element where the notices are

* add site health check test

* actually save the changes

* remove max age check
only exists in an html comment anyway

* simplify the site health check

* add the message when you expand the accordion

* add other site health things

* change press to click?

* add "open the accordion" as a custom step

* move behat stuff around

* move stuff around again

* update the behat.yml

* remove custom context and try "when I follow"

* move to checking the text inside the elements

* target the hidden element

* use hidden='hidden'

* call it a div

* simplify the tests

* remove press
since we can't actually press

* it did actually find the right heading
maybe it will find the right text?

* add @\since tags

* add changelog and upgrade notice

* let's try checking for some of the hidden text

* period at the end of the sentence

* add the ranks back
this shows us that our ranking function is working

* add the messages

* remove age rank tests
because goutte doesn't natively interpret html comments

* add github testing badge
since phpunit is no longer run on circle

* add script to maybe skip behat tests if we don't need to run them

* add step to workflow

* do not run if the circle config changes

* also ignore if scripts (that aren't behat-related) have changed

* fix the logic (again)

* one more flippity flip

* remove the "ignoring" message
it's actually implied by the fact that is_ignored is checked

* use function to determine if a file should be ignored

Co-authored-by: Phil Tyler <[email protected]>

* update changelog to note mu-plugin updates

* add functionality to automatically set the default_ttl if it was set to 600

* trigger the setting change and display an admin notice informing users it was done
only show the notice to users who haven't already seen it and who can manage_options

* add unit tests for set_max_age_to_default

* move the max age update notice to the bootstrap

* remove the set_max_age_updated helper
this wasn't working and meant that we were needing to make multiple update options in a short space of time. we might have actually been running into race conditions where one update was overwriting the other one.

* use a new option for the updated flag

* add _notice to the user meta key so it's distinct from the new option

* update tests for new changes

* add translator note

* user notice about 600 second update is not dismissable
because it only appears once

* don't show seconds in updated notice

* pass the function into the apply_filter hook
so you can selectively disable specific notices

* add docblock

* add test for the notice

* return the value of disable_notices
rather than hard-coded "false"

* Add scenario to set max-age to 600 and auto-update to the default value

* here's a behat test that might not work
not sure if it will know what pantheon-cache[default-ttl] is without giving it an element to look at.

* fixed it based on upstream tests

* refresh the page

* go to instead of refresh
since refresh isn't a thing ¯\_(ツ)_/¯

* remove all the old npm stuff and use all new npm stuff

* add node build to the build & tag workflow

* add del package

* repurpos gruntfile into gulpfile

* repackage gulpfile and package.json as a module

* add additional test failure messaging

* gitignore assets

* don't export the gulpfile

* invoke sass correctly

* proper sassing

* add a main.scss file

* compiler tweaks

* use concat

* initial styles

* enqueue css

* use the filter added in pantheon-systems/pantheon-mu-plugin#46 to add header

* some initial styles for the max age box

* add a global admin notice that appears once

* remove seconds from the notice

* test the new notice

* set dismissable depending on which notice we're showing

* show the max age rank html comment

* fix the conditionals for cs

* update behat tests for new notice language

* bugfix: don't update user meta that max_age was updated if it hasn't been

* add one more thing to test in behat

* add a test for the error, specifically

* add a test for the warning

* simplify the conditionals

* lint

* specify the pages that we're on?

* remove specific element

* fix typo

* take out the dashboard main page goto

* validate the setting was saved

* let's just remove the 5 days notice

* just remove the test
we have similar things being tested in phpunit

* we can actually remove current_max_age >= WEEK_IN_SECONDS
this is covered by max_age_rank. if max_age_rank is 0 it, by definition, means that the current max age is >= WEEK_IN_SECONDS

* if we're only comparing two things, we don't need to break the if clauses up

* we do want to warn users if they have manually set their max age to 600
we just don't want to warn them if we're about to (or just did) change it to a week for them

* there should only be one css file

* remove seconds

* check stored default_ttl value

* fix failing test

* fix translators note

* remove seconds

* remove redundant check

* tweak the logic again

* fix the test by updating the default ttl

* add the description after the input

* styles for box and info bar

* update the filter name

* filter the input box

* add a padding helper

* ...and use it

* lint

* add styling for links in the info bar.

* no padding on the right
padding the right makes the bar flush with the edge of the box

* adjust h3 margin
so it looks better when there's no banner

* style the select input

* don't render the info bar

* use wp_kses_post instead of esc_html_e
we might want to add links to this bar

* helper function for available dropdown options and make it filterable

* Refactor default_ttl_input function to handle custom options and filterable dropdown

* remove seconds from behat tests

* add a period for dumb lint rule

* remove hyphen from max-age
in everything user-facing

* update the tests

* conditionally append a timestamp to the css version
to refresh it on each page load if debug is true

* don't show the input box if the ttl is unset

* remove filters in teardown

* remove hyphen in tests

* specify method visibility

* test the setting description callback

* test the default ttl option input callback

* test max_age_options and filter

* add a behat test for the select input

* maybe change the then

* remove all hyphens

* be more specific about the select input

* try using the class and the select

* let's try checking to see if the response contains the selected option

* print for debugging

* one last try before I give up

* remove the new behat test

* use a simple true/false gate for max_age header

* display a warning if the default_ttl is saved to a value that's not one of the default optiosn

* show the dropdown with the custom value
so a new value can be selected from the droptdown when prompted

* remove placeholder comment

* gix the global warning shown logic

* make sure to take into consideration custom and filtered

* bail early if the max age is filtered

* better comment

* remove value range entirely

* remove recommendation if filtered

* break out custom and filtered outputs
filtered displays the grayed out input box
custom adds to the dropdown

* update tests

* translator note

* move the debug note

Co-authored-by: Phil Tyler <[email protected]>

* add since and return values

* push the description down a bit

* personalized message based on current cache max age

* remove current when not necessary

* update tests, add a data provider

* use boolean variable names
`$is_filtered` instead of `$filtered`
`$has_custom_ttl` instead of `$custom` and `$custom_ttl`

---------

Co-authored-by: Phil Tyler <[email protected]>

* [CMSP-992] plugin documentation update (#273)

* add initial admin interface class
hook to mu-plugin > 1.4.0

* some more scaffolding

* require at least 6.4

* don't show notices if wp_admin_notice doesn't exist

* add notice if mu-plugin was not found

* add notice if the mu-plugin is old

* fix link and change decimal to string

* use spaces instead of line breaks

* add helper function to get current max age
this is either set in the mu-plugin or empty. if empty, it should default to 1 week

* add notice if less than 1 week but not == 600 seconds

* add docblock

* add translator comments

* update tested up to and requires at least values in readmes

* version bump

* bump composer deps

* don't display the warnings if we aren't on the pantheon cache admin page

* convert static class to a namespace
there's no reason to make this a class since we're not using any class features

* add a bootstrapper for namespace-only files

* lint

* escape the wp_die message

* use a helper for humanized time calculations

* we still need to test the current max age

* pass the current max age to the message, too
and be specific that we're talking about seconds

* use the filterable value for default max age
because it could be something different

* add a helper function for retrieving the default max age
this is helpful so we can always return the filtered value

* also display the seconds in the successful test

* rank the max age value
don't say it's "very low" unless that's actually accurate.

* add caching to the ranked compare

* make the color more severe if it's a bigger issue

* change the color of the admin notice based on the severity of the diff

* clear the transient when the option is updated

* break notice type into a variable

* fix the translator note

* keep the rank but hide it from the dom

* add unit tests

* add initial behat test
let's just see if we can assume this will work

* fix failing test

* specify the element where the notices are

* add site health check test

* actually save the changes

* remove max age check
only exists in an html comment anyway

* simplify the site health check

* add the message when you expand the accordion

* add other site health things

* change press to click?

* add "open the accordion" as a custom step

* move behat stuff around

* move stuff around again

* update the behat.yml

* remove custom context and try "when I follow"

* move to checking the text inside the elements

* target the hidden element

* use hidden='hidden'

* call it a div

* simplify the tests

* remove press
since we can't actually press

* it did actually find the right heading
maybe it will find the right text?

* add @\since tags

* add changelog and upgrade notice

* let's try checking for some of the hidden text

* period at the end of the sentence

* add the ranks back
this shows us that our ranking function is working

* add the messages

* remove age rank tests
because goutte doesn't natively interpret html comments

* add github testing badge
since phpunit is no longer run on circle

* add script to maybe skip behat tests if we don't need to run them

* add step to workflow

* do not run if the circle config changes

* also ignore if scripts (that aren't behat-related) have changed

* fix the logic (again)

* one more flippity flip

* remove the "ignoring" message
it's actually implied by the fact that is_ignored is checked

* use function to determine if a file should be ignored

Co-authored-by: Phil Tyler <[email protected]>

* update changelog to note mu-plugin updates

* add functionality to automatically set the default_ttl if it was set to 600

* trigger the setting change and display an admin notice informing users it was done
only show the notice to users who haven't already seen it and who can manage_options

* add unit tests for set_max_age_to_default

* move the max age update notice to the bootstrap

* remove the set_max_age_updated helper
this wasn't working and meant that we were needing to make multiple update options in a short space of time. we might have actually been running into race conditions where one update was overwriting the other one.

* use a new option for the updated flag

* add _notice to the user meta key so it's distinct from the new option

* update tests for new changes

* add translator note

* user notice about 600 second update is not dismissable
because it only appears once

* don't show seconds in updated notice

* pass the function into the apply_filter hook
so you can selectively disable specific notices

* add docblock

* add test for the notice

* return the value of disable_notices
rather than hard-coded "false"

* Add scenario to set max-age to 600 and auto-update to the default value

* here's a behat test that might not work
not sure if it will know what pantheon-cache[default-ttl] is without giving it an element to look at.

* fixed it based on upstream tests

* refresh the page

* go to instead of refresh
since refresh isn't a thing ¯\_(ツ)_/¯

* remove all the old npm stuff and use all new npm stuff

* add node build to the build & tag workflow

* add del package

* repurpos gruntfile into gulpfile

* repackage gulpfile and package.json as a module

* add additional test failure messaging

* gitignore assets

* don't export the gulpfile

* invoke sass correctly

* proper sassing

* add a main.scss file

* compiler tweaks

* use concat

* initial styles

* enqueue css

* use the filter added in pantheon-systems/pantheon-mu-plugin#46 to add header

* some initial styles for the max age box

* add a global admin notice that appears once

* remove seconds from the notice

* test the new notice

* set dismissable depending on which notice we're showing

* show the max age rank html comment

* fix the conditionals for cs

* update behat tests for new notice language

* bugfix: don't update user meta that max_age was updated if it hasn't been

* add one more thing to test in behat

* add a test for the error, specifically

* add a test for the warning

* simplify the conditionals

* lint

* specify the pages that we're on?

* remove specific element

* fix typo

* take out the dashboard main page goto

* validate the setting was saved

* let's just remove the 5 days notice

* just remove the test
we have similar things being tested in phpunit

* we can actually remove current_max_age >= WEEK_IN_SECONDS
this is covered by max_age_rank. if max_age_rank is 0 it, by definition, means that the current max age is >= WEEK_IN_SECONDS

* if we're only comparing two things, we don't need to break the if clauses up

* we do want to warn users if they have manually set their max age to 600
we just don't want to warn them if we're about to (or just did) change it to a week for them

* there should only be one css file

* remove seconds

* check stored default_ttl value

* fix failing test

* fix translators note

* remove seconds

* remove redundant check

* tweak the logic again

* fix the test by updating the default ttl

* add the description after the input

* styles for box and info bar

* update the filter name

* filter the input box

* add a padding helper

* ...and use it

* lint

* add styling for links in the info bar.

* no padding on the right
padding the right makes the bar flush with the edge of the box

* adjust h3 margin
so it looks better when there's no banner

* style the select input

* don't render the info bar

* use wp_kses_post instead of esc_html_e
we might want to add links to this bar

* helper function for available dropdown options and make it filterable

* Refactor default_ttl_input function to handle custom options and filterable dropdown

* remove seconds from behat tests

* add a period for dumb lint rule

* remove hyphen from max-age
in everything user-facing

* update the tests

* conditionally append a timestamp to the css version
to refresh it on each page load if debug is true

* don't show the input box if the ttl is unset

* remove filters in teardown

* remove hyphen in tests

* specify method visibility

* test the setting description callback

* test the default ttl option input callback

* test max_age_options and filter

* add a behat test for the select input

* maybe change the then

* remove all hyphens

* be more specific about the select input

* try using the class and the select

* let's try checking to see if the response contains the selected option

* print for debugging

* one last try before I give up

* remove the new behat test

* use a simple true/false gate for max_age header

* display a warning if the default_ttl is saved to a value that's not one of the default optiosn

* show the dropdown with the custom value
so a new value can be selected from the droptdown when prompted

* remove placeholder comment

* gix the global warning shown logic

* make sure to take into consideration custom and filtered

* bail early if the max age is filtered

* better comment

* remove value range entirely

* remove recommendation if filtered

* break out custom and filtered outputs
filtered displays the grayed out input box
custom adds to the dropdown

* update tests

* translator note

* move the debug note

Co-authored-by: Phil Tyler <[email protected]>

* add since and return values

* push the description down a bit

* personalized message based on current cache max age

* remove current when not necessary

* update tests, add a data provider

* update changelog

* cache max age filter docs

* document filter to disable notices

* emdash

Co-authored-by: Phil Tyler <[email protected]>

* add missing links

* emdash

* update the 2.0.0 upgrade notice

* add upgrade notice to .md

* remove linebreak

* add -dev tag to versions

* fix readme spacing

---------

Co-authored-by: Phil Tyler <[email protected]>

* Add NPM Diff action (#275)

* use NPM Lockfile Changes

* make sure the workflow also runs when package-lock files are updated

* rename the workflow file
since it's not just composer anymore

* allow fuzzy matching
because excluded subdirectory files should not trigger behat tests

* Build unminified css (#276)

* add gulp-rename
for renaming the minified css file

* update the build workflow to create two css files

* explicitly enqueue the minified css file

* define the path

* full path to workspace?

* add an npm install step
to generate the lockfile
might be ignored by .gitattributes

* re-add path

* don't fail if the test fails

* temporarily don't ignore package-lock.json files

* remove path

* run workflow when the workflow itself is changed
so we can see the effects of our changes

* pass path

* remove unnecessary params
the defaults cover these

* comment out the npm package diff and add description why

* don't run on package-lock updates

* don't run the workflow if the release event is a pre-release (#277)

* update validator version to v1 (#278)

since autotag is now running

* remove gitignore rule to ignore compiled css files (#280)

* fix syntax error in conditional (#281)

* fix syntax error in conditional

* add a workflow that validates workflows

* [CMSP-1193] Filter `pantheon_cache_default_max_age`  when nonces are created (#282)

* require the wp_screen class if it's not loaded

* filter default cache max age to less than nonce_life when creating nonces

* add tests

* update changelog

* add props

* re-add package-lock.json to .gitattributes (#284)

* Release 2.0.0

---------

Co-authored-by: Chris Reynolds <[email protected]>
Co-authored-by: Phil Tyler <[email protected]>
Co-authored-by: Pantheon Automation <[email protected]>
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.

3 participants