Contains several improvements for the new json diff render: 1. Removes extra left-inset of the +/- icons for changed lines. This means that the +/- icons will now show up in the change request popover, whereas they were hidden (pushed outside the frame) previously). 2. Change styling based on whether it's an edit or a full replacement. If it's an edit, keep the +/- icons per changed line. If it's a full replacement (e.g. the object has been created or deleted), don't show the +/- icons, and make the whole object the right color (specifically: this also colors the surrounding braces that weren't colored before). Not showing +/- for new/deleted objects is in line with how the previous system worked. 3. If there are no changes, show `(no changes)`, as we did before. Unfortunately, I don't think the component has any fallback for this case, so we can't render arbitrary code. However, when it does happen, the .diff container doesn't have any children, so we can render it with CSS. It's not ideal for accessibility reasons etc, but it's better than nothing, I think. 4. Adds a +/- to the button to open and close the full diff to indicate better what it does. Also, only shows the button if it's an edit. When it's a replacement, we show the full diff anyway, so the button has no effect. 5. Does not exclude any keys by default anymore, but makes it a parameter ## Left inset change + no excluded keys: Before: <img width="277" alt="image" src="https://github.com/user-attachments/assets/65d4c972-ccbd-4202-b162-1c94a49920cc" /> After: <img width="462" alt="image" src="https://github.com/user-attachments/assets/14408bf2-cc00-4710-869b-83479d72f2f3" /> ## Edit vs full replacement Before: <img width="324" alt="image" src="https://github.com/user-attachments/assets/5a7f6727-f4a6-40f1-becf-184f2f390e9b" /> (notice the surrounding braces (`{}`) aren't the right color) <img width="339" alt="image" src="https://github.com/user-attachments/assets/65247bde-469d-4408-90da-3867c1b4d650" /> After: <img width="364" alt="image" src="https://github.com/user-attachments/assets/972fe602-fe2a-46b3-ba52-d13e4427db5b" /> <img width="374" alt="image" src="https://github.com/user-attachments/assets/0d2f194b-3194-469b-9096-9a946c362178" /> ## No changes Before: <img width="276" alt="image" src="https://github.com/user-attachments/assets/dac79332-1739-4ee8-91ca-c0e5950424fa" /> After: <img width="271" alt="image" src="https://github.com/user-attachments/assets/23f70e8e-c9ef-42e0-9862-303c5a7df0b9" /> (The show all props button will show the whole object regardless): <img width="352" alt="image" src="https://github.com/user-attachments/assets/c2f7cba0-3afa-4c54-aa5a-6e01120a5eee" /> ## Button Before: <img width="240" alt="image" src="https://github.com/user-attachments/assets/45201048-5946-41fe-999c-b95c6617b384" /> After: <img width="274" alt="image" src="https://github.com/user-attachments/assets/68cf96cf-4536-47db-903e-2e7884fa045f" /> |
||
---|---|---|
.. | ||
.yarn/releases | ||
cypress | ||
public | ||
scripts | ||
src | ||
.editorconfig | ||
.gitignore | ||
.npmignore | ||
.nvmrc | ||
.yarnrc.yml | ||
check-imports.rc | ||
cypress.config.ts | ||
cypress.d.ts | ||
index.html | ||
index.js | ||
mise.toml | ||
orval.config.ts | ||
package.json | ||
README.md | ||
tsconfig.json | ||
tsconfig.node.json | ||
vercel.json | ||
vite.config.mts | ||
yarn.lock |
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