1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
Commit Graph

147 Commits

Author SHA1 Message Date
Gastón Fournier
3d9f31f839
feat: ensure at least one owner on remove user/group access (#5085)
## About the changes
This makes sure that projects have at least one owner, either a group or
a user. This is to prevent accidentally losing access to a project.

We check this when removing a user/group or when changing the role of a
user/group

**Note**: We can still leave a group empty as the only owner of the
project, but that's okay because we can still add more users to the
group
2023-10-19 14:14:59 +02:00
andreas-unleash
6760fc0723
fix: add project filter to feature-toggle-list-builder (#5099)
Adds `forProject` filter to FeatureToggleQueryBuilder
Filters playground results for an array of projects

Closes #
[1-1525](https://linear.app/unleash/issue/1-1525/getting-results-for-all-projects-when-defining-a-single-project-in-the)

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-10-19 15:05:56 +03:00
Mateusz Kwasniewski
de237d844d
feat: detect grandchild dependency (#5094) 2023-10-19 13:14:32 +02:00
Mateusz Kwasniewski
56892c54d9
feat: check if child and parent are in the same project (#5093) 2023-10-19 11:11:05 +02:00
Fredrik Strand Oseberg
7195a63e56
Refactor/last seen at ft list (#5089)
Refactor last seen at for the feature toggle list
2023-10-19 10:58:10 +02:00
Mateusz Kwasniewski
f8855f8234
feat: prevent self dependencies (#5090) 2023-10-19 08:57:23 +02:00
Fredrik Strand Oseberg
cd864ed09e
fix: add sort to deep diff (#5084)
Sort array items before running compare. Feature flag certain properties
of strategy that were previously not present in the /api/admin/features
endpoint.
2023-10-18 16:34:42 +02:00
Fredrik Strand Oseberg
3ac8ab898a
fix: log diff (#5072)
Add a deep diff function to investigate diff in logs
2023-10-18 09:25:25 +02:00
Mateusz Kwasniewski
75b131162e
feat: dependent features use new transaction mechanism (#5073) 2023-10-18 08:59:26 +02:00
Gastón Fournier
db04a1eaa8
chore: introduce type to prevent potential issues (#5066)
## About the changes
This small improvement aims to help developers when instantiating
services. They need to be constructed without injecting services or
stores created elsewhere so they can be bound to the same transactional
scope.

This suggests that you need to create the services and stores on your
own
2023-10-17 12:30:44 +02:00
andreas-unleash
cf42a829f4
feat: add option to return disabled strategies (#5059)
Adds the option to include disabled strategies (behind the
playgroundImprovements flag

Closes #
[1-1505](https://linear.app/unleash/issue/1-1505/return-disabled-strategies-in-the-playground-features-request)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-10-17 12:35:07 +03:00
Gastón Fournier
08116d008a
chore: GA transactional decorator (#5020)
## About the changes
After testing with the flag enabled and fixing a bug, this is ready to
be GA
2023-10-17 10:47:18 +02:00
Jaanus Sellin
5619db33ed
feat: import dependencies (#5044) 2023-10-17 08:22:54 +03:00
Mateusz Kwasniewski
e9e110f702
feat: show dependencies only when using pro/enterprise or at least on… (#5052) 2023-10-16 20:56:06 +02:00
Fredrik Strand Oseberg
0064c9e1be
refactor: add tests for /api/client/features (#5057)
add more robust tests for /api/client/features
2023-10-16 16:18:41 +02:00
Fredrik Strand Oseberg
9e493f56a0
refactor: create builder class for converting rows to avoid duplication (#5050)
Create a builder for creating the data structures for feature toggle
list and playground api
2023-10-16 14:19:46 +02:00
Fredrik Strand Oseberg
1a46ab7b12
refactor: add test coverage (#5046)
Adds test coverage for different feature flag paths temporarily
2023-10-16 13:17:26 +02:00
Fredrik Strand Oseberg
b58d900c2d
fix: feature flag playground features in new store (#5013)
Have playground use the method in the feature-toggle-service instead of
asking the client-feature-toggle-store
2023-10-16 12:29:31 +02:00
Mateusz Kwasniewski
c41f23ae54
feat: remove dependency on archive (#5040) 2023-10-16 08:59:34 +02:00
Jaanus Sellin
2263a1f062
feat: dependencies import validation (#5023) 2023-10-13 14:17:54 +03:00
Fredrik Strand Oseberg
b6d945befc
refactor: feature toggle list query (#5022)
Cean up huge query method in feature-toggle-store
2023-10-13 12:29:14 +02:00
Mateusz Kwasniewski
3eeafba5f9
feat: validate archive dependent features (#5019) 2023-10-13 12:09:46 +02:00
andreas-unleash
a9a75d5e82
fix: disable all environments when reviving a feature (#4999)
Disable all environments when reviving a feature

Closes #
[SR-93](https://linear.app/unleash/issue/SR-93/disable-all-environments-when-reviving-a-feature)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-10-13 10:38:18 +03:00
Jaanus Sellin
a7dd0d6c1a
fix: import segment test and fix (#5017) 2023-10-13 09:40:34 +03:00
Fredrik Strand Oseberg
f34d187cd9
Refactor/separate client and admin store (#5006)
This PR is the first step in separating the client and admin stores.
Currently our feature toggle services uses the client store to serve
multiple purposes. 

Admin API uses the feature toggle service to serve both the feature
toggle list and playground features, while the client API uses the
feature toggle service to serve client features. The admin API can
change often and have very different requirements than the client API,
which changes infrequently and generally keeps the same stable structure
for long periods of time. This architecture is error prone, because when
you need to make changes to the admin API, you can very easily affect
the client API.

I aim to put up a stone wall between the two APIs. Complete separation
between the two APIs, at the cost of some duplication.

In this PR I have created a feature oriented architecture for client
features and disconnected the client API from the feature toggle
service. It now goes through it's own service to it's own store. For
feature toggle service I have duplicated and replaced the functionality
that serves /api/admin/features, I have kept a lot of the ugliness in
the code and haven't removed anything in order to avoid breaking
changes.

Next steps: 
* Move playground to admin API
* Remove client-feature-toggle-store from feature-toggle-service
2023-10-12 13:58:23 +02:00
Jaanus Sellin
7b7a2a706c
fix: enable segment importing for oss (#5010) 2023-10-12 13:43:43 +03:00
Jaanus Sellin
2059706e77
feat: export dependent feature toggles (#5007) 2023-10-12 12:56:10 +03:00
Gastón Fournier
7343183f2d
chore: split interfaces for import and export (#5004)
## About the changes
This splits the interfaces for import and export, especially because the
import functionality has to be replaced in enterprise repo.

This is a breaking change because of the service renames, but I'll have
the PR for the other repository ready so we reduce the time to fix. I
intentionally avoided doing it backward compatible because of time.
2023-10-12 11:34:09 +02:00
Mateusz Kwasniewski
cfcf9de65a
feat: Protect archive feature (#5003) 2023-10-12 08:38:03 +02:00
Mateusz Kwasniewski
30e9fb87e9
feat: prevent adding dependency to archived or removed parent (#4987) 2023-10-11 16:21:57 +02:00
Fredrik Strand Oseberg
bc96216daa
Refactor/move features to feature oriented architecture (#4994)
This PR gathers feature related files in the same folder.
2023-10-11 09:38:57 +02:00
Christopher Kolstad
0c069b1385
fix: added await to getActiveUsers tests 2023-10-10 13:23:20 +02:00
Christopher Kolstad
1edd73db45
feat: feature changes counted in new table (#4958)
As part of more telemetry on the usage of Unleash. 

This PR adds a new `stat_` prefixed table as well as a trigger on the
events table trigger on each insert to increment a counter per
environment per day.

The trigger will trigger on every insert into the events base, but will
filter and only increment the counter for events that actually have the
environment set. (there are events, like user-created, that does not
relate to a specific environment).

Bit wary on this, but since we truncate down to row per (day,
environment) combo, finding conflict and incrementing shouldn't take too
long here.

@ivarconr was it something like this you were considering?
2023-10-10 12:32:23 +02:00
Mateusz Kwasniewski
b4c8f92a26
feat: do not allow to manage dependencies directly with cr enabled (#4971) 2023-10-10 09:25:03 +02:00
Fredrik Strand Oseberg
d896dbd0c7
Fix/last seen at by environment (#4939)
Initial architecture for last seen at by environment.
2023-10-09 10:54:00 +02:00
Gastón Fournier
34fc17146e
chore: improve type on import service (#4962)
## About the changes
Limit import type to what matters
2023-10-09 10:45:19 +02:00
Mateusz Kwasniewski
8b0cf8b11d
feat: allow to delete dependencies when no orphans (#4952) 2023-10-06 13:39:16 +02:00
Mateusz Kwasniewski
2c7587ba4b
feat: dependent features in playground (#4930) 2023-10-05 13:05:20 +02:00
Gastón Fournier
0da48cc0d1
chore: revamp transactional impl (#4916)
## About the changes
This transactional implementation decorates a service with a
transactional method that removes the need to start transactions in the
method using the service.

This is a gradual rollout with a feature toggle, just because
transactions are not easy.
2023-10-04 15:16:37 +02:00
Mateusz Kwasniewski
257414424d
feat: copy feature with parent (#4918) 2023-10-04 12:20:27 +02:00
Mateusz Kwasniewski
5141d9db67
feat: change project with feature dependencies (#4915) 2023-10-04 12:16:52 +02:00
Mateusz Kwasniewski
88305a6388
feat: prevent delete and archive on parent feature (#4913) 2023-10-04 09:27:53 +02:00
Mateusz Kwasniewski
296cc9a9f2
feat: update dependency permission (#4910) 2023-10-04 09:27:14 +02:00
Christopher Kolstad
6673d131fe
feat: biome lint (#4853)
This commit changes our linter/formatter to biome (https://biomejs.dev/)
Causing our prehook to run almost instantly, and our "yarn lint" task to
run in sub 100ms.

Some trade-offs:
* Biome isn't quite as well established as ESLint
* Are we ready to install a different vscode plugin (the biome plugin)
instead of the prettier plugin


The configuration set for biome also has a set of recommended rules,
this is turned on by default, in order to get to something that was
mergeable I have turned off a couple the rules we seemed to violate the
most, that we also explicitly told eslint to ignore.
2023-09-29 14:18:21 +02:00
Mateusz Kwasniewski
fbc571dffc
feat: events for dependencies (#4864) 2023-09-29 14:02:15 +02:00
Mateusz Kwasniewski
72cca4f450
feat: display dependencies and parents in project details (#4859) 2023-09-28 13:37:52 +02:00
Nuno Góis
87d9497be9
refactor: prefer eventService.storeEvent methods (#4830)
https://linear.app/unleash/issue/2-1403/consider-refactoring-the-way-tags-are-fetched-for-the-events

This adds 2 methods to `EventService`:
 - `storeEvent`;
 - `storeEvents`;

This allows us to run event-specific logic inside these methods. In the
case of this PR, this means fetching the feature tags in case the event
contains a `featureName` and there are no tags specified in the event.

This prevents us from having to remember to fetch the tags in order to
store feature-related events except for very specific cases, like the
deletion of a feature - You can't fetch tags for a feature that no
longer exists, so in that case we need to pre-fetch the tags before
deleting the feature.

This also allows us to do any event-specific post-processing to the
event before reaching the DB layer.
In general I think it's also nicer that we reference the event service
instead of the event store directly.

There's a lot of changes and a lot of files touched, but most of it is
boilerplate to inject the `eventService` where needed instead of using
the `eventStore` directly.

Hopefully this will be a better approach than
https://github.com/Unleash/unleash/pull/4729

---------

Co-authored-by: Gastón Fournier <gaston@getunleash.io>
2023-09-27 14:23:05 +01:00
Mateusz Kwasniewski
a06037625d
refactor: expicit names in queries (#4850) 2023-09-27 15:17:04 +02:00
Mateusz Kwasniewski
87a81120d2
feat: feature admin API returns dependencies and children (#4848) 2023-09-27 15:07:20 +02:00
Mateusz Kwasniewski
fd8775f13d
feat: read model for dependent features (#4846) 2023-09-27 14:33:51 +02:00