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

828 Commits

Author SHA1 Message Date
Nuno Góis
054c590813
fix: limit creation of other users PATs (adapting) (#3019)
https://linear.app/unleash/issue/2-656/limit-the-ability-of-creating-a-token-on-behalf-of-another-user

Adapts to the refactor that reverts the initial experimental idea of
Service Accounts before they existed in the current implementation:
Managing other user's PATs.
2023-01-31 08:40:23 +00:00
Gastón Fournier
9c214858c7
chore: backport changes from 4.20 (#3021)
## About the changes
Changes included in 4.20 release, mainly improving OpenAPI tags
2023-01-30 16:02:42 +01:00
Gastón Fournier
812604902b
fix: list projects with all archived toggles (#3020)
## About the changes
While trying to count only features that are not archived to display the
amount of features of a project, accidentally we filtered out projects
with all features archived (they should show up in the list but with
count of features zero)
2023-01-30 13:32:43 +00:00
sjaanus
ab5da2116a
Remove timeout from store (#3018) 2023-01-30 12:01:44 +01:00
Mateusz Kwasniewski
d9110b6ce5
refactor: separate scheduling from DI (#3017) 2023-01-30 11:13:17 +01:00
Mateusz Kwasniewski
96b21f08b0
feat: allow every store to participate in transaction (#3016) 2023-01-30 09:02:44 +01:00
Fredrik Strand Oseberg
1c4ba4cc97
Feat/project stats types (#3012)
Update type for project stats
2023-01-27 17:19:27 +01:00
Fredrik Strand Oseberg
4ea4bcfaf4
fix: down migration (#3015)
* Fixes broken down migration
2023-01-27 16:13:59 +01:00
Fredrik Strand Oseberg
897e97330a
Feat/project stats members (#3009)
This PR adds project members to the project stats and connects the stats
to the UI.
2023-01-27 13:13:41 +01:00
sjaanus
e226e31ad5
Export variants env (#3008)
Export variants env
2023-01-27 13:20:32 +02:00
Mateusz Kwasniewski
f8473a243f
exclude tags for other features (#3007) 2023-01-27 11:34:20 +01:00
Fredrik Strand Oseberg
d8a250dc9c
Feat/project status monthly (#2986)
This PR takes the project status API a step further by adding the
capability of providing a date to control the selection. We are
currently making calculations based on a gliding 30 day window, updated
once a day. The initial database structure and method for updating the
UI is outlined in this PR.
2023-01-26 16:13:15 +01:00
Mateusz Kwasniewski
6b9a242be5
upload limit and import ui tweaks (#2998) 2023-01-26 12:36:45 +01:00
Mateusz Kwasniewski
527ed5feaf
filter out unused fields as they fail import validation (#2997) 2023-01-26 09:48:10 +01:00
Mateusz Kwasniewski
decb7f320d
feat: import stage (#2985) 2023-01-25 12:34:28 +01:00
Mateusz Kwasniewski
80c444aa99
cleanup in export and import (#2973) 2023-01-24 14:29:59 +01:00
Christopher Kolstad
c961374b24
task: changing variants blocked by cr (#2966)
## About the changes
This PR adds two new functions that is protected by CR. When used
instead of the current setVariantOnEnv and setVariantsOnEnv if the flag
UNLEASH_EXPERIMENTAL_CR_ON_VARIANTS is set, the call is blocked. This
leaves the old functions, which is used from the CR flow in place, and
adds new methods protected by CR.

Also adds e2e tests verifying that the methods will block requests if CR
is enabled for project:environment pair, as well as not block if CR is
not enabled. Tests already in place should confirm that the default
flow, without the flag enabled just works.
2023-01-24 10:43:10 +01:00
Nuno Góis
ccfc046937
feat: adds the PAT_DELETE event (#2965)
<img width="973" alt="image"
src="https://user-images.githubusercontent.com/14320932/214047789-830adae4-daf1-4761-9b77-a49c9b92d0d8.png">

Adds the `PAT_DELETE` event so we can log the relevant information when
a PAT is deleted.

Should cover the following scenarios:

- User deletes their own PAT;
- Admin deletes another user's PAT;
- Admin deletes a Service Account token;
2023-01-23 15:11:16 +02:00
Gastón Fournier
70d8f9e58a
feat: add warning hints on potential misconfiguration (#2948)
## 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>
2023-01-20 18:09:01 +01:00
Gastón Fournier
96c65fc10d
feat: Add ability to push variants to multiple environments (#2914)
## About the changes
This PR adds the ability to push variants to multiple environments
overriding the existing variants.

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

**Note:** This won't fail if there are variants in other environments, because the operation wouldn't be idempotent. It should have that property because setting variants to 1 or more environments once or twice should not make a difference
2023-01-20 10:30:20 +01:00
Gastón Fournier
30ed92cbbb
fix: Add missing sortOrder property (#2940)
Add sortOrder property to some OpenAPI schemas
2023-01-20 08:46:01 +01:00
sjaanus
53c11b8585
Add feature name to strategy schema (#2936) 2023-01-19 15:17:36 +02:00
Fredrik Strand Oseberg
f4d857285b
feat: status API (#2931)
Initial status API
2023-01-19 13:27:50 +01:00
Nuno Góis
7d73d772df
feat: add the account abstraction logic (#2918)
https://linear.app/unleash/issue/2-579/improve-user-like-behaviour-for-service-accounts-accounts-concept

Builds on top of https://github.com/Unleash/unleash/pull/2917 by moving
the responsibility of handling both account types from `users` to
`accounts`.

Ideally:
 - `users` - Should only handle users;
 - `service-accounts` - Should only handle service accounts;
 - `accounts` - Should handle any type of account;

This should hopefully also provide a good building block in case we
later decide to refactor this further down the `accounts` path.
2023-01-18 16:08:07 +00:00
Ivar Conradi Østhus
bb20c6d102
fix: project feature_count should not include archived (#2919)
fixes: #2923
2023-01-18 15:58:27 +01:00
andreas-unleash
5ceab6f989
Add flag to control CASE_INSENSITIVE_IN_OPERATORS until SDKs catch up (#2927)
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! ❤️ -->

## 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-01-18 15:53:14 +02:00
andreas-unleash
91e20cc09a
Add support for case for IN and NOT_IN operators (#2924)
Signed-off-by: andreas-unleash <andreas@getunleash.ai>

Adds support for case for IN and NOT_IN operators
<!-- 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? -->

<img width="1547" alt="Screenshot 2023-01-18 at 11 35 10"
src="https://user-images.githubusercontent.com/104830839/213136158-25c525c8-de82-423b-93d1-5ae6eb8469fa.png">

## 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-01-18 14:42:26 +02:00
Fredrik Strand Oseberg
89163b8719
refactor/clean-up-get-project (#2925)
This PR moves the getProjectOverview method out from the project health
controller. It doesn't make sense that this method lives here anymore,
as over time it has grown into method that relays all information about
a single project. It makes more sense that this now lives on the root of
the project api. Also removes unwanted duplication of getProjectOverview
from the project-service and the project-health-service.
2023-01-18 13:22:58 +01:00
Nuno Góis
d63b3c69fe
feat: adapt user logic to better adapt to SAs (#2917)
https://linear.app/unleash/issue/2-579/improve-user-like-behaviour-for-service-accounts-accounts-concept

<img width="803" alt="image"
src="https://user-images.githubusercontent.com/14320932/213011584-75870595-988d-49bc-a7bf-cd1ffd146bca.png">

Makes SAs behave more like users. 

Even though they share the same `users` database table, the `is_service`
column distinguishes them. This PR makes the distinction a bit less
obvious by not filtering out SAs for some methods in the user store,
returning both account types and their respective account type
information so we can handle them properly on the UI.

We felt like this was a good enough approach for now, and a decent
compromise to move SAs forward. In the future, we may want to make a
full refactor with the `accounts` concept in mind, which we've
experimented with in the
[accounts-refactoring](https://github.com/Unleash/unleash/tree/accounts-refactoring)
branches (both OSS and Enterprise).
 
https://github.com/Unleash/unleash/pull/2918 - Moves this a bit further,
by introducing the account service and store.
2023-01-18 12:12:44 +00:00
Fredrik Strand Oseberg
bf7ef62059
feat: initial status box implementation (#2913)
First iteration of new status boxes
2023-01-18 10:10:41 +01:00
sjaanus
16bca1260c
Segment export (#2922)
Segment export
2023-01-18 10:41:22 +02:00
sjaanus
b895c99743
Export features (#2905) 2023-01-17 13:10:20 +02:00
Gastón Fournier
005e5b1d15
fix: found an edge case exporting variants (#2900)
## About the changes
When exporting v3, for variants backward compatibility, we need to find
one featureEnvironment and fetch variants from there.
In cases where the default environment is disabled (therefore does not
get variants per environment when added), it can be still be selected
for the export process. Therefore variants don't appear in the feature
when they should be there.

An e2e test that fails with the previous implementation was added to
validate the behavior

This comes from our support ticket 404
2023-01-13 14:55:57 +01:00
Mateusz Kwasniewski
5569101f30
feat: import feature strategies (#2885) 2023-01-12 15:24:34 +01:00
Mateusz Kwasniewski
a52d3b0f77
test: fix test runs to 1 (#2886) 2023-01-12 13:53:05 +01:00
Gastón Fournier
ce815e5f29
feat: report app names only if below a threshold (#2737)
## About the changes
Introduce a snapshot version of instanceStats inside
instance-stats-service to provide a cached state of the statistics
without compromising the DB.

### Important notes
Some rule-of-thumb applied in the PR that can be changed:
1. The snapshot refresh time
2. The threshold to report appName with the metrics

## Discussion points
1. The snapshot could be limited to just the information needed (things
like `hasOIDC` don't change until there's a restart), to optimize the memory usage
3. metrics.ts (used to expose Prometheus metrics) has a [refresh
interval of
2hs](2d16730cc2/src/lib/metrics.ts (L189-L195)),
but with this implementation, we could remove that background task and
rely on the snapshot
4. We could additionally update the snapshot every time someone queries
the DB to fetch stats (`getStats()` method), but it may increase
complexity without a significant benefit

Co-authored-by: Mateusz Kwasniewski <kwasniewski.mateusz@gmail.com>
Co-authored-by: Simon Hornby <liquidwicked64@gmail.com>
2023-01-12 11:26:59 +01:00
Mateusz Kwasniewski
be1762d33f
Scheduler abstraction (#2829) 2023-01-11 16:15:53 +01:00
sjaanus
eb7e82dff2
Export with strategies (#2877) 2023-01-11 15:00:20 +00:00
Mateusz Kwasniewski
afdcd45042
feat: first skeleton of the batch import (#2868)
First skeleton of batch import:
* injecting feature toggle service because I want to reuse logic and not
just the store
2023-01-11 15:19:16 +01:00
Gastón Fournier
fa47fee55e
feat: RBAC read params from body (#2846)
## About the changes
This is a follow-up on #1953

This implementation generalizes how we fetch some standard parameters
from the query parameters or request body.

## Discussion points
Unfortunately, we have not used standard names for our APIs and one
example is our `projectId` (in some cases we just used `project`).
Ideally, we're only using one way of sending these parameters either
`projectId` or `project` (same applies to `environment` vs
`environmentId`).

If both parameters are present, due to historical reasons, we'll give
precedence to:
- `projectId` over `project`
- `environment` over `environmentId` 

In the presence of both query parameters and body, we'll give precedence
to query parameters also for historical reasons.
2023-01-11 10:48:27 +01:00
andreas-unleash
e050495199
fix feature-schema.ts (#2729)
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 fixes the admin feature schema by moving the `strategies`
(featureStrategySchema) from the root of `feature` object to
`feature.environment`
## 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-01-11 10:53:43 +02:00
Gastón Fournier
9ea67a74b4
feat: add error logs for addons (#2739)
## About the changes
This uses log-level warning so we can turn off the log without turning
off all error logs. This could potentially be tweaked further by using
log categories in the log configuration.

Closes #2057
2023-01-11 09:13:22 +01:00
sjaanus
6c9ef53ea4
Export import flag (#2866)
Export import flag
2023-01-11 09:23:47 +02:00
sjaanus
11d5a157c4
Remove E flag (#2832) 2023-01-11 09:00:26 +02:00
sjaanus
f3f3a59e5e
Import export (#2865) 2023-01-10 15:59:02 +02:00
Ivar Conradi Østhus
0c1e997f0b
fix: store snapshots in temp folder (#2864) 2023-01-10 13:53:00 +01:00
Nuno Góis
997dbbbea5
Feat sa table info (#2848)
https://linear.app/unleash/issue/2-543/show-relevant-information-on-the-service-accounts-table

Shows relevant information on the table, like total PATs and the last
time a service account was active based on latest seen PAT for that
account. Adapts to the latest related PR on enterprise.


![image](https://user-images.githubusercontent.com/14320932/211312719-c4ed940a-723b-4b2e-a79e-8e7cdbda7c58.png)
2023-01-09 16:18:37 +00:00
sjaanus
7a1c18bd35
Ability to add AJV schemas runtime (#2792) 2023-01-06 11:41:39 +02:00
Mateusz Kwasniewski
5ac08e06d9
fix: when health is 0 we should not show 100 (#2833) 2023-01-05 15:14:27 +01:00
Gastón Fournier
29be130757
fix: enforce weight precision to 1 decimal (#2749)
## About the changes
According to our docs, we only support up to 1 decimal place for
weights. This is to use integers to represent the percentages (we divide
them by 10) and supporting more decimals results in bad maths due to
floating point arithmetics.

This PRs adds Frontend and Backend validations to enforce this
restriction

Closes #2222

## Discussion points
Should we reconsider supporting more decimal places, that door remains
open, but for now we'll just adhere to our documentation because that
change would require some development.
2023-01-05 12:39:18 +01:00
Tymoteusz Czech
1653b0449a
Orval generator POC (#2724)
for #2715
2023-01-05 11:57:53 +01:00
Gastón Fournier
58dd09f3e1
fix: export features with variants event when feature is disabled (#2824)
## About the changes
When exporting features one is normally also interested in disabled
features, so they are also included in the export file, while the
variants are not. I do not see a good reason for that, so this PR
removes the check and exports the variants then as well.
I could also add an option as well, but as long as there is no good
reason for ignoring the variants I would just export them with the
features.

This PR adds tests on #2719

Closes #2719

Co-authored-by: Martin Joehren <martin.joehren@esailors.de>
2023-01-05 12:30:07 +02:00
Ivar Conradi Østhus
3a8107ce6e
fix: state-service should always keep api keys (#2552)
We have experienced side-effects where the import was unexpected and
resulted in environments thought to be removed. This had the unexpected
side-effect of also deleting API keys for some environments not part of
the import file.

This commit removes the ability of the state-service to mutate api keys
directly. There is no compelling reasons why we should remove API keys
as part of an import query.

Co-authored-by: Gastón Fournier <gaston@getunleash.ai>
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2023-01-04 11:24:34 +00:00
Gastón Fournier
bf77182ca7
feat: limit the amount of results coming from Prometheus (#2776)
## About the changes
To avoid showing too much data in the traffic screen, limit the number
of results to `topk`.

## Discussion points
Top 10 is a rule of thumb, but maybe we could do top 25. Until we gather
more data, I believe this should be good enough
2023-01-04 11:00:04 +01:00
Nuno Góis
28fbcf69ec
feat: enterprise service accounts (BE) (#2806)
https://linear.app/unleash/issue/2-537/back-end-for-service-accounts

Supersedes https://github.com/Unleash/unleash/pull/2731
2023-01-03 15:15:32 +00:00
sjaanus
bae623d69e
Fix joi failing starting from 17.7.0 release (#2790) 2023-01-03 11:50:00 +02:00
sjaanus
8a8cd1bf27
UI Flags cleanup (#2778) 2023-01-02 15:41:43 +02:00
Nuno Góis
88004a6138
feat: allows creation of PATs for other users (#2718)
https://linear.app/unleash/issue/2-530/api-allow-creation-of-pats-for-other-users


![image](https://user-images.githubusercontent.com/14320932/208720680-5d5ccee7-1972-4f5b-8024-3a69d50a571f.png)

Adds and takes into account the following permissions:
 - **READ_USER_PAT**;
 - **CREATE_USER_PAT**;
 - **DELETE_USER_PAT**;
 
 API only, will make some exploration on UI soon.

Co-authored-by: Gastón Fournier <gaston@getunleash.ai>
2023-01-02 10:49:57 +00:00
sjaanus
ec535ad7cc
Make it possible to validate enterprise schema with respondWithValidation (#2781)
Now respondWithValidation<T, S = SchemaId> can be called in oss and
enterprise to validate against needed schema.
2023-01-02 12:08:27 +02:00
sjaanus
6c621bf65b
Fix crashing search bars (#2765) 2022-12-28 12:35:27 +02:00
Nuno Góis
aaa96f71cb
feat: message banner (#2726)
Related to:
https://linear.app/unleash/issue/2-511/exploration-build-data-for-the-possibility-of-showing-an-alert-to-the
Namely:
https://unleash-internal.slack.com/archives/C046LV85N3C/p1671443897386729

The idea is to have a general message banner that can be controlled
through a feature flag in Unleash to display announcements, warnings,
informations, etc.

Currently using mock feature flags, but the idea is to bind this to a
feature flag we can manage in our Unleash instance, and use its payload
to provide information to end users whenever we want.

Co-authored-by: Gastón Fournier <gaston@getunleash.ai>
2022-12-22 15:16:51 +00:00
Christopher Kolstad
5b66346e56
fixes 2-456: Preserve all data from strategy import (#2720)
## What
Previously when importing strategies we've used the same data type we've
used for creating strategies (the minimal, a name, an optional
description, optional parameters and an optional editable column). This
meant that exporting strategies and then importing them would reactivate
deprecated strategies. This PR changes to allow the import to preserve
all the data coming in the export file.

## Tests
Added four new tests, two new unit tests using our fake stores and two
new e2e tests. Interestingly the ones in the fake store ran green before
this change as well, probably because we just insert the parsed json
object in the fake store, whereas the real store actually converts the
object from camelCasing to the postgresql snake_casing standard.

## Discussion points:
### Mismatch between fake and real stores
This is inevitable since storing things in javascript arrays vs saving
in a real database will have some differences, but this again shows the
value of our e2e tests.

### Invariants
Should we see if we can add some invariants to our import/export so that
we can write some proptests for it? One candidate is commutativity of
import/export. On a fresh database importing and then exporting should
yield the same file that was imported provided all flags are turned on.
Candidate for Q1 improvement of import/export.
2022-12-21 13:33:41 +01:00
sjaanus
be045dc13a
Remove favorites feature flag (#2722) 2022-12-21 12:03:06 +00:00
sjaanus
a0619e963d
Maintenance mode for users (#2716) 2022-12-21 13:23:44 +02:00
Nuno Góis
7ce5b3de64
refactor: flag resolver should use stricter types (#2571)
Adding stricter types to `FlagResolver` can possibly help improve our DX
- Help us prevent errors like typos, guide us to correctly add a flag
when needed, and warn us of stray checks whenever we do a clean up at a
later stage.
2022-12-20 15:10:06 +00:00
Gastón Fournier
4b519ead4f
perf: Simplify queries to prometheus (#2706)
## About the changes
This PR improves our queries to Prometheus (instead of making multiple queries do only one) and improves the UI and the code. 

The reports aggregate all HTTP methods (GET, POST, PUT, DELETE, OPTIONS, HEAD and PATCH) without distinction under the same "endpoint" (a relative path inside unleash up to a certain depth)

Co-authored-by: Nuno Góis <nuno@getunleash.ai>
2022-12-19 17:06:59 +01:00
sjaanus
2d5455d203
Maintenance mode middleware (#2707) 2022-12-19 09:01:04 +02:00
Nuno Góis
a3ac96f763
Feat network overview (#2708)
https://linear.app/unleash/issue/2-512/exploration-network-overview-represented-as-a-flow-chart

<img width="1307" alt="image"
src="https://user-images.githubusercontent.com/14320932/208110067-294a0b91-d52e-49d1-9024-fa5e8530e2d8.png">
2022-12-16 14:12:36 +00:00
Gastón Fournier
2979f21631
feat: expose number of registered applications metric (#2692)
## About the changes
This metric will expose an aggregated view of how many client
applications are registered in Unleash. Since applications are ephemeral
we are exposing this metric in different time windows based on when the
application was last seen.

The caveat is that we issue a database query for each new range we want
to add. Hopefully, this should not be a problem because:
a) the amount of ranges we'd expose is small and unlikely to grow
b) this is currently updated at startup time and even if we update it on
a scheduled basis the refresh rate will be rather sparse

## Sample data
This is how metrics will look like
```
# HELP client_apps_total Number of registered client apps aggregated by range by last seen
# TYPE client_apps_total gauge
client_apps_total{range="allTime"} 3
client_apps_total{range="30d"} 3
client_apps_total{range="7d"} 2
```
2022-12-16 11:16:51 +00:00
Christopher Kolstad
eafba10cac
feature: add query support to features endpoint (#2693)
## About the changes
The deprecated /api/admin/features endpoint supported querying with tag
and namePrefix parameters.

This PR adds this functionality to
/api/admin/projects/<project>/features as well, allowing to replicate
queries that used to work.

Closes #2306

### Important files
src/lib/db/feature-strategy-store.ts
src/test/e2e/stores/feature-strategies-store.e2e.test.ts

## Discussion points
I'm extending our query parameters support for
/api/admin/projects/<projectId>/features endpoint. This will be
reflected in our open-api spec, so I also made an
adminFeaturesQuerySchema for this.

Also, very open for something similar to what we did for the modifyQuery
for the archived parameter, but couldn't come up with a good way to
support subselects using the query builder, it just ended up blowing the
stack. If anyone has a suggestion, I'm all ears.

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2022-12-16 12:05:18 +01:00
sjaanus
d42e90544f
Maintenance mode UI (#2704) 2022-12-15 16:07:22 +02:00
Nuno Góis
90f0d665f9
fix: disable networkView for dev, fail more gracefully (#2701)
Disables networkView for dev for now. Attempts to fail more gracefully
both on the service and front-end.
2022-12-15 10:12:02 +00:00
Christopher Kolstad
23094b016e
feat: first draft of chart for instance traffic in frontend (#2670)
## What
We've already added the backend for this. This is the initial work for
drawing a chart for instance traffic in the frontend. It requires the environment variable `PROMETHEUS_API` set to a valid prometheus-query-language (promql) supported backend, such as Prometheus itself or Victoria Metrics. Besides, at the moment we're hiding this functionality behind the flag `UNLEASH_EXPERIMENTAL_NETWORK_VIEW` which has to be set to true

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
Co-authored-by: Gastón Fournier <gaston@getunleash.ai>
2022-12-15 08:47:07 +00:00
Ivar Conradi Østhus
34c12c8234
fix: adjust db-pool for test to use max=4 2022-12-14 20:25:14 +01:00
Ivar Conradi Østhus
e01167676c
fix: background frontend settings should not crash tests 2022-12-14 20:24:47 +01:00
Ivar Conradi Østhus
e4035d37d4
fix: adjust db-pool for test to use max=3 2022-12-14 19:53:26 +01:00
Ivar Conradi Østhus
2223cace41
fix: adjust db-pool a bit 2022-12-14 19:42:01 +01:00
Ivar Conradi Østhus
09c87c755f
Fix/remove settings cache (#2694)
In this PR we remove the general SettingService cache, as it will not
work across multiple horizontal unleash instances, events are not
published across.

We also fix the CORS origin to: 
- Access-Control-Allow-Origin set to "*" if no Origin is configured
- Access-Control-Allow-Origin set to "*" if any Origin is configured to
"*"
- - Access-Control-Allow-Origin set to array and have the "cors"
middleware to return an exact match on the user provided Origin.

Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com>
2022-12-14 17:35:22 +01:00
Ivar Conradi Østhus
10aa79eb56
fix: move docker-compose to this repo (#2666)
Use latest official image for Unleash for simplicity. 
Also takes away the proxy as it is not needed anymore.
2022-12-12 20:40:18 +01:00
Nuno Góis
5086ec7921
remove feature flag: tokens last seen (#2673)
https://linear.app/unleash/issue/2-470/clean-up-flag
2022-12-12 14:32:35 +00:00
Nuno Góis
e8d0fdba1f
remove feature flag: toggle tag filtering (#2668)
https://linear.app/unleash/issue/2-482/clean-up-feature-flag-after-this-goes-ga

Relevant discussion:
https://unleash-internal.slack.com/archives/C046LV6HH6W/p1670837328201169
2022-12-12 13:21:12 +00:00
Gastón Fournier
5fe238c896
task: Expose prometheus metrics (#2586)
## About the changes
This connects our backend with Prometheus (or compatible) metrics
service, and exposes raw data (i.e. acting as a proxy)

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
2022-12-12 14:05:56 +01:00
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
sjaanus
6b74b7c255
Fix error in migration when updating feature_environments (#2607)
Fixes a issue, where `variants` was null in features table, but column is not nullable.


Co-authored-by: sighphyre <liquidwicked64@gmail.com>
2022-12-06 14:57:54 +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