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

904 Commits

Author SHA1 Message Date
andreas-unleash
9b6f5cd198
fix: make api tokens ui consistent and remove check for deprecated envs. (#3410)
<!-- 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 removes the check for deprecated environments when validating
api token environment.

Unifies global and project level tokens allow selection of deprecated
environments when creating an api token

Adds 'deprecated' to the EnvironmentSelector when appropriate

## 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>
2023-03-29 10:33:14 +03:00
Jaanus Sellin
99bcd7ca5c
feat: add import export flag (#3411) 2023-03-29 09:19:33 +03:00
andreas-unleash
0d68febdf7
Fix: make stickiness accept any string (#3408)
<!-- 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! ❤️ -->
Changes the schema and api to accept any string for defaultStickiness
## 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>
2023-03-28 16:42:16 +03:00
Mateusz Kwasniewski
3b311f74c0
feat: stop change project on change request enabled (#3391) 2023-03-28 11:28:22 +02:00
Fredrik Strand Oseberg
a98bfb2229
fix: remove notification feature flag from oss (#3390)
Removes the notifications feature flag
2023-03-27 16:08:27 +02:00
Mateusz Kwasniewski
2caab45801
feat: disallow clone toggle on change request enabled (#3383) 2023-03-27 13:21:50 +02:00
Mateusz Kwasniewski
9abe859e60
chore: remove export import flag (#3371) 2023-03-27 12:31:19 +02:00
Fredrik Strand Oseberg
354e54a356
fix: count events instead of loading them in memory (#3382)
Refactor project events to use count instead of loading the events in
memory
2023-03-27 11:24:01 +02:00
Ivar Conradi Østhus
b5a31dabc4
fix: use correct casing fro ETag header (#3387) 2023-03-27 08:32:49 +00:00
Christopher Kolstad
49fbf4a635
task: enclose ETag in double quotes. (#3385)
According to the
[RFC](https://www.rfc-editor.org/rfc/rfc7232#section-2.3) Etags should
be enclosed in double quotes. This PR makes sure we do actually wrap it
in double quotes
2023-03-24 16:11:42 +01:00
Mateusz Kwasniewski
ab913228ca
refactor: read model for change request access checking (#3380) 2023-03-24 14:31:43 +01:00
Gastón Fournier
3f29fa5ec8
refactor: fix compilation issues in features service (#3323)
## About the changes
This PR fixes a bunch of null check errors:
https://github.com/Unleash/unleash/actions/runs/4509279284/jobs/7938853559#step:5:39
2023-03-24 10:43:38 +01:00
Gastón Fournier
a79a76f497
refactor: test composition and other error codes (#3348)
## About the changes
Small refactor to showcase how to use [composition to validate different
aspects of the
response](https://github.com/Unleash/unleash/pull/3348/files#diff-ee4c1bd501b1195162b7a85ed6be348a665288f871abc8e74f64d94361213f9eR361-R367)
and checking [different status
codes](https://github.com/Unleash/unleash/pull/3348/files#diff-4044a5da3280ef76960bbffd5f36eccb395ac319fe58c4d59ef68a878cbb1a5dR95)
2023-03-23 16:31:05 +01:00
Mateusz Kwasniewski
57f42b5629
feat: collaboration mode API cleanup (#3357) 2023-03-23 14:13:34 +01:00
Jaanus Sellin
407b2524b8
fix: use projectId from param (#3372) 2023-03-23 10:12:38 +02:00
Nuno Góis
27d48b3437
Feat segments project safeguards (#3359)
https://linear.app/unleash/issue/2-811/ability-to-move-project-specific-segments


![image](https://user-images.githubusercontent.com/14320932/226572047-19ed225c-13d5-4f2e-b10f-e17a7f7e6ae7.png)

Provides some safeguards to project-specific segments when managing them
on a global level (segments page):
- You can always promote a segment to global;
- You can't specify a project if the segment is currently in use in
multiple projects;
- You can't specify a different project if the segment is currently
already in use in a project;
2023-03-21 20:28:43 +00:00
Mateusz Kwasniewski
902ebefe7e
feat: support updating existing projects without existing settings (#3358) 2023-03-21 10:32:09 +01:00
Gastón Fournier
af42347a7b
chore: PoC test API helper (DRY) (#3342)
## About the changes
New way of centralizing API calls while doing E2E tests to avoid repeating ourselves.
2023-03-20 10:27:19 +01:00
Jaanus Sellin
d28e65b94c
feat: revive features (#3344) 2023-03-17 18:21:13 +00:00
Ivar Conradi Østhus
dc5b53fa4d
Poc: calculate etag based on query and latest revison id (#3062)
This is very much POC and WIP
2023-03-17 14:10:21 +01:00
andreas-unleash
32e1ad44ed
Feat/add cypress tests for project scoped stickiness (#3340)
<!-- 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>
2023-03-17 14:41:59 +02:00
Gastón Fournier
7a9ea22eed
feat: project-specific segments tests and fixes (#3339)
## About the changes
- Refactored some E2E tests to use our APIs
- Added test cases for project-specific segments
- Added validation to check a project can access a specific segment
- Fixed an OpenAPI schema that was missing segments

## Discussion points
https://github.com/Unleash/unleash/pull/3339/files#r1140008992
2023-03-17 12:43:34 +01:00
Mateusz Kwasniewski
0797e2849f
feat: project mode flag (#3336) 2023-03-16 16:27:08 +01:00
Fredrik Strand Oseberg
e2ad0cae45
fix: refactor calculate time to prod (#3333)
This PR changes how we calculate average time to production. Instead of
calculating fleeting 30 day windows and calculating the past and current
window, we now calculate a flat average across the entire project life.
This is less error prone as each feature will be tied to the earliest
time it was turned on in a production environment.
2023-03-16 15:45:24 +01:00
Mateusz Kwasniewski
1064dfa40c
feat: project mode (#3334) 2023-03-16 15:29:52 +01:00
andreas-unleash
edd12709ef
fix: remove proxy return all toggles functionality (#3331)
<!-- 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 removes the return all toggles functionality. Removes the flag
as well
## 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 #
[1-778](https://linear.app/unleash/issue/1-778/remove-proxyalltoggles-functionality)

<!-- (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>
2023-03-16 14:00:18 +02:00
andreas-unleash
65f4f88fdf
fix: bug fix - end the response when projectScopedStickiness is disabled (#3332)
This PR fixes a bug where the api call to getProjectSettings was left
hanging because no `end` was specified on the server

<!-- 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>
Co-authored-by: Nuno Góis <github@nunogois.com>
2023-03-16 12:02:23 +02:00
Jaanus Sellin
d94dd31677
feat: refactor archive (#3330) 2023-03-16 10:26:02 +02:00
Jaanus Sellin
138ac98094
feat: bulk revive features (#3321) 2023-03-16 09:51:18 +02:00
Mateusz Kwasniewski
481a7bc45c
fix: Missing export (#3327) 2023-03-15 17:10:36 +01:00
Mateusz Kwasniewski
ce0543c951
feat: Create project service di (#3326) 2023-03-15 16:46:41 +01:00
andreas-unleash
933455e308
feat: use api instead of localStorage (#3305)
<!-- 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 replaces localStorage with api calls for getting/setting project
scoped stickiness
## 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>
2023-03-15 16:06:25 +02:00
Gastón Fournier
1d0bc833b3
chore: refactor segments to stop depending on the implementation (#3315)
## About the changes
- Introducing ISegmentService interface to decouple from the actual
implementation
- Moving UpsertSegmentSchema to OSS to be able to use types
- Added comments where our code is coupled with segments just to
highlight and have a conversation about some use cases if needed, but
they can be removed before merging
- Removed segment service from some project features as it was not used
2023-03-15 14:58:19 +01:00
Mateusz Kwasniewski
d9e3ff9cd4
refactor: move project membership check from access to project (#3322) 2023-03-15 14:44:08 +01:00
Jaanus Sellin
a5f1b89b4a
feat: bulk delete features (#3314) 2023-03-15 15:08:08 +02:00
Mateusz Kwasniewski
9fd84abaa5
feat: Default project mode open (#3316) 2023-03-15 12:28:06 +01:00
Jaanus Sellin
6c813ab066
feat: bulk stale features (#3311) 2023-03-15 08:37:06 +02:00
Mateusz Kwasniewski
7753082660
feat: expose project members (#3310) 2023-03-14 16:27:57 +01:00
Mateusz Kwasniewski
5b8d023184
feat: project settings migration (#3313) 2023-03-14 14:43:14 +01:00
Mateusz Kwasniewski
3837cceafe
fix: type checker happy (#3306) 2023-03-14 10:32:00 +01:00
Tymoteusz Czech
30a753b93f
UI/bulk select (#3267)
Select multiple toggles on project overview.
2023-03-14 08:56:03 +00:00
Jaanus Sellin
1746a951c2
feat: bulk archive features (#3286)
Bulk archiving features logic.
2023-03-14 10:48:29 +02:00
andreas-unleash
de73fd3554
feat: default stickiness per project in settings (#3299)
<!-- 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! ❤️ -->

Introduces 2 new endpoints (behind flag `projectScopedStickiness` to set
and get the setting

## 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>
2023-03-13 14:22:47 +02:00
Nuno Góis
fe1e3566ee
fix: assume undefined instead of null on segment project (#3304)
Assume `undefined` instead of `null` for project in terms of interfacing
with segments: If the `project` field is not present, that means that it
is not set, which means we're dealing with a "global" segment. If we
want to unset `project` and make a segment global, we simply don't send
the `project` property on our PUT method.
2023-03-13 10:25:48 +00:00
Mateusz Kwasniewski
8fdb263d64
feat: disable verbosity from db-migrate (#3301) 2023-03-13 10:12:43 +01:00
Nuno Góis
db8d4d6f49
fix: segment project null handling (#3300)
~~Should we handle this on the store layer instead~~? 🤔
Fixing this on the store layer. Effectively, frontend is able to send
`project: null` and even if that gets magically converted to `""` it's
OK since we're covering that use case on the store layer. Backend
response will be `project: null` as well, so it should be consistent.
2023-03-10 13:26:48 +00:00
Mateusz Kwasniewski
10f7d57f13
fix: remove remaining warnings in tests (#3296) 2023-03-10 12:12:17 +01:00
andreas-unleash
3193423d2d
feat: Project scoped stickiness (#3289)
Project scoped stickiness 
<!-- 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! ❤️ -->

Adds `projectScopedStickiness` flag to experimental.ts
Refactor Stickiness select for reusability
Modify FlexibleStrategy to respect the setting.
Modify EnvironmentVariantModal to respect the setting

## 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>
2023-03-10 12:28:02 +02:00
Gastón Fournier
fecbdd48a9
chore: add project-specific-segment permission (#3295)
## About the changes
This adds new permission to control access to project specific segments 

This should be used later for
https://linear.app/unleash/issue/2-743/have-a-project-specific-configuration-section:
![image
(11)](https://user-images.githubusercontent.com/455064/224277399-338ed0e6-f5e3-4318-a2cd-ac1300b60603.png)
2023-03-10 10:34:26 +01:00
Simon Hornby
5088409c4d
fix: polling in proxy repository now stops correctly (#3268)
### What

This patches two very subtle bugs in the proxy repository that cause it
to never actually stop polling the db in the background

## Details - Issue 1

We've recently started to get the following output when running `yarn
test`:

` Attempted to log "Error: Unable to acquire a connection
at Object.queryBuilder
(/home/simon/dev/unleash/node_modules/knex/lib/knex-builder/make-knex.js:111:26)`
        
This seems to occur for every test suite after running the proxy tests
and the full stack trace doesn't point to anything related to the
running tests that produce this output. Running a `git bisect` points to
this commit:
6e44a65c58
being the culprit but I believe that this may have surfaced the bug
rather than causing it.

Layering in a few console logs and running Unleash, seems to point to
the proxy repository setting up data polling but never actually
terminating it when `stop` was called, which is inline with the output
here - effectively the tests were continuing to run the polling in the
background after the suite had exited and jest freaks out that an async
task is running when it shouldn't be. This is easy to reproduce once the
console logs are in place in the `dataPolling` function, by running
Unleash - creating and deleting a front end token never terminates the
poll cycle.

I believe the cause here is some subtlety around using async functions
with timers - stop was being called, which results in the timer being
cleared but a scheduled async call was already on the stack, causing the
recursive call to resolve after stop, resurrecting the timer and
reinitializing the poll cycle.

I've moved the terminating code into the async callback. Which seems to
solve the problem here.

## Details - Issue 2

Related to the first issue, when the proxy service stops the underlying
Unleash Client, it never actually calls destroy on the client, it only
removes it from its internal map. That in turn means that the Client
never calls stop on the injected repository, it only removes it from
memory. However, the scheduled task is `async` and `unref`, meaning it
continues to spin in the background until every other process also
exits. This is patched by simply calling destroy on the client when
cleaning up

## The Ugly

This is really hard to test effectively, mostly because this is an issue
caused by internals within NodeJS and async. I've added a test that
reads the output from the debug log (and also placed a debug log in the
termination code). This also requires the test code to wait until the
async task completes. This is horribly fragile so if someone has a
better idea on how to prove this I would be a very happy human.

The second ugly part is that this is a subtle issue in complex code that
really, really needs to work correctly. I'm nervous about making changes
here without lots of eyes on this
2023-03-10 10:03:32 +02:00