VACMS-15791 next preview functionality #227
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Relates to #15791.
This PR puts some env vars in place for preview functionality. Existing routes should be unaffected, as they don't actually require authentication.
There is a companion PR on the CMS side: department-of-veterans-affairs/va.gov-cms#15936
This PR should merge first, so that these env vars are in place for when next-build is cloned & built in CMS tugboat envs. Then we can test the CMS PR properly.
This PR's additional functionality cannot be tested on this tugboat environment!
The CMS endpoint our tugboat hits by default doesn't have preview capability merged yet.
The CMS PR cannot be tested on its respective tugboat environment until this PR is merged and next can handle generating previews.
Testing done
Locally, with a local CMS endpoint using the branch above configured as described in the QA steps below.
I was successfully able to render previews for:
Also verified that existing pages generated as normal on this PR's tugboat environment.
QA steps
in next-build repo:
.env.local
needs these environment variables with the correct values:afterwards, run
yarn dev
to start the webserver (yarn build:preview
&&yarn start
also works, butyarn dev
is fine)in the va.gov-cms repo:
Store these keys in the repo root, outside of the docroot folder. If you are on the branch from the CMS PR specified above, these files will be .gitignored.
After the keys are in place, navigate to https://va-gov-cms.ddev.site/admin/config/services/next/entity-types and configure Story and Story Listing to use the preview server. You can leave the On-demand Validation settings blank for now.
All of the setup is now in place! These are intentionally not enabled in the CMS PR. They will be set in a follow-up PR focused on the UI experience (no iframe takeover, etc), and using feature flags.
Navigate to a Story Listing node ( https://va-gov-cms.ddev.site/erie-health-care/stories ) and see that the site loads in the iframe. There may be some CORS errors due to the iframe, these will be sorted out in a follow-up.
Navigate to a published Story node ( https://va-gov-cms.ddev.site/providence-health-care/stories/va-providence-veterans-day-observance ) and see that the site loads in the iframe.
Edit that story node with some new content and save it as a Draft. There should now be a "latest revision" tab ( https://va-gov-cms.ddev.site/node/62962/latest ), and the site should load in the iframe with the updated content.
Create a new Story node ( https://va-gov-cms.ddev.site/node/add/news_story ) and save it without publishing (Draft). The page should still render in the iframe.
Tasks