Add PostHog source UI with region select
Show a US/EU region dropdown for the PostHog Cloud API-key form and an instance-URL field for Self-Hosted, map both to the connector inputs, and register the PostHog logo for the self-hosted provider. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
@@ -122,6 +122,12 @@ function mapAPIKeyExtraSettingToField(
|
|||||||
case "METABASE":
|
case "METABASE":
|
||||||
if (settingKey === "instanceUrl") return "metabaseInstanceUrl";
|
if (settingKey === "instanceUrl") return "metabaseInstanceUrl";
|
||||||
break;
|
break;
|
||||||
|
case "POSTHOG":
|
||||||
|
if (settingKey === "region") return "posthogRegion";
|
||||||
|
break;
|
||||||
|
case "POSTHOG_SELF_HOSTED":
|
||||||
|
if (settingKey === "instanceUrl") return "posthogInstanceUrl";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -580,7 +586,26 @@ export function AddAccessSourceDialog({
|
|||||||
required
|
required
|
||||||
autoFocus
|
autoFocus
|
||||||
/>
|
/>
|
||||||
{activeProvider?.extraSettings.map(setting => (
|
{activeProvider?.extraSettings.map(setting =>
|
||||||
|
setting.key === "region"
|
||||||
|
? (
|
||||||
|
<div key={setting.key} className="space-y-1.5">
|
||||||
|
<label className="text-sm font-medium">{__(setting.label)}</label>
|
||||||
|
<Select
|
||||||
|
value={extraSettingValues[setting.key] ?? ""}
|
||||||
|
onValueChange={(val: string) =>
|
||||||
|
setExtraSettingValues(prev => ({
|
||||||
|
...prev,
|
||||||
|
[setting.key]: val,
|
||||||
|
}))}
|
||||||
|
placeholder={__("Select a region")}
|
||||||
|
>
|
||||||
|
<Option value="US">{__("United States (US)")}</Option>
|
||||||
|
<Option value="EU">{__("Europe (EU)")}</Option>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
: (
|
||||||
<Field
|
<Field
|
||||||
key={setting.key}
|
key={setting.key}
|
||||||
label={__(setting.label)}
|
label={__(setting.label)}
|
||||||
@@ -592,7 +617,8 @@ export function AddAccessSourceDialog({
|
|||||||
}))}
|
}))}
|
||||||
required={setting.required}
|
required={setting.required}
|
||||||
/>
|
/>
|
||||||
))}
|
),
|
||||||
|
)}
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ const thirdParties: Record<string, FC<ComponentProps<"svg">>> = {
|
|||||||
OPENAI: OpenAI,
|
OPENAI: OpenAI,
|
||||||
PAGERDUTY: PagerDuty,
|
PAGERDUTY: PagerDuty,
|
||||||
POSTHOG: PostHog,
|
POSTHOG: PostHog,
|
||||||
|
POSTHOG_SELF_HOSTED: PostHog,
|
||||||
RESEND: Resend,
|
RESEND: Resend,
|
||||||
SENTRY: Sentry,
|
SENTRY: Sentry,
|
||||||
SLACK: Slack,
|
SLACK: Slack,
|
||||||
|
|||||||
Reference in New Issue
Block a user