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

store layouts #326

Closed
wants to merge 20 commits into from
Closed

store layouts #326

wants to merge 20 commits into from

Conversation

dblatcher
Copy link
Contributor

@dblatcher dblatcher commented Sep 27, 2024

What does this change?

  • makes a new data type for Editions Layouts - representing the arrangement of newsletters on https://www.theguardian.com/email-newsletters for the different editions (UK, US, AU, INT, EUR) of the page.
  • defines an abstract class for a service to manage the storage of the editions layouts and an 'in memory' implementation using a static set of initial test data
  • adds an API route to manage request from the UI to get and update the Editions Layouts from the UI
  • adds a new permission to control a user's ability to do updates (only available to "developer).
  • builds UI pages to display the layouts and allow user with the permission to edit them (using the existing JsonEditor component - with a view to developing more user-friendly UI later)

How to test

Run locally, with the "developer" permissions set in .env.local (see main readme for setup):
USER_PERMISSIONS={"[email protected]": 0}

go to http://localhost:4200/layouts to see the main UI - you should be able to create and edit layouts

shut down the app, change the user permission level to :
USER_PERMISSIONS={"[email protected]": 3}

run the app again and you go to go to http://localhost:4200/layouts - you should have read-only access

How can we measure success?

This moves towards having the arrangement on the /email-newsletters page controlled from the newsletters tool, rather than requiring PR's in the DCR repo.

subsequent PRs:

  • creating an s3 based implementation of the LayoutStorage class to allow the changes to be persisted. Adding the deployment options / config to use that in CODE/PROD builds
  • [frontend repo] - read the layout data and cache from the newsletters API, include it in the data posted to DCR
  • [dcr repo] - use the layout data from frontend instead of the hard coded copy
  • designing a user-friendly layout editor so editorial can self-serve changes
  • update which users have permissions to use the new editor

Have we considered potential risks?

Before merging, should modify this branch so it won't result in the new /layouts UI pages being made live with the current config - this can be done by editing apps/newsletters-api/src/register-ui-server.ts

It should be safe to have the newsletters API publish the /layouts routes (with the test data), but we can modify the branch to exclude them if prefered.

Images

Screenshot 2024-09-27 at 16 49 48 Screenshot 2024-09-27 at 16 49 26

Accessibility

@dblatcher dblatcher requested a review from a team as a code owner September 27, 2024 15:50
apps/newsletters-api/src/register-ui-server.ts Dismissed Show dismissed Hide dismissed
apps/newsletters-api/src/register-ui-server.ts Dismissed Show dismissed Hide dismissed
@dblatcher dblatcher closed this Oct 30, 2024
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.

1 participant