feat(hybrid-cloud): Adds region selector dropdown behind feature flag#59164
Conversation
|
🚨 Warning: This pull request contains Frontend and Backend changes! It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently. Have questions? Please ask in the |
Codecov Report
@@ Coverage Diff @@
## master #59164 +/- ##
==========================================
+ Coverage 80.39% 80.75% +0.35%
==========================================
Files 5165 5164 -1
Lines 225901 225928 +27
Branches 38021 38022 +1
==========================================
+ Hits 181613 182448 +835
+ Misses 38645 37948 -697
+ Partials 5643 5532 -111
|
6f7109d to
bd038e7
Compare
| addLoadingMessage(t('Saving changes\u2026')); | ||
| api.request(apiEndpoint, { | ||
|
|
||
| const request_options: RequestOptions = { |
There was a problem hiding this comment.
| const request_options: RequestOptions = { | |
| const requestOptions: RequestOptions = { |
| request_options.host = hostOverride; | ||
| } | ||
|
|
||
| api.request(apiEndpoint, request_options); |
There was a problem hiding this comment.
| request_options.host = hostOverride; | |
| } | |
| api.request(apiEndpoint, request_options); | |
| requestOptions.host = hostOverride; | |
| } | |
| api.request(apiEndpoint, requestOptions); |
To align better with naming conventions elsewhere in our JS code.
| ConfigStore.get('privacyUrl'); | ||
|
|
||
| // Set only a single region in the config store by default | ||
| ConfigStore.set('regions', [{name: '--monolith--', url: 'https://example.com'}]); |
There was a problem hiding this comment.
You might be leaking state here. Should we backup state at the beginning of beforeEach() and restore in an afterEach?
There was a problem hiding this comment.
Good point, I'll go ahead and add that. Do we have global setup/teardown fixtures for ConfigStore by chance?
There was a problem hiding this comment.
Do we have global setup/teardown fixtures for ConfigStore by chance?
I don't think we have global setup/teardown on any of our reflux stores.
| return [url, RegionDisplayName[regionName]]; | ||
| } | ||
|
|
||
| return [url, name]; |
There was a problem hiding this comment.
If we're sending the host name for the region in the request, do we parse the URL in the server side? Should we be sending the region name instead so that we don't have to parse URLs from user data?
There was a problem hiding this comment.
As far as I know, the region is unused/extraneous in the request body, but I couldn't figure out how to omit it from the form data 😅 Ideally we wouldn't send this at all.
There was a problem hiding this comment.
We could supply a model to ApiForm that omits the region field from the serialized request data via the transformData method.
sentry/static/app/components/forms/model.tsx
Lines 324 to 334 in 563e619
is the signature for FormModel.transformData and an existing usage can be found here
sentry/static/app/components/modals/sentryAppPublishRequestModal.tsx
Lines 44 to 61 in 563e619
Implements a simple dropdown with default region mapping for our two expected regions, guarded behind a feature flag.
Automatically routes the provision request to the correct region when one is selected via the dropdown.
Without the feature flag enabled, or with it enabled in monolith mode:
With the feature flag enabled and with multiple regions: