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

2544 Commits

Author SHA1 Message Date
Mateusz Kwasniewski
5662fe79f8
feat: emails sent table migration (#8528) 2024-10-25 09:53:52 +02:00
David Leek
fbd3f97ae0
chore: add migration for release plans (#8529) 2024-10-24 13:33:54 +02:00
gitar-bot[bot]
589d9f1af7
[Gitar] Cleaning up stale flag: displayTrafficDataUsage with value true (#8481) 2024-10-24 08:05:06 +02:00
Jaanus Sellin
9839b77008
feat: rework application overview db query (#8518)
Previously we were returning all instance names from database, but now
we count them in database.
2024-10-23 16:05:01 +03:00
gitar-bot[bot]
f2ee02ed9e
[Gitar] Cleaning up stale flag: collectTrafficDataUsage with value true (#8480) 2024-10-23 14:32:09 +02:00
Mateusz Kwasniewski
faaf54ca99
feat: email service for productivity report (#8517)
Co-authored-by: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com>
2024-10-23 11:53:43 +02:00
Melinda Fekete
8b0af59897
Update and restructure environments (#8496) 2024-10-22 17:55:11 +02:00
Mateusz Kwasniewski
1abc330a85
fix: enable nav sidebar for previous uis (#8508) 2024-10-22 15:31:25 +02:00
Gastón Fournier
15f55c7662
chore: Prometheus metrics refactor (#8484)
Migrate some prometheus metrics to use the new and sequential metric
updater
2024-10-22 15:11:57 +02:00
Mateusz Kwasniewski
d3294d58c2
chore: remove navigation sidebar leftover flag (#8504) 2024-10-22 10:08:27 +02:00
Tymoteusz Czech
2e970b0ff2
fix: don't allow . or .. in feature url (#8479)
We do some validation on flag names, but there's some cases that slip
through. These are some cases that we should handle better.

With `..` as a name, you can't go into the flag in Unleash and you can't
activate any environments because the it is interpreted as "go up a
level".
2024-10-21 16:35:17 +02:00
Mateusz Kwasniewski
a6c7a5fc90
feat: increase latest events in personal dashboard (#8491) 2024-10-21 12:30:50 +02:00
Gastón Fournier
a9f9be1efa
chore: add a class to handle aggreggation queries (#8446)
## About the changes
We have many aggregation queries that run on a schedule:
f63496d47f/src/lib/metrics.ts (L714-L719)

These staticCounters are usually doing db query aggregations that
traverse tables and we run all of them in parallel:
f63496d47f/src/lib/metrics.ts (L410-L412)

This can add strain to the db. This PR suggests a way of handling these
queries in a more structured way, allowing us to run them sequentially
(therefore spreading the load):
f02fe87835/src/lib/metrics-gauge.ts (L38-L40)

As an additional benefit, we get both the gauge definition and the
queries in a single place:
f02fe87835/src/lib/metrics.ts (L131-L141)

This PR only tackles 1 metric, and it only focuses on gauges to gather
initial feedback. The plan is to migrate these metrics and eventually
incorporate more types (e.g. counters)

---------

Co-authored-by: Nuno Góis <github@nunogois.com>
2024-10-18 11:11:22 +02:00
David Leek
d9646edcfc
feat: release plans nav menu item and icon suggestion (#8469) 2024-10-18 08:23:52 +02:00
Nuno Góis
3f8d4c3538
chore: update schemas related to Unleash AI chat (#8463)
https://linear.app/unleash/issue/2-2779/store-conversations-in-the-database

Updates schemas related to Unleash AI chat and renames the `chat` column
to `messages` to ensure everything aligns nicely.
2024-10-16 14:44:37 +01:00
Melinda Fekete
c580e762b3
Restructure features documentation (#8394) 2024-10-16 13:59:30 +02:00
David Leek
bb800e3537
fix: group and user has at least 1 project owner counter respects multirole project groups (#8453) 2024-10-16 12:47:00 +02:00
Nuno Góis
b9ea6641ff
chore: AI chats db migration (#8460)
https://linear.app/unleash/issue/2-2845/db-migration-ai-chats

Adds a new DB migration for creating a new `ai_chats` table, used on the
Unleash AI experiment.
2024-10-16 10:43:52 +01:00
gitar-bot[bot]
6d2b882eb8
[Gitar] Cleaning up stale flag: stripHeadersOnAPI with value true (#8457)
[![Gitar](https://raw.githubusercontent.com/gitarcode/.github/main/assets/gitar-banner.svg)](https://gitar.co)
  
  ---
This automated PR was generated by [Gitar](https://gitar.co). View
[docs](https://gitar.co/docs).

Co-authored-by: Gitar <noreply@gitar.co>
2024-10-16 09:30:32 +02:00
David Leek
2cac903068
chore: releasePlans feature flag (#8458)
Adds the releasePlans feature flag
2024-10-16 09:00:58 +02:00
Gastón Fournier
7fb9308b3e
feat: ability to configure when users are considered inactive (#8454)
Give the ability to change when users are considered inactive via an
environment variable `USER_INACTIVITY_THRESHOLD_IN_DAYS` or
configuration option: `userInactivityThresholdInDays`. Default remains
180 days
2024-10-15 16:34:04 +02:00
Gastón Fournier
07469a427c
fix: same site api call with session cookie (#8435)
## About the changes
This fixes #8029. How to reproduce the issue is in the ticket.

The issue happens because when a web app is hosted in the same domain as
Unleash UI and the web app uses unleash SDK to make requests to Unleash,
the browser automatically includes the cookie in the request headers,
because:

- The request URL matches the cookie's Path attribute (which it does in
this case).
- The request is sent to the same domain (which it is, since both apps
are under the same domain).

And this is by design in the HTTP cookie specification:
https://datatracker.ietf.org/doc/html/rfc6265

This PR avoids overriding the API user with the session user if there's
already an API user in the request. It's an alternative to
https://github.com/Unleash/unleash/pull/8434

Closes #8029
2024-10-15 13:16:16 +02:00
Gastón Fournier
e22f6a04ba
chore: wrapTimer function types (#8428)
This gives us better types for our wrapTimer function.

Maybe the type `(args: any) => any` could also be improved

---------

Co-authored-by: Nuno Góis <nuno@getunleash.io>
2024-10-15 11:18:22 +02:00
Jaanus Sellin
39fb1b5db5
fix: archived flags without metrics do not count towards onboarding (#8443) 2024-10-14 14:09:57 +03:00
Jaanus Sellin
735e6f0b23
feat: now you can add env type to env order (#8442) 2024-10-14 13:26:38 +03:00
gitar-bot[bot]
d8ddb57818
chore: improve addon metrics usage 2024-10-14 09:20:27 +02:00
Jaanus Sellin
e72aa2871e
feat: order environment plausible events (#8427) 2024-10-11 11:05:33 +03:00
David Leek
24b9e4987b
chore:origin middleware flag cleanup (#8402) 2024-10-10 14:26:35 +02:00
Jaanus Sellin
3427fd745c
chore: debug lifecycle only when have new stages (#8418) 2024-10-10 14:28:11 +03:00
David Leek
b1cdde0c6b
chore: flag for webhook domain logging (#8413) 2024-10-10 13:23:52 +02:00
Nuno Góis
f78ce12860
chore: add unleashAI chat schemas (#8405)
https://linear.app/unleash/issue/2-2788/add-unleash-ai-chat-openapi-schemas

Adds OpenAPI schemas for the Unleash AI chat and respective messages.
2024-10-10 09:43:28 +01:00
Nuno Góis
d00873c357
chore: add OpenAI API key configuration (#8400)
https://linear.app/unleash/issue/2-2787/add-openai-api-key-to-our-configuration

Adds the OpenAI API key to our configuration and exposes a new
`unleashAIAvailable` boolean in our UI config to let our frontend know
that we have configured this. This can be used together with our flag to
decide whether we should enable our experiment for our users.
2024-10-10 09:43:14 +01:00
Jaanus Sellin
3a2206d228
feat: order environments service implementation (#8415)
This can be consumed in enterprise repo.
2024-10-10 11:33:21 +03:00
Nuno Góis
d032a91494
chore: add unleashAI feature flag (#8399)
https://linear.app/unleash/issue/2-2773/add-unleashai-feature-flag

Adds the `unleashAI` feature flag, the first step in the Unleash AI
experiment.
2024-10-09 14:10:58 +01:00
Jaanus Sellin
ca831f79e5
feat: order additional environments email templates (#8401)
Most of the HTML/styles retaken from existing templates.


![image](https://github.com/user-attachments/assets/5244c8d2-fe80-474a-9e65-a0f5ae4d44c2)
2024-10-09 15:15:27 +03:00
Thomas Heartman
f23ba70bb4
feat: add timestamps to project events (#8389)
This PR adds timestamps to project events and displays them in the
"latest events" box in the project details view.

It also changes the font weight of events to be only normal.


![image](https://github.com/user-attachments/assets/69ee4052-fe96-4fc9-ae45-0818acb0570a)
2024-10-09 09:32:58 +02:00
Gastón Fournier
cf5e492dab
chore: add timers to count queries (#8393)
## About the changes
These might be some heavy queries, adding timers to them to validate
that assumption and get some insights
2024-10-08 15:41:00 +02:00
Jaanus Sellin
8f4454039a
feat: start capturing onboarded status also from register endpoint (#8386)
1. Remove all customer intervals
2. Start capturing onboarded status also from register endpoint
2024-10-08 12:40:33 +03:00
Jaanus Sellin
93883b3767
chore: update debugging lifecycle format (#8371) 2024-10-07 14:54:53 +03:00
Christopher Kolstad
942555b993
fix: use ip-address for remote-strategy (#8380)
Removed direct dependency on ip in favor of maintained `ip-address`.

Copied from unleash-client-node.
2024-10-07 13:51:03 +02:00
Thomas Heartman
2905b560bd
fix: no owners listed in personal dashboard for default project (#8373)
This PR fixes a bug where the default project would have no listed
owners. The issue was that the default project has no user owners by
default, so we didn't get a result back when looking for user owners.
Now we check whether we have any owners for that project, and if we
don't, then we return the system user as an owner instead.

This also fixes an issue for the default project where you have no roles
(because by default, you don't) by updating the schema to allow an empty
list.
2024-10-07 10:52:11 +02:00
Thomas Heartman
2ac9c701c3
fix: return 404 if the project doesn't exist (#8362)
This change adds a check for whether the project exists in the
database before trying to fetch data for it. If it doesn't exist,
you'll get a 404.
2024-10-04 15:43:02 +02:00
Jaanus Sellin
1875c9b6d1
feat: add flag to purchase additional environments (#8366) 2024-10-04 15:07:14 +03:00
Thomas Heartman
89b619deba
openapi: small adjustments to dashboard schemas (#8363)
This PR contains a number of small updates to the dashboard schemas,
including rewording descriptions, changing numbers to integers, setting
minimum values.
2024-10-04 12:52:14 +02:00
Jaanus Sellin
e8e005daa4
feat: archived features will be included in onboarding (#8350)
Now when you are finished onboarding and you archive feature, you will
not restart onboarding.
2024-10-03 13:01:45 +03:00
Mateusz Kwasniewski
10dffcd232
feat: health score components in personal dashboard (#8348) 2024-10-03 10:21:27 +02:00
Jaanus Sellin
9a64dfbfbe
feat: add logging for lifecycle prom metrics (#8341) 2024-10-02 15:49:15 +03:00
Gastón Fournier
6aef7ba84c
chore: remove unused flag (#8340)
Code affected by this flag was removed long time ago
2024-10-02 14:46:14 +02:00
Thomas Heartman
aa28b78c30
chore: remove the projects? Property from ICreateGroupModel (#8246)
This property does not seem to be used anywhere, so we can remove it.

Can't find any references in code here or in enterprise. Let's try it
and see if it breaks.
2024-10-02 11:04:44 +02:00
Thomas Heartman
5f7e21f1e7
chore: test that owners and roles are returned (#8319)
Test that owners and roles are returned in the personal dashboard
project details response as expected.
2024-10-02 07:50:38 +00:00
Thomas Heartman
4c4b4aa922
refactor: use promise.all instead of sequential awaited calls (#8316)
This PR follows up on a comment made in
https://github.com/Unleash/unleash/pull/8314 and groups sequential
awaited calls into a single Promise.all instead.
2024-10-02 07:49:53 +00:00
Mateusz Kwasniewski
f47ae12263
feat: personal dashboard project avg health scores (#8328) 2024-10-02 09:33:50 +02:00
Fredrik Strand Oseberg
4d97f59e62
fix: add missing awaits on events (#8320)
This PR adds missing awaits on the call to eventStore which were
revealed to be fire and forget when we added transactional support for
these methods.
2024-10-01 14:34:25 +02:00
Fredrik Strand Oseberg
ab81528536
feat: add transactional support for access service (#8311)
Continuing splitting #8271 into smaller pieces. This PR adds
transactional support for access service.
2024-10-01 11:56:26 +02:00
Thomas Heartman
96d8dc353a
feat: return project roles (#8314)
This PR updates the personal dashboard project endpoint to return owners
and roles. It also adds the impl for getting roles (via the access
store).

I'm filtering the roles for a project to only include project roles for
now, but we might wanna change this later.

Tests and UI update will follow.
2024-10-01 09:13:59 +00:00
Thomas Heartman
050e53e564
feat: return project owners (#8312)
This PR is part 1 of returning project owners and your project roles for
the personal dashboard single-project endpoint.

It moves the responsibility of adding owners and roles to the project to
the service from the controller and adds a new method to the project
owners read model to take care of it.

I'll add roles and tests in follow-up PRs.
2024-10-01 08:18:42 +00:00
Fredrik Strand Oseberg
dcb0228105
fix: handle empty strings on permissions gracefully in access service (#8306)
Splitting #8271 into smaller pieces. This first PR will focus on making
access service handle empty string inputs gracefully and converting them
to null before inserting them into the database.
2024-10-01 09:03:46 +02:00
Mateusz Kwasniewski
b037bfb71c
feat: include favorite projects in personal dashboard (#8309) 2024-09-30 16:48:58 +02:00
Thomas Heartman
50c5af8632
feat: hook up admin / owner data to UI (#8300)
This PR hooks up the owners and admins of Unleash to the UI. They'll
only be visible in cases where you have no projects.

In addition, it adds Orval schemas for the new payload properties and
updates the generating schemas to fix some minor typing issues.
2024-09-30 13:40:33 +00:00
Thomas Heartman
e4cec6629d
test: test the dashboard admins property (#8303)
This PR adds tests for the new admins property of the personal dashboard
API payload.

It checks that only user admins are added and that their image URL is
not an empty string. In doing this, also fixes an issue where the image
URL wouldn't be generated correctly.

## Discussion points

Some of the test feels like it might be better testing on a deeper level
(i.e. the account store). However, from an initial glance, I think that
would require more setup and work, so I'm leaving it in the dashboard
test for now as that's where it's ultimately useful. But we can discuss
if we should move it.
2024-09-30 13:38:00 +00:00
Mateusz Kwasniewski
d7db80d948
feat: use onboarding status to conditionally show badge and message (#8304) 2024-09-30 15:30:18 +02:00
Mateusz Kwasniewski
ac90c942db
feat: add onboarding status to personal dashboard api (#8302) 2024-09-30 14:25:56 +02:00
Ivar Conradi Østhus
01afe87302
fix: extend feature_toggle_update counter with details about action (#8202)
Ideally `feature_lifecycle_stage_entered{stage="archived"}` would allow
me to see how many flags are archived per week.
It seems like the numbers for this is a bit off, and wanted to extend
our current `feature_toggle_update` counter with action details.
2024-09-30 12:16:03 +00:00
Thomas Heartman
a4ea46dab6
feat: add Unleash admins to API payload (#8299)
Adds Unleash admins to the personal dashboard payload.

Uses the access store (and a new method) to fetch admins and maps it to
a new `MinimalUser` type. We already have a `User` class, but it
contains a lot of information we don't care about here, such as `isAPI`,
SCIM data etc.

In the UI, admins will be shown to users who are not part of any
projects. This is the default state for new viewer users, and can also
happen for editors if you archive the default project, for instance.

Tests in a follow-up PR
2024-09-30 11:01:30 +00:00
Mateusz Kwasniewski
751c2fa902
feat: last project events ui polishing (#8298) 2024-09-30 11:18:25 +02:00
Thomas Heartman
6188079122
feat: add project owners to personal dashboard (#8293)
This PR adds all user-type owners of projects that you have access to to
the personal dashboard payload. It adds the new `projectOwners` property
regardless of whether you have access to any projects or not because it
required less code and fewer conditionals, but we can do the filtering
if we want to.

To add the owners, it uses the private project checker to get accessible
projects before passing those to the project owner read model, which has
a new method to fetch user owners for projects.
2024-09-30 10:49:34 +02:00
Mateusz Kwasniewski
f000579d5b
feat: adjust search query for personal project (#8296) 2024-09-27 15:23:00 +02:00
David Leek
530af3d7d6
fix: some integrations only counted errors not all results (#8295) 2024-09-27 14:57:26 +02:00
Mateusz Kwasniewski
147984f9d5
feat: display basic list of project events (#8291) 2024-09-27 14:02:30 +02:00
Nuno Góis
28edadd507
chore: fix search events endpoint description (#8289)
Scouting: I think this description was copy-pasted from the previous
endpoint and we forgot to update it.
2024-09-27 11:16:51 +00:00
Mateusz Kwasniewski
e540db4cb3
feat: return latest project events (#8287) 2024-09-27 12:47:21 +02:00
Mateusz Kwasniewski
829fda77fd
refactor: composition root for personal dashboard service (#8280) 2024-09-27 10:44:27 +02:00
Mateusz Kwasniewski
4107e84f43
feat: personal dashboard project details API stub (#8282) 2024-09-26 15:51:51 +02:00
Thomas Heartman
5a874df915
fix: trim role names before validation (#8277)
This trims role names before validation and subsequent validation.
This fixes a bug where you could have names that were empty or that
were duplicates of other names, but with leading or trailing
spaces. (They display the same in the UI).

This does not modify how we handle descriptions in the API. While the
UI form requires you to enter a description, the API does not. As
such, we can't make that required now without it being a breaking
change.
2024-09-26 11:52:51 +00:00
Mateusz Kwasniewski
137b8ee260
feat: project details for personal dashboard (#8274) 2024-09-26 13:43:51 +02:00
Thomas Heartman
a7e0743d88
chore: remove manual anonymization of outgoing project owners (#8252)
This change removes the flag used to anonymize project owners on the
way out. It was an issue in demo when we'd forgotten to configure the
email encryption. However, this issue has been resolved and we can
remove this check now.
2024-09-26 11:29:18 +02:00
Mateusz Kwasniewski
ceb21fbe51
feat: get projects by ids (#8269) 2024-09-26 11:27:59 +02:00
Thomas Heartman
cf476f9e7d
chore: update orval for personal dashboards (#8268)
Updates orval for personal dashboards
2024-09-26 11:03:55 +02:00
Mateusz Kwasniewski
823f6330b7
refactor: move getProjectsByUser to read model (#8262) 2024-09-26 09:45:02 +02:00
Thomas Heartman
44bf6615a3
feat: add project owners to personal dashboard project payload (#8248)
This PR adds project owner information to the personal dashboard's
project payload.

To do so, it uses the existing project owners read model.

I've had to make a few changes to the project owners read model to
accomodate this:
- make the input type to `addOwners` more lenient. We only need the
project ids, so we can make that the only required property
- fall back to using email as the name if the user has no name or
username (such as if you sign up with the demo auth)
2024-09-25 11:32:33 +00:00
Thomas Heartman
289324fd02
feat: add group project roles to project roles (#8245)
This PR adds project roles you get from groups to the list of roles
listed for each project.
2024-09-25 10:29:05 +02:00
Thomas Heartman
4fe80ffc3f
feat: add your projects (with roles) to personal dashboard api (#8236)
This PR adds some of the necessary project data to the personal
dashboard API: project names and ids, and the roles that the user has in
each of these projects.

I have not added project owners yet, as that would increase the
complexity a bit and I'd rather focus on that in a separate PR.

I have also not added projects you are part of through a group, though I
have added a placeholder test for that. I will address this in a
follow-up.
2024-09-25 06:17:25 +00:00
Gastón Fournier
5ac32b3713
chore: send full message without trimming to the addon event (#8230)
Address
https://github.com/Unleash/unleash/pull/8219#discussion_r1772884465
2024-09-24 10:43:08 +01:00
Nuno Góis
72bdce98de
chore: feature event formatter md format style (#8222)
https://linear.app/unleash/issue/2-2697/implement-proper-markdown-bold-format-in-feature-event-formatter-md

This is a follow up to https://github.com/Unleash/unleash/pull/8205,
specifically [this
comment](https://github.com/Unleash/unleash/pull/8205#issuecomment-2368207656)
from @gastonfournier

Implements an easy way to switch between formatting styles in our event
formatter. This enhancement will allow us to generate fully
markdown-formatted event summaries when needed, while preserving the
simplistic markdown formatting currently supported by platforms like
Slack.

Also includes some slight scouting. See comments for details.
2024-09-24 10:25:12 +01:00
Gastón Fournier
7d916e9449
fix: trim messages longer than 3000 chars (#8219)
## About the changes
When trying to send messages longer than 3000 chars we get this error:
```
[ERROR]  web-api:WebClient:0 failed to match all allowed schemas [json-pointer:/blocks/0/text]
[ERROR]  web-api:WebClient:0 must be less than 3001 characters [json-pointer:/blocks/0/text/text]
[2024-09-23T10:10:15.676] [WARN] addon/slack-app - All (1) Slack client calls failed with the following errors: A platform error occurred: {"ok":false,"error":"invalid_blocks","errors":["failed to match all allowed schemas [json-pointer:/blocks/0/text]","must be less than 3001 characters [json-pointer:/blocks/0/text/text]"],"response_metadata":{"messages":["[ERROR] failed to match all allowed schemas [json-pointer:/blocks/0/text]","[ERROR] must be less than 3001 characters [json-pointer:/blocks/0/text/text]"],"scopes":["incoming-webhook","users:read","channels:read","groups:read","mpim:read","im:read","users:read.email","chat:write"],"acceptedScopes":["chat:write"]}}
```

This PR trims the text length to 3000 chars.

We also upgrade slack API due to some security fixes:
https://github.com/slackapi/node-slack-sdk/releases/tag/%40slack%2Fweb-api%407.3.4

After checking the migration guide to v7 it seems that none of the
breaking changes affect us:
https://github.com/slackapi/node-slack-sdk/wiki/Migration-Guide-for-web%E2%80%90api-v7

## Testing
I did manual test this integration and the fix. The way to reproduce is
adding a very long strategy name and sending that as an update on Slack:

![image](https://github.com/user-attachments/assets/81df9554-f59b-4fa4-96c8-77dbf7a56257)

Now the event succeeds and we notice on the integration event log that
the message was trimmed:

![image](https://github.com/user-attachments/assets/79efc536-3dd3-4090-99f3-5fd4c7a88715)

---------

Co-authored-by: Nuno Góis <github@nunogois.com>
2024-09-24 10:06:10 +02:00
Nuno Góis
7a3a5ad33c
chore: event timeline tooltips (#8205)
https://linear.app/unleash/issue/2-2664/implement-event-tooltips

Implements event tooltips in the new event timeline.

This leverages our current `feature-event-formatter-md` to provide both
a label and a summary of the event. Whenever our new `eventTimeline`
flag is enabled, we enrich our events in our event search endpoint with
this information. We've discussed different options here and reached the
conclusion that this is the best path forward for now. This way we are
being consistent, DRY, relatively performant and it also gives us a
happy path forward if we decide to scope in the event log revamp, since
this data will already be present there.

We also added a new `label` property to each of our event types
currently in our event formatter. This way we can have a concise,
human-readable name for each event type, instead of exposing the
internal event type string.

~~We also fixed the way the event formatter handled bold text (as in,
**bold**). Before, it was wrapping them in *single asterisks*, but now
we're using **double asterisks**. We also abstracted this away into a
helper method aptly named `bold`. Of course, this change meant that a
bunch of snapshots and tests needed to be updated.~~

~~This new `bold` method also makes it super easy to revert this
decision if we choose to, for any reason. However I believe we should
stick with markdown formatting, since it is the most commonly supported
formatting syntax, so I see this as an important fix. It's also in the
name of the formatter (`md`). I also believe bold was the original
intent. If we want italic formatting we should implement it separately
at a later point.~~

Edit: It was _bold_ of me to assume this would work out of the box on
Slack. It does when you manually try it on the app, but not when using
the Slack client. See: https://github.com/Unleash/unleash/pull/8222


![image](https://github.com/user-attachments/assets/31eb6296-5d4b-4400-8db0-5eb7437dd2ff)


![image](https://github.com/user-attachments/assets/ac177415-78da-4c4b-864b-0c7a1668f6b5)
2024-09-24 08:45:08 +01:00
Mateusz Kwasniewski
fee2143edf
feat: Personal flags UI component (#8221) 2024-09-24 08:42:49 +02:00
Mateusz Kwasniewski
4f1c00122d
feat: personal dashboard api (#8218) 2024-09-23 15:47:19 +02:00
gitar-bot[bot]
338b5ce853
[Gitar] Cleaning up stale flag: useProjectReadModel with value true (#8211)
Co-authored-by: Gitar <noreply@gitar.co>
Co-authored-by: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com>
2024-09-23 13:20:42 +02:00
gitar-bot[bot]
5dd0fb9f44
[Gitar] Cleaning up stale flag: projectListImprovements with value true (#8212)
Co-authored-by: Gitar <noreply@gitar.co>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com>
2024-09-23 13:07:59 +02:00
gitar-bot[bot]
1296327c03
[Gitar] Cleaning up stale flag: archiveProjects with value true (#8201) 2024-09-23 11:51:55 +02:00
gitar-bot[bot]
bb32336408
[Gitar] Cleaning up stale flag: newEventSearch with value true (#8196)
[![Gitar](https://raw.githubusercontent.com/gitarcode/.github/main/assets/gitar-banner.svg)](https://gitar.co)
  
  ---
This automated PR was generated by [Gitar](https://gitar.co). View
[docs](https://gitar.co/docs).

---------

Co-authored-by: Gitar <noreply@gitar.co>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-20 14:48:33 +03:00
Christopher Kolstad
29b292f1ea
task: make count column bigint. (#8183)
We now have customers that exceed INT capacity, so we need to change
this to BIGINT in client_metrics_env_variants_daily as well.

Even heavy users only have about 10000 rows here, so should be a quick
enough operation.
2024-09-19 10:59:40 +02:00
Thomas Heartman
15a98fcaf4
fix: update playground SDK to increase the possible random numbers used for stickiness id (#8182)
Same fix as done in some other sdks, such as the node one at
https://github.com/Unleash/unleash-client-node/pull/417o

Fixes an issue where 1% rollout would not yield any results with
random rollout for certain group ids
2024-09-19 08:34:04 +00:00
Mateusz Kwasniewski
8e037a335f
feat: personal dashboard route (#8173) 2024-09-19 09:59:07 +02:00
Gastón Fournier
a48da821ef
fix: upgrade openapi to drop dompurify and fix path-to-regexp (#8170)
This new version [does not depend on
dompurify](https://github.com/Unleash/unleash/pull/8170/files#diff-51e4f558fae534656963876761c95b83b6ef5da5103c4adef6768219ed76c2deL3853-L3858)
which should fix
https://github.com/Unleash/unleash/security/dependabot/195

Tested the UI locally

![image](https://github.com/user-attachments/assets/af350bf1-d736-4a4a-a092-53da2d21c471)
2024-09-18 12:16:21 +02:00
Nuno Góis
85b67ae330
chore: add eventTimeline feature flag (#8159)
https://linear.app/unleash/issue/2-2658/create-eventtimeline-feature-flag

Adds a new `eventTimeline` feature flag for the new event timeline
feature.

I think `eventTimeline` is an appropriate name given the feature
description and the way it is evolving, but I'm open to suggestions.
~~This also assumes that this feature will target OSS.~~ Confirmed that
this will be a premium feature.
2024-09-18 08:55:50 +01:00
Fredrik Strand Oseberg
2406b10ca3
chore: remove debug logs (#8147)
We used these logs to debug an issue in sandbox regarding permissions.
They are no longer needed.
2024-09-17 09:06:29 +02:00
Fredrik Strand Oseberg
9c435a9ec6
chore: add stringified logs (#8134) 2024-09-11 09:33:13 +02:00
Fredrik Strand Oseberg
8a92dd0fd7
chore: add logging to new code path (#8133) 2024-09-11 08:31:31 +02:00
Fredrik Strand Oseberg
e1b7cfd8dd
Fix/project role permission grant (#8084)
## Background

In #6380 we fixed a privilege escalation bug that allowed members of a
project that had permission to add users to the project with roles that
had a higher permission set than themselves. The PR linked essentially
constricts you only be able to assign users to roles that you possess
yourself if you are not an Admin or Project owner.

This fix broke expectations for another customer who needed to have a
project owner without the DELETE_PROJECT permission. The fix above made
it so that their custom project owner role only was able to assign users
to the project with the role that they posessed.

## Fix

Instead of looking directly at which role the role granter has, this PR
addresses the issue by making the assessment based on the permission
sets of the user and the roles to be granted. If the granter has all the
permissions of the role being granted, the granter is permitted to
assign the role.

## Other considerations

The endpoint to get roles was changed in this PR. It previously only
retrieved the roles that the user had in the project. This no-longer
makes sense because the user should be able to see other project roles
than the one they themselves hold when assigning users to the project.

The drawback of returning all project roles is that there may be a
project role in the list that the user does not have access to assign,
because they do not hold all the permissions required of the role. This
was discussed internally and we decided that it's an acceptable
trade-off for now because the complexities of returning a role list
based on comparing permissions set is not trivial. We would have to
retrieve each project role with permissions from the database, and run
the same in-memory check against the users permission to determine which
roles to return from this endpoint. Instead we opted for returning all
project roles and display an error if you try to assign a role that you
do not have access to.

## Follow up
When this is merged, there's no longer need for the frontend logic that
filters out roles in the role assignment form. I deliberately left this
out of the scope for this PR because I couldn't wrap my head around
everything that was going on there and I thought it was better to pair
on this with @chriswk or @nunogois in order to make sure we get this
right as the logic for this filtering seemed quite complex and was
touching multiple different components.

---------

Co-authored-by: Fredrik Strand Oseberg <fredrikstrandoseberg@Fredrik-sin-MacBook-Pro.local>
2024-09-10 20:35:45 +02:00
Mateusz Kwasniewski
47753b90b2
fix: user projects should exclude archived ones (#8118) 2024-09-06 12:29:05 +02:00
Jaanus Sellin
b6e22d6178
feat: new onboarding welcome screen logic (#8110)
1. We will not show grid until 2 flags exist
2. Now new feature creation button will be always displayed on top with
different style
3. Moved some text around


![image](https://github.com/user-attachments/assets/6cfc2152-b52d-479c-8a2e-988c9e8b79ad)
2024-09-06 13:15:28 +03:00
Thomas Heartman
c1092bacf9
fix: give project_default_strategy_write the ability to update the default strategy (#8112)
This appears to have been an oversight in the original implementation
of this endpoint. This seems to be the primary point of this
permission. Additionally, the docs mention that this permission should
allow you to do just that.

Note: I've not added any tests for this, because we don't typically add
tests for it. If we have an example to follow, I'd be very happy to add
it, though
2024-09-06 11:49:11 +02:00
Nuno Góis
ec417bf15e
docs: remove mention of admin name and email env vars (#8096)
https://github.com/Unleash/unleash/pull/7795 mistakenly included a
mention that these environment variables can be used:

- `UNLEASH_DEFAULT_ADMIN_NAME`
- `UNLEASH_DEFAULT_ADMIN_EMAIL`

However that's not really the case, since we decided to remove their
respective implementation before merging that PR.
2024-09-05 09:27:54 +01:00
Nuno Góis
39538012ac
fix: use the correct env vars for initial admin account (#8095)
https://github.com/Unleash/unleash/pull/7795 mistakenly changed the
initial admin account environment variables to be:

 - `INITIAL_ADMIN_USER_USERNAME`
 - `INITIAL_ADMIN_USER_PASSWORD`

Instead of the previous:

 - `UNLEASH_DEFAULT_ADMIN_USERNAME`
 - `UNLEASH_DEFAULT_ADMIN_PASSWORD`

See:
https://github.com/Unleash/unleash/pull/7795/files?diff=unified&w=0#diff-a38cc7ae9f963264333b6535498970a33e046dba50a6af554f438343a6edd2ddR319-R334

This PR reverts them back to the correct environment variable names and
adds a test to prevent something similar from happening in the future.
2024-09-05 09:10:51 +01:00
Nuno Góis
7bfc8b23ee
fix: add request body schema in update segment endpoint (#8085)
https://linear.app/unleash/issue/2-2592/updateimprove-a-segment-via-api-call

Related to https://github.com/Unleash/unleash/issues/7987

This does not make the endpoint necessarily better - It's still a PUT
that acts as a PUT in some ways (expects specific required fields to be
present, resets the project to `null` if it's not included in the body)
and a PATCH in others (ignores most fields if they're not included in
the body). We need to have a more in-depth discussion about developing
long-term strategies for our API and respective OpenAPI spec.

However this at least includes the proper schema for the request body,
which is slightly better than before.
2024-09-05 08:17:04 +01:00
Mateusz Kwasniewski
d220aaec0f
fix: editor can add dependencies in default project (#8077) 2024-09-04 11:25:32 +02:00
Jaanus Sellin
9eb80a8d48
chore: clear onboarding events (#8062)
Clearing onboarding tables, because the data is invalid and we want to
start tracking all of this for only new customers.
This migration must be applied after the new logic is implemented.
2024-09-03 16:27:11 +03:00
Mateusz Kwasniewski
3d63089cb2
feat: ignore onboarding events for existing customers (#8064) 2024-09-03 15:24:33 +02:00
Jaanus Sellin
037651c35f
feat: start returning onboarding status with project overview (#8058)
To show/hide onboarding flow, we need to get extra info about onboarding
status. This PR adds it to project overview.
2024-09-03 14:41:47 +03:00
Mateusz Kwasniewski
b350bd11a7
fix: onboarding events corner cases (#8057) 2024-09-03 12:53:48 +02:00
Tymoteusz Czech
ea328e5b43
fix: prevent config resolver snapshot test (#8041)
Prevent test failing on a system with different environment variables.
Spreading `experimental` serves similar purpose.
2024-09-02 15:14:34 +02:00
Tymoteusz Czech
76ffdb2cd3
chore: update Frontend schema (#8037)
update types, fix frontend types issues in insights and archive
2024-09-02 14:41:17 +02:00
Jaanus Sellin
e4fcb252d1
feat: welcome to your project component (#8039)
Currently displaying always when flag enabled.


![image](https://github.com/user-attachments/assets/e4c48595-b2d9-4093-af98-360d5856e7d5)
2024-09-02 15:09:00 +03:00
Tymoteusz Czech
bd25bb633d
Feat: projects OpenAPI update (#8036)
Make OpenApi ready for new project read-model.
2024-09-02 13:45:23 +02:00
Mateusz Kwasniewski
1bc0f97101
feat: onboarding service composition root (#8035) 2024-09-02 11:39:47 +02:00
Christopher Kolstad
0f5e4dc96b
task: remove upgrade edge banner. (#8032)
All customers but one are now upgraded, and this banner no longer adds
value, we also have the outdated SDK banner, which can fill in if
needed.
2024-09-02 10:50:19 +02:00
Jaanus Sellin
2a6b2e98e0
feat: onboarding table to prometheus (#8034)
Instead of lifecycle table, we take the metrics directly from onboarding
tables.
2024-09-02 11:41:00 +03:00
Mateusz Kwasniewski
f27e07ab88
feat: onboarding store (#8027) 2024-09-02 08:53:23 +02:00
gitar-bot[bot]
b26fb8992d
[Gitar] Cleaning up stale flag: killInsightsUI with value false (#8002)
Co-authored-by: Gitar <noreply@gitar.co>
Co-authored-by: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com>
2024-08-30 12:32:51 +02:00
Mateusz Kwasniewski
2a35976081
feat: user loging event emitting with login order (#8021) 2024-08-30 11:28:19 +02:00
Jaanus Sellin
4079485338
feat: collect onboarding events in separate table (#8020) 2024-08-30 11:34:47 +03:00
Mateusz Kwasniewski
c5d6bdecac
feat: projects onboarding metrics (#8014) 2024-08-29 14:57:27 +02:00
gitar-bot[bot]
536f7320b2
[Gitar] Cleaning up stale flag: checkEdgeValidTokensFromCache with value true (#7853)
[![Gitar](https://raw.githubusercontent.com/gitarcode/.github/main/assets/gitar-banner.svg)](https://gitar.co)
  
  ---
This automated PR was generated by [Gitar](https://gitar.co). View
[docs](https://gitar.co/docs).

Co-authored-by: Gitar <noreply@gitar.co>
2024-08-29 12:27:33 +02:00
Jaanus Sellin
e61f016c8c
feat: start collecting prometheus metrics for onboarding events (#8012)
We start collecting prometheus metrics for onboarding events.

Co-authored-by: @kwasniew
2024-08-29 12:46:23 +03:00
Jaanus Sellin
5fe811ca3e
feat: start populating user first seen column (#8010)
Co-authored-by: kwasniew <kwasniewski.mateusz@gmail.com>
2024-08-29 10:45:30 +02:00
Jaanus Sellin
3188f991f4
feat: start tracking user first login migration (#8006)
Start tracking user first login.
2024-08-28 16:27:09 +03:00
gitar-bot[bot]
031a2e805a
[Gitar] Cleaning up stale flag: timeAgoRefactor with value true (#7997)
Co-authored-by: Gitar <noreply@gitar.co>
Co-authored-by: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com>
2024-08-28 11:12:27 +00:00
Jaanus Sellin
7ad686e14e
fix: change .inc calls to .increment (#8000)
We are observing incorrect data in Prometheus, which is consistently
non-reproducible. After a restart, the issue does not occur, but if the
pods run for an extended period, they seem to enter a strange state
where the counters become entangled and start sharing arbitrary values
that are added to the counters.

For example, the `feature_lifecycle_stage_entered` counter gets an
arbitrary value, such as 12, added when `inc()` is called. The
`exceedsLimitErrorCounter` shows the same behavior, and the code
implementation is identical.

We also tested some existing `increase()` counters, and they do not
suffer from this issue.

All calls to `counter.labels(labels).inc(`) will be replaced by
`counter.increment()` to try to mitigate the issue.
2024-08-28 12:50:36 +03:00
Jaanus Sellin
3d22f6e909
fix: support search for tags that has colon inside (#7998)
Previously we expected the tag to look like `type:value`. Now we allow
everything after first colon, as the value and not break query
`type:this:still:is:value`.
2024-08-28 11:33:51 +03:00
Tymoteusz Czech
427c43e123
fix: project last seen at metrics (#7988)
Read `last_seen_at` from correct table `last_seen_at_metrics`, instead
of deprecated `feature.last_seen_at`
2024-08-27 10:17:19 +00:00
Thomas Heartman
9af42b3565
fix: add migration to normalize api token types (#7974)
Adds a migration to normalize api token types already in the database,
to remove any weird casing issues as currently demonstrated on sandbox


![image](https://github.com/user-attachments/assets/ad14db22-114d-4de2-b952-722df9ae84a4)

This is a companion piece to #7972
2024-08-23 13:29:49 +02:00
Mateusz Kwasniewski
1f3cc3917e
fix: split features schema into archived and project features (#7973) 2024-08-23 12:59:39 +02:00
Thomas Heartman
4693f7c598
fix: normalize casing for API token types before insert (#7972)
Fixes a bug where if you had API keys using different casing for the
same type, they'd come out as different types in the API token count
map. To get around it, we normalize the keys to lowercase before
inserting them into the map, taking into account any previous values
that might have existed for that type.

Should fix issues like this:

![image](https://github.com/user-attachments/assets/1fe218ed-7729-4a06-9a10-f4c8c7831bf8)
2024-08-23 12:53:53 +02:00
gitar-bot[bot]
4615ff40ce
[Gitar] Cleaning up stale flag: resourceLimits with value true (#7964)
[![Gitar](https://raw.githubusercontent.com/gitarcode/.github/main/assets/gitar-banner.svg)](https://gitar.co)
  
  ---
This automated PR was generated by [Gitar](https://gitar.co). View
[docs](https://gitar.co/docs).

---------

Co-authored-by: Gitar <noreply@gitar.co>
Co-authored-by: Thomas Heartman <thomas@getunleash.io>
2024-08-22 13:20:53 +02:00
Thomas Heartman
b0541a0af2
feat: add remaining resource usage to instance stats (#7958)
Updates the instance stats endpoint with 
- maxEnvironmentStrategies
- maxConstraints
- maxConstraintValues

It adds the following rows to the front end table:
- segments (already in the payload, just not used for the table before)
- API tokens (separate rows for type, + one for total) (also existed
before, but wasn't listed)
- Highest number of strategies used for a single flag in a single
environment
- Highest number of constraints used on a single strategy
- Highest number of values used for a single constraint


![image](https://github.com/user-attachments/assets/57798f8e-c466-4590-820b-15afd3729243)
2024-08-22 13:09:26 +02:00
David Leek
00700918c8
chore: remove unused feature flag for webhooks name logging (#7968) 2024-08-22 12:39:52 +02:00
David Leek
e13f7eea63
feat: log domain every time a webhook is invoked (#7962) 2024-08-22 11:26:53 +02:00
Thomas Heartman
e5cca661d9
fix: serialize API token data correctly in instance stats (#7953)
Turns out we've been trying to return API token data in instance stats
for a while, but that the serialization has failed. Serializing a JS map
just yields an empty object.

This PR fixes that serialization and also adds API tokens to the
instance stats schema (it wasn't before, but we did return it). Adding
it to the schema is also part of making resource usage visible as part
of the soft limits project.
2024-08-22 10:29:05 +02:00
Jaanus Sellin
ead195923c
fix: fixing flaky test, because order for distinct may be random (#7954) 2024-08-21 15:42:23 +03:00
Jaanus Sellin
99e4a564d0
fix: fix events with no-project projects (#7951)
Fixes issue where `segment-created `events had fake project name
**no-project** attached.

In total for previous 4 months, all segments created that were global
segments, have this issue.


https://github.com/Unleash/unleash/pull/6872/files#diff-68dcd43b31d35a8a80c73bca1f2a9626b0234dd0b76920a6881b81fa04708268R135
2024-08-21 15:32:37 +03:00
gitar-bot[bot]
3a15fa7689
[Gitar] Cleaning up stale flag: integrationEvents with value true (#7940) 2024-08-21 14:25:24 +02:00
Mateusz Kwasniewski
48423fa980
fix: enable disabled strategies keeps settings (#7950) 2024-08-21 13:17:33 +02:00
Gastón Fournier
45de8ceae0
chore: type our path parameters when they are numbers (#4471)
Path types in our openapi are inferred as string (which is a sensible
default). But we can be more specific and provide the right type for
each parameter. This is one example of how we can do that
2024-08-21 13:01:00 +02:00
Jaanus Sellin
df73c65073
feat: filter projectless events for normal users (#7914)
Now events that do not have project ( for example user creation, segment
creation etc), will not be displayed to non root admins.
2024-08-21 13:59:24 +03:00
Tymoteusz Czech
6c5ce52470
Refactor: Remove react-timeago (#7943)
Remove dependency 🫡
2024-08-21 12:03:03 +02:00
gitar-bot[bot]
43100f9561
Cleaning up stale flag: insightsV2 with value true (#7896)
Co-authored-by: Gitar <noreply@gitar.co>
Co-authored-by: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com>
2024-08-21 12:01:35 +02:00
Mateusz Kwasniewski
ee1d8ee8cd
fix: misc fixes for project archive (#7948) 2024-08-21 10:34:13 +02:00
Thomas Heartman
3cd312f9a9
chore: allow you to use the options object to override *all* the new resource limits (#7938)
This allows us to use different limits for enterprise self-hosted and
hosted
2024-08-21 08:59:19 +02:00