1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-02 01:17:58 +02:00
unleash.unleash/frontend
Thomas Heartman f7c667e410
Feat(1-3760)/filters per analytics section (#10039)
Splits the insights page into separate sections with their own separate
filters. Each filter is sticky to the top of the page, similar to how
the previous filters worked.

In doing this, I have also moved around a lot of code. Refer to the
inline comments for more specific examples, but on a high level, this
PR:
- Moves the flag check from InsightsCharts into Insights itself. Because
the old Insights had filters and state, and the new one does not, it
made sense to fork off higher up in the tree. Because the new version
doesn't have state, I have also simplified it and removed an
intermediate component (InsightsCharts) that doesn't feel necessary
anymore.
- Because InsightsCharts isn't used anymore, I've moved the
LegacyInsightsCharts file back into InsightsCharts. However, I'm happy
to move it back if we think that's useful.
- Instead of all charts living in InsightsCharts, I've split each
section into its own file in the new sections directory. Because the
sections have separate filters, they don't share any state anymore, so
there's nothing they share.
- I'm reusing the existing hook and endpoint. As it stands, the
performance insights use **most** of the data from that payload (but not
all of it). The user insights use some of it. Flag lifecycle insights
doesn't use anything, but I've wired it up to make the filters work. I
expect that we'll iterate on the API endpoints etc later.


![image](https://github.com/user-attachments/assets/8fcf5800-18be-4399-b7e2-e2b4b8565ea8)
2025-06-03 10:47:30 +02:00
..
.yarn/releases feat: Unleash v7 ESM migration (#9877) 2025-05-14 09:47:12 +02:00
cypress feat: Unleash v7 ESM migration (#9877) 2025-05-14 09:47:12 +02:00
public chore: simplify serving of static openapi assets (#10046) 2025-05-28 19:14:55 +02:00
scripts
src Feat(1-3760)/filters per analytics section (#10039) 2025-06-03 10:47:30 +02:00
.editorconfig
.gitignore chore: Add Thomas's weird files to .gitignore (#8872) 2024-11-27 16:53:33 +01:00
.npmignore
.nvmrc chore(deps): update node.js to v22 (#9487) 2025-05-14 10:31:18 +00:00
.yarnrc.yml feat: Unleash v7 ESM migration (#9877) 2025-05-14 09:47:12 +02:00
check-imports.rc
cypress.config.ts feat: Unleash v7 ESM migration (#9877) 2025-05-14 09:47:12 +02:00
cypress.d.ts
index.html feat: use Unleash React SDK in Admin UI (#9723) 2025-04-10 08:26:30 +02:00
index.js feat: Unleash v7 ESM migration (#9877) 2025-05-14 09:47:12 +02:00
mise.toml feat: Unleash v7 ESM migration (#9877) 2025-05-14 09:47:12 +02:00
orval.config.js
package.json chore(deps): update dependency typescript to v5.8.3 (#7480) 2025-05-29 10:49:07 +00:00
README.md
tsconfig.json feat: Unleash v7 ESM migration (#9877) 2025-05-14 09:47:12 +02:00
tsconfig.node.json feat: Unleash v7 ESM migration (#9877) 2025-05-14 09:47:12 +02:00
vercel.json
vite.config.mts chore: add file and component names to styled output class names in dev (#9351) 2025-02-24 14:45:20 +01:00
yarn.lock chore(deps): update dependency typescript to v5.8.3 (#7480) 2025-05-29 10:49:07 +00: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