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

Create service for persisting layouts #20

Closed
pling-scottlogic opened this issue Aug 9, 2023 · 1 comment · Fixed by #55
Closed

Create service for persisting layouts #20

pling-scottlogic opened this issue Aug 9, 2023 · 1 comment · Fixed by #55
Assignees
Labels

Comments

@pling-scottlogic
Copy link

pling-scottlogic commented Aug 9, 2023

Background
We need to create a service which handles the persistence of layouts.

The implementation of persistence has two levels:

  1. An interface which directs to a persistence management handler
  2. The implementation of the persistence management handler (client / server)

Level 1 is an interface which can direct to multiple persistence handlers, i.e. local or remote. Creating the interface is the priority, as this can be extended with as many persistence handlers as required.

We can implement basic local storage persistence using this interface to showcase the layout management feature.

Server-side persistence is low priority for the Layout epic, as we can easily hook up server level persistence management into the interface at a later stage.

Work Required

  • Implement a RESTful interface to direct to a local/remote persistence handler
    • Can make use of use-layout-config.ts
    • Create/Update/Delete
  • Implement the local layout persistence handler
    • Can make use of local-config.ts

Acceptance Criteria

  • As a Vuu UI user, when I save a layout, then a file defining the layout is saved locally
  • As a Vuu UI user, when I save a layout, then a screenshot of the layout is saved locally

Dev Notes

  • The current hooks in the layout-config directory and any associated layout-management code is a good starting point but it's quite primitive. It assumes you are saving one thing and doesn't have configuration for options such as layout names, groups, etc.

Questions

  • Where should the file be saved? In-browser?
    • Answer: Browser local storage
  • (How often) do we clear the saved files?
    • UI option?
    • Answer: Can be dev-managed for local storage as it's not a permanent solution
  • How do we couple a screenshot with the layout file?
  • How do we handle layout metadata (layout name, group, username, save date, ID)
@cfisher-scottlogic cfisher-scottlogic changed the title Create server for persisting layouts Create service for persisting layouts Aug 14, 2023
@cfisher-scottlogic cfisher-scottlogic added this to the Layout Management milestone Aug 14, 2023
@cfisher-scottlogic
Copy link

cfisher-scottlogic commented Aug 14, 2023

After a chat with Steve we've changed the direction of this ticket from a 'server implementation' focus to a 'persistence implementation' focus.

Old ticket details

Option 1
Create an endpoint on Vuu server (main backend) to handle layout persistence

👍 A lot of the infrastructure is already in place (with timestamp snapshots of layout)
👎 Vuu server not necessarily the best place to actually host the endpoint for saving layouts because it's meant to just be for data communication

❓ Is there already a database we can use?

Option 2
Create a separate service to handle layout persistence

👍 Separation of concerns
👎 More upfront cost (in terms of dev effort)

2a: Node.js
2b: Scala

❓ Is this a single use server? Will it be extended for other uses?
❓ What benefit does this provide compared to using the existing functionality?

Dev Notes

  • The layout is a JSON structure which needs to be persisted serverside
    • layoutFromJson() deserializes JSON to React elements
    • layoutToJson() serializes React elements to JSON
  • layoutActionDispatcher() currently handles saving
    • Need more granularity on saving, e.g. 'save page', 'save tab', 'save this specific layout' ]
    • Use-layout-config.ts
      • Timestamp snapshots of layout use loadLayoutById()
    • remote-config.ts
      • saveRemoteConfig() makes the POST request to save layout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants