feat(onboarding): enhance integration setup with Docker discovery, URL templating, and API key helpers
Add automatic Docker container discovery during onboarding to pre-select and pre-fill integrations. Introduce base URL templating with subdomain/port modes, API key settings path links, and a curated onboarding list that hides niche integrations (GitHub, npm, Docker Hub, etc.). Prevent duplicate widget seeding and remove the timetable widget from defaults.
This commit is contained in:
18 files changed
+1056
-56
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import { integrationIconSlugs } from "./docker-integration-match";
|
||||
import type { IntegrationKind } from "./integration";
|
||||
import { getIntegrationDefaultPort } from "./integration";
|
||||
|
||||
export type UrlTemplateMode = "hostPort" | "subdomain";
|
||||
|
||||
const getSlugForKind = (kind: IntegrationKind): string =>
|
||||
integrationIconSlugs[kind] ?? kind.toLowerCase();
|
||||
|
||||
export const buildIntegrationUrl = (
|
||||
kind: IntegrationKind,
|
||||
baseHost: string,
|
||||
mode: UrlTemplateMode,
|
||||
dockerPort?: number,
|
||||
): string => {
|
||||
const host = baseHost.trim().replace(/\/+$/, "");
|
||||
if (!host) return "";
|
||||
|
||||
const slug = getSlugForKind(kind);
|
||||
|
||||
const modeBuilders: Record<UrlTemplateMode, () => string> = {
|
||||
subdomain: () => `http://${slug}.${host}`,
|
||||
hostPort: () => {
|
||||
const port = dockerPort ?? getIntegrationDefaultPort(kind);
|
||||
return port ? `http://${host}:${port}` : `http://${host}`;
|
||||
},
|
||||
};
|
||||
|
||||
return modeBuilders[mode]();
|
||||
};
|
||||
Reference in new issue
Block a user