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

11929 Commits

Author SHA1 Message Date
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
Tymoteusz Czech
f2e2952c31
fix: projects archive search (#7898)
Filter projects when searching
2024-08-15 16:19:29 +02:00
Mateusz Kwasniewski
a3decb543f
feat: Show project archived message (#7899) 2024-08-15 14:56:12 +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
Thomas Heartman
64a9caab30
fix: display 3 types of models image (#7885)
The link to the image was incorrectly formatted, leading to the image
being displayed as a link. This fixes it so that the image is displayed
inline.
2024-08-15 11:12:04 +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
Tymoteusz Czech
1e66fedb7e
chore: update openapi (#7881)
Auto-generated types
2024-08-14 14:31:32 +00:00
GitHub Actions Bot
de2a62a15d chore: bump version to 6.1.9+main 2024-08-14 13:33:40 +00:00
Thomas Heartman
f59b77571c
chore: code cleanup: event log filters (#7870)
Adds tests for event log filters (to ensure we show the right filters)
and refactors the implementation of eventlogfilters.

Primary goal of refactoring:
- Make it so that all filters are created in one single list (instead of
injected from different variables)
- Avoid making a requests for features (and to a lesser extent:
projects) if you can't use them for filters
- Improve code structure
2024-08-14 15:27:22 +02:00
Thomas Heartman
dad30a08f0
fix: cap number of collaborators displayed (#7879)
Caps the number of collaborators to display to a constant (currently
set to 99).

Above that, it'll always show "+99".

However, we also add a tooltip that shows you a prettified version of
the extra collaborators (using the `millify` package that we already use
for metrics)

Screenies:

< 1000 collaborators:

![image](https://github.com/user-attachments/assets/b030e77e-e23d-4cac-a1d1-7841a4ba86e7)


1000 - 1M collaborators:

![image](https://github.com/user-attachments/assets/b72ca22e-513d-4d69-b78d-c675951c894a)

1M+ collaborators:

![image](https://github.com/user-attachments/assets/6341e87d-17da-4359-bce3-e31df637cd5c)

Update, it now shows the total number of collaborators instead of the
overflow:

![image](https://github.com/user-attachments/assets/67a459c5-91b8-475d-b0e3-c5c19aaf62d7)
2024-08-14 13:27:05 +00:00
Simon Hornby
f276728688
feat: allow editing root role/description on SCIM group (#7874) 2024-08-14 15:11:56 +02:00
Thomas Heartman
5e82e47d94
fix: add collaborators to ignored props for feature diff notif (#7877)
Fixes a problem with demo saying you've got outdated data when someone
else has worked with ya
2024-08-14 13:46:03 +02:00
GitHub Actions Bot
7481ea9912 chore: bump version to 6.1.8+main 2024-08-14 11:45:02 +00: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
Jaanus Sellin
778413d4c0
feat: plausible for events export (#7868)
Plausible for events exports. And small cleanup.
2024-08-14 11:56:03 +03:00
Nuno Góis
585eb30730
chore: initial admin email (#7795)
https://linear.app/unleash/issue/2-2518/figure-out-how-to-create-the-initial-admin-user-in-unleash

The logic around `initAdminUser` that was introduced in
https://github.com/Unleash/unleash/pull/4927 confused me a bit. I wrote
new tests with what I assume are our expectations for this feature and
refactored the code accordingly, but would like someone to confirm that
it makes sense to them as well.

The logic was split into 2 different methods: one to get the initial
invite link, and another to send a welcome email. Now these two methods
are more granular than the previous alternative and can be used
independently of creating a new user.

---------

Co-authored-by: Gastón Fournier <gaston@getunleash.io>
2024-08-14 10:05:11 +02:00
Thomas Heartman
764d03767b
chore: begin front end cleanup (#7865)
Begins cleaning up the front end.

Removes the "legacy" event log component in favor of only using the new
one. What we do is simply not to show the filters if you're not on
enterprise.

This means that we'll get pagination (and maybe exports?) for everyone.

It also means that you can reverse-engineer the filters and use them
even on non-enterprise, as long as you're happy editing URLs manually.
However, putting it behind a flag on the front end always exposed that
kind of risk, so I don't think this is a bad move.
2024-08-14 10:03:28 +02:00
Mateusz Kwasniewski
4738d4a61f
feat: query archived projects (#7862) 2024-08-13 15:33:31 +02:00
Jaanus Sellin
8ce594ba52
feat: exporting events as csv (#7860)
Adding csv library that also makes nested properties into columns.
2024-08-13 16:28:03 +03:00
Tymoteusz Czech
ccb29a5acf
refactor: project archive card (#7859)
- Refactored "favorites" action, and fixed issue with "favorite" prop
- Refactored "owners" - simplified footer
2024-08-13 15:19:13 +02:00
Thomas Heartman
9f0fd7e200
chore: create skeleton loading for new event screen (#7861)
Updates the new event log to show a skeleton loading screen while the
search results are being fetched.

The placeholder size is based on the standard event size.


![image](https://github.com/user-attachments/assets/fce51445-2b73-40dd-9452-29a415ec278a)
2024-08-13 15:18:47 +02:00
Tymoteusz Czech
f2b7e0278d
Projects archive UI (#7842)
Closes
[issue/1-2666](https://linear.app/unleash/issue/1-2666/archived-projects-view)
2024-08-13 14:33:11 +02:00
GitHub Actions Bot
3c45a4b2a9 chore: bump version to 6.1.5+main 2024-08-13 12:22:38 +00:00
Gastón Fournier
ea92081545
fix: remove another scimApi flag (#7858) 2024-08-13 14:03:52 +02:00
Gastón Fournier
376012ddd1
fix: remove flag from UI (#7857) 2024-08-13 11:44:16 +00:00
gitar-bot[bot]
caac8f3fcb
[Gitar] Cleaning up stale flag: parseProjectFromSession with value true (#7854)
[![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-13 14:15:59 +03:00
Jaanus Sellin
bbdb5e635b
feat: update feature completed payload to have boolean instead of string (#7855)
For easy gitar integration, we need to have boolean in the event
payload.
We might rethink it when we add variants, but currently enabled with
variants is not used.
2024-08-13 12:43:49 +03:00
GitHub Actions Bot
17e2102f0e chore: bump version to 6.1.4+main 2024-08-13 09:30:17 +00:00
Thomas Heartman
1b892979d3
feat: add event creators data to filter (#7822)
Adds event creator data to the event creator filter.

It uses a new useEventCreators hook to fetch event creators from the new
API, and uses that to populate the event creators filter.
2024-08-13 10:41:55 +02:00
Mateusz Kwasniewski
bb30032f2e
feat: revive project (#7847) 2024-08-13 10:25:42 +02:00
Mateusz Kwasniewski
fcf1329816
feat: exclude archived projects from insights and project stats (#7843) 2024-08-13 10:00:04 +02:00
Thomas Heartman
0934c6ccd8
fix: search events by user ID, not by user name (#7846)
Changes the event search handling, so that searching by user uses the
user's ID, not the "createdBy" name in the event. This aligns better
with what the OpenAPI schema describes it.
2024-08-13 09:32:51 +02:00
GitHub Actions Bot
507219e1c7 chore: bump version to 6.1.3+main 2024-08-13 07:10:26 +00:00
Thomas Heartman
245bdeae1e
chore: generate orval for event creators (#7823)
Updates our orval config to include event creator data
2024-08-12 15:07:26 +02:00
Jaanus Sellin
b194393dae
feat: export events as json (#7841)
![image](https://github.com/user-attachments/assets/7e24339d-fa59-4b80-a322-05323e01eabe)
2024-08-12 15:30:20 +03:00
Thomas Heartman
fa96ff1450
fix: display feature naming patterns in dialog (#7837)
Updates the dialog form template to include a `namingPattern` prop that
can be used to display the naming pattern of whatever the form is used
for.

Also updates the create feature dialog to display the naming pattern in
the current project.

The naming pattern component re-uses the pattern that we have in place
for feature naming patterns, but puts it in an expandable dialog
instead.

Screenies:

Naming pattern closed:

![image](https://github.com/user-attachments/assets/145e4268-1aa0-4c1b-8f08-97857447e2f5)


![image](https://github.com/user-attachments/assets/1613c846-e7d4-41c8-a1c8-a66ab87b6e5f)



Naming pattern open:

![image](https://github.com/user-attachments/assets/1aa37162-500b-4b83-926f-07aa777e8017)
2024-08-12 13:56:07 +02:00
Mateusz Kwasniewski
9b781b781a
feat: prevent move feature to archived project (#7839) 2024-08-12 13:29:38 +02:00
Mateusz Kwasniewski
67fa28f05a
feat: prevent revive flag/flags in archived project (#7826) 2024-08-12 13:29:24 +02:00
Jaanus Sellin
624c6ce9c3
feat: events table type column index (#7838)
Adding index on even table type column, since we are running queries on
top of it.
2024-08-12 13:46:27 +03:00