Fix the Segment region input and invite duplicates
The region is a two-value allow-list the server resolves to an API host, but it rendered as a free-text field: only PostHog is special-cased in the API-key dialog, everything else falls through to a generic Field. Typing "EU1" — the region Segment's own UI shows for the EU workspace — passed the non-empty check, then failed the mutation, and the dialog's generic error blamed the API key. It is a select now, so the label no longer has to spell the accepted values out. An invite that has already been accepted can still be listed, and the member and the invite were keyed differently (user ID vs email), so the same person surfaced as two rows — one active with roles, one inactive without. Invites for an email already seen among members are dropped. Per-user permission errors now name the user, and the probe URL builds its query with url.Values rather than a hand-written string. The region-to-host mapping is the only API-key setting that derives a value instead of storing input verbatim, and it had no test; a typo in either host would only have surfaced as a live 404. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
@@ -26,6 +26,8 @@ import {
|
||||
DialogContent,
|
||||
DialogFooter,
|
||||
Field,
|
||||
Option,
|
||||
Select,
|
||||
useDialogRef,
|
||||
useToast,
|
||||
} from "@probo/ui";
|
||||
@@ -248,7 +250,8 @@ export function APIKeyConnectorDialog({
|
||||
};
|
||||
|
||||
// PostHog renders a dedicated deployment selector (Cloud region or
|
||||
// self-hosted URL); every other provider falls back to generic fields.
|
||||
// self-hosted URL) and Segment a region selector; every other provider falls
|
||||
// back to generic fields.
|
||||
const renderAPIKeyExtraSettings = () => {
|
||||
if (!provider) {
|
||||
return null;
|
||||
@@ -263,6 +266,25 @@ export function APIKeyConnectorDialog({
|
||||
);
|
||||
}
|
||||
|
||||
// The server maps this to a regional API host and rejects anything outside
|
||||
// the allow-list, so it must not be typed by hand.
|
||||
if (provider.provider === "SEGMENT") {
|
||||
return (
|
||||
<div className="space-y-1.5">
|
||||
<label className="text-sm font-medium">{__("Region")}</label>
|
||||
<Select
|
||||
value={extraSettingValues.region ?? ""}
|
||||
onValueChange={(val: string) =>
|
||||
setExtraSettingValues(prev => ({ ...prev, region: val }))}
|
||||
placeholder={__("Select a region")}
|
||||
>
|
||||
<Option value="US">{__("United States")}</Option>
|
||||
<Option value="EU">{__("Europe")}</Option>
|
||||
</Select>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return provider.extraSettings.map((setting) => {
|
||||
const value = extraSettingValues[setting.key] ?? "";
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user