1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
Commit Graph

615 Commits

Author SHA1 Message Date
Ivar Conradi Østhus
d9d9f01b37
feat: add capability to write heap snapshot. (#2611)
Is protected behind a config option called `enableHeapSnapshotEnpoint`.
When API endpoint is triggered it will write a heapSnapshot to disk.

Steps to create heap snapshot:

1. Add env variable `ENABLE_HEAP_SNAPSHOT_ENPOINT=true`. 
2. Call this endpoint: `/internal-backstage/heapSnapshot`
3. Download the created heapdump from the server. 

The snapshot can be loaded in the chrome dev-tool to analysis.
2022-12-08 11:25:39 +01:00
andreas-unleash
d69ca0a508
ui flags replaced in index.html (#2617)
Signed-off-by: andreas-unleash <andreas@getunleash.ai>

<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->
This PR puts the ui flags in the index.html in a meta tag. This makes
them accessible without logging in and allows us to track user signups
with invite links
## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2022-12-07 14:31:27 +02:00
Gastón Fournier
aa20d2d418
Fix PATCH variants (old endpoint) when variants per environment are enabled (#2591)
## About the changes
This PR addresses some issues when working with variants after migrating
to variants per environment.

**Problem:** since PATCH
`/api/admin/projects/default/features/${featureName}/variants` does not
take into account `featureEnvironments`, when variantsPerEnvironment
gets enabled, this method will override the variants in other
environments (i.e. not doing a patch). This method has to be maintained
because of backward compatibility but it has to be adapted to deal with
variants per environment


https://linear.app/unleash/issue/2-476/when-using-patch-for-variants-without-environments-it-wipes-out

Co-authored-by: Nuno Góis <github@nunogois.com>
2022-12-06 09:47:54 +00:00
Thomas Heartman
8c42fbf34b
Docs(fix): add more (missing) redirects, fix links (#2592)
## What

This PR fixes some broken links we had in the application. It also adds
redirects for those links so that they should work in the future.

## Why

Because it's important to have links that work 💁
2022-12-06 09:32:42 +01:00
Mateusz Kwasniewski
e059b755c9
skip change request (#2598) 2022-12-05 15:38:17 +01:00
Mateusz Kwasniewski
b9290dd5ed
CR applier should be able to create strategy (#2597) 2022-12-05 12:39:13 +01:00
Simon Hornby
447bd44c99
Remove clone env and sync sso group flags (#2596)
Removes feature flags for syncing sso groups and clone environment.
These features are being made generally available for all who have
access to environments and sso groups
2022-12-05 12:07:15 +02:00
Ivar Conradi Østhus
4a3d26065f
Fix/cors expose ETag (#2594)
This commit fixes two issues with the frontend API

1. fix: update cors max age to match chromium defaults
https://source.chromium.org/chromium/chromium/src/+/main:services/network/public/cpp/cors/preflight_result.cc;drc=49e7c0b4886cac1f3d09dc046bd528c9c811a0fa;l=31
2: fix: expose ETage for cross-origin requests
2022-12-05 10:04:35 +01:00
Fredrik Strand Oseberg
bc3744d565
fix: remove stray only (#2589)
This removes stray onlys in our tests and adds a linter rule that will
error if only is present. Also updates the test result of one of our
tests as a result of [this pull
request](https://github.com/Unleash/unleash/pull/2344)
2022-12-02 13:10:39 +01:00
Tymoteusz Czech
79e96fdb98
feat: favorite feature and project (#2582)
## About the changes
Add an ability to star a toggle from it's overiew.

Co-authored-by: sjaanus <sellinjaanus@gmail.com>
2022-12-02 09:16:03 +02:00
sjaanus
e728ecba69
Remove signup conditional flag (#2581)
Remove signup flag
2022-12-01 14:12:54 +02:00
Gastón Fournier
bf0171518c
task: continue to return export v3 when variants per env disabled (#2529)
## About the changes
With the latest changes of variants per environment, we switched to
export schema v4 without having the feature toggle enabled. This moves
the variants to `featureEnvironments` when they were previously in
`features`. The main problem is that it can create confusion as the
exported file has the same variants for each one of the environments but
after importing the file the UI will only show one set of variants
attached to the feature.

With this change, we're maintaining the previous schema until the
feature toggle is enabled.
2022-12-01 11:13:49 +00:00
sjaanus
24fee65f7e
Make single project endpoint also return all features favorites (#2578)
Small update, that single project endpoint would also return features
with favorites.
2022-12-01 09:49:49 +02:00
Tymoteusz Czech
5f88269744
feat: favorite feature table icons (#2525) 2022-11-30 12:44:38 +00:00
Fredrik Strand Oseberg
dacaaa51b7
feat: default the frontend api flags to on (#2573)
* This PR turns on the flag for the frontendApi to be on by default. We
should still be able to override them from the unleash-cloud
distribution.
2022-11-30 13:33:07 +01:00
sjaanus
65851ba51c
Add favorite events (#2572)
This PR adds 4 new events

1. FAVORITE_FEATURE_ADDED
2.  FAVORITE_FEATURE_REMOVED
3. FAVORITE_PROJECT_ADDED
4. FAVORITE_PROJECT_REMOVED
2022-11-30 14:26:17 +02:00
sjaanus
a22d5f5a43
Favorite project (#2569)
Adds ability to favorite projects.

1. Can favorite project
2. Can unfavorite project
3. Favorite field is returned on `/api/admin/projects/default`
4. Favorite field is returned on` /api/admin/projects`
2022-11-30 13:41:53 +02:00
sjaanus
0d58371f11
Some tweaks to favorites (#2563)
This is follow up PR to https://github.com/Unleash/unleash/pull/2550,
which addresses the issues that came up from reviews.
2022-11-30 09:47:57 +02:00
sjaanus
9ac6b945be
Fix super small text issue (#2473)
Fix super small text issue

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2022-11-30 09:18:49 +02:00
Nuno Góis
7ce38ffe89
feat: update seen_at pat column (#2516)
https://linear.app/unleash/issue/2-451/update-last-seen-column-for-pats
2022-11-30 08:10:31 +02:00
Nuno Góis
4d8817698a
feat: add last seen column to token table (#2520)
https://linear.app/unleash/issue/2-449/add-table-column-to-api-tokens-table-ui
2022-11-30 08:07:13 +02:00
Nuno Góis
564c287025
Feat update token seen at (#2514)
https://linear.app/unleash/issue/2-448/update-last-seen-column-for-api-tokens

Co-authored-by: Ivar Conradi Østhus <ivar@getunleash.ai>
2022-11-29 19:46:40 +00:00
sjaanus
b32d3d0fee
Favorite features (#2550) 2022-11-29 16:06:08 +01:00
Nuno Góis
1fec43947d
add feature flag: network view (#2543)
https://linear.app/unleash/issue/2-453/add-feature-flag
2022-11-28 13:48:02 +00:00
Christopher Kolstad
1ecbc32e14
task: Make operations on the API Token store auditable. (#2531)
## About the changes
We need a way to have an audit log for operations made on Api Tokens.
These changes adds three new event types, API_TOKEN_CREATED,
API_TOKEN_UPDATED, API_TOKEN_DELETED and extends api-token-service to
store these to our event store to reflect the action being taken.
2022-11-28 10:56:34 +01:00
Fredrik Strand Oseberg
5d52216d53
fix: adds cors caching (#2522)
* This PR adds a configurable maxAge header to the CORS middleware. This
allows the preflight request to be cached so that we can reduce the
request load on our end for the frontend clients starting to utilise the
frontend api.
2022-11-24 16:14:47 +01:00
andreas-unleash
35d9a62d89
Soft landing page on projects or last viewed project (#2499)
Signed-off-by: andreas-unleash <andreas@getunleash.ai>

This PR introduces a soft landing page to the last viewed project or to
the project list (if there is more than 1 project)

Changes: 
- Replaced clearing of `storage` with clearing `cache` in logout.ts ::
REVERTED
- Root redirects to `projects` instead of `features`

<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2022-11-23 15:58:02 +02:00
Simon Hornby
0897180af5
fix: resolve an issue where cloning a feature toggle with a segment (#2511)
fix an issue where cloning a feature toggle with a strategy with segments would raise an error but still clone successfully
2022-11-23 15:39:09 +02:00
Nuno Góis
f9726fdee9
add tokens last seen feature flag (#2512)
https://linear.app/unleash/issue/2-450/add-feature-flag
2022-11-23 13:33:02 +00:00
sjaanus
b071de6742
Add possibility to soft delete users (#2497)
Previously we hard deleted the users, but due to change requests and
possibly other features in future, we really want to hard-link user
table and have meaningful relationships.

But this means, when user is deleted, all linked data is also deleted.
**Workaround is to soft delete users and just clear users data and keep
the relationships alive for audit logs.**

This PR implements this feature.
2022-11-23 09:30:54 +02:00
Simon Hornby
801df6953c
fix: force clone feature to correctly copy variant environments (#2498)
patches an issue where cloning a feature would clone variants for
it's last found environment in the db. This now will clone the feature
environments correctly
2022-11-22 17:00:44 +02:00
Mateusz Kwasniewski
8af64e9370
add events and expose them for webhooks (#2493) 2022-11-22 13:39:15 +01:00
Simon Hornby
2a4ca96da2
Permission for variant environments (#2490)
adds permissions for variants per environment
2022-11-22 11:54:04 +02:00
Thomas Heartman
d5fbd0b743
refactor: move docs into new structure / fix links for SEO (#2416)
## What

This (admittedly massive) PR updates the "physical" documentation
structure and fixes url inconsistencies and SEO problems reported by
marketing. The main points are:

- remove or move directories : advanced, user_guide, deploy, api
- move the files contained within to the appropriate one of topics,
how-to, tutorials, or reference
- update internal doc links and product links to the content
- create client-side redirects for all the urls that have changed.

A number of the files have been renamed in small ways to better match
their url and to make them easier to find. Additionally, the top-level
api directory has been moved to /reference/api/legacy/unleash (see the
discussion points section for more on this).

## Why

When moving our doc structure to diataxis a while back, we left the
"physical' files lying where they were, because it didn't matter much to
the new structure. However, that did introduce some inconsistencies with
where you place docs and how we organize them.

There's also the discrepancies in whether urls us underscores or hyphens
(which isn't necessarily the same as their file name), which has been
annoying me for a while, but now has also been raised by marketing as an
issue in terms of SEO.

## Discussion points

The old, hand-written API docs have been moved from /api to
/reference/api/legacy/unleash. There _is_ a /reference/api/unleash
directory, but this is being populated by the OpenAPI plugin, and mixing
those could only cause trouble. However, I'm unsure about putting
/legacy/ in the title, because the API isn't legacy, the docs are. Maybe
we could use another path? Like /old-docs/ or something? I'd appreciate
some input on this.
2022-11-22 09:05:30 +00:00
Christopher Kolstad
f937e80272
fix: Updated event to include project (#2491)
### What
Our EnvironmentVariant needs project name so this PR makes sure our
service accepts the project id as one of the arguments.
2022-11-22 09:57:12 +01:00
andreas-unleash
6e5b214475
implement proxy all endpoint (#2460)
Signed-off-by: andreas-unleash <andreas@getunleash.ai>

<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->

This PR implements the `all` endpoint of unleash-proxy, by adding an
experimental flag that can control the behaviour

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2022-11-21 12:57:07 +02:00
Gastón Fournier
efd47b72a8
feat: Add variants per env (#2471)
## About the changes
Variants are now stored in each environment rather than in the feature
toggle. This enables RBAC, suggest changes, etc to also apply to
variants.

Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#2254

### Important files
- **src/lib/db/feature-strategy-store.ts** a complex query was moved to
a view named `features_view`
- **src/lib/services/state-service.ts** export version number increased
due to the new format

## Discussion points
We're keeping the old column as a safeguard to be able to go back

Co-authored-by: sighphyre <liquidwicked64@gmail.com>
Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
2022-11-21 10:37:16 +01:00
andreas-unleash
a165eb191c
add back removed permissions and eventType from module exports (#2476)
Signed-off-by: andreas-unleash <andreas@getunleash.ai>

<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->
This PR adds (back) the permissions and eventType module exports

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2022-11-21 10:42:43 +02:00
Nuno Góis
93bd9d869a
Variants per environment (frontend) (#2453)
![image](https://user-images.githubusercontent.com/14320932/202286759-b9c30228-59cc-4c58-a7b0-3c6c3d0ecba6.png)
## About the changes

https://linear.app/unleash/issue/2-425/variants-crud-new-environment-cards-with-tables-inside-add-edit-and

Basically created parallel components for the **variants per
environments** feature, so both flows should work correctly depending on
the feature flag state. Some of the duplication means that cleanup
should be straightforward - Once we're happy with this feature it should
be enough to delete
`frontend/src/component/feature/FeatureView/FeatureVariants/FeatureVariantsList`
and do some little extra cleanup.

I noticed we had some legacy-looking code in variants, so this involved
*some* rewriting of the current variants logic. Hopefully this new code
looks nicer, more maintainable, and more importantly **doesn't break
anything**.

Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#2254

### Important files
Everything inside the
`frontend/src/component/feature/FeatureView/FeatureVariants/FeatureEnvironmentVariants`
folder.
2022-11-18 11:43:24 +00:00
Mateusz Kwasniewski
ac65778cfa
separate protected and unprotected routes (#2466) 2022-11-18 09:29:26 +01:00
Gastón Fournier
dc08f1dadd
fix: broken UI after import (#2447)
fix: broken UI when importing features into environments which are not linked to the feature's project

## Related to
- PR: https://github.com/Unleash/unleash/pull/2209
- Issue: https://github.com/Unleash/unleash/issues/2186
- Issue: https://github.com/Unleash/unleash/issues/2193

## Expected behaviour:
After importing we should see:

![image](https://user-images.githubusercontent.com/455064/202149719-fa74b3b7-3936-443b-9d0e-8f1ca2e779f4.png)

## About the changes
**The problem:** when we import we have projects, features and
environments. Each feature belongs to a project (this is by default and
the imported file enforces that). The links between projects and
features, or projects and environments, depend on us creating those
relationships. When we add a feature to an environment we're not
validating that the project and the environment are connected. Because
of that, in some situations (like in this test), we can end up with a
project with features but no environment.

This breaks a weak constraint we had which is that all projects should
have at least one environment.

**This PR makes the following assumption when importing**: _if a feature
is added to an environment, and that environment is still not linked to
the project that feature belongs to, then the project and environments
have to be linked_. The rationale behind this is that the user couldn't
have generated this export file without the project and environment
being linked together.
2022-11-17 14:05:57 +01:00
andreas-unleash
726ede5cbe
Define exports for enterprise (#2435)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->
This PR sets up exports so that we can import in enterprise with just
"unleash-server".
This will free us to refactor unleash internals without breaking
enterprise

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->
2022-11-17 13:02:40 +02:00
sjaanus
9176ffae1e
Change requests - add multiple reviewers (#2448)
This PR adds implements the frontend and migrations part of multiple
reviewers.

2 UI parts:

1. Configuration to add the count of required approvals
2. Handle multiple approvers in review page.
2022-11-17 11:08:29 +02:00
Fredrik Strand Oseberg
978674e33a
feat: update strategy segments with edit / create strategy (#2420)
* Refactors how we add / edit segments to make it more ergonomic to work with in regards to change requests
2022-11-16 15:35:39 +01:00
sjaanus
3ef0ca580a
Remove change request api protection (#2434)
Remove change request api protection
2022-11-15 14:13:09 +02:00
Nuno Góis
1ddc46011c
Feature toggles: Filtering by tags (#2396)
https://linear.app/unleash/issue/UNL-140/experiment-with-filtering-feature-toggles-by-tags-on-the-ui

Going with a naïve approach for now, tags can be searchable the same way
we search for text. The tags column only shows up if at least one toggle
has tags set. There's a simple highlightable component that lets us know
a match was found and then shows all the tags on a tooltip:
<img width="1289" alt="image"
src="https://user-images.githubusercontent.com/14320932/201155093-b8605ff2-5bf7-45c5-b240-a33da254c278.png">
2022-11-15 10:24:36 +00:00
Tymoteusz Czech
a191313956
refactor: remove public signup link feature flag (#2423)
## About the changes
Cleanup: remove feature flag.

Closes
[1-356/remove-feature-flag-from-the-code](https://linear.app/unleash/issue/1-356/remove-feature-flag-from-the-code)
2022-11-15 10:03:20 +01:00
sjaanus
131ebb931a
Permission guards in existing endpoints interacting with feature toggle configuration (#2418)
This PR adds permission guards for operations.

1. Toggling feature flag
2. Adding a strategy
3. Updating a strategy
4. Deleting a strategy
2022-11-14 15:05:26 +02:00
Nuno Góis
2fa154a3e4
Update environments (#2339)
https://linear.app/unleash/issue/2-357/update-environments-pages
2022-11-11 10:24:56 +00:00
andreas-unleash
74c5189159
Feat/add change request settings (#2390)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->
Add change_request_settings table 
Remove change_request_enabled column

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->
2022-11-11 10:09:25 +02:00