Skip to content

Commit af26905

Browse files
committed
feat(webapp): preselect manual card and add docs links in private connections setup
- Default 'I have my details' as the selected setup method when opening the Add Private Connection page so the form is immediately usable - Replace the embedded docs iframe in the Step-by-step guide card with a button that opens the docs page in a new tab - Add a 'Docs' nav-bar accessory linking to the private-link setup guide on both the Private Connections list and Add Connection pages, matching the 'Task docs' pattern used elsewhere
1 parent c69e939 commit af26905

2 files changed

Lines changed: 53 additions & 21 deletions

File tree

  • apps/webapp/app/routes
    • _app.orgs.$organizationSlug.settings.private-connections._index
    • _app.orgs.$organizationSlug.settings.private-connections.new

apps/webapp/app/routes/_app.orgs.$organizationSlug.settings.private-connections._index/route.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { logger } from "~/services/logger.server";
1818
import { getPrivateLinks } from "~/services/platform.v3.server";
1919
import { requireUserId } from "~/services/session.server";
2020
import {
21+
docsPath,
2122
OrganizationParamsSchema,
2223
organizationPath,
2324
v3PrivateConnectionsPath,
@@ -29,6 +30,7 @@ import { type ActionFunctionArgs, json } from "@remix-run/server-runtime";
2930
import { deletePrivateLink } from "~/services/platform.v3.server";
3031
import { redirectWithErrorMessage, redirectWithSuccessMessage } from "~/models/message.server";
3132
import {
33+
BookOpenIcon,
3234
ClipboardDocumentIcon,
3335
PlusIcon,
3436
TrashIcon,
@@ -182,6 +184,13 @@ export default function Page() {
182184
<NavBar>
183185
<PageTitle title="Private Connections" />
184186
<PageAccessories>
187+
<LinkButton
188+
variant="docs/small"
189+
LeadingIcon={BookOpenIcon}
190+
to={docsPath("private-networking/overview")}
191+
>
192+
Private connection docs
193+
</LinkButton>
185194
{hasPrivateNetworking && canAdd && (
186195
<LinkButton variant="primary/small" LeadingIcon={PlusIcon} to="new">
187196
Add Connection

apps/webapp/app/routes/_app.orgs.$organizationSlug.settings.private-connections.new/route.tsx

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ import {
1212
PageContainer,
1313
} from "~/components/layout/AppLayout";
1414
import { Button, LinkButton } from "~/components/primitives/Buttons";
15+
import { ClipboardField } from "~/components/primitives/ClipboardField";
1516
import { Fieldset } from "~/components/primitives/Fieldset";
1617
import { FormButtons } from "~/components/primitives/FormButtons";
1718
import { FormError } from "~/components/primitives/FormError";
1819
import { Header2, Header3 } from "~/components/primitives/Headers";
1920
import { Input } from "~/components/primitives/Input";
2021
import { InputGroup } from "~/components/primitives/InputGroup";
2122
import { Label } from "~/components/primitives/Label";
22-
import { NavBar, PageTitle } from "~/components/primitives/PageHeader";
23+
import { NavBar, PageAccessories, PageTitle } from "~/components/primitives/PageHeader";
2324
import { Paragraph } from "~/components/primitives/Paragraph";
2425
import { Select, SelectItem } from "~/components/primitives/Select";
2526
import { prisma } from "~/db.server";
@@ -36,11 +37,14 @@ import {
3637
} from "~/services/platform.v3.server";
3738
import { requireUserId } from "~/services/session.server";
3839
import {
40+
docsPath,
3941
OrganizationParamsSchema,
4042
organizationPath,
4143
v3PrivateConnectionsPath,
4244
} from "~/utils/pathBuilder";
4345
import {
46+
ArrowTopRightOnSquareIcon,
47+
BookOpenIcon,
4448
CommandLineIcon,
4549
DocumentTextIcon,
4650
PencilSquareIcon,
@@ -531,7 +535,7 @@ export default function Page() {
531535
const { availableRegions, activeRegions, awsAccountIds } = useTypedLoaderData<typeof loader>();
532536
const { organizationSlug } = useParams();
533537
const lastSubmission = useActionData();
534-
const [setupMethod, setSetupMethod] = useState<SetupMethod | null>(null);
538+
const [setupMethod, setSetupMethod] = useState<SetupMethod | null>("manual");
535539

536540
const defaultRegion = "us-east-1";
537541

@@ -547,6 +551,15 @@ export default function Page() {
547551
<PageContainer>
548552
<NavBar>
549553
<PageTitle title="Add Private Connection" backButton={{ to: v3PrivateConnectionsPath({ slug: organizationSlug! }), text: "Private Connections" }} />
554+
<PageAccessories>
555+
<LinkButton
556+
variant="docs/small"
557+
LeadingIcon={BookOpenIcon}
558+
to={docsPath("private-networking/overview")}
559+
>
560+
Private connection docs
561+
</LinkButton>
562+
</PageAccessories>
550563
</NavBar>
551564
<PageBody scrollable={true}>
552565
<MainHorizontallyCenteredContainer className="max-w-3xl">
@@ -651,45 +664,55 @@ export default function Page() {
651664
</div>
652665
)}
653666

654-
{/* Docs iframe */}
667+
{/* Docs link */}
655668
{setupMethod === "docs" && (
656669
<div className="mb-6 rounded-lg border border-grid-dimmed p-4">
657670
<Header3 spacing>Setup Guide</Header3>
658671
{awsAccountIds.length > 0 && (
659672
<>
660673
<Paragraph variant="small" className="mb-3">
661674
When adding allowed principals to your VPC Endpoint Service, use the following
662-
AWS account ID(s):
675+
AWS account ARN(s):
663676
</Paragraph>
664-
<div className="mb-4 rounded-md border border-charcoal-700 bg-charcoal-900 p-3">
677+
<div className="mb-4 space-y-2">
665678
{awsAccountIds.map((id) => (
666-
<code key={id} className="text-sm text-emerald-400">
667-
{id}
668-
</code>
679+
<ClipboardField
680+
key={id}
681+
value={`arn:aws:iam::${id}:root`}
682+
variant="primary/medium"
683+
/>
669684
))}
670685
</div>
671686
</>
672687
)}
673-
<iframe
674-
src="https://trigger.dev/docs/network/private-link-setup-guide"
675-
title="Private Link Setup Guide"
676-
className="h-[600px] w-full rounded-md border border-charcoal-700"
677-
/>
688+
<Paragraph variant="small" className="mb-3">
689+
Follow the step-by-step guide in our docs to create a VPC Endpoint Service in the
690+
AWS Console, then come back here to add the connection.
691+
</Paragraph>
692+
<LinkButton
693+
to={docsPath("private-networking/aws-console-setup")}
694+
variant="primary/medium"
695+
TrailingIcon={ArrowTopRightOnSquareIcon}
696+
>
697+
Open setup guide
698+
</LinkButton>
678699
</div>
679700
)}
680701

681-
{/* AWS account IDs reference */}
682-
{setupMethod === "manual" && (
702+
{/* AWS account ARNs reference */}
703+
{setupMethod === "manual" && awsAccountIds.length > 0 && (
683704
<div className="mb-6 rounded-lg border border-grid-dimmed p-4">
684-
<Paragraph variant="small" className="mb-2">
685-
Add the following AWS account ID(s) to your VPC Endpoint Service's allowed
705+
<Paragraph variant="small" className="mb-3">
706+
Add the following AWS account ARN(s) to your VPC Endpoint Service's allowed
686707
principals:
687708
</Paragraph>
688-
<div className="rounded-md border border-charcoal-700 bg-charcoal-900 p-3">
709+
<div className="space-y-2">
689710
{awsAccountIds.map((id) => (
690-
<code key={id} className="text-sm text-emerald-400">
691-
{id}
692-
</code>
711+
<ClipboardField
712+
key={id}
713+
value={`arn:aws:iam::${id}:root`}
714+
variant="primary/medium"
715+
/>
693716
))}
694717
</div>
695718
</div>

0 commit comments

Comments
 (0)