Skip to content

feat: unify base URL config and add region dropdown with manual override#7842

Open
afsuyadi wants to merge 8 commits into
Flagsmith:mainfrom
afsuyadi:fix/unify-baseurl-config
Open

feat: unify base URL config and add region dropdown with manual override#7842
afsuyadi wants to merge 8 commits into
Flagsmith:mainfrom
afsuyadi:fix/unify-baseurl-config

Conversation

@afsuyadi

Copy link
Copy Markdown
Contributor

Thanks for submitting a PR! Please check the boxes below:

  • [✔] I have read the Contributing Guide.
  • [ ] I have added information to docs/ if required so people know about the feature.
  • [✔] I have filled in the "Changes" section below.
  • [✔] I have filled in the "How did you test this code" section below.

Changes

Contributes to #7795

  1. Add options array with label and value (URL) key for Amplitude, Datadog, Heap, Mixpanel, and New Relic integration
  2. Modify CreateEditIntegration component to enable Custom URL as manual override

How did you test this code?

For every platform, I try to manually test them by choosing the options in Select component, either selecting the existing options or manually inserting the URL

Datadog testing:
datadog-testing.webm

Amplitude testing:
amplitude-testing.webm

Heap testing:
heap-testing.webm

New Relic testing:
new-relic_testing.webm

Mixpanel testing:
mixpanel-testing.webm

Additional Note

  1. During Mixpanel's testing, it seems that the backend serializer haven't existed yet. Mentioning this unmerged PR fix: add regional base URL for Mixpanel #7802 which is related to the serializer of Mixpanel.
  2. I plan to also add dropdown for LaunchDarkly, but it seems that it requires backend changes (new model field, migration, serializer update, client update), which seems to be out of this issue's scope. Waiting for further instructions.

@afsuyadi
afsuyadi requested a review from a team as a code owner June 20, 2026 04:55
@afsuyadi
afsuyadi requested review from kyle-ssg and removed request for a team June 20, 2026 04:55
@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

@afsuyadi is attempting to deploy a commit to the Flagsmith Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the front-end Issue related to the React Front End Dashboard label Jun 20, 2026
@afsuyadi afsuyadi changed the title Unify base URL config and add region dropdown with manual override feat(integration): unify base URL config and add region dropdown with manual override Jun 20, 2026
@manos-saratsis

This comment was marked as spam.

@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview, Comment Jul 15, 2026 1:15pm
flagsmith-frontend-staging Ready Ready Preview, Comment Jul 15, 2026 1:15pm

Request Review

kyle-ssg
kyle-ssg previously approved these changes Jul 15, 2026
Extract the Select value into an if/else chain to satisfy the
no-nested-ternary rule failing CI.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Integration defaults now expose regional and custom URL options for several integrations. The integration modal tracks custom URL selections, renders text inputs for custom values, resets custom state during data changes, and normalises New Relic base_url values before create or update requests. A reusable ensureTrailingSlash utility and tests cover trailing-slash handling.

Estimated code review effort: 3 (Moderate) | ~20 minutes


Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: fc781497-b42b-4815-bdbe-67981828a9c5

📥 Commits

Reviewing files that changed from the base of the PR and between 51858d6 and cd863e4.

📒 Files selected for processing (2)
  • frontend/common/stores/default-flags.ts
  • frontend/web/components/modals/CreateEditIntegrationModal.tsx

Comment thread frontend/common/stores/default-flags.ts Outdated
Comment thread frontend/web/components/modals/CreateEditIntegrationModal.tsx
Comment thread frontend/web/components/modals/CreateEditIntegrationModal.tsx Outdated
@kyle-ssg kyle-ssg changed the title feat(integration): unify base URL config and add region dropdown with manual override fea: unify base URL config and add region dropdown with manual override Jul 15, 2026
@kyle-ssg kyle-ssg changed the title fea: unify base URL config and add region dropdown with manual override feat: unify base URL config and add region dropdown with manual override Jul 15, 2026
- Point Datadog presets at the per-site API hosts (base_url feeds the
  Events API, so app hosts and the datadoghw typo would fail)
- Point New Relic presets at the REST v2 API hosts with the trailing
  slash NewRelicWrapper requires
- Clear customUrlFields whenever the form resets so a stale Custom URL
  selection can't leak into another project's form
- Only apply custom-URL handling to fields offering the 'custom'
  sentinel, restoring 'Please select' for unmatched Slack channels

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
frontend/web/components/modals/CreateEditIntegrationModal.tsx (1)

360-396: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Prevent submission with an empty custom URL.

Selecting custom immediately writes '' to formData, but the Save button and handleSubmit do not enforce Input.isValid. Users can therefore submit an empty base_url, resulting in an unusable integration or a guaranteed backend failure. Disable Save or validate every entry in customUrlFields before sending the mutation.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 82050c66-a826-4ec6-a6c3-9cbb6e0e373e

📥 Commits

Reviewing files that changed from the base of the PR and between cd863e4 and 32edc28.

📒 Files selected for processing (2)
  • frontend/common/stores/default-flags.ts
  • frontend/web/components/modals/CreateEditIntegrationModal.tsx

Comment thread frontend/common/stores/default-flags.ts
kyle-ssg and others added 2 commits July 15, 2026 13:41
NewRelicWrapper appends v2/applications/... directly to base_url, so a
custom URL without a trailing slash produced a malformed request URL.
Append the slash before create/update submissions and cover the helper
with unit tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replace the integration-specific normaliseIntegrationBaseUrl helper
with a generic string util; the New Relic condition now lives at the
submit call site where the constraint is documented.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 27b81650-1717-4056-9148-cbf8336197cf

📥 Commits

Reviewing files that changed from the base of the PR and between 32edc28 and cb14186.

📒 Files selected for processing (3)
  • frontend/common/utils/__tests__/normaliseIntegrationBaseUrl.test.ts
  • frontend/common/utils/normaliseIntegrationBaseUrl.ts
  • frontend/web/components/modals/CreateEditIntegrationModal.tsx

Comment thread frontend/common/utils/__tests__/normaliseIntegrationBaseUrl.test.ts Outdated
Heap's EU Track API endpoint is https://c.eu.heap-api.com/api/track;
heapanalytics.eu is not a Heap ingest host.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
frontend/web/components/modals/CreateEditIntegrationModal.tsx (1)

388-391: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Prevent saving an empty Custom URL.

Selecting Custom URL clears the field, but submission does not validate customUrlFields, and the Save button remains enabled. This allows base_url: '' to be submitted; New Relic normalisation intentionally leaves empty strings unchanged. Block submission, or disable Save, until every selected custom URL contains a non-whitespace value.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5700d5da-da0f-4879-8b0f-f8d91a66758f

📥 Commits

Reviewing files that changed from the base of the PR and between cb14186 and b8406ef.

📒 Files selected for processing (3)
  • frontend/common/utils/__tests__/ensureTrailingSlash.test.ts
  • frontend/common/utils/ensureTrailingSlash.ts
  • frontend/web/components/modals/CreateEditIntegrationModal.tsx

Reconciles the Heap and Mixpanel base_url presets added on main by
Flagsmith#7732/Flagsmith#7802 with the ones added here (duplicate field definitions
after an otherwise clean auto-merge).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@kyle-ssg
kyle-ssg requested review from a team and talissoncosta and removed request for a team July 15, 2026 13:06
@kyle-ssg

Copy link
Copy Markdown
Member

Thank you for this, adding a custom option to selects makes a lot of sense and the new options are very sensible. @talissoncosta I can't approve and push this since I pushed a couple fixes to the branch, are you able to review?

@afsuyadi

Copy link
Copy Markdown
Contributor Author

Thank you for this, adding a custom option to selects makes a lot of sense and the new options are very sensible. @talissoncosta I can't approve and push this since I pushed a couple fixes to the branch, are you able to review?

Yes, assuming they might establish new regions, so we just need to add the new label and value.
For other third-party tools that aren't moidified in this PR (Issue #7795 ), do we need to make some changes for them too? @kyle-ssg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants