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

6404 Commits

Author SHA1 Message Date
Aneesh Relan
1d5249eddc
fix: slack back link url to point to the feature page (#2128)
* fix: slack back link url to point to the feature page

* update snapshots

* update feature link in case project info is available in event

* update missing snapshot
2022-10-05 11:30:51 +02:00
sjaanus
774d4234bb
Remove member count for default project (#2131)
* Remove member count from default project

* Remove dependencies
2022-10-05 11:51:47 +03:00
Thomas Heartman
e30b830305
docs: add link to migration guides (#2135) 2022-10-05 10:12:07 +02:00
Tymoteusz Czech
df11ad9135
fix: "Reset password" page works when password authentication is disabled (#2126)
fix: password reset with only sso enabled

show correct error message
2022-10-05 09:02:20 +02:00
Thomas Heartman
0e4734af38
docs: Update docs with new constraint availability (#2113)
* docs: fix duplicated image.

* docs: add announcement banner for constraints

* docs: style announcement bar via CSS

* docs: update doc availability notices

* docs: remove commented-out announcement bar code
2022-10-04 14:13:52 +02:00
Pranshu Khanna
688ca2c53f
Updated Readme with the Constraints Announcement 2022-10-04 14:04:28 +02:00
Nuno Góis
e53d40c588
fix: strategy name sort (#2130) 2022-10-04 10:41:43 +01:00
Aneesh Relan
528748e757
fix: use correct column name for correct member count (#2127) 2022-10-04 10:45:55 +03:00
sjaanus
9473ffd4f2 4.16.0 2022-10-03 13:26:08 +03:00
sjaanus
b26d2f2218
Fix yarn lint to fmt:check (#2125) 2022-10-03 12:20:47 +02:00
Nuno Góis
ddcfe132e4
feat: new profile page and PATs front-end (#2109)
* feat: new user dropdown and profile page

* fix: add popup boxShadow to dark-theme

* fix: update routes snap

* refactor: move some tab specific logic into tabs component

* add useProfile hook example

* fix profile tab header (no name)

* fix: hide user popup when clicking profile link

* - add PATs to profile;
- add route logic to profile;
- refactor TimeAgoCell title;
- misc fixes and refactoring;

* add profile info to profile tab

* simplify req paths

* add PAT flag to the front-end

* fix: some UI adjustments

* change user popup buttons to links

* fix profile on front-end, add role description

* update delete PAT text

* address some PR comments

* address PR comments

* some more UI fixes and refactoring

* move password request to API hook
2022-10-03 10:49:52 +01:00
Ivar Conradi Østhus
8099acd216
fix: update coverage 2022-09-30 20:24:46 +02:00
Ivar Conradi Østhus
c59d40fba9
fix: updated develper guide to force UTC timezone for test db 2022-09-30 20:21:03 +02:00
Gard Rimestad
ba8bdc585a
fix: url encode application name in links (#2121)
* fix: url encode application name in links

This ensures that we url encode application names for our links.
2022-09-30 15:53:02 +02:00
Ivar Conradi Østhus
5141e77bce
fix: add appName to http response time metrics (#2117) 2022-09-30 15:28:50 +02:00
andreas-unleash
bd9172b7a0
Update public signup migration files (#2120)
Update
2022-09-30 15:20:24 +03:00
sjaanus
ddc759ac63
Add some extra fields for profile (#2119)
First version
2022-09-30 14:36:45 +03:00
Tymoteusz Czech
47152cf05b
Feat/invite user (#2061)
* refactor: user creation screen cleanup

* feat: deprecation notice for google sso

* fix: docs openid typo

* invite link bar

* invite link page

* fix prettier docs

* regenerated openapi

* hooks for invite page api

* update openapi

* feat: invite link update

* feat: add public signup token soft-delete

* public signup frontend feature flag

* fix: new user api issues

* feat: allow for creating new user from invite link

* Feat/invite user public controller (#2106)

* added PublicInviteController for public urls

* added PublicInviteController for public urls

* added PublicInviteController for public urls

* added PublicInviteController for public urls

* fix test

* fix test

* update openapi

* refactor: password reset props

* fix: public invite schema and validation

Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>

* user invite frontend

Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>

* invite link delete confirmation dialog

* refactor: password reset action

* fix: new user invite loading state

* fix: run ts check with ci

* revert openapi changes

* fix: invite token api interface

* fix: openapi schema index

* fix: update test snapshots

* update frontend snapshot

* fix: prettier ci

* fix: updates after review

Co-authored-by: andreas-unleash <104830839+andreas-unleash@users.noreply.github.com>
Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>
2022-09-30 13:01:32 +02:00
andreas-unleash
5e2d96593a
sort feature strategies by created_at first and then sort_order (#2116)
* sort feature strategies by created_at first and then sort_order

* fix sorting
2022-09-30 12:50:00 +03:00
Ivar Conradi Østhus
ef965d66de
feat: Open-Source Strategy Constraints (#2112)
This commits lift the flags and makes Strategy Constraints
available to all users of Unleash.

Read more in the docs:
https://docs.getunleash.io/advanced/strategy_constraints

Enjoy!

@ivarconr
Author and maintainer
2022-09-30 10:45:34 +02:00
Ivar Conradi Østhus
9ba441b9cf
fix: typo in strategy-constraints.md (#2115) 2022-09-29 19:26:14 +02:00
sjaanus
ec7e256140
Backend for profile page (#2114)
* First version of profile

* Fix tests

* Fix typings

* Replace where to andwhere to be more clear
2022-09-29 16:27:54 +03:00
Thomas Heartman
0302b3d2e3
fix: Update UI labeling: custom constraint -> (strategy) constraint (#2101)
* fix: change every instance of "custom constraint"

This changes every instance of "custom constraint" to "constraint" or
"strategy constraint" depending on the context.

* fix: rename custom-constraint.png to avoid confusion

* Update images-constraints

Co-authored-by: NicolaeUnleash <103567375+NicolaeUnleash@users.noreply.github.com>
2022-09-29 11:43:04 +02:00
Thomas Heartman
51a64eff47 Docs: fix typo: Unlash -> Unleash 2022-09-29 09:31:54 +02:00
sjaanus
d5f621f3b2
Add test for api-token-middleware to not make database call when using PAT (#2110)
* Middleware first version

* Middleware tests

* Add tests

* Finish middleware tests

* Add type for request

* Add flagresolver

* Fix snapshot

* Update flags and tests

* Put it back as default

* Update snapshot

* Add middleware test
2022-09-29 08:53:29 +03:00
sjaanus
d79ace57ec
Personal access token middleware (#2069)
* Middleware first version

* Middleware tests

* Add tests

* Finish middleware tests

* Add type for request

* Add flagresolver

* Fix snapshot

* Update flags and tests

* Put it back as default

* Update snapshot
2022-09-28 16:53:56 +03:00
Fredrik Strand Oseberg
7fbe227e0f
Fix/frontendapi synchronization (#2100)
* feat: add db fetch polling for proxy endpoints

* feat: add test for retrieving cache on interval

* feat: configurable interval

* fix: add config options

* feat: docs

* fix: add config to proxy-repository

* fix: update snapshots

* Update website/docs/reference/front-end-api.md

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

* fix: update docs

* Update website/docs/deploy/configuring-unleash.md

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

* Update website/docs/reference/front-end-api.md

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2022-09-28 14:23:41 +02:00
Tymoteusz Czech
0086f2f19f
Fix: prevent password reset email flooding (#2076)
* fix: prevent password reset email flooding

* feat: add tests to user service for password reset
2022-09-28 10:24:43 +02:00
Thomas Heartman
86824d693f
docs(fix): fix broken link to front-end API tokens (#2094)
This change fixes a broken link to front-end API tokens from the front-end API page. The anchor had changed.
2022-09-27 15:52:06 +02:00
Gastón Fournier
65f2aaf6f5
fix: support coverage reports on external PRs (#2087)
* fix: support coverage reports on external PRs
* removed the coverage comment on the PR until we can investigate this further

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2022-09-27 15:51:04 +02:00
Saketsuraj
501c08a4b1
Updated name and parameters description (#2083)
## Description

Updates descriptions for "name" and "parameters" fields of custom activation strategies to clarify what they are and should be used for.

## Commits

* Updated name and parameters description

* Update website/docs/advanced/custom-activation-strategy.md

Co-authored-by: Thomas Heartman <thomasheartman+github@gmail.com>

* updated name's and parameter's description

Co-authored-by: Thomas Heartman <thomasheartman+github@gmail.com>

Co-authored-by: Thomas Heartman <thomasheartman+github@gmail.com>
2022-09-27 13:41:32 +02:00
Gard Rimestad
9aa1c7aeb0
fix: client registration events are on eventStore (#2093)
Client registration events are on eventStore and not on eventBus. This
change makes us have sdk name and version metrics in unleash.
2022-09-27 11:06:06 +02:00
andreas-unleash
0da2054aa4
fixed missing role by calling get after insert (#2091)
* fixed missing role by calling get after insert

* update snapshot
2022-09-26 16:50:54 +03:00
sjaanus
b206d582ed
Fix snapshot so tests will work (#2092)
Fix snapshot
2022-09-26 16:30:18 +03:00
sjaanus
2a54ace005
Add description to PAT (#2090)
* Add description to PAT

* Add tests
2022-09-26 15:42:39 +03:00
Gastón Fournier
c8a007684a
Revert usage of pull_request_target (#2088) 2022-09-26 12:53:20 +02:00
Gard Rimestad
17d1d2288c
fix: make unit test target work (#2082)
This makes `yarn test:unit` work
2022-09-26 12:30:10 +02:00
andreas-unleash
aa589b5ff5
Fix/oas response (#2068)
* bug fix

* bug fix

* remove doc file

* store fixes

* bug fix

* rollback deleted file

* fix test

* add url to token

* return all tokens not just active

* add url fix

* PR comment

* PR comment

* PR comment

* add the flag to the experimental options

* fix env var name
2022-09-26 13:06:30 +03:00
sjaanus
1426d5be33
Added login endpoint rate limit (#2074)
* Added login rate limit

* Make more pretty

* Make more pretty

* Fix

* Remove double after all
2022-09-26 10:58:58 +03:00
sjaanus
74c5db60be
Fix openapi snapshot so tests will not fail (#2085)
Fix openapi
2022-09-26 10:15:29 +03:00
Thomas Heartman
f131d5a7f8
fix: Revert breaking change for incoming token creation reqs (#2084)
## What

This change reverts the spec change to create-api-token-schema that
was introduced in 97c2b3c089

That commit changed the endpoint from allowing any string to only
allowing strings that match the values of the ApiTokenType value.

## Why

Because we already validate this on the backend, I didn't think it
would break anything. However, because OpenAPI enums are case
sensitive (and do not currently support anything else), it _did_ break
the API. ([stack overflow post that explains how this
works](https://stackoverflow.com/questions/60772786/case-insensitive-string-parameter-in-schema-of-openapi))

## Of note

This should have been caught by the tests, but it didn't show up until
it was merged to the main branch. I think it might be worth looking
into how we do the PR testing.
2022-09-23 16:01:47 +02:00
Thomas Heartman
97c2b3c089
openapi: improve validation testing (#2058)
## What

This PR adds an extra layer of OpenAPI validation testing to what we already have. It also fixes any issues that make the new tests fail.

## Why

While the current OpenAPI validation takes care of _some_ things, there's also things it misses, as shown by #2055. By adding the OpenAPI Enforcer package, we should hopefully be able to catch more of these errors in the future. The enforcer _does_ flag the issue in #2055 as an error.

## How

By adding the OpenAPI Enforcer package and making whatever changes it picks up on.

By adding location headers to all our 201 endpoints. I also had to change some signatures on `create` store methods so that they actually return something (a lot of them just returned `void`).

## Discussion points

### Code changes

Some of the code changes may not be necessary or we may want to change more code to align with what changes have been done. It may be worth standardizing on a pattern for `*store.create` methods, so that they always return an identifier or the stored object, for instance.

### On relative URIs

The 201 location headers use relative URIs to point to the created resources. This seemed to be the easiest way to me, as we don't need to worry about figuring out what the absolute URL of the instance is (though we could probably just concat it to the request URI?). The algorithm for determining relative URIs is described in [RFC 3986 section 5](https://www.rfc-editor.org/rfc/rfc3986#section-5).

There's also some places where I'm not sure we _can_ provide accurate location url. I think they're supposed to point _directly at_ whatever the resource is, but for some resources (such as api tokens), you can only get it as part of a collection. From [RFC 9110 on the location field](https://httpwg.org/specs/rfc9110.html#field.location) (emphasis mine):

> the Location header field in a [201 (Created)](https://httpwg.org/specs/rfc9110.html#status.201) response is supposed to provide a URI that is **specific** to the created resource.

A link to a collection is not specific. I'm not sure what best to do about this.

### Inline comments

I've added a number of inline PR comments that I'd love to get some feedback on too. Have a look and let me know what you think!

### Unfinished business

I've added some juicy comments to some of the files here. They contain non-blocking issues that I'm tracking (via github issues). We should resolve them in the future, but right now they can stay as they are. 

## Commits

* Feat: add openapi-enforcer + tests; fix _some_ issues

* Test: allow non-standard string formats

* validation: fix _some_ 201 created location header endpoints

* #1391: fix remaining 201 location headers missing

* Refactor: use the ajv options object instead of add* methods

* #1391: flag validation errors and warnings as test failures

* #1391: modify patch schema to specify either object or array

We don't provide many patch endpoints, so we _could_ create separate
patch operation objects for each one. I think that makes sense to do
as part of the larger cleanup. For now, I think it's worth to simply
turn it into one of these. While it's not entirely accurate, it's
better than what we had before.

* Refactor: make tests easier to read

* #1391: use enum for valid token types

This was previously only a description. This may seem like a breaking
change because OpenAPI would previously accept any string. However,
Joi also performs validation on this, so invalid values wouldn't work
previously either.

* #1391: Comment out default parameter values for now

This isn't the _right_ way, but it's the pragmatic solution. It's not
a big deal and this works as a stopgap solution.

* #1391:  add todo note for api token schema fixes

* #1391: update snapshot

* Revert "#1391: modify patch schema to specify either object or array"

This reverts commit 0dd5d0faa1.

Turns out we need to allow much more than just objects and arrays.
I'll leave this as is for now.

* Chore(#1391): update comment explaining api token schema TODO

* #1391: modify some test code and add comment

* #1391: update tests and spec to allow 'any' type in schema

* Chore: remove comment

* #1391: add tests for context field stores

* #1391: add location header for public signup links

* #1391: fix query parameter description.

There was indeed a bug in the package, and this has been addressed
now, so we can go back to describing the params properly.
2022-09-23 15:02:09 +02:00
Christopher Kolstad
667fb9a8cf
fix: deletes all sessions for user on logout (#2071)
* fix: deletes all sessions for user on logout
2022-09-23 14:19:17 +02:00
Thomas Heartman
a3585343e1
docs: Move user groups section to after permissions section (#2081)
The permissions section is a subsection of the CPR section and
shouldn't be separated. This seems to have been an oversight.
2022-09-23 11:15:15 +02:00
Gard Rimestad
87a9789300
fix: s/Never logged/Never/g in frontend (#2075)
When a user has never been logged in "last login: never" reads better
than "last login: Never logged".
2022-09-23 10:00:06 +02:00
Thomas Heartman
d7b2874afd
Fix(#1391): fix edge case URLs in code samples (#2078) 2022-09-21 11:24:25 +02:00
Thomas Heartman
0a99dfd6e3
#1391: add generated doc cleaning script (#2077)
* #1391: add generated doc cleaning script

## What

The cleaning script replaces all references to the Unleash ushosted instance in the
generated OpenAPI docs. It removes extra path segments (such as leading
`/ushosted` instances) and replaces the ushosted base url with something
user-agnostic.

## Why

When we host the OpenAPI docs in our official documentation, the generated
docs shouldn't necessarily point at _one specific instance_, and especially
not one that the reader is unlikely to ever use. Instead, we can remove all
the bits that are specific to the generation source we use, and make the docs
easier to use. In particular, removing the leading `/ushosted` is likely to
save us loooots of questions.

* #1391: change env var used for generating openapi from localhost

Using NODE_ENV=development doesn't necessarily make sense, so adding
an extra variable sounds reasonable to me.

* #1391: ensure that all generation commands also clean docs

* #1391: change <your-unleash-instance-url> to <your-unleash-url>

* #1391: fix ushosted replacement: not all paths start with /api

* #1391: chore: remove potential `ushosted` ending of api url

In the event that we change the base URL of OpenAPI, so that paths
don't start with `/ushosted/`, the script should still work, changing
those paths into <your-unleash-url> too.

Additionally, remove all instances of `/ushosted` that we find. In the
event that some things switch around or whatever.
2022-09-20 12:43:39 +02:00
Thomas Heartman
1b1dcea769 Docs(fix): update docusaurus deploy command to generate openapi docs
Without this, the build fails 🙈
2022-09-19 14:53:34 +02:00
Thomas Heartman
2d04bd9ea2
Add OpenAPI docs (#1391) (#2066)
## What

This PR (finally 🎉) adds generated OpenAPI docs to the official Unleash documentation. In addition to generating docs when things get merged to main, it also pushes new doc updates every day at 12:00 AM (cron `@daily`).

## Why

Now that we have OpenAPI'd all the things, we can finally start using it. This will allow us to remove hand-written api docs from the documentation and should make sure everything is always kept up to date.

### Generating from us-hosted (Unleash enterprise)

Unleash has several different versions (open source, pro, enterprise). The versions do not necessarily have the exact same api surface. In fact, the enterprise version has a few endpoints that open source does not.

Because we want to have _all_ endpoints listed in the documentation we need to generated the docs from an enterprise spec. Which brings us into the next point:

### The need for scheduled jobs

Regarding the daily scheduled tasks to update the documentation: why do we need that?

The docs are generated from the tip of the main branch. For most of the docs, this is good and something that we want. However, because the OpenAPI docs are generated from the enterprise edition, it _will not be in sync_ with the open source main branch.

Also, we probably do not want the docs to list the current bleeding edge api changes. Instead, we should prefer to use the latest enterprise release (roughly). However, because we don't get notified when this version is released and deployed, we'll instead run the API generation on a daily cadence.

This isn't the perfect solution, but it's simple and gets us 80% of the way there. More intricate solutions can be set up later.

## How

-   By adding a scheduled workflow to the generate docs config.
-   By adding .gitignore entries for the generated files

There's also some minor changes in styling etc.

## Dependencies

This is dependent on the changes introduced in #2062 having propagated to the enterprise release, which will probably not be for another week or so.

## Discussion

What should the API reference docs url be? I've set it to be `/reference/api/unleash/*` for now, but I'm on the fence about whether it should be `apis` or `api` in there. I also want to get the proxy and other APIs in there as we grow.

-------

## Commits

* docs: style openapi operation buttons

* docs: minor operation badge adjustments

* docs: use permalink to css snippet i copied

* docs: ignore files related to openapi generation

* docs: re-enable openapi docs

* Docs(#1391): prep for integration

* docs(#1391): run docs generation daily

* docs(#1391): add generation step to doc prs too

* docs(#1391): use the US hosted instance to generate docs

* docs(#1391): move doc generation into build command

* docs(#1391): use `/reference/api/*` instead of `/reference/apis/*`
2022-09-19 14:50:24 +02:00
Thomas Heartman
2484720c74
docs: fix broken link to how-to-create-API token guide (#2073) 2022-09-19 13:18:44 +02:00