314 Commits

Author SHA1 Message Date
sighphyre 5a82d9be87 fix: Update updateUser code to reject empty emails (#1210)
* fix: Update updateUser code to reject empty emails

This fixes an issue where the updateUser call would allow null email
addresses, then update the email to null and then raise an exception,
leaving the db in a state where no user could be resolved.

* fix: remove username/email requirement in user.ts

Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2022-01-03 20:14:56 +01:00
Ivar Conradi Østhus 8d8d48026d fix: adjust feature-variant-updated event 2021-12-17 04:30:39 +01:00
Christopher Kolstad 994db02f84 fix: Adds feature-variant-updated event. (#1189)
This triggers when we update or overwrite variants, and will include the
previous variants and the new variants.

Co-authored-by: Ivar Østhus <ivarconr@gmail.com>
2021-12-16 11:07:19 +01:00
Christopher Kolstad 791384ddb1 Fix/variants ordering (#1187)
* fix: sort variants on output

We found that for existing variants, the sorting by name wasn't applied, so the index in the patches were wrong. This PR adds the sort also when we're getting variants as part of the getFeature call, not just when we're getting the variants. This should make the UX consistent, and prevent our patches from hitting the wrong index in the variants array.

Co-authored-by: Youssef Khedher <khedher.youssef@hotmail.fr>
2021-12-15 14:20:32 +01:00
Ivar Conradi Østhus 08bff6359c fix: uintroduce call to update last_seen on client-instance 2021-12-10 09:31:54 +01:00
Ivar Conradi Østhus 573385a630 fix: drop client_metrics table 2021-12-10 09:31:54 +01:00
Ivar Conradi Østhus bf1223e07d fix: rename services 2021-12-10 09:31:54 +01:00
Ivar Conradi Østhus cf70da71c9 fix: lint 2021-12-10 09:31:54 +01:00
Ivar Conradi Østhus bb4e6290d5 fix: move toggle-counters to metrics service 2021-12-10 09:31:54 +01:00
Ivar Conradi Østhus 9f13b801eb fix: rename metrics-service to client-instance service 2021-12-10 09:31:54 +01:00
Ivar Conradi Østhus 4a9939ccb1 feat: remove old metrics service 2021-12-10 09:31:54 +01:00
Youssef Khedher 7ec9672a5c Merge pull request #1145 from Unleash/feat/update-health-report
feat: update health report
2021-12-06 15:39:45 +01:00
Fredrik Strand Oseberg 98d64fc1e4 fix: open validate endpoint (#1162)
* fix: open validate endpoint

* fix: set validate permission to none
2021-12-06 15:19:25 +01:00
Ivar Conradi Østhus 3c550f157a fix: always require permission for POST, PATCH, PUT, DELETE (#1152) 2021-12-03 12:46:50 +01:00
Ivar Conradi Østhus 784ddf8fb3 fix: cleanup old user permissions (#1150) 2021-12-01 22:10:09 +01:00
Youssef 5e6e7e1aac adding tests 2021-12-01 10:41:41 +01:00
Youssef 26c9bfa3c8 fix: add timestamp on project creation for update_at column 2021-12-01 09:59:34 +01:00
Youssef 00f5740d18 fix: rename last_update to updated_at 2021-11-30 15:25:52 +01:00
Youssef c3273ce1ab fix: remove lastUpdate from fieldToRow 2021-11-30 15:14:50 +01:00
Youssef 71c6b05bc4 fix: remove unused dep 2021-11-30 14:53:31 +01:00
Youssef 10c1b56e38 add lastupdate to health report 2021-11-30 14:05:44 +01:00
Youssef 991a4a8634 add last-update migration to projects table 2021-11-30 10:40:58 +01:00
Ivar Conradi Østhus eb8265922d Fix/enable standard environments (#1134) 2021-11-26 15:31:36 +01:00
Christopher Kolstad 5829ec7b3d task: Sort variants by name (#1132) 2021-11-26 13:06:36 +01:00
Christopher Kolstad 5cdb3f665a task: Ban changes to variants through feature (#1130)
* task: Ban changes to variants through feature

After adding the new `/variants` endpoint for features we now have a way
to access control adding/modifying variants, so the /:featureName
endpoint should no longer allow editing/adding variants.

This removes variants as a known field from the featureMetadata schema
and tells joi to stripUnknown, thus making sure we never include
variants in the initial creation or future update calls.

For the old features v1 API we allow it to declare that it has already
validated the data coming with its own schema, so we should use the data
we get from it. Thus keeping the old v1 functionality intact

Co-authored-by: Simon Hornby <simon@getunleash.ai>
2021-11-25 14:53:58 +01:00
Ivar Conradi Østhus b47b507e18 fix: metrics v2 should await for the clearer (#1114) 2021-11-25 14:18:35 +01:00
Christopher Kolstad c9ff3972e2 fix: Stop healthrating from including archived (#1128)
- Since the archived toggles are not visible in the health dashboard,
  including them in the health rating calculation makes for some really
  confusing dashboards. This PR makes sure we only include non-archived
  toggles when calculating health.
2021-11-25 10:09:23 +01:00
Christopher Kolstad 72092e4a1c fix: make new variant api validate name uniqueness (#1126) 2021-11-24 14:22:28 +01:00
Christopher Kolstad 6c6001619c Feat/variant api (#1119)
Add a new .../:feature/variants API

This adds
- `GET /api/admin/projects/:projectId/features/:featureName/variants` which returns 
```json
{ version: '1', variants: IVariant[] }
```
- `PATCH /api/admin/projects/:projectId/features/:featureName/variants` which accepts a json patch set and updates the feature's variants field and then returns 
```json
{ version: '1', variants: IVariant[] }
```
- `PUT /api/admin/projects/:projectId/features/:featureName/variants`
 which accepts a IVariant[] and overwrites the current variants list for the feature defined in :featureName and returns
```json
{ version: '1', variants: IVariant[] }

- This also makes sure the total weight of all variants is == 1000
- Validates that there is at least 1 'variable' variant if there are variants
- Validates that 'fix' variants total weight can't exceed 1000
- Adds tests for all these invariants.


Co-authored-by: Simon Hornby <simon@getunleash.ai>
2021-11-24 13:08:04 +01:00
Fredrik Strand Oseberg c369b77b24 Merge branch 'master' into feat/splash 2021-11-12 13:19:36 +01:00
Youssef 2d03b8c61e fix: return be object instead of array 2021-11-12 13:19:06 +01:00
Ivar Conradi Østhus d8478dd928 feat: clean up events (#1089)
Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
2021-11-12 13:15:51 +01:00
Youssef 16429fcf9a fix: add cascade query inside create table for splash 2021-11-12 13:01:56 +01:00
Youssef 0199d1f211 fix: remove req.body from the splash object when update 2021-11-12 12:44:33 +01:00
Youssef Khedher 314c60393f Merge branch 'master' into feat/splash 2021-11-12 11:30:08 +01:00
Youssef e0356eff6d fix: update e2e test for splash 2021-11-12 11:18:09 +01:00
Youssef fc275a6183 fix: update sql query in add-splash-entry 2021-11-12 11:02:12 +01:00
Youssef c4e56aae09 fix: remove record splash and update sql query in add-splash-entry 2021-11-12 10:49:09 +01:00
Martin Lehmann 064599c942 fix: refactor client-metrics list and ttl-list to TypeScript (#1080)
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2021-11-11 20:29:40 +01:00
Ivar Conradi Østhus f0895cf653 fix: prevent deadlock for batchinserting usage metrics (#1100)
* fix: prevent deadlock for batchinserting usage metrics

In client metrics v2 we utilize postgres to count the usage
across a few dimentions (featureName, app_name, environment).

It turns out that if the UPDATE values are not executed in a predictable
order we can end up in a deadlock scenario with postgresql.

In this fix we thus sort the metrics on the feature_name, app_name and
envrionment, to make sure they always are executed in a predictabel
order, and thus avoiding independent inserts colliding in to a deadlock
waiting for eachother.

* fix: tests cannot assume order
2021-11-11 16:05:29 +01:00
Youssef cd38c5a01d add e2e splash test 2021-11-10 11:24:44 +01:00
Youssef db9722dccc add splash e2e + api tests 2021-11-10 11:24:01 +01:00
Youssef c4da3e89c5 fix: styling 2021-11-09 20:55:23 +01:00
Youssef 96f2514fc5 send splash data in the user object 2021-11-09 20:39:13 +01:00
Youssef cc516618a1 add splash-controller and cascade migration 2021-11-09 14:16:34 +01:00
Fredrik Oseberg d73293c576 fix: add migration 2021-11-09 11:52:02 +01:00
Youssef 875fb7734c create splash migration store and service file 2021-11-08 16:31:38 +01:00
Ivar Conradi Østhus 645a8bce05 fix: convert iso-strings from db to date object 2021-11-04 22:16:48 +01:00
Ivar Conradi Østhus 053956b45e fix/projectId cannot change for strategy configs (#1084) 2021-11-04 21:24:55 +01:00
Fredrik Strand Oseberg ec60f4485c fix: disable projects (#1085) 2021-11-04 21:09:52 +01:00