70d8f9e58a
## About the changes Add warnings when we detect something might be wrong with the customer configuration, in particular with regard to variants configuration ## Rationale Moving from variants per feature to variants per environment will allow users to have fine-grained permissions and more control over variants on different environments: #2254 But because this requires an additional step of copying variants to other environments, we identified the potential risk of users forgetting to follow this step. To keep them informed about this, we're introducing a warning sign after a toggle is enabled when we detect that: 1. The environment is enabled without variants 2. Other enabled environments have variants This situation would be a problem if you rely on `getVariant` method from the SDK, because without variants you'll receive the default variant. Probably, not what you'd expect after enabling the toggle, but there are situations where this might be correct. Because of the latter, we thought that adding a warning and letting the user handle the situation was the best solution. ## UI sketches ![image (6)](https://user-images.githubusercontent.com/455064/213676353-112639f0-7781-42c0-8c9d-8c7eba316bae.png) ![Screenshot from 2023-01-19 08-55-10](https://user-images.githubusercontent.com/455064/213664639-7b11ff4b-048a-4a36-aa71-7df2f889adff.png) Co-authored-by: Nuno Góis <github@nunogois.com> |
||
---|---|---|
.. | ||
cypress | ||
public | ||
src | ||
.editorconfig | ||
.gitignore | ||
.nvmrc | ||
.prettierignore | ||
.prettierrc | ||
cypress.json | ||
index.html | ||
index.js | ||
orval.config.js | ||
package.json | ||
README.md | ||
tsconfig.json | ||
tsconfig.node.json | ||
vercel.json | ||
vite.config.ts | ||
yarn.lock |
frontend
This directory contains the Unleash Admin UI frontend app.
Run with a local instance of the unleash-api
First, start the unleash-api backend on port 4242. Then, start the frontend dev server:
cd ~/frontend
yarn install
yarn run start
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:
./scripts/generate-openapi.sh
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