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

1914 Commits

Author SHA1 Message Date
Mateusz Kwasniewski
2b2089f7b5
feat: clickable banner modal links (#6552) 2024-03-14 13:19:27 +01:00
Simon Hornby
a2c4b8c320
refactor: allow user events to take in only what they need (#6545) 2024-03-14 12:14:33 +02:00
Jaanus Sellin
ba53bd7bf9
refactor: optimize applications overview (#6548)
There was no need to join the entire metrics table, as it is a huge
table. We only needed all combinations of app_name, environment, and
feature_name. The new query retrieves all this data, which will then be
joined into the main query.
2024-03-14 12:11:15 +02:00
Mateusz Kwasniewski
c6fd558da4
feat: show outdated sdks banner (#6541) 2024-03-14 10:15:33 +01:00
Jaanus Sellin
8c87e27b8a
feat: enable frontend cache for everyone (#6546) 2024-03-14 10:55:49 +02:00
Nuno Góis
bc6a96cf6b
chore: suggest nested properties in action filters (#6533)
https://linear.app/unleash/issue/2-2029/support-filtering-on-nested-properties

Suggests nested properties in action filters. Also sorts them
alphabetically.

Follow up to https://github.com/Unleash/unleash/pull/6531

<img width="381" alt="image"
src="https://github.com/Unleash/unleash/assets/14320932/4e2c900d-335b-4360-8be4-186f3887e42b">
2024-03-13 16:07:01 +00:00
Mateusz Kwasniewski
9438400e77
feat: outdated sdks api (#6539) 2024-03-13 15:56:22 +01:00
Jaanus Sellin
3c22a302c7
fix: fix frontend api timings (#6536)
Just a typo
2024-03-13 15:10:48 +02:00
Jaanus Sellin
c4412d8276
fix: measure frontend times only when flag enabled (#6535)
Moving to controller level to measure only for flag. Other option would
have been to check flag also at service.
2024-03-13 14:28:59 +02:00
Nuno Góis
422af36d2d
chore: flatten payload util (#6531)
https://linear.app/unleash/issue/2-2029/support-filtering-on-nested-properties

This will allow us to support and suggest payload subproperties in the
action filters.
2024-03-13 11:10:44 +00:00
Jaanus Sellin
570af43615
feat: share context between both frontend apis (#6529)
We are sharing contexts because we want both clients to use same session
ID.
2024-03-13 11:17:40 +02:00
Jaanus Sellin
259fde09db
feat: add possibility to see differences for frontend API (#6528) 2024-03-13 09:41:48 +02:00
Gastón Fournier
16507a971b
chore: re-add max listeners (#6522)
## About the changes
Some tests are reporting this error:

`MaxListenersExceededWarning: Possible EventEmitter memory leak
detected. 11 UPDATE_REVISION listeners added to
[ConfigurationRevisionService]. Use emitter.setMaxListeners() to
increase limit`

I thought it's because of this change
https://github.com/Unleash/unleash/pull/6400#discussion_r1511494201 but
it was not.

I've managed to get a trace of the issue following this
https://stackoverflow.com/q/62897235/239613 and now we can identify
`ConfigurationRevisionService` as one explanation. The reason is that
it's a singleton that should be cleaned up after tests.

E.g.:
https://github.com/Unleash/unleash/actions/runs/8248332132/job/22558419656?pr=6517#step:8:15
2024-03-12 16:34:55 +01:00
Mateusz Kwasniewski
6278cdb6c7
feat: better logging for old and new frontend api differences (#6524) 2024-03-12 16:22:16 +01:00
Fredrik Strand Oseberg
bfbd18eb97
fix: allow deletion of segments referencing strategies in archived f… (#6406)
Subset of #6392, allowing you to delete segments that are referenced in
strategies on archived features.
2024-03-12 15:03:53 +01:00
Jaanus Sellin
a08bada1de
feat: do not return disabled features to FE api (#6520) 2024-03-12 14:41:25 +02:00
Christopher Kolstad
ca329da4b4
fix: scim id was not unique (#6450)
This PR drops the previous PRs scim_id idx and replaces it with an
actual UNIQUE index
2024-03-12 13:36:21 +01:00
Jaanus Sellin
2a57acca41
feat: start monitoring total time to update cache (#6517) 2024-03-12 14:27:04 +02:00
Mateusz Kwasniewski
1d526e707b
test: compare frontend api implementations (#6515) 2024-03-12 12:22:27 +01:00
Jaanus Sellin
b7915171ff
feat: start tracking operation duration (#6514) 2024-03-12 12:30:30 +02:00
Christopher Kolstad
55da9b8133
fix: admin token requests does not automatically have id (#6501)
To check that users do indeed have permissions to update the roles from
project-service, we've been depending on req.user.id.
We had one error on Friday March 8th, where we managed to send
undefined/null to a method that requires a number. This PR assumes that
if we have an API token, and we have admin permissions and userId is not
set we're a legacy admin token.

It uses the util method for extractUserId(req: IAuthRequest | IApiRequest), so if we've passed through the apiTokenMiddleware first, we'll have userId -42, if we haven't, we'll get -1337.
2024-03-12 10:39:37 +01:00
Mateusz Kwasniewski
bc83a4d66e
refactor: rename proxy to frontend api in openapi schemas (#6511) 2024-03-12 10:15:24 +01:00
Mateusz Kwasniewski
1f374ea20e
refactor: rename proxy to frontend api (#6502) 2024-03-11 17:30:46 +01:00
Gastón Fournier
977b0e4e28
chore: rename parametric types to make them clearer (#6500)
## About the changes
Just renaming to bring more clarity based on
https://github.com/Unleash/unleash/pull/6436#discussion_r1517334796
2024-03-11 15:41:34 +01:00
Mateusz Kwasniewski
160eec18a0
feat: compare old and new proxy results (#6497) 2024-03-11 14:00:18 +01:00
Jaanus Sellin
a544a8a4ad
feat: count frontend api requests (#6495)
Now frontend API requests will be counted separately under
getAllByfrontend. We are already tracking new FE db calls, so we can
build grafana dashboard.
2024-03-11 14:54:14 +02:00
Jaanus Sellin
184e0e5190
feat: add returnGlobalFrontendApiCache flag (#6494) 2024-03-11 14:27:17 +02:00
Mateusz Kwasniewski
eae373f386
fix: Configuration revision service singleton (#6493) 2024-03-11 13:22:52 +01:00
Mateusz Kwasniewski
c841e72244
fix: revert composition root (#6492) 2024-03-11 13:09:13 +01:00
Jaanus Sellin
0cf7b324a5
feat: frontend api clean up not needed columns (#6489)
1. Clean up not used fields
2. Fix a bug where segment was not attached
2024-03-11 13:41:41 +02:00
Jaanus Sellin
2997faecf6
refactor: remove client from frontend api (#6490)
There was extra call getClient().getAll() not needed and complicating
readability.
2024-03-11 13:30:32 +02:00
Mateusz Kwasniewski
17ea8b3734
feat: compare feture definitions not evaluations (#6486) 2024-03-11 12:05:17 +01:00
Mateusz Kwasniewski
48fa39c9fc
feat: Compositon root for proxy service (#6488) 2024-03-11 11:22:04 +01:00
Mateusz Kwasniewski
2a3959082c
refactor: proxy/frontend api in feature oriented architecture (#6487) 2024-03-11 09:28:40 +01:00
Nuno Góis
7d827442ee
fix: add actions validation (#6481)
https://linear.app/unleash/issue/2-2022/improve-actions-validation

Improves our current actions form validation. 

Empty actions are now ignored on the payload and we get errors in
actions where any of the required fields are empty.

Also refactored our current actions into a constant map that can be
shared across frontend and backend.
2024-03-11 08:18:36 +00:00
Gastón Fournier
da41d3dbcf
chore: automate openapi schema list (#6463)
## About the changes
This PR automates the generation of exported open api schemas on
pre-commit, removing some manual steps and also standardizing the
process. The schema list definition now looks way simpler:

b6f3877296/src/lib/openapi/index.ts (L37-L49)

Also added
2817e66b29/src/lib/openapi/spec/index.ts (L1-L4)
for devs
2024-03-08 14:58:22 +01:00
Jaanus Sellin
381af7835b
feat: sort frontend api features by name (#6479) 2024-03-08 15:34:33 +02:00
Jaanus Sellin
2e6d91846b
feat: make frontend api complexity O(n) instead of O(n2) (#6477) 2024-03-08 14:00:38 +01:00
David Leek
6f2bd546a6
fix: await trafficDataUsageStore.deleteAll where its being used (#6478)
## About the changes

trafficDataUsageStore.deleteAll() wasn't being awaited in tests, leading
to flaky tests. This PR ensures it's being awaited
2024-03-08 13:34:46 +01:00
Mateusz Kwasniewski
8f105f9d30
feat: Compare old results with new frontend api (#6476) 2024-03-08 13:03:41 +01:00
Gastón Fournier
1949d0134f
fix: mapper function should be partial (#6475)
Small fix to make mapper function partial as it should be
2024-03-08 11:20:41 +01:00
Gastón Fournier
82f4093c04
feat: adapted CRUD store from enterprise into OSS (#6474)
## About the changes
This ports the CRUD store into OSS which is an abstraction to reduce the
amount of boilerplate code we have to write in stores.

By extending CRUDStore, the store becomes simply the type definition:
```typescript
 type ActionModel = { 
     actionSetId: number; 
     action: string; 
     executionParams: Record<string, unknown>; 
     createdByUserId: number; 
     sortOrder: number; 
 }; 
  
 export class ActionStore extends CRUDStore< 
     ActionModel & { id: number; createdAt: Date }, 
     ActionModel 
 > { 
}
```

And eventually specific mappings between those types can be provided (if
the mapping is more complex than camelCase -> snake_case):
```typescript
 toRow: ({ project, name, actor, match, createdByUserId }) => ({ 
     created_by_user_id: createdByUserId, 
     project, 
     name, 
     actor_id: actor, 
     source: match.source, 
     source_id: match.sourceId, 
     payload: match.payload, 
 }), 
 fromRow: ({ 
     id, 
     created_at, 
     created_by_user_id, 
     project, 
     name, 
     actor_id, 
     source, 
     source_id, 
     payload, 
 }) => ({ 
     id, 
     createdAt: created_at, 
     createdByUserId: created_by_user_id, 
     project, 
     name, 
     actor: actor_id, 
     match: { 
         source, 
         sourceId: source_id, 
         payload, 
     }, 
 }), 
```
Stores can also be extended to include additional functionality in case
you need to join with another table or do an aggregation, but it
significantly reduces the amount of boilerplate code needed to create a
basic store
2024-03-08 10:39:29 +01:00
Mateusz Kwasniewski
8f2631e418
feat: stabilize global frontend api cache (#6466) 2024-03-08 08:41:22 +01:00
Jaanus Sellin
7b402ad6b3
feat: create global repository for frontend repositories (#6460)
Co-authored-by: kwasniew <kwasniewski.mateusz@gmail.com>
2024-03-07 16:48:52 +02:00
Gastón Fournier
5b87ca6b75
chore: consider execution limits per minute and actions limit per (#6462)
## About the changes
Define a schema that works both for the frontend and the backend to
define soft limits in the resource usage.
2024-03-07 13:02:49 +01:00
Ivar Conradi Østhus
9cb116af39
fix: only release migration lock if acquired (#6454)
We should not try to release the migration lock if where unable to
acquire it. By trying to close it when we have not successfully
connected to the database we end up hanging for a while before the
process is eventually killed.

I did not add a better error-message, as Unleash now gives a better
error stack and crashes immediate if you start without a database
password. We should still consider if you need to specify db credentials
or not. Technically it is possible to have a postgres without a password
(but it is likely not common).



Closes: #6408
2024-03-07 11:58:05 +01:00
Gastón Fournier
2cd80d31f8
chore: remove compiler warnings from create-config (#6459)
## About the changes
Some changes to fix compiler errors in create-config
2024-03-07 11:44:59 +01:00
Gastón Fournier
feb6825023
chore: add a generic error for limit's exeeded (#6452)
## About the changes
We don't have a meaningful error for limits established by the
application. This could be a good starting point.

The error code is 400 cause I couldn't find anything better. 

The name of the error was picked from UnleashApiErrorTypes:
2d8e9f87ff/src/lib/error/unleash-error.ts (L4-L34)
2024-03-06 19:17:31 +01:00
Ivar Conradi Østhus
2185742b1d
fix: clone feature toggle should not copy createdAt (#6442)
This is a small fix to avoid that cloning a feature toggle also clones
the "createdAt" field, which does not make sense.

fixes: #6426
2024-03-06 09:03:50 +01:00
Jaanus Sellin
ae38b81af1
chore: remove archived column from features table (#6431)
This column has not been used for 1.5 years and was replace by
**archived_at** column and people still get confused of why this is not
working as name suggests. Removing this column to remove technical debt.
2024-03-05 22:28:47 +02:00