Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions dashboard/e2e/support.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,3 +395,61 @@ test.describe("the platform admin's support queue", () => {
await shot(page, "support-queue-phone");
});
});

// Settings, hosted only: "Move to your own AWS account" opens Contact us with
// the move preset and files a normal ticket. A person helps with the move.
test.describe("moving to your own AWS account", () => {
for (const vp of [
{ name: "desktop", width: 1440, height: 900 },
{ name: "phone", width: 390, height: 844 },
]) {
test(`the Settings card files a "Move to self-host" ticket with the answers (${vp.name})`, async ({ page }) => {
await page.setViewportSize({ width: vp.width, height: vp.height });
const db = await mockApi(page);
await page.goto("/settings/");
const card = page.getByTestId("move-to-selfhost");
await expect(card).toContainText("Move to your own AWS account");
await expect(card).toContainText("We'll help you plan the move and bring your settings and data over.");
await card.scrollIntoViewIfNeeded();
await noSideScroll(page);
await card.screenshot({ path: path.join(SHOTS_DIR, `move-card-${vp.width}.png`) });
await shot(page, `move-settings-${vp.width}`);

await card.getByRole("link", { name: "Talk to us about moving" }).click();
await expect(page).toHaveURL(/\/support\/?\?new=1&type=selfhost/);
await expect(page.getByRole("heading", { level: 1, name: "Move to your own AWS account" })).toBeVisible();
await expect(page.getByLabel("Subject")).toHaveValue("Move to self-host");
await page.getByLabel("Team size").selectOption("11 to 50 people");
await page.getByLabel("AWS region").selectOption("eu-west-1");
await page.getByLabel("Settings and instructions").check();
await page.getByLabel("Knowledge and data sources").check();
await noSideScroll(page);
await shot(page, `move-form-${vp.width}`);

// Notes are optional for a move: the answers are the ticket.
await page.getByRole("button", { name: "Send to support" }).click();
await expect(page).toHaveURL(/\/support\/ticket\/?\?id=/);
const post = db.posts.find((p) => p.path === "/api/support/tickets");
expect(post?.body.subject).toBe("Move to self-host");
expect(post?.body.body).toBe(
"**Topic:** Move to self-host\n**Team size:** 11 to 50 people\n**AWS region:** eu-west-1\n**What to bring over:** Settings and instructions, Knowledge and data sources",
);
});
}

test("a self-hosted install never shows the card, and the move link is plain help there", async ({ page }) => {
await page.route((url) => url.pathname === "/runtime-config.js", (route) =>
route.fulfill({ contentType: "text/javascript", body: `window.__CODERHELM_CONFIG__ = ${JSON.stringify({ selfHosted: true })};` }),
);
await mockApi(page);
await page.goto("/settings/");
await expect(page.getByRole("heading", { level: 1, name: "Settings" })).toBeVisible();
await expect(page.getByRole("link", { name: /Notifications/ }).first()).toBeVisible();
await expect(page.getByTestId("move-to-selfhost")).toHaveCount(0);
await expect(page.getByText("Move to your own AWS account")).toHaveCount(0);

await page.goto("/support/?new=1&type=selfhost");
await expect(page.getByRole("heading", { level: 1, name: "Get help" })).toBeVisible();
await expect(page.getByTestId("move-form")).toHaveCount(0);
});
});
30 changes: 29 additions & 1 deletion dashboard/src/app/settings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useToast } from "@/components/toast";
import { Callout } from "@/components/callout";
import { StatusPill } from "@/components/status-pill";
import { Skeleton } from "@/components/skeleton";
import { ChevronRightIcon } from "@/components/icons";
import { ChevronRightIcon, CloudIcon } from "@/components/icons";
import { dangerButton, focusRing, inputClass, secondaryButton } from "@/components/ui";
import { Modal, modalActions } from "@/components/modal";
import { SETTINGS_GROUPS, type SettingsItem } from "@/components/settings-items";
Expand Down Expand Up @@ -85,6 +85,8 @@ export default function SettingsPage() {
))}
</div>

{me && !isSelfHosted() && <MoveToSelfHost />}

{me && can(me, "reset") && <DangerZone />}
</Page>
);
Expand Down Expand Up @@ -122,6 +124,32 @@ function SettingsRow({ item, readOnly, status }: { item: SettingsItem; readOnly:
);
}

/**
* Hosted only: moving the team to its own AWS account starts as a support
* ticket. A person helps plan the move and bring settings and data over.
*/
function MoveToSelfHost() {
return (
<section aria-labelledby="move-to-selfhost" className="mt-10" data-testid="move-to-selfhost">
<SectionHeading id="move-to-selfhost" className="mb-3">
Hosting
</SectionHeading>
<div className="flex items-start gap-3 rounded-lg border border-zinc-800 bg-zinc-900/40 px-4 py-4 lg:max-w-[calc(50%-0.375rem)]">
<span className="mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-zinc-800 bg-zinc-950 text-zinc-300" aria-hidden="true">
<CloudIcon />
</span>
<div className="min-w-0 flex-1">
<p className="text-sm font-medium text-zinc-100">Move to your own AWS account</p>
<p className="mt-0.5 text-sm text-zinc-400">Run Coderhelm in your own AWS account. We&apos;ll help you plan the move and bring your settings and data over.</p>
<Link href="/support?new=1&type=selfhost" className={`${secondaryButton} mt-3`}>
Talk to us about moving
</Link>
</div>
</div>
</section>
);
}

function DangerZone() {
const [open, setOpen] = useState(false);
const [confirmText, setConfirmText] = useState("");
Expand Down
91 changes: 82 additions & 9 deletions dashboard/src/app/support/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { Field } from "@/components/settings";
import { MarkdownEditor, clearDraft } from "@/components/markdown-editor";
import { Segmented } from "@/components/segmented";
import { buttonClass, focusRing, fullWidthOnPhone, primaryButton, secondaryButton } from "@/components/ui";
import { isSelfHosted } from "@/lib/runtime-config";
import { List, ListEmpty, ListError, ListRow, ListSkeleton, ListToolbar, StatusText, useListParams } from "@/components/list";

const KINDS: SupportItemKind[] = ["run", "review", "release", "plan", "alert", "data_source"];
Expand All @@ -43,6 +44,32 @@ const BODY_TIPS = [

const NEW_TICKET_DRAFT = "support:new-ticket";

// "Move to your own AWS account" (Settings, hosted only): a normal ticket
// whose subject names the topic and whose body carries these answers. A
// person helps with the move; nothing is copied automatically.
const MOVE_TOPIC = "Move to self-host";
const TEAM_SIZES = ["1 to 10 people", "11 to 50 people", "51 to 200 people", "More than 200 people"];
const AWS_REGIONS = ["us-east-1", "us-east-2", "us-west-2", "ca-central-1", "eu-west-1", "eu-west-2", "eu-central-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1"];
const BRING_OVER = [
"Settings and instructions",
"Repositories and their settings",
"Knowledge and data sources",
"Memory and what Coderhelm learned",
"Run and review history",
"People and roles",
];

/** The ticket body for a move: the answers first, then anything else they wrote. */
function moveTicketBody(a: { size: string; region: string; bring: string[]; notes: string }): string {
const lines = [
`**Topic:** ${MOVE_TOPIC}`,
`**Team size:** ${a.size || "Not given"}`,
`**AWS region:** ${a.region || "Not sure yet"}`,
`**What to bring over:** ${a.bring.length ? a.bring.join(", ") : "Not sure yet"}`,
];
return a.notes.trim() ? `${lines.join("\n")}\n\n${a.notes.trim()}` : lines.join("\n");
}

export default function SupportPageWithParams() {
return (
<Suspense
Expand Down Expand Up @@ -194,8 +221,11 @@ function NewTicket() {
const from = params.get("from") || "";
// Where the person came from: "Report an issue", "Contact us", or "Get help".
const type = params.get("type");
const intro =
type === "issue"
// Only the hosted service offers the move; on an install it is plain help.
const isMove = type === "selfhost" && !isSelfHosted();
const intro = isMove
? { title: "Move to your own AWS account", lead: "Tell us a little about your team. A person from Coderhelm support will help you plan the move and bring your settings and data over.", placeholder: MOVE_TOPIC }
: type === "issue"
? { title: "Report an issue", lead: "Tell us what went wrong. The page you were on is attached; remove it below if it doesn't help.", placeholder: "A run stopped at the test step" }
: type === "contact"
? { title: "Contact us", lead: "Questions, feedback or anything else. Coderhelm support answers here and by email.", placeholder: "A question about auto-merge" }
Expand All @@ -213,9 +243,14 @@ function NewTicket() {
const [subject, setSubject] = useState(
initialItem
? `Something is wrong with ${initialItem.kind === "review" || initialItem.kind === "alert" ? `an ${initialItem.kind}` : initialItem.kind === "data_source" ? "a data source" : `a ${initialItem.kind}`}`
: "",
: isMove
? MOVE_TOPIC
: "",
);
const [body, setBody] = useState("");
const [size, setSize] = useState("");
const [region, setRegion] = useState("");
const [bring, setBring] = useState<string[]>([]);
const [priority, setPriority] = useState<SupportPriority>("normal");
const [busy, setBusy] = useState(false);
const [error, setError] = useState("");
Expand Down Expand Up @@ -253,10 +288,11 @@ function NewTicket() {
};

const submit = async () => {
if (!subject.trim() || !body.trim() || busy) return;
if (!subject.trim() || (!isMove && !body.trim()) || busy) return;
setBusy(true);
setError("");
const req: NewSupportTicket = { subject: subject.trim(), body: body.trim(), priority };
const text = isMove ? moveTicketBody({ size, region, bring, notes: body }) : body.trim();
const req: NewSupportTicket = { subject: subject.trim(), body: text, priority };
if (page) req.page = page;
if (items.length > 0) req.items = items.map((i) => ({ kind: i.kind, id: i.id, label: i.label || undefined, repo: i.repo || undefined }));
if (people.length > 0) req.people = people.map((p) => (p.outside ? { email: p.email } : { user_id: p.user_id }));
Expand Down Expand Up @@ -293,7 +329,44 @@ function NewTicket() {
placeholder={intro.placeholder}
autoFocus
/>
<Field as="custom" id="ticket-body" label="What happened?">
{isMove && (
<fieldset className="space-y-4" data-testid="move-form">
<legend className="sr-only">About your move</legend>
<div className="grid gap-4 sm:grid-cols-2">
<Field as="select" id="move-size" label="Team size" value={size} onChange={(e) => setSize(e.target.value)}>
<option value="">Choose one</option>
{TEAM_SIZES.map((t) => (
<option key={t} value={t}>{t}</option>
))}
</Field>
<Field as="select" id="move-region" label="AWS region" value={region} onChange={(e) => setRegion(e.target.value)}>
<option value="">Not sure yet</option>
{AWS_REGIONS.map((r) => (
<option key={r} value={r}>{r}</option>
))}
</Field>
</div>
<div>
<p className="mb-1.5 text-sm font-medium text-zinc-200">What to bring over</p>
<ul className="grid gap-1.5 sm:grid-cols-2">
{BRING_OVER.map((b) => (
<li key={b}>
<label className="flex cursor-pointer items-center gap-2.5 text-sm text-zinc-300">
<input
type="checkbox"
checked={bring.includes(b)}
onChange={() => setBring((now) => (now.includes(b) ? now.filter((x) => x !== b) : [...now, b]))}
className="h-4 w-4 shrink-0 accent-emerald-500"
/>
{b}
</label>
</li>
))}
</ul>
</div>
</fieldset>
)}
<Field as="custom" id="ticket-body" label={isMove ? "Anything else? (optional)" : "What happened?"}>
{(ids) => (
<MarkdownEditor
{...ids}
Expand All @@ -303,8 +376,8 @@ function NewTicket() {
maxLength={8000}
minRows={7}
draftKey={NEW_TICKET_DRAFT}
placeholder="What happened, what you expected, and when. The template above gives you a head start."
template={{ label: "Use issue template", text: ISSUE_TEMPLATE }}
placeholder={isMove ? "Dates that matter, anything you must keep, questions about the move." : "What happened, what you expected, and when. The template above gives you a head start."}
template={isMove ? undefined : { label: "Use issue template", text: ISSUE_TEMPLATE }}
tips={BODY_TIPS}
onSubmitShortcut={() => void submit()}
/>
Expand Down Expand Up @@ -398,7 +471,7 @@ function NewTicket() {
<Link href="/support" className={`${secondaryButton} ${fullWidthOnPhone}`}>
Cancel
</Link>
<button type="submit" disabled={busy || !subject.trim() || !body.trim()} className={`${primaryButton} ${fullWidthOnPhone}`}>
<button type="submit" disabled={busy || !subject.trim() || (!isMove && !body.trim())} className={`${primaryButton} ${fullWidthOnPhone}`}>
{busy ? "Sending…" : "Send to support"}
</button>
</div>
Expand Down
14 changes: 14 additions & 0 deletions docs/components/install/wizard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// answers decide the screen.

import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { MOVE_TO_SELF_HOST_URL } from '@/lib/shared';
import {
type Check,
type DnsRecord,
Expand Down Expand Up @@ -531,6 +532,17 @@ function Toggle({ checked, onChange, title, help, testId }: { checked: boolean;
);
}

/** One line for teams coming from the hosted service: a person helps them move. */
function MovingNote({ className = '' }: { className?: string }) {
return (
<p className={`text-sm text-fd-muted-foreground ${className}`} data-testid="moving-note">
Moving from CoderHelm cloud?{' '}
<a className="font-medium text-fd-primary hover:underline" href={MOVE_TO_SELF_HOST_URL}>Talk to us</a>{' '}
and we&apos;ll help move your data.
</p>
);
}

/** What will be created, where it will answer and what it costs, before anyone opens AWS. */
function Summary({ s, cost }: { s: InstallState; cost: { low: number; high: number; model: string } }) {
const address = s.domainChoice === 'coderhelm'
Expand Down Expand Up @@ -565,6 +577,7 @@ function Summary({ s, cost }: { s: InstallState; cost: { low: number; high: numb
</ul>
<p className="mt-3 text-xs leading-5 text-fd-muted-foreground">A small team&apos;s estimate; most of it scales with use. Not included: {cost.model.charAt(0).toLowerCase() + cost.model.slice(1)}.</p>
</details>
<MovingNote className="border-t border-fd-border px-4 py-3" />
</section>
);
}
Expand Down Expand Up @@ -1551,6 +1564,7 @@ export function InstallWizard() {
</li>
))}
</ul>
<MovingNote className="mt-4" />
</section>
);
}
Expand Down
5 changes: 5 additions & 0 deletions docs/e2e/install.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,10 @@ test('ready: the optional setup list, each with its check and one action', async
await expect(list.locator('[data-optional="updates"]')).toHaveAttribute('data-state', 'done');
await expect(list.locator('[data-optional="backups"]')).toContainText('Done by the install');
await expect(page.getByTestId('optional-invite-action')).toHaveAttribute('href', `${INSTALL}/settings/people/`);
// Teams moving from the hosted service: a person helps, by email to support.
const moving = page.getByTestId('screen-ready').getByTestId('moving-note');
await expect(moving).toHaveText("Moving from CoderHelm cloud? Talk to us and we'll help move your data.");
await expect(moving.getByRole('link', { name: 'Talk to us' })).toHaveAttribute('href', 'mailto:support@coderhelm.com?subject=Moving%20to%20self-hosted%20CoderHelm');
assertPrivate(m);
});

Expand Down Expand Up @@ -634,6 +638,7 @@ test('hybrid: pick the setup, the name is checked as you type, and AWS opens wit
await expect(page.getByTestId('name-picker-status')).toHaveText('Available: example-co.coderhelm.com is free. It’s claimed for you once your install answers.');
await expect(page.getByTestId('summary')).toContainText('example-co.coderhelm.com');
await expect(page.getByTestId('summary')).toContainText('CoderHelm’s app');
await expect(page.getByTestId('summary').getByTestId('moving-note').getByRole('link', { name: 'Talk to us' })).toHaveAttribute('href', /^mailto:support@coderhelm\.com\?subject=Moving/);
await page.getByLabel('Your email').fill('ada@example.com');
await page.getByTestId('launch').click();
await expect(page.getByTestId('step-title')).toHaveText('Waiting for AWS');
Expand Down
7 changes: 7 additions & 0 deletions docs/lib/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ export const gitConfig = {
contentDir: 'docs/content/docs',
};

/**
* "Moving from CoderHelm cloud?": an email to support with the topic in the
* subject. A person helps with the move; there is no automatic migration tool.
* coderhelm.com's /self-host/ page uses the same address.
*/
export const MOVE_TO_SELF_HOST_URL = 'mailto:support@coderhelm.com?subject=Moving%20to%20self-hosted%20CoderHelm';

/** The JSON Schema for plugin manifests, served at a stable URL. */
export const PLUGIN_SCHEMA_PATH = '/schema/plugin-manifest.v1.json';

Expand Down
23 changes: 23 additions & 0 deletions src/content/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ export const SITE = {
docsUrl: "https://docs.coderhelm.com",
installUrl: "https://docs.coderhelm.com/self-host/install/",
email: "support@coderhelm.com",
// "Talk to us about moving": the site has no contact form, so moving from
// the hosted service to a self-hosted install starts as an email to support
// with the topic in the subject. A person answers; there is no automatic
// migration tool.
moveUrl: "mailto:support@coderhelm.com?subject=Moving%20to%20self-hosted%20CoderHelm",
tagline: "Ship code, not tickets. The AI engineer that stays on the code after the pull request.",
// The one sentence that defines the product, used word for word in the home
// page, the meta description, JSON-LD and llms.txt.
Expand Down Expand Up @@ -270,6 +275,10 @@ const home: Page = {
type: "note",
text: "The first public self-host release is not out yet. Until it is, you can read through the guide, but an install cannot finish.",
},
{
type: "p",
text: `Moving from CoderHelm cloud? [Talk to us](${SITE.moveUrl}) and we'll help move your settings and data.`,
},
{ type: "shot", shot: "setup", caption: "The Setup page of a self hosted install: each check passing, or saying what is wrong and how to fix it. Example data." },
],
},
Expand Down Expand Up @@ -885,6 +894,20 @@ const selfHost: Page = {
},
],
},
{
id: "moving",
heading: "Moving from CoderHelm cloud?",
blocks: [
{
type: "p",
text: "We'll help you plan the move and bring your settings and data over to your own AWS account. Tell us about your team and a person from CoderHelm will work through it with you.",
},
{
type: "actions",
items: [{ label: "Talk to us about moving", href: SITE.moveUrl }],
},
],
},
{
id: "after",
heading: "It keeps checking itself",
Expand Down
Loading