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

78 Commits

Author SHA1 Message Date
Thomas Heartman
94b65542e8
refactor: remove check for feature naming data object (#4745)
We already check for its presence before doing anything. We don't need
to
check it twice (we're not Santa Claus, after all).
2023-09-15 12:51:47 +02:00
Mateusz Kwasniewski
878780f068
feat: playground custom properties are nested (#4686) 2023-09-14 12:28:28 +02:00
Thomas Heartman
9bdee12ad9
feat: stop regexes with whitespace (#4681)
This PR stops regexes with whitespace from being added as feature naming
patterns.
2023-09-14 07:56:23 +00:00
Thomas Heartman
6dbea08d0b
feat: disallow description when no pattern exists (#4679)
This PR makes it so that adding a feature naming description when there
is no pattern is disallowed. It also changes the validation for feature
naming slightly so that it can return multiple errors at once.
2023-09-14 09:32:07 +02:00
Thomas Heartman
392beee114
feat: add implicit surrounding ^ and $ to patterns (#4664)
This PR updates the back-end handling of feature naming patterns to add
implicit leading `^`s and trailing `$`s to the regexes when comparing
them.

It also adds tests for the new behavior, both for new flag names and for
examples.

## Discussion points

Regarding stripping incoming ^ and $: We don't actually need to strip
incoming `^`s and `$`s: it appears that `^^^^^x$$$$$` is just as valid
as `^x$`. As such, we can leave that in. However, if we think it's
better to strip, we can do that too.

Second, I'm considering moving the flag naming validation into a
dedicated module to encapsulate everything a little better. Not sure if
this is the time or where it would live, but open to hearing
suggestions.
2023-09-13 10:50:37 +02:00
Mateusz Kwasniewski
2b2f5e20fa
feat: Import limit validation (#4669) 2023-09-12 15:36:19 +02:00
Mateusz Kwasniewski
4dcbb4b997
feat: check toggle limit on import (#4665) 2023-09-12 13:53:04 +02:00
Thomas Heartman
9114969869
feat: make import/export work with project patterns (#4652)
This PR adds feature name pattern validation to the import validation
step. When errors occur, they are rendered with all the offending
features, the pattern to match, plus the pattern's description and
example if available.


![image](https://github.com/Unleash/unleash/assets/17786332/69956090-afc6-41c8-8f6e-fb45dfaf0a9d)

To achieve this I've added an extra method to the feature toggle service
that checks feature names without throwing errors (because catching `n`
async errors in a loop became tricky and hard to grasp). This method is
also reused in the existing feature name validation method and handles
the feature enabled chcek.

In doing so, I've also added tests to check that the pattern is applied.
2023-09-12 10:19:40 +02:00
andreas-unleash
1cd0edb11a
feat: variant with number payload (#4654)
Adds `number` as possible payload type for variant.
Adds a flag to enable the feature
Updates all relevant models and schemas
Adds the option to the UI

Closes: #
[1-1357](https://linear.app/unleash/issue/1-1357/support-number-in-variant-payload)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-09-11 16:57:42 +03:00
Mateusz Kwasniewski
45e089f27f
chore: strategy variant flag removed (#4603) 2023-09-04 13:15:54 +02:00
Mateusz Kwasniewski
2c3514954c
feat: import service validate duplicates (#4558) 2023-08-24 10:05:21 +02:00
Jaanus Sellin
0fb078d4c5
fix: do not allow creation/update of feature toggle with invalid strategy name (#4555) 2023-08-23 16:56:22 +03:00
Mateusz Kwasniewski
65e62c64b8
fix: import duplicate features (#4550) 2023-08-23 11:11:16 +02:00
Mateusz Kwasniewski
2cfb99c768
feat: features overwrite warning (#4535) 2023-08-21 11:09:09 +02:00
David Leek
57c448c197
fix: deletion validation didnt account for groups (#4441)
<!-- 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. -->

Fixes an issue where project role deletion validation didn't validate
against project roles being connected to groups
2023-08-08 13:45:19 +02:00
Thomas Heartman
a7cb2b8d53
openapi: stabilize playground + feature types endpoints (#4433)
This PR stabilizes the playground and feature types endpoints by
changing their tag from 'Unstable' to respectively 'Playground' and
'Feature Types'. It also moves the existing feature type endpoint (which
was previously tagged as 'Features') to the 'Feature Types' tag.
2023-08-08 09:01:02 +02:00
Mateusz Kwasniewski
e20e7df10f
feat: protect segment operations for change requests (#4417) 2023-08-04 12:23:19 +02:00
andreas-unleash
d1daf0b98c
fix: Remove lastSeenAt when exporting FeatureEnvironment (#4416)
Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-08-04 08:54:57 +00:00
andreas-unleash
d21ccb7f1c
Feat: last seen in feature environment (#4391)
- Adds last_seen_at column in feature_environments and lastSeenAt
property to the FeatureEnvironment models

Closes
[1-1181](https://linear.app/unleash/issue/1-1181/implement-storing-last-seen-per-environment-be)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-08-04 09:59:54 +03:00
Arne-Christian Rundereim
8aec4a02cb
fix: EventStore#getMaxRevisionId can return null (#4384)
In a new fresh Unleash instance with cache enabled this can cause
feature toggles to never get updated.

We saw in our client that the ETag was ETag: "60e35fba:null" Which
looked incorrect for us.

I also did manual testing and if the andWhere had a value of largerThan
higher than whatever the id was then we would get back { max: null }.

This should fix that issue.
2023-08-01 23:59:09 +02:00
Mateusz Kwasniewski
da5e18233c
feat: segments service DI (#4376) 2023-08-01 11:20:59 +02:00
Mateusz Kwasniewski
f053be427b
test: matching variants (#4349) 2023-07-26 20:03:30 +02:00
Mateusz Kwasniewski
7095e87061
fix: do not split non string values (#4346) 2023-07-26 12:32:08 +02:00
Mateusz Kwasniewski
9f35c2187f
fix: sync enabled and variant status (#4345) 2023-07-26 12:23:39 +02:00
Mateusz Kwasniewski
2b565aeef7
feat: incrementing sort order for strategies (#4343) 2023-07-26 11:31:26 +02:00
Mateusz Kwasniewski
5de4958b0f
fix: group cleanup (#4334) 2023-07-24 11:05:55 +02:00
Mateusz Kwasniewski
f1d1d7d49a
feat: strategy variants in playground (#4281) 2023-07-21 08:15:15 +02:00
Mateusz Kwasniewski
593f83d5d3
feat: advancedPlayground flag used only for runtime control (#4262) 2023-07-18 08:49:04 +02:00
Mateusz Kwasniewski
e8ea79c967
feat: client api with proper client segments and strategy variants (#4244) 2023-07-14 13:25:31 +02:00
Jaanus Sellin
3da1cbba47
feat: feature creation limit crud together with frontend (#4221) 2023-07-13 14:02:35 +03:00
Tymoteusz Czech
de8e9a03ae
Inline endpoint descriptions (#4145)
Update OpenApi docs
2023-07-05 11:25:58 +02:00
andreas-unleash
64c1527213
chore: document endpoint tagged Unstable (#4118)
Adds description and summary to all endpoints with Unstable tag
2023-07-04 14:41:16 +00:00
Thomas Heartman
be0e94105d
bug(#3545): include strategy titles on playground evaluation results (#4084)
This PR adds strategy titles as an optional bit of data added to client
features. It's only added when prompted.


![image](https://github.com/Unleash/unleash/assets/17786332/99509679-2aab-4c2a-abff-c6e6f27d8074)

## Discussion points:

### getPlaygroundFeatures

The optional `includeStrategyId` parameter has been replaced by a
`getPlaygroundFeatures` in the service (and in the underlying store).
The playground was the only place that used this specific include, so
instead of adding more and making the interface for that method more
complex, I created a new method that deals specifically with the
playground.

The underlying store still uses an `optionalIncludes` parameter,
however. I have a plan to make that interface more fluid, but I'd like
to propose that in a follow-up PR.
2023-06-29 10:38:51 +02:00
Gastón Fournier
4cedb00e04
fix: fetching user root roles include custom ones (#4068)
## About the changes
`getUserRootRoles` should also consider custom root roles

This introduces test cases that unveiled a dependency between stores
(this happens actually at the DB layer having access-service access
tables from two different stores but skipping the store layer).


https://linear.app/unleash/issue/2-1161/a-user-with-custom-root-role-and-permission-to-create-client-api

---------

Co-authored-by: Nuno Góis <github@nunogois.com>
2023-06-22 14:42:01 +00:00
Mateusz Kwasniewski
374d49f5bf
feat: ui tweaks for playground (#4058) 2023-06-22 10:13:17 +02:00
Thomas Heartman
24e9cf7c8f
feat: add "edit" link to playground strategies (#4027)
This change adds an "edit" link to all playground strategies when they
are returned from the API, allowing the user to jump directly to the
evaluated strategy edit screen.

This change applies to both old and new strategies, so it should even
work in the old playground.

This does not use this information in the frontend yet.

## Discussion points:

Should "links" be an object or a singular string? I know the
notifications service uses just "link", but using an object will make
it easier to potentially add more actions in the future (such as
"enable"/"disable", maybe?)

Do we need to supply basePath? I noticed that the notifications links
only ever use an empty string for base path, so it might not be
necessary and can potentially be left out.

## Changes

I've implemented the link building in a new view model file. Inspecting
the output after the result is fully ready requires some gnarly
introspection and mapping, but it's tested.

Further, I've done a little bit of work to stop the playground service
using the schema types directly as the schema types now contain extra
information.

This PR also updates the `urlFriendlyString` arbitrary to not produce
strings that contain only periods. This causes issues when parsing URLs
(and is also something we struggle with in the UI).
2023-06-22 07:19:35 +00:00
Mateusz Kwasniewski
ffed4e78b0
feat: configurable playground limit (#4047) 2023-06-22 08:46:13 +02:00
Thomas Heartman
80a2e1b93f
fix: reject API admin tokens when importing features (#4016)
This PR fixes an issue where trying to use an admin token to import
features via the API resulted in a 500 (due to missing properties).

The solution is to catch when the user is using and admin token in the
controller, throw a 400, and tell them to use personal access tokens or
service accounts.

The PR includes a new test file for this specific use case. We don't
really test these cases many other places, so it seemed the logical
choice.
2023-06-20 12:57:59 +00:00
Mateusz Kwasniewski
a0862cfc10
feat: Query complexity validation (#4017) 2023-06-20 14:28:02 +02:00
Jaanus Sellin
9c8651879f
fix: filter out usage for export (#4006) 2023-06-19 13:42:55 +03:00
Nuno Góis
bb026c0ba1
feat: custom root roles (#3975)
## About the changes
Implements custom root roles, encompassing a lot of different areas of
the project, and slightly refactoring the current roles logic. It
includes quite a clean up.

This feature itself is behind a flag: `customRootRoles`

This feature covers root roles in:
 - Users;
 - Service Accounts;
 - Groups;

Apologies in advance. I may have gotten a bit carried away 🙈 

### Roles

We now have a new admin tab called "Roles" where we can see all root
roles and manage custom ones. We are not allowed to edit or remove
*predefined* roles.

![image](https://github.com/Unleash/unleash/assets/14320932/1ad8695c-8c3f-440d-ac32-39746720d588)
This meant slightly pushing away the existing roles to `project-roles`
instead. One idea we want to explore in the future is to unify both
types of roles in the UI instead of having 2 separate tabs. This
includes modernizing project roles to fit more into our current design
and decisions.

Hovering the permissions cell expands detailed information about the
role:

![image](https://github.com/Unleash/unleash/assets/14320932/81c4aae7-8b4d-4cb4-92d1-8f1bc3ef1f2a)

### Create and edit role

Here's how the role form looks like (create / edit):

![image](https://github.com/Unleash/unleash/assets/14320932/85baec29-bb10-48c5-a207-b3e9a8de838a)
Here I categorized permissions so it's easier to visualize and manage
from a UX perspective.

I'm using the same endpoint as before. I tried to unify the logic and
get rid of the `projectRole` specific hooks. What distinguishes custom
root roles from custom project roles is the extra `root-custom` type we
see on the payload. By default we assume `custom` (custom project role)
instead, which should help in terms of backwards compatibility.

### Delete role

When we delete a custom role we try to help the end user make an
informed decision by listing all the entities which currently use this
custom root role:

![image](https://github.com/Unleash/unleash/assets/14320932/352ed529-76be-47a8-88da-5e924fb191d4)
~~As mentioned in the screenshot, when deleting a custom role, we demote
all entities associated with it to the predefined `Viewer` role.~~
**EDIT**: Apparently we currently block this from the API
(access-service deleteRole) with a message:

![image](https://github.com/Unleash/unleash/assets/14320932/82a8e50f-8dc5-4c18-a2ba-54e2ae91b91c)
What should the correct behavior be?

### Role selector

I added a new easy-to-use role selector component that is present in:
 - Users 

![image](https://github.com/Unleash/unleash/assets/14320932/76953139-7fb6-437e-b3fa-ace1d9187674)
 - Service Accounts

![image](https://github.com/Unleash/unleash/assets/14320932/2b80bd55-9abb-4883-b715-15650ae752ea)
- Groups

![image](https://github.com/Unleash/unleash/assets/14320932/ab438f7c-2245-4779-b157-2da1689fe402)

### Role description

I also added a new role description component that you can see below the
dropdown in the selector component, but it's also used to better
describe each role in the respective tables:

![image](https://github.com/Unleash/unleash/assets/14320932/a3eecac1-2a34-4500-a68c-e3f62ebfa782)

I'm not listing all the permissions of predefined roles. Those simply
show the description in the tooltip:

![image](https://github.com/Unleash/unleash/assets/14320932/7e5b2948-45f0-4472-8311-bf533409ba6c)

### Role badge

Groups is a bit different, since it uses a list of cards, so I added yet
another component - Role badge:

![image](https://github.com/Unleash/unleash/assets/14320932/1d62c3db-072a-4c97-b86f-1d8ebdd3523e)

I'm using this same component on the profile tab:

![image](https://github.com/Unleash/unleash/assets/14320932/214272db-a828-444e-8846-4f39b9456bc6)

## Discussion points
- Are we being defensive enough with the use of the flag? Should we
cover more?
 - Are we breaking backwards compatibility in any way?
 - What should we do when removing a role? Block or demote?
- Maybe some existing permission-related issues will surface with this
change: Are we being specific enough with our permissions? A lot of
places are simply checking for `ADMIN`;
- We may want to get rid of the API roles coupling we have with the
users and SAs and instead use the new hooks (e.g. `useRoles`)
explicitly;
 - We should update the docs;
- Maybe we could allow the user to add a custom role directly from the
role selector component;

---------

Co-authored-by: Gastón Fournier <gaston@getunleash.io>
2023-06-14 14:40:40 +01:00
Mateusz Kwasniewski
8bddbd80f6
feat: advanced playground openapi (#3972) 2023-06-14 11:05:08 +02:00
Mateusz Kwasniewski
edd67f7046
test: advanced playground (#3968) 2023-06-14 08:23:36 +02:00
Mateusz Kwasniewski
555f77463d
feat: draft branch playground evaluation (#3967) 2023-06-13 13:56:26 +02:00
Mateusz Kwasniewski
7d69750f3b
refactor: Extract playground steps (#3966) 2023-06-13 11:26:10 +02:00
Mateusz Kwasniewski
32ae15741c
refactor: read project ids in memory (#3965) 2023-06-13 10:12:14 +02:00
Mateusz Kwasniewski
7b8b6bceaf
feat: walking skeleton of the advanced playground (#3949) 2023-06-12 11:01:52 +02:00
Mateusz Kwasniewski
0101491a83
refactor: playground in feature oriented architecture (#3942) 2023-06-09 12:55:54 +02:00
Jaanus Sellin
ec6e4d70b5
feat: context field usage backend (#3921) 2023-06-09 12:00:17 +03:00
Jaanus Sellin
0efaa346c4
feat: usage on context fields in list (#3906) 2023-06-06 13:59:41 +03:00