1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
Commit Graph

9638 Commits

Author SHA1 Message Date
Christopher Kolstad
a6cde07af0
Updated scripts to use owner (#5341)
See [Linear issue
2-1627](https://linear.app/unleash/issue/2-1627/db-permissions-update-docs-and-migration-guides).

Since we now use functions, we need more permissions than just GRANT ALL
PERMISSIONS ON DATBASE. In addition we need to be allowed to create
functions in the schema that's actually being used. This PR takes the
easy way out and say that we need OWNER privileges on the database. That
guarantees that we can do all we do in our migration scripts.

### Discussion points
We might encounter some pushback on this, if so, we'll need to say that
we need
`GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN <schema>` in addition to GRANT
ALL PRIVILEGES ON DATABASE, where <schema> is the schema selected in
their configuration.
2023-11-27 07:55:03 +00:00
Gard Rimestad
eb42246ce2
feat: add accessLogs feature flag (#5417)
This is a feature flag in unleash-enterprise
2023-11-27 08:07:42 +01:00
Christopher Kolstad
24d111c4c5
docs: Update recommended postgres to 14 (#5240)
We've been caught out here, we added a migration that used PG>=11
syntax, but our docs still state that we support v10, when it reached
EoL Nov 2022. This updates our docs to state v14 and newer, v14 came out
in 2021 and as such won't be EoL until 2026 according to [Postgres 5
year versioning scheme
support](https://www.postgresql.org/support/versioning/)
2023-11-25 09:27:11 +01:00
Tymoteusz Czech
dbd897e3bd
Feat/new paginated table (#5371)
## About the changes
2023-11-24 17:50:58 +01:00
Ivar Conradi Østhus
f00eac0881
fix: User audit events (create, update, delete) should include rootRole. (#5399)
Audit events for USER_CREATE, USER_UPDATE and USER_DELETE did not
include the users rootRole.


![image](https://github.com/Unleash/unleash/assets/158948/fcbc1407-e4f0-438f-86cf-7073205cd8c2)

---------

Co-authored-by: Gastón Fournier <gaston@getunleash.io>
2023-11-24 16:06:37 +01:00
Nuno Góis
47e214d96f
fix: enable toggle with disabled strategies dialog (#5416)
https://linear.app/unleash/issue/UNL-283/improve-dialog-when-there-are-disabled-strategies-and-we-want-to

Improves the "enable toggle when there are disabled strategies" dialog.
Also implements passing in the missing `disabledStrategiesCount`
property to the dialog.


![image](https://github.com/Unleash/unleash/assets/14320932/95d9110e-8c1c-47ce-8e1b-389607115a54)
2023-11-24 14:57:03 +00:00
Mateusz Kwasniewski
2e96ace14e
feat: feature type updated audit log (#5415) 2023-11-24 14:24:31 +01:00
Gastón Fournier
d680e50055
feat: audit roles (#5408)
## About the changes
Audit changes to roles both root and project roles.
2023-11-24 14:22:31 +01:00
Mateusz Kwasniewski
295b0c073e
fix: missing user id in segment update (#5414) 2023-11-24 11:17:36 +01:00
Mateusz Kwasniewski
ce382a4bf9
fix: prevent concurrent queries from running out of transaction (#5412) 2023-11-24 11:11:26 +01:00
Nuno Góis
aa8347eb7a
fix: delete archived feature toggles in the UI (#5411)
This PR addresses 2 tasks that aim to fix and improve the UI/UX on
archived feature toggle deletion:

-
https://linear.app/unleash/issue/UNL-260/delete-feature-toggle-dialog-update-word-toggles-to-singular-toggle
-
https://linear.app/unleash/issue/UNL-282/deleting-multiple-toggles-in-the-project-archive-the-batch-selector

Essentially:

- Makes it clearer that we're deleting a single feature toggle by
changing the text to singular toggle
- Improves clarity further by adding a list of feature toggles about to
be deleted
- Fixes a bug where the batch selector would not be cleared after
deleting multiple feature toggles

## Deleting one feature toggle (singular)

![image](https://github.com/Unleash/unleash/assets/14320932/c956f459-ef18-4153-97f7-ffdd6b11613c)

## Deleting multiple feature toggles (plural)

![image](https://github.com/Unleash/unleash/assets/14320932/14f875a4-7f56-4db9-81db-cd06526e5bd5)
2023-11-24 09:35:13 +00:00
Tymoteusz Czech
ffe37ac709
Basic filter label (#5387) 2023-11-24 10:07:42 +01:00
Jaanus Sellin
b0c05111c6
feat: allow filtering projects with operators (#5400)
This is first iteration. When we add more fields to be filterable with
operators, we can have more reusable components for this.
2023-11-24 10:45:44 +02:00
andreas-unleash
2e1790985c
feat: Handle scheduled request events in addons (#5403)
- Create 2 new events to replace the SCHEDULED_CHANGE_REQUEST_EXECUTED
event
- Handle the 3 events in slack-app and webhook addon definitions

3 events handled:
- CHANGE_REQUEST_SCHEDULED
- CHANGE_REQUEST_SCHEDULED_APPLICATION_SUCCESS
- CHANGE_REQUEST_SCHEDULED_APPLICATION_FAILURE

Closes #
[1-1555](https://linear.app/unleash/issue/1-1555/update-change-request-scheduled-and-scheduled-change-request-executed)

Note: SCHEDULED_CHANGE_REQUEST_EXECUTED will be removed in follow up PR
not to break current enterprise build

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-11-23 15:00:24 +02:00
Ivar Conradi Østhus
916e4c99b1
fix: upgrade wait-on to v7.2.0 2023-11-23 13:45:36 +01:00
Ivar Conradi Østhus
6df127059a
fix: upgrade @slack/web-api to v6.10.0 2023-11-23 13:41:49 +01:00
Fredrik Strand Oseberg
a8ea8d3fbe
Fix/clean last seen environments (#5402)
This PR addresses some cleanup related to removing the
useLastSeenRefactor flag:

* Added fallback last seen to the feature table last_seen_at column 
* Remove foreign key on environment since we can not guarantee that we
will get valid data in this field
* Add environments to cleanup function
* Add test for cleanup environments
2023-11-23 12:12:58 +01:00
Nuno Góis
88a034d066
fix: dedupe any duplicate permissions (#5397)
https://linear.app/unleash/issue/2-1656/create-db-migration-that-ensures-correct-state-of-permissions

This adds a migration that dedupes any duplicate permissions.
2023-11-23 10:23:21 +00:00
Nuno Góis
7d2fd172a5
fix: role permissions UI improvements (#5388)
https://linear.app/unleash/issue/2-1657/role-permissions-improvements

This PR includes 3 improvements:
 - Sort permissions alphabetically
 - Ensure we don't display duplicate permissions
 - Improve alignment of columns by using a proper grid


![image](https://github.com/Unleash/unleash/assets/14320932/7cb4a70e-8e39-4077-95a0-66f29b3c2e55)
2023-11-23 09:43:15 +00:00
Ivar Conradi Østhus
ce01687e3b
fix: Audit events for segments should include project id (#5401) 2023-11-23 10:32:49 +01:00
andreas-unleash
937a605888
chore: remove variantTypeNumber flag (#5382)
Closes #
[1-1648](https://linear.app/unleash/issue/1-1648/clean-varianttypenumber-flag-for-release)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-11-23 11:12:56 +02:00
andreas-unleash
1dafc85eaa
chore: remove playgroundImprovements flag (#5384)
Closes #:

[1-1647](https://linear.app/unleash/issue/1-1647/clean-playgroundimprovements-flag-for-release)

[1-1665](https://linear.app/unleash/issue/1-1665/flaky-test-playgroundconnectionfieldsettesttsx)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-11-23 10:50:19 +02:00
andreas-unleash
3e12c2b5b6
Chore: remove disableEnvsOnRevive flag (#5391)
Closes #
[1-1646](https://linear.app/unleash/issue/1-1646/clean-disableenvsonrevive-flag-for-release)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-11-23 10:10:37 +02:00
Thomas Heartman
b211345a44
fix: if a strategy both uses a segment actively and in CRs, list it twice (#5390)
This PR changes the behavior of the API a little bit. Instead of
removing any strategies from `changeRequestStrategies` that are also
in `strategies`, we keep them in instead.

The reason for this is that the overview of where a segment is used is
incomplete if it shows only strategies but not CRs. Imagine this:

You want to delete a segment, but you're told it's only used in strategy
S.
So you go and remove it from strategy S, but then you're told it's
suddenly used in CRs A, B, and C. This is now a two-step operation
with a bad surprise. Instead, we could show you immediately that this
segment is used in strategy S and CRs A, B, and C.
2023-11-22 14:13:18 +01:00
Jaanus Sellin
432aed3034
feat: support multiple terms in search, remove tag support in search (#5395)
1. Removing tag support in search
2. Adding multi keyword support for search
2023-11-22 15:06:07 +02:00
Fredrik Strand Oseberg
5414fa6663
Refactor/remove last seen at flag (#5394)
This PR removes the feature flag for displaying the new last seen by
environments component.
2023-11-22 13:32:38 +01:00
Thomas Heartman
dc1aaf6d99
chore: only return change request data if the unleash instance is an enterprise instance (#5331)
Otherwise, we might accidentally display CR data to open source users.
But more importantly, it might keep them from being able to delete a
segment that's in use by a CR in their database that they can't touch.

So by checking that they're on an enterprise instance, we avoid this
potential blocker.

I've added the `includeChangeRequestUsageData` parameter as a boolean
now, but I'm open to other suggestions.
2023-11-22 12:15:29 +00:00
Jaanus Sellin
68558fc774
feat: able to search by description (#5392) 2023-11-22 14:08:52 +02:00
Nuno Góis
5dc3e830a8
feat: add CREATE_TAG_TYPE permission (#5386)
https://linear.app/unleash/issue/2-1164/update-tag-type-covers-both-creation-and-update

Adds a new `CREATE_TAG_TYPE` permission instead of using
`UPDATE_TAG_TYPE` for both actions.
2023-11-22 10:20:19 +00:00
Thomas Heartman
fac2578922
chore: avoid duplicates (#5381)
This PR handles the case where a single strategy is used in multiple
change requests. Instead of listing the strategy several times in the
output, we consolidate the entries and add a new `changeRequestIds`
property. This is a non-empty list that points to all the change
requests it is used in.

This is required for us to be able to link back to the change requests
from the UI overview.
2023-11-22 10:26:35 +01:00
andreas-unleash
8ffc92af5b
fix: Only show strategy variant changes if there is a diff in the variants (#5353)
What it says on the box

Closes #
[1-1652](https://linear.app/unleash/issue/1-1652/remove-the-variants-from-change-request-page-when-not-modified)

![Screenshot 2023-11-16 at 11 26
05](https://github.com/Unleash/unleash/assets/104830839/8f25b82c-4dbc-46fb-bdd6-0e0049659c72)

![Screenshot 2023-11-16 at 11 25
46](https://github.com/Unleash/unleash/assets/104830839/e6366622-3a50-4a0e-bba2-6c1d34e64077)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-11-22 09:50:03 +02:00
Thomas Heartman
9ac3d7511a
chore: use query to get strategies instead of whether a segment is in use (#5375)
This change is just a refactor, removing code that's no longer used. Instead of
checking just whether a segment is in use, we now extract the list of
strategies that use this segment. This is slightly more costly,
perhaps, but it will be necessary for the upcoming implementation.
2023-11-22 06:54:28 +00:00
Thomas Heartman
8337885e47
feat: return CR uses of segments when flag is active (#5378)
This PR changes the payload of the strategiesBySegment endpoint when the
flag is active. In addition to returning just the strategies, the object
will also contain a new property, called `changeRequestStrategies`
containing the strategies that are used in change requests.

This PR does not update the schema. That can be done later when the
changes go into beta. This also allows us some time to iterate on the
payload without changing the public API.

## Discussion points:

Should `strategies` and `changeRequestStrategies` ever contain
duplicates? Take this scenario:
- Strategy S uses segment T.
- There is an open change request that updates the list of segments for
S to T and a new segment U.
- In this case, strategy S would show up both in `strategies` _and_ in
`changeRequestStrategies`.

We have two options: 
1. Filter the list of change request strategies, so that they don't
contain any duplicates (this is currently how it's implemented)
2. Ignore the duplicates and just send both lists as is.

We're doing option 2 for now.
2023-11-22 07:51:04 +01:00
Gastón Fournier
7ddcceed8a
fix: remove user from project (#5383)
Removing a user from a project was impossible if you only had 1 owner.
It worked fine when having more than an owner. This should fix it and
we'll add tests later
2023-11-21 15:44:12 +01:00
Jaanus Sellin
1429b54957
feat: sorting by last seen, environments now working properly (#5376)
Now calculates final ranks also, if there are some ranks missing from
duplicates.
2023-11-21 15:19:06 +02:00
Nuno Góis
a137275e16
chore: unpin node version in build (#5379)
https://linear.app/unleash/issue/2-1434/unpin-node-18-when-a-fix-is-out

Unpins the node version in our build step.
Continues the work of https://github.com/Unleash/unleash/pull/5146
2023-11-21 12:58:34 +00:00
Jaanus Sellin
62dbf8d12f
fix: last seen is now using last seen values from new table (#5380)
In short the issue is that after our last seen improvements, we did not
update where we are getting last_seen field. It was still using features
table, which is not the source of last seen anymore.
2023-11-21 14:44:41 +02:00
Fredrik Strand Oseberg
fe4bb4f227
feat: scheduled functions observability (#5377)
See linear issue:
https://linear.app/unleash/issue/1-1656/add-scheduler-observability

As per post mortem actions, we are adding observability to scheduled
functions.

This PR adds prometheus observability to our scheduled functions via a
summary. In addition to timing these functions with the more accurate
process.hrtime, we are getting a counter for free per scheduled job id.

Prometheus example: 

<img width="731" alt="Skjermbilde 2023-11-21 kl 13 36 33"
src="https://github.com/Unleash/unleash/assets/16081982/08a2064d-5152-4b4f-8a08-eb06e726757a">
2023-11-21 13:42:38 +01:00
Thomas Heartman
f8db9098fc
Revert "Fix: add the right change"
This reverts commit 9dc64659b7.

Wasn't intended to push to main.
2023-11-21 12:54:45 +01:00
Thomas Heartman
9dc64659b7
Fix: add the right change 2023-11-21 12:53:35 +01:00
Fredrik Strand Oseberg
83fe430a14
Feat/private project badge (#5373)
Adds an icon with tooltip for private projects in ProjectCard and
Project header:

<img width="528" alt="Skjermbilde 2023-11-21 kl 10 58 13"
src="https://github.com/Unleash/unleash/assets/16081982/28004c11-a20d-4740-98f4-127f41639896">
2023-11-21 11:49:50 +01:00
Tymoteusz Czech
d5049e6197
feat: useTableState hook (#5362)
Simplified logic for handling interaction between URL (query), table state and localstorage.
2023-11-21 11:25:31 +01:00
Nuno Góis
ae375703d2
fix: scheduler job runtime control (#5363)
## PR Description


https://linear.app/unleash/issue/2-1645/address-post-mortem-action-point-all-flags-should-be-runtime

Refactor with the goal of ensuring that flags are runtime controllable,
mostly focused on the current scheduler logic.

This includes the following changes:
 - Moves scheduler into its own "scheduler" feature folder
- Reverts dependency: SchedulerService takes in the MaintenanceService,
not the other way around
- Scheduler now evaluates maintenance mode at runtime instead of relying
only on its mode state (active / paused)
- Favors flag checks to happen inside the scheduled methods, instead of
controlling whether the method is scheduled at all (favor runtime over
startup)
 - Moves "account last seen update" to scheduler
 - Updates tests accordingly
 - Boyscouting

Here's a manual test showing this behavior, where my local instance was
controlled by a remote instance. Whenever I toggle `maintenanceMode`
through a flag remotely, my scheduled functions stop running:


https://github.com/Unleash/unleash/assets/14320932/ae0a7fa9-5165-4c0b-9b0b-53b9fb20de72


Had a look through all of our current flags and it *seems to me* that
they are all used in a runtime controllable way, but would still feel
more comfortable if this was double checked, since it can be complex to
ensure this.

The only exception to this was `migrationLock`, which I believe is OK,
since the migration only happens at the start anyways.

## Discussion / Questions

~~Scheduler `mode` (active / paused) is currently not *really* being
used, along with its respective methods, except in tests. I think this
could be a potential footgun. Should we remove it in favor of only
controlling the scheduler state through maintenance mode?~~ Addressed in
7c52e3f638

~~The config property `disableScheduler` is still a startup
configuration, but perhaps that makes sense to leave as is?~~
[Answered](https://github.com/Unleash/unleash/pull/5363#issuecomment-1819005445)
by @FredrikOseberg, leaving as is.

Are there any other tests we should add?

Is there anything I missed?

Identified some `setInterval` and `setTimeout` that may make sense to
leave as is instead of moving over to the scheduler service:
- ~~`src/lib/metrics` - This is currently considered a `MetricsMonitor`.
Should this be refactored to a service instead and adapt these
setIntervals to use the scheduler instead? Is there anything special
with this we need to take into account? @chriswk @ivarconr~~
[Answered](https://github.com/Unleash/unleash/pull/5363#issuecomment-1820501511)
by @ivarconr, leaving as is.
- ~~`src/lib/proxy/proxy-repository.ts` - This seems to have a complex
and specific logic currently. Perhaps we should leave it alone for now?
@FredrikOseberg~~
[Answered](https://github.com/Unleash/unleash/pull/5363#issuecomment-1819005445)
by @FredrikOseberg, leaving as is.
- `src/lib/services/user-service.ts` - This one also seems to be a bit
more specific, where we generate new timeouts for each receiver id.
Might not belong in the scheduler service. @Tymek
2023-11-21 10:06:38 +00:00
Thomas Heartman
27252f7728
chore: find segment strategies in CRs (#5365)
This PR adds the ability to detect which strategies use a specific
segment in active change requests.

It does not wire this functionality up to anything just yet. Follow-up
PRs will integrate this with the segment service and eventually with the
front end.
2023-11-21 10:29:43 +01:00
Mateusz Kwasniewski
7a8c8c8d29
docs: variants reassignment (#5372) 2023-11-21 10:24:35 +01:00
Jaanus Sellin
e79e30de96
fix: total number should be correct now in search (#5355)
The issue was that we all features were created exactly in same time,
and our feature counter waas expecting time to be unique to feature,
which was not the case.
2023-11-21 09:08:20 +01:00
Fredrik Strand Oseberg
11533bf97a
refactor: remove feature flag for Dora (#5367) 2023-11-21 08:18:00 +01:00
Thomas Heartman
0ba99a6162
fix: handle check against non existing projects (#5368)
Instead of throwing an error when the project doesn't exist, we say that
the names are valid, because we have nothing to say that they're not.
Presumably there is already something in place to prevent you from
importing into a non-existent project.
2023-11-20 16:02:41 +00:00
Thomas Heartman
90d6c7c0ba
chore: remove usage of feature naming pattern flag (#5364)
In preparation for this feature going GA
2023-11-20 12:42:24 +01:00
Drew Gorton
fd099e242e
Add redirects from 404 logs (#5356)
Add more redirects from the docs refactor
2023-11-17 09:38:33 -06:00