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

12374 Commits

Author SHA1 Message Date
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
Nuno Góis
9a98f86077
chore: make the Unleash AI chat resizable (#8456)
https://linear.app/unleash/issue/2-2840/make-the-unleash-ai-chat-window-resizable

This PR makes the Unleash AI chat resizable, providing users with a
flexible way to adjust the chat window's size.

Implements a reusable `Resizable` wrapper component that allows
configuration of:
 - Minimum, maximum, and default sizes.
- Customizable resize handlers for each edge and corner of the
container.
 - Optional resize event callbacks.

Double-clicking any resize handler maximizes the container along that
axis (or both, if it's a corner). If the container is already maximized,
double-clicking again will revert it to the default size.
2024-10-16 09:15:40 +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
Thomas Heartman
6ba87d1436
chore: fix invalid dom nesting (#8451)
This PR fixes all `invalidDomNesting` errors we're getting in our tests.
The culprit was the `Badge` icon we use, which wrapped its children in a
div. When that's used as a child of a `p` tag, that'd cause this to
trigger.

What I've done is to change the wrapping element to a span instead. The
Badge itself uses an `display: inline-flex`, so divs and spans should be
treated the same, meaning there's no visual change for this.
2024-10-16 08:33:47 +02:00
Nuno Góis
8d4e84d6eb
fix: unleash AI chat message code not breaking to new line (#8455)
https://linear.app/unleash/issue/2-2841/fix-a-bug-where-code-does-not-break-to-new-lines-in-messages

Fixes a bug where code in an Unleash AI chat message would not break to
new lines.

### Before

<img width="451" alt="image"
src="https://github.com/user-attachments/assets/43023206-f6e9-48ef-bd22-cc0c0fe04668">

### After

<img width="404" alt="image"
src="https://github.com/user-attachments/assets/2f0bad32-8d40-4edd-bdbb-df0eb9ffb977">
2024-10-15 14:43:01 +00: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
Thomas Heartman
6b56f8ff89
chore: add descriptions to accordion headers (#8452)
This commits adds descriptions to the accordion headers in the
personal dashboard.


![image](https://github.com/user-attachments/assets/d7b7aeff-3a69-45f7-ab42-23228a49132b)
2024-10-15 13:14:18 +00:00
Thomas Heartman
abef5deaef
chore: remove all deprecated imports of act (#8398)
don't use `act` from `react-dom`. Instead, use act from `react`
directly, as advised by the deprecation notice.

This PR fixes all of the deprecated import warnings, updates some
testing libraries we use (and tests), and fixes one or two other
warnings.
2024-10-15 13:53:26 +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
Mateusz Kwasniewski
fc1f058cf4
chore: make onboarding concepts img more readable (#8448) 2024-10-15 12:02:55 +02:00
Tymoteusz Czech
258eb36afe
fix($env): fix environment order form state (#8449) 2024-10-15 09:44:40 +00: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
Thomas Heartman
e4cfb29adc
refactor: front end code pt II (#8444)
This PR continues the refactoring of the front end code for dashboards. 

The main points are:
- Extracts the `ActionBox` component that we used in a lot of places.
There were some minor differences between the various incarnations, so
this also better aligns them.
- Extract other components (`AskOwnerToAddYouToTheirProject`,
`YourAdmins`)
- Move the `NeutralCircleContainer` into `SharedComponents`
- Delete the separate no content grid (this is now handled in projects
instead)
- extract my projects grid contents into a single function so that it's
easier to understand what content you get for what states

Here's all the states side by side:

![image](https://github.com/user-attachments/assets/c5abc406-7374-41e4-8ff6-d48fe61cd7c8)
2024-10-15 09:14:24 +00:00
Tymoteusz Czech
f5a2a18ffc
Add environment types environment order (#8447) 2024-10-15 11:00:31 +02:00
Thomas Heartman
4167d772e9
chore: rename personal dashboard menu item to dashboard (#8437)
This change updates the title for the personal dashboard menu item to
be just "dashboard"

Before:

![image](https://github.com/user-attachments/assets/d04be63c-ad1f-471b-8ab1-5e781063716c)

After:

![image](https://github.com/user-attachments/assets/dc4a39b6-5b30-455d-b20a-6f04f84962d7)
2024-10-15 09:34:43 +02:00
Nuno Góis
d02443be95
chore: Unleash AI chat UI (#8445)
https://linear.app/unleash/issue/2-2792/create-the-aichat-component

Implements the Unleash AI chat UI.

This is essentially a polished version from the hackathon.

It will show up in the bottom right corner when the respective
prerequisites are met.

<img width="1508" alt="image"
src="https://github.com/user-attachments/assets/80da15a5-e638-4ccf-850b-508fcfd4991a">

<img width="1507" alt="image"
src="https://github.com/user-attachments/assets/8690cd42-1106-4f42-b459-41e574ab282f">

<img width="1506" alt="image"
src="https://github.com/user-attachments/assets/ea243828-ffcd-4243-b40c-6fa6357c3e70">
2024-10-15 08:14:04 +01:00
Nuno Góis
f63496d47f
chore: Unleash AI API hook (#8441)
https://linear.app/unleash/issue/2-2791/create-a-useaiapi-react-hook

Implements a basic Unleash AI API React hook that fits our initial needs
for interacting with this API through our frontend.

Also adds a new nice-to-have script to run the frontend set to the
`demo` base path, which matches our Cloud defaults. This way you can run
the latest local cloud with the latest local frontend in an easy way.
2024-10-14 13:29:29 +01:00
Thomas Heartman
9d49070cee
refactor: refactor personal dashboard front end code pt1 (#8440)
This is the first step in refactoring the front end code for personal
dashboards.

At this point:
- extract `useDashboardState` to its own file
- extract my flags to its own file
- Rename `Grid.tsx` to `SharedComponents.tsx` as it contains more than
just the grid.
2024-10-14 13:51:23 +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
Thomas Heartman
a3dd51734e
fix: handle cases where the flag name causes API errors (or other errors occur) (#8439)
This commit fixes a bug where the frontend would crash if the flag
name was invalid (such as `..`).


![image](https://github.com/user-attachments/assets/6f41f0d3-4d5f-433d-ad53-899d22b02d89)
2024-10-14 11:48:22 +02:00
Thomas Heartman
5a036997dc
Revert "Refactor front end code pt 1 (#8438)"
This reverts commit 8c2ed5dc30.
2024-10-14 11:46:09 +02:00
Thomas Heartman
8c2ed5dc30
Refactor front end code pt 1 (#8438)
This PR is the first in the front end code refactoring. It moves My
Flags out into a separate file and includes some extra error handling
(such as if the name of the flag causes problems for the API).


![image](https://github.com/user-attachments/assets/5aec8f0c-de79-4b7d-b56b-42297b872ec5)
2024-10-14 11:45:37 +02:00
gitar-bot[bot]
d8ddb57818
chore: improve addon metrics usage 2024-10-14 09:20:27 +02:00
Thomas Heartman
e2354dcceb
fix: spacing between lifecycle metrics and env/period selector (#8433)
This PR fixes a spacing issues between the lifecycle metrics and the
environment/period selector. They're now grouped better by proximity.
2024-10-11 14:00:25 +02:00
Jaanus Sellin
a991cf4eff
fix: now health widget will match will chart (#8432)
Now it will match with chart if no data.

Previous


![image](https://github.com/user-attachments/assets/48d9c19b-962f-45b9-ab6e-defacd53d90e)



Now


![image](https://github.com/user-attachments/assets/f0132890-9491-4f0e-a88b-e5444ca3eb6b)
2024-10-11 14:33:46 +03:00
Tymoteusz Czech
226874fe23
fix($env): order API integration update (#8431) 2024-10-11 13:23:54 +03:00
Jaanus Sellin
cc07a48500
feat: more clear pricing text (#8429)
![image](https://github.com/user-attachments/assets/c7643829-efe5-43d6-90fc-546d3a47d0b2)

---------

Co-authored-by: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com>
2024-10-11 13:19:11 +03:00
Thomas Heartman
32816f5abf
fix: handle narrow screens better (#8430)
This PR improves handling of narrow screens. It:
- makes the owner/roles row wrap when it needs to
- makes the lifecycle + metric selectors wrap when necessary
- makes the text for the empty chart wrap (and makes it text, not label)
2024-10-11 11:21:13 +02:00
Tymoteusz Czech
1fa918e4f7
feat($env): additional environments - API integration (#8424)
Make API calls from "order environments" dialog, improve validation
2024-10-11 09:01:35 +00:00
Thomas Heartman
01b2a15b8a
fix: adjust the height of the flag section (#8426)
This commit adjusts the height of the flag section in the personal
dashboard, so that the chart doesn't cause scrolling on the widest
version.

Before:

![image](https://github.com/user-attachments/assets/32a30338-b647-4458-bc09-604e821b30c7)

After:

![image](https://github.com/user-attachments/assets/c4760900-ef1b-4c45-b8aa-f81dff2a3a55)

Also fixes some issues in regards to super big lists when it goes into
flex mode and makes the chart more responsive
2024-10-11 10:09:26 +02:00
Jaanus Sellin
e72aa2871e
feat: order environment plausible events (#8427) 2024-10-11 11:05:33 +03:00
Thomas Heartman
d944eff34c
refactor: use splash api to store splash state (#8422)
To avoid showing the key concepts screen to users every time they log
back in to Unleash (after logging out), store the state in the DB splash
table.

The reason we need to do this is that we clear localstorage on logging
out, so things like splash screens and certain other settings don't get
stored.
2024-10-11 09:19:29 +02:00
Thomas Heartman
74370468d1
fix: section sizes (#8423)
This PR fixes issues with section sizes including:
- Jank when they change suddenly
- Overflowing list of admins / events
- Short lists that should stretch to the height of their container.
2024-10-11 09:10:21 +02:00
Thomas Heartman
4c8aef58ae
fix: revert link changes (#8425)
Making them absolute appears to break them. Reverting to relative links.
2024-10-11 08:09:31 +02:00
Nuno Góis
7c5fab518f
chore: use new signal meta properties in event timeline (#8421)
https://linear.app/unleash/issue/2-2796/better-signals-integration

Adds support to the following signal payload meta properties:
 - `unleash_title`
 - `unleash_description`
 - `unleash_icon`
 - `unleash_variant`

Follows a logic similar to what we currently have for banners. E.g.
[custom icon](https://docs.getunleash.io/reference/banners#custom-icon).

## Call signal endpoints

![image](https://github.com/user-attachments/assets/7c806a96-5aa4-40a7-b24e-27ab8dc4e374)

![image](https://github.com/user-attachments/assets/6edfd45d-d702-4bd3-9af8-d3655528b09e)


## View signals in event timeline

![image](https://github.com/user-attachments/assets/b3852686-e2c8-407c-b968-b52a1686fdd6)

![image](https://github.com/user-attachments/assets/b47683c5-51b6-426c-96d1-7308fc9e6eab)
2024-10-10 15:41:02 +01:00
David Leek
24b9e4987b
chore:origin middleware flag cleanup (#8402) 2024-10-10 14:26:35 +02:00
Thomas Heartman
f0dc7fa0ae
fix: fix title sizes (#8420)
Makes both headers of the same setup complete section the same size.
Also normalize casing
2024-10-10 13:50:30 +02:00
Thomas Heartman
21887aa3b9
fix: show empty chart when we're loading flag metrics (#8419)
This PR makes it so that we show an empty chart when we're loading flag
metrics, instead of showing the placeholder chart.

It uses a very simple version that may not be the same size as the
standard chart (because it has no labels), but we can change that at a
later date.


![image](https://github.com/user-attachments/assets/621ba1b9-e936-4c65-a77b-e1cd6debf865)
2024-10-10 13:43:31 +02:00
Thomas Heartman
fcce0f852c
chore: track personal dashboard navigation (#8417)
This PR adds plausible tracking for navigating to items from the
personal dashboard.

It tracks:

- Navigating to projects from the list
- Navigating to projects from the onboarding screen
- Navigating to flags from the list
- Opening the key concepts dialog
2024-10-10 13:30:47 +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
Thomas Heartman
a5cfd2e80e
feat: handle cases where user has no flags (#8416)
This PR handles the cases where a user has no flags to display. There's
a few different ways this can happen:

1. The user has no project membership.
2. The user has projects, but no flags.

In the first case, we tell them to reach out to their admin.
In the second case, we tell them to go to one of their projects to
create a new flag.

User has no projects:

![image](https://github.com/user-attachments/assets/84b94044-3577-4009-97ae-ab709b94fc2e)


User has no flags:

![image](https://github.com/user-attachments/assets/d7fa2fcc-d758-4d7b-b986-376315150846)
2024-10-10 12:54:42 +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
Tymoteusz Czech
534dd093d2
Additional environments confirmation dialog (#8407) 2024-10-10 10:26:13 +02:00
Thomas Heartman
5df7b15af0
fix: chart issues in dark mode (#8414)
This PR fixes two issues with the chart in dark mode:
1. Grid lines are almost invisible
2. Placeholder data lines are way too bright

The fix for both is to use the theme's divider color.


![image](https://github.com/user-attachments/assets/1064d081-0cd8-4b2b-97a7-225e29b3af19)


![image](https://github.com/user-attachments/assets/4f046f98-5664-421a-b0a8-620f2dbe96f9)
2024-10-10 10:03:16 +02:00
Thomas Heartman
e6365d8bce
chore: remove graph, update health message (#8403)
Removes the graph and updates the box to show a health message based on
current health if you don't have any trends:

With trends:

![image](https://github.com/user-attachments/assets/5c7a2102-207c-431f-9918-93a910480d48)

Without:

![image](https://github.com/user-attachments/assets/311427ba-38e9-4d49-9c10-2c932982d4d4)
2024-10-10 09:22:45 +02:00