1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
Commit Graph

2416 Commits

Author SHA1 Message Date
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
David Leek
74133395cc
chore: change integration events api tag to addons (#7932) 2024-08-20 14:00:58 +02:00
Mateusz Kwasniewski
02c8250905
fix: delete project action (#7934) 2024-08-20 11:46:12 +02:00
Thomas Heartman
7c774b22e8
fix: don't count flags multiple times (bonus: don't count non-project events) (#7931)
This PR fixes an issue where the number of flags belonging to a project
was wrong in the new getProjectsForAdminUi.

The cause was that we now join with the events table to get the most
"lastUpdatedAt" data. This meant that we got multiple rows for each
flag, so we counted the same flag multiple times. The fix was to use a
"distinct".

Additionally, I used this as an excuse to write some more tests that I'd
been thinking about. And in doing so also uncovered another bug that
would only ever surface in verrry rare conditions: if a flag had been
created in project A, but moved to project B AND the
feature-project-change event hadn't fired correctly, project B's last
updated could show data from that feature in project A.

I've also taken the liberty of doing a little bit of cleanup.
2024-08-20 09:31:45 +00:00
Mateusz Kwasniewski
4e11e57f7f
feat: project actions count metric (#7929) 2024-08-20 09:46:39 +02:00
David Leek
e714a7fe2b
feat:metrics for outgoing integrations (#7921) 2024-08-20 09:00:28 +02:00
Gastón Fournier
106e1d1376
fix: last seen metrics exceeding table limits (#7923)
## About the changes
When storing last seen metrics we no longer validate at insert time that
the feature exists. Instead, there's a job cleaning up on a regular
interval.

Metrics for features with more than 255 characters, makes the whole
batch to fail, resulting in metrics being lost.

This PR helps mitigate the issue while also logs long name feature names
2024-08-19 20:17:52 +00:00
gitar-bot[bot]
662c7ab4dc
[Gitar] Cleaning up stale flag: changeRequestPlayground with value true (#7920) 2024-08-19 15:33:55 +02:00
David Leek
205aeb5265
feat: feature flags for metrics and service name logging (#7916) 2024-08-19 14:16:31 +02:00
Thomas Heartman
7008070fc1
chore: impl empty results for fake project read model (#7912)
Implements empty responses for the fake project read model. Instead of
throwing a not implemented error, we'll return empty results.

This makes some of the tests in enterprise pass.
2024-08-19 10:53:05 +02:00
Thomas Heartman
f965246b83
chore: minor cleanup in new project read model (#7911)
This PR touches up a few small things in the project read model.

Fixes:
Use the right method name in the query/method timer for
`getProjectsForAdminUi`. I'd forgotten to change the timer name from the
original method name.

Spells the method name correctly for the `getMembersCount` timer (it
used to be `getMemberCount`, but the method is callled `getMembersCount`
with a plural s).

Changes:
Call the `getMembersCount` timer from within the `getMembersCount`
method itself. Instead of setting that timer up from two different
places, we can call it in the method we're timing. This wasn't a problem
previously, because the method was only called from a single place.
Assuming we always wanna time that query, it makes more sense to put the
timing in the actual method.
2024-08-19 10:13:30 +03:00
Thomas Heartman
79c3f8e975
refactor: switch projectStore.getProjects with projectReadModel.getProjectsForAdminUi in project service (#7904)
Hooks up the new project read model and updates the existing project
service to use it instead when the flag is on.

In doing:
- creates a composition root for the read model
- includes it in IUnleashStores
- updates some existing methods to accept either the old or the new
model
- updates the OpenAPI schema to deprecate the old properties
2024-08-19 08:46:50 +02:00
Thomas Heartman
abd077aaf7
chore: add flags projectListImprovements and useProjectReadModel (#7905)
These are both related to the work on the project list improvements
project.

The `projectListImprovements` flag will be used to enable disable the
new project list improvements.

The `useProjectReadModel` flag will be used to enable/disable the use
of the new project read model and is mostly a safety feature.
2024-08-16 11:54:11 +02:00
Thomas Heartman
0847a395dc
chore: Extract project read model (#7887)
Creates a new project read model exposing data to be used for the UI and
for the insights module.

The model contains two public methods, both based on the project store's
`getProjectsWithCounts`:
- `getProjectsForAdminUi`
- `getProjectsForInsights`

This mirrors the two places where the base query is actually in use
today and adapts the query to those two explicit cases.

The new `getProjectsForAdminUi` method also contains data for last flag
update and last flag metric reported, as required for the new projects
list screen.

Additionally the read model contains a private `getMembersCount` method,
which is also lifted from the project store. This method was only used
in the old `getProjectsWithCounts` method, so I have also removed the
method from the public interface.

This PR does *not* hook up the new read model to anything or delete any
existing uses of the old method.

## Why?

As mentioned in the background, this query is used in two places, both
to get data for the UI (directly or indirectly). This is consistent with
the principles laid out in our [ADR on read vs write
models](https://docs.getunleash.io/contributing/ADRs/back-end/write-model-vs-read-models).

There is an argument to be made, however, that the insights module uses
this as an **internal** read model, but the description of an internal
model ("Internal read models are typically narrowly focused on answering
one question and usually require simple queries compared to external
read models") does not apply here. It's closer to the description of
external read models: "View model will typically join data across a few
DB tables" for display in the UI.

## Discussion points

### What about properties on the schema that are now gone?

The `project-schema`, which is delivered to the UI through the
`getProjects` endpoint (and nowhere else, it seems), describes
properties that will no longer be sent to the front end, including
`defaultStickiness`, `avgTimeToProduction`, and more. Can we just stop
sending them or is that a breaking change?

The schema does not define them as required properties, so in theory,
not sending them isn't breaking any contracts. We can deprecate the
properties and just not populate them anymore.

At least that's my thought on it. I'm open to hearing other views.

### Can we add the properties in fewer lines of code? 

Yes! The [first commit in this PR
(b7534bfa)](b7534bfa07)
adds the two new properties in 8 lines of code.

However, this comes at the cost of diluting the `getProjectsWithCounts`
method further by adding more properties that are not used by the
insights module. That said, that might be a worthwhile tradeoff.

## Background

_(More [details in internal slack
thread](https://unleash-internal.slack.com/archives/C046LV6HH6W/p1723716675436829))_

I noticed that the project store's `getProjectWithCounts` is used in
exactly two places:

1. In the project service method which maps directly to the project
controller (in both OSS and enterprise).
2.  In the insights service in enterprise.

In the case of the controller, that’s the termination point. I’d guess
that when written, the store only served the purpose of showing data to
the UI.

In the event of the insights service, the data is mapped in
getProjectStats.
But I was a little surprised that they were sharing the same query, so I
decided to dig a little deeper to see what we’re actually using and what
we’re not (including the potential new columns). Here’s what I found.

Of the 14 already existing properties, insights use only 7 and the
project list UI uses only 10 (though the schema mentions all 14 (as far
as I could tell from scouring the code base)). Additionally, there’s two
properties that I couldn’t find any evidence of being used by either:
-   default stickiness
-   updatedAt (this is when the project was last updated; not its flags)
2024-08-16 10:52:57 +02:00
gitar-bot[bot]
977f969b80
[Gitar] Cleaning up stale flag: improveCreateFlagFlow with value true (#7895)
[![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: sjaanus <sellinjaanus@gmail.com>
2024-08-15 15:53:36 +03:00
Mateusz Kwasniewski
30cbde573b
feat: return archived at in project overview (#7888) 2024-08-15 14:15:06 +02:00
gitar-bot[bot]
413df42555
[Gitar] Cleaning up stale flag: commandBarUI with value true (#7894)
[![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: sjaanus <sellinjaanus@gmail.com>
2024-08-15 14:29:07 +03:00
Mateusz Kwasniewski
c2e6f74bfa
fix: exclude archived features in segments count (#7897) 2024-08-15 13:27:18 +02:00
David Leek
cf83043d8a
feat: resolve useragent source and add as source label to metrics (#7883) 2024-08-15 13:25:42 +02:00
Jaanus Sellin
183a9fc737
feat: support private projects for event search (#7884)
Adds private projects support for event search. Unit test should cover
the usecases.
2024-08-15 12:51:04 +03:00
Mateusz Kwasniewski
a89f05181d
fix: exclude archived features in segments count (#7886) 2024-08-15 11:32:46 +02:00
Tymoteusz Czech
3baeb4c541
feat: dialogs for project revive and delete (#7863)
Dialog needed to confirm revive/delete actions
2024-08-15 07:25:49 +00:00
Jaanus Sellin
627768b96c
feat: start using event service composition root (#7871)
During adding privateProjectsChecker, I saw that events composition root
is not used almost at all.
Refactored code so we do not call new EventService anymore.
2024-08-15 08:33:46 +03:00
Mateusz Kwasniewski
94605646f6
fix: always provide empty segments list in feature env strategies (#7880)
<!-- 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

When reading feature env strategies and there's no segments it returns
empty list of segments now. Previously it was undefined leading to
overly verbose change request diffs.

<img width="669" alt="Screenshot 2024-08-14 at 16 06 14"
src="https://github.com/user-attachments/assets/1ac6121b-1d6c-48c6-b4ce-3f26c53c6694">


### 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? -->
2024-08-14 19:13:06 +02:00
Simon Hornby
f276728688
feat: allow editing root role/description on SCIM group (#7874) 2024-08-14 15:11:56 +02:00
Mateusz Kwasniewski
94a05eecc0
fix: change request enabled check should ignore disabled envs (#7869) 2024-08-14 13:13:31 +02:00
Gastón Fournier
cac621c450
fix: messed up on merge-conflicts (#7873)
When fixing conflicts accidentally I've undone my changes
2024-08-14 12:00:57 +02:00
Mateusz Kwasniewski
cb6ba743ac
fix: make archivedAt nullable (#7872) 2024-08-14 11:36:48 +02:00
Mateusz Kwasniewski
b042afb7dd
feat: archived projects query improved (#7866) 2024-08-14 11:01:17 +02:00