mirror of
https://github.com/coder/coder.git
synced 2026-09-21 12:44:32 +08:00
feat: redirect to the template builder after first time setup (#27670)
This commit is contained in:
@@ -220,7 +220,8 @@ This section includes some of the quicker ways to install Coder. For more detail
|
||||
Templates define what's in your development environment. The template builder
|
||||
guides you through creating one without writing any Terraform.
|
||||
|
||||
1. Select **Templates** > **New Template**. The template builder opens.
|
||||
1. Coder opens the template builder after initial setup.
|
||||
To open it again later, select **Templates** > **New Template**.
|
||||
|
||||
1. Select the **Docker** base template from the list.
|
||||
|
||||
|
||||
@@ -19,8 +19,10 @@ test("setup deployment", async ({ page }) => {
|
||||
await page.getByLabel("Password").fill(users.owner.password);
|
||||
await page.getByTestId("create").click();
|
||||
|
||||
await expectUrl(page).toHavePathName("/templates");
|
||||
await page.getByTestId("button-select-template").isVisible();
|
||||
await expectUrl(page).toHavePathName("/templates/new/builder");
|
||||
await expect(
|
||||
page.getByRole("heading", { name: "Create new template" }),
|
||||
).toBeVisible();
|
||||
|
||||
for (const user of Object.values(users)) {
|
||||
// Already created as first user
|
||||
|
||||
@@ -71,7 +71,7 @@ describe("Setup Page", () => {
|
||||
await waitFor(() => screen.findByText("Password is too short"));
|
||||
});
|
||||
|
||||
it("redirects to the app when setup is successful", async () => {
|
||||
it("redirects to the template builder when setup is successful", async () => {
|
||||
let userHasBeenCreated = false;
|
||||
|
||||
server.use(
|
||||
@@ -110,8 +110,8 @@ describe("Setup Page", () => {
|
||||
element: <SetupPage />,
|
||||
},
|
||||
{
|
||||
path: "/templates",
|
||||
element: <h1>Templates</h1>,
|
||||
path: "/templates/new/builder",
|
||||
element: <h1>Template Builder</h1>,
|
||||
},
|
||||
],
|
||||
{ initialEntries: ["/setup"] },
|
||||
@@ -119,7 +119,7 @@ describe("Setup Page", () => {
|
||||
);
|
||||
await waitForLoaderToBeRemoved();
|
||||
await fillForm();
|
||||
await waitFor(() => screen.findByText("Templates"));
|
||||
await waitFor(() => screen.findByText("Template Builder"));
|
||||
});
|
||||
|
||||
it("calls sendBeacon with telemetry", async () => {
|
||||
|
||||
@@ -41,7 +41,7 @@ export const SetupPage: FC = () => {
|
||||
// If the user is logged in, navigate to the app
|
||||
if (isSignedIn) {
|
||||
return setupRequired.current ? (
|
||||
<Navigate to="/templates" replace />
|
||||
<Navigate to="/templates/new/builder" replace />
|
||||
) : (
|
||||
<Navigate to="/" state={{ isRedirect: true }} replace />
|
||||
);
|
||||
|
||||
@@ -210,7 +210,11 @@ export const SetupPageView: FC<SetupPageViewProps> = ({
|
||||
{authMethods?.github.enabled && (
|
||||
<>
|
||||
<Button className="w-full" asChild type="submit" size="lg">
|
||||
<a href="/api/v2/users/oauth2/github/callback">
|
||||
<a
|
||||
href={`/api/v2/users/oauth2/github/callback?redirect=${encodeURIComponent(
|
||||
"/templates/new/builder",
|
||||
)}`}
|
||||
>
|
||||
<ExternalImage src="/icon/github.svg?blackWithColor" />
|
||||
GitHub
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user