1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
unleash.unleash/frontend
Thomas Heartman 8954277d20
chore(ui): add splash screen for oss segments (#5053)
This PR adds a splash screen for segments being open-sourced. 

It looks like this:


![image](https://github.com/Unleash/unleash/assets/17786332/bf8766e6-b9cc-4f0b-a6d1-f6e89e21d844)

## About the changes

I've more or less wholesale copied the demo dialog that @nunogois
implemented. I've put it in the `splash` directory for now (because
that's where it seemed most appropriate). The reason for straight
copying it instead of extending existing functionality is primarily that
this should be short-lived and deleted after the next release or so. So
isolating all the changes into a single directory seems like a good
idea.

## Discussion points

Because OSS installations don't connect to Unleash, we can't use feature
flags to control the rollout here. Instead, we must just assume that OSS
users will want to see it. If there is a better way we can control this,
that'd be great. I'd love to be able to use time constraints to not show
this after a certain date, for instance, but I don't think that's
something we can do right now?

The splash is also set to display on any page you're at when you first
load unleash. However, closing the dialog (either by closing or by
asking to see segments) will store that in localstorage, and you won't
be shown the dialog again.

---------

Co-authored-by: Nuno Góis <github@nunogois.com>
2023-10-19 08:28:14 +02:00
..
cypress fix: make cypress list length checks more relaxed (#4933) 2023-10-05 14:50:46 +03:00
public
scripts
src chore(ui): add splash screen for oss segments (#5053) 2023-10-19 08:28:14 +02:00
.editorconfig
.gitignore
.nvmrc chore: update to node 18 (#3527) 2023-04-18 10:35:32 +02:00
cypress.config.ts feat: biome lint frontend (#4903) 2023-10-02 13:25:46 +01:00
cypress.d.ts
index.html feat: dynamic icons by adding material symbols font (#5008) 2023-10-12 11:22:23 +01:00
index.js
orval.config.js
package.json fix: server-side request forgery in @cypress/request@2.88.12 (#5077) 2023-10-18 13:29:53 +03:00
README.md
tsconfig.json
tsconfig.node.json
vercel.json
vite.config.ts
yarn.lock fix: server-side request forgery in @cypress/request@2.88.12 (#5077) 2023-10-18 13:29:53 +03:00

frontend

This directory contains the Unleash Admin UI frontend app.

Run with a local instance of the unleash-api

Refer to the Contributing to Unleash guide for instructions. The frontend dev server runs (in port 3000) simultaneously with the backend dev server (in port 4242):

yarn install
yarn dev

Run with a sandbox instance of the Unleash API

Alternatively, instead of running unleash-api on localhost, you can use a remote instance:

cd ./frontend
yarn install
yarn run start:sandbox

Running end-to-end tests

We have a set of Cypress tests that run on the build before a PR can be merged so it's important that you check these yourself before submitting a PR. On the server the tests will run against the deployed Heroku app so this is what you probably want to test against:

yarn run start:sandbox

In a different shell, you can run the tests themselves:

yarn run e2e:heroku

If you need to test against patches against a local server instance, you'll need to run that, and then run the end to end tests using:

yarn run e2e

You may also need to test that a feature works against the enterprise version of unleash. Assuming the Heroku instance is still running, this can be done by:

yarn run start:enterprise
yarn run e2e

Generating the OpenAPI client

The frontend uses an OpenAPI client generated from the backend's OpenAPI spec. Whenever there are changes to the backend API, the client should be regenerated:

For now we only use generated types (src/openapi/models). We will use methods (src/openapi/apis) for new features soon.

yarn gen:api
rm -rf src/openapi/apis

clean up src/openapi/index.ts imports, only keep first line export * from './models';

This script assumes that you have a running instance of the enterprise backend at http://localhost:4242. The new OpenAPI client will be generated from the runtime schema of this instance. The target URL can be changed by setting the UNLEASH_OPENAPI_URL env var.

Analyzing bundle size

npx vite-bundle-visualizer in the root of the frontend directory