scottlogic / finos-vuu Goto Github PK
View Code? Open in Web Editor NEWThis project forked from finos/vuu
Vuu - an open source view server and html 5 based UI system
Home Page: https://vuu.finos.org
License: Apache License 2.0
This project forked from finos/vuu
Vuu - an open source view server and html 5 based UI system
Home Page: https://vuu.finos.org
License: Apache License 2.0
The screenshot feature implemented in #23 works in Chrome and Edge, but not in Firefox.
vuu-ui
(npm run showcase
)The Save Layout dialog shows, displaying a screenshot of the current layout.
Cypress end-to-end tests have been added to the CI pipeline since this bug was raised. We will want to add a step to test-ui.yml
to run them in Firefox as part of this ticket.
We have created a Component for the Save Layout Dialog. We want it to display a screenshot of the layout taken when the Dialog is opened
We want the e2e automated test to be run across different browsers as part of our checks whenever a PR is raised
as part of #54 and #27 we have added error catching for CRUD operation around Layout Management. We now want to add something that informs the user that an error has occurred (currently we are just using console.error())
#75 explored alternative approaches to the screenshot string as it can be very long and posed threats to performance and robustness of client/server interaction. The short term outcome of that prioritised function over form, adding a @Lob
annotation to the server entity to accommodate big screenshot strings. There were a few other possible solutions that could be worth exploring so we're not having to handle a large string from client through to server, which would require further investigation.
(Courtesy of @pling-scottlogic)
1. Convert the entity to use a byte array:
@Lob
private byte[] screenshot;
Would need to do some manual conversion (I wasn't able to get this working).
Base64.getDecoder().decode(rawScreenshot.replaceFirst("data:image/png;base64,",""))
2. Save as "blob" on client-side, upload as multipart file and store as byte array - looks like the best option
3. Client-side compression
We want to implement SSL on the layout server so that we can use a secure HTTPS connection when calling from Vuu UI. This will also satisfy the static code analysis and therefore remove the need to reference the calling code in the .semgrepignore file.
application.properties
file for the layout serverSecurityConfig
class to redirect HTTP requests to HTTPSEpic to cover the improvements to the quality of Typescript use in the FINOS-VUU repository
We currently have 2 different Context Providers around layouts: LayoutManagerProvider and LayoutProvider. LayoutManagerProvider includes state and functionality to manage the layouts and the metadata. LayoutProvider manages the on-screen layout (which hasnt been saved with metadata yet).
useLayoutManager should include:
See PR for POC
Some styling needs to be tweaked on the SaveLayoutPanel
and LayoutList
components to make them match the Figma designs.
LayoutList
Layout definitions are currently being transferred to and from the server as raw string values in a single JSON field. Since the layout is defined in a JSON format, we want to embed this as a fully formed node within the request/response.
definition
fields in all layout DTOs and entities from String
to JsonNode
(import from Jackson databind)@Convert
to make use of the existing JsonNodeConverter
We created a new server for handling layouts in #25. We want to add tests for this.
Currently the loadLayoutById functionality replaces everything in the layout view with the saved layout. We want the functionality to load the saved layout and add it to what is already in the layout view
Currently we are allowing all menu options for non-active tabs (tabs that are not selected). This leads to unwanted behaviour when the user tries to save a non-active tab as we are taking a screenshot of the layout but we cant take a screenshot of the tab that is not being displayed.
Background
We need to create a service which handles the persistence of layouts.
The implementation of persistence has two levels:
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
use-layout-config.ts
local-config.ts
Acceptance Criteria
Dev Notes
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
The layout server was implemented in #57. It currently handles persistence of a user created layout. We need to expand the server to handle application layout(s), as pointed out in the PR for #57 (comment).
The Figma design includes an image of the layout, which can be produced with one of the following packages:
We need to determine which of these packages is most appropriate to use for saving and browsing layouts.
Acceptance Criteria
Pick a package
Proof of concept
A: I tested with file saving and the biggest file was 25kb, so file size doesn't look to be a concern.
We have a cypress test for the screenshot functionality. the test is currently under e2e directory we want to move it under components/ or integration/
The e2e tests should cover the most obvious, important user flows
Integration tests should cover less important permutations, and interactions between different layers of our application
For example, our e2e might be As a user, I can save a layout. Integration tests related to that might be When I save a layout, I can see a screenshot of the layout and When I save a layout, I see a dialog to confirm details of the layout to be saved
https://docs.cypress.io/guides/core-concepts/testing-types
https://docs.cypress.io/guides/component-testing/overview
In LocalLayoutPersistenceManager
, whenever we attempt to read a key from local storage which is not present, we immediately default to returning an empty array. We want to change this behaviour so that an exception is thrown, then caught and handled outside of the persistence manager.
LocalLayoutPersistenceManager
, throw an appropriate exception whenever getLocalEntity
returns undefined
LocalLayoutPersistenceManager
and handle appropriately (e.g. defaulting to an empty array)As part of the Layout Management Issue, we want to build a modal component to allow users to save their current layout.
Edit the placeholder component SaveLayoutPanel.tsx
to match the Figma design (Save Layout 2 > Save Modal w/Overlay > Frame 108)
Write unit tests (using react-testing-library) for the new component.
When a layout changes, a layout change event is triggered. This is handled by the Shell/layout management system , which persists the changed JSON representation of the UI.
Until now, the entire JSON structure of the UI has been persisted as one entity. We are moving to an approach that saves layouts individually, where the application level structure references those layouts rather than including them directly.
The layout change handling code needs to know whether any particular change is caused by a change at the application level (switching tabs, opening or closing a layout) or at the layout level (adding or moving a component within the layout, saving props on a component e.g sorting a table, applying a filter)
Modify the layout change callback to provide this information
We want to add e2e tests to cover the main functionalities
We want to document our ways of working for anyone in Scott Logic who wants to be involved in the project in the future
wiki on GH Repo to cover:
We're also swallowing these tickets:
the dropdown moves along with the input fields
input field moves but the dropdown doesnt
In #25, we set up a simple REST service to handle remote persistence of layouts. We want to set up a simple database to use in conjunction with this.
as part of the layout manager feature we have been taking screenshots of the layouts and we are storing them as strings which are very long. We want to investigate what the best way of handling/storing PNGs is.
example length for the PNG string is 13186 characters
As part of the Layout Management Milestone we've begun writing some e2e tests with Cypress for the first time in the project.
The tests written in #23 are a good first step, but there's improvements to be done.
As this is the first time we're setting up e2e tests in this project, we should think about best practices to make it easier to implement tests moving forward.
Use info in the dev notes to refine a list of tasks.
screenshot.cy.js
As a user, I can save a layout
. Integration tests related to that might be When I save a layout, I can see a screenshot of the layout
and When I save a layout, I see a dialog to confirm details of the layout to be saved
screenshot.cy.js
defining all of the locators relevant to it, we have locators defined for each section/page of the application, which can then be used in any tests which rely on that page/sectionMike gave us some useful links to help us in this process:
Some styling needs to be tweaked on the SaveLayoutPanel component to make it match the Figma design.
As part of the layout management directive, we want to restructure the JSON format that defines layouts.
Current selectors are based on classnames. These should be a last resort if the framework doesn't provide other selectors. A combination of Cypress & Testing Library gives support for better selectors (like aria attributes). We should use these.
We should consider implementing some kind of testing design pattern, like POM (Page Object Model), to encapsulate different parts of the application
E.g. rather than screenshot.cy.js defining all of the locators relevant to it, we have locators defined for each section/page of the application, which can then be used in any tests which rely on that page/section
https://www.testim.io/blog/end-to-end-testing-best-practices/
https://www.testim.io/blog/end-to-end-testing-guide/
https://www.lambdatest.com/learning-hub/end-to-end-testing
In #20, we create a front-end interface to handle all layout persistence. We need to make an implementation of this interface to communicate with the REST service created in #25 to handle remote layout storage.
We will need to mock the API response.
As part of the Layout Management Issue, we want to build a component to allow users to browse layouts that have been saved.
Create new Component to match Figma design
Write unit tests (using react-testing-library) for the new component.
When attempting to operate on a layout that does not exist in local storage, the current behaviour of LocalLayoutPersistenceManager
is to continue regardless (see Current Behaviour below). We want to change this so that an exception is thrown whenever we try to access a layout with an non-existant ID.
The current behaviour is as follows, when provided with an ID that does not correspond to any layout in local storage:
updateLayout
will add a new layout (and metadata) with the provided IDdeleteLayout
will leave local storage unalteredloadLayout
will log a warning and return an empty objectupdateLayout
, deleteLayout
and loadLayout
methods in LocalLayoutPersistenceManager
, so that an exception is thrown if there is no layout or metadata in storage with the requested IDvalidateId
(use a consistent approach for all three methods)* At time of writing, none of these methods are being used.
There is a warningLayout
, which might be sensible to display when one of these exceptions is thrown.
As part of the layout management directive, we want to create a backend service to handle remotely saved layouts.
GET
for loading saved layoutsPOST
for saving new layoutsPUT
for updating existing layoutsDELETE
for deleting layoutWe have a remote layout manager that makes requests to the layout server for layouts and metadata. After adding a resource for application layouts, we want to call into these new endpoints from the client.
From RemoteLayoutPersistenceManager:
#57 introduced the remote server for layout management. We need to write documentation on how to run the server and publish this to the main Vuu docusaurus site. #27 also integrated remote layout management into the UI using the server, and provides a means of choosing either the local or remote implementation with envars. We should document how to change from local/remote.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.