Skip to content

chore: patch 2.14.2 #14371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 20, 2024
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
10 changes: 10 additions & 0 deletions scripts/build_windows_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
agpl="${CODER_BUILD_AGPL:-0}"
output_path=""
version=""
sign_windows="${CODER_SIGN_WINDOWS:-0}"

args="$(getopt -o "" -l agpl,output:,version: -- "$@")"
eval set -- "$args"
Expand Down Expand Up @@ -51,6 +52,11 @@ if [[ "$output_path" == "" ]]; then
error "--output is a required parameter"
fi

if [[ "$sign_windows" == 1 ]]; then
dependencies java
requiredenvs JSIGN_PATH EV_KEYSTORE EV_KEY EV_CERTIFICATE_PATH EV_TSA_URL GCLOUD_ACCESS_TOKEN
fi

if [[ "$#" != 1 ]]; then
error "Exactly one argument must be provided to this script, $# were supplied"
fi
Expand Down Expand Up @@ -125,3 +131,7 @@ popd
cp "$temp_dir/installer.exe" "$output_path"

rm -rf "$temp_dir"

if [[ "$sign_windows" == 1 ]]; then
execrelative ./sign_windows.sh "$output_path" 1>&2
fi
22 changes: 22 additions & 0 deletions site/src/pages/TemplatesPage/CreateTemplateButton.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { Meta, StoryObj } from "@storybook/react";
import { screen, userEvent } from "@storybook/test";
import { CreateTemplateButton } from "./CreateTemplateButton";

const meta: Meta<typeof CreateTemplateButton> = {
title: "pages/TemplatesPage/CreateTemplateButton",
component: CreateTemplateButton,
};

export default meta;
type Story = StoryObj<typeof CreateTemplateButton>;

export const Close: Story = {};

export const Open: Story = {
play: async ({ step }) => {
const user = userEvent.setup();
await step("click on trigger", async () => {
await user.click(screen.getByRole("button"));
});
},
};
56 changes: 56 additions & 0 deletions site/src/pages/TemplatesPage/CreateTemplateButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import AddIcon from "@mui/icons-material/AddOutlined";
import Inventory2 from "@mui/icons-material/Inventory2";
import NoteAddOutlined from "@mui/icons-material/NoteAddOutlined";
import UploadOutlined from "@mui/icons-material/UploadOutlined";
import Button from "@mui/material/Button";
import type { FC } from "react";
import {
MoreMenu,
MoreMenuContent,
MoreMenuItem,
MoreMenuTrigger,
} from "components/MoreMenu/MoreMenu";

type CreateTemplateButtonProps = {
onNavigate: (path: string) => void;
};

export const CreateTemplateButton: FC<CreateTemplateButtonProps> = ({
onNavigate,
}) => {
return (
<MoreMenu>
<MoreMenuTrigger>
<Button startIcon={<AddIcon />} variant="contained">
Create Template
</Button>
</MoreMenuTrigger>
<MoreMenuContent>
<MoreMenuItem
onClick={() => {
onNavigate("/templates/new?exampleId=scratch");
}}
>
<NoteAddOutlined />
From scratch
</MoreMenuItem>
<MoreMenuItem
onClick={() => {
onNavigate("/templates/new");
}}
>
<UploadOutlined />
Upload template
</MoreMenuItem>
<MoreMenuItem
onClick={() => {
onNavigate("/starter-templates");
}}
>
<Inventory2 />
Choose a starter template
</MoreMenuItem>
</MoreMenuContent>
</MoreMenu>
);
};
7 changes: 5 additions & 2 deletions site/src/pages/TemplatesPage/TemplatesPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test("create template from scratch", async () => {
element: <TemplatesPage />,
},
{
path: "/starter-templates",
path: "/templates/new",
element: <div data-testid="new-template-page" />,
},
],
Expand All @@ -34,6 +34,9 @@ test("create template from scratch", async () => {
name: "Create Template",
});
await user.click(createTemplateButton);
const fromScratchMenuItem = await screen.findByText("From scratch");
await user.click(fromScratchMenuItem);
await screen.findByTestId("new-template-page");
expect(router.state.location.pathname).toBe("/starter-templates");
expect(router.state.location.pathname).toBe("/templates/new");
expect(router.state.location.search).toBe("?exampleId=scratch");
});
46 changes: 25 additions & 21 deletions site/src/pages/TemplatesPage/TemplatesPageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ import {
TableRowSkeleton,
} from "components/TableLoader/TableLoader";
import { useClickableTableRow } from "hooks/useClickableTableRow";
import { useDashboard } from "modules/dashboard/useDashboard";
import { linkToTemplate, useLinks } from "modules/navigation";
import { createDayString } from "utils/createDayString";
import { docs } from "utils/docs";
import {
formatTemplateBuildTime,
formatTemplateActiveDevelopers,
} from "utils/templates";
import { CreateTemplateButton } from "./CreateTemplateButton";
import { EmptyTemplates } from "./EmptyTemplates";

export const Language = {
Expand Down Expand Up @@ -167,38 +169,40 @@ export const TemplatesPageView: FC<TemplatesPageViewProps> = ({
examples,
canCreateTemplates,
}) => {
const { experiments } = useDashboard();
const isLoading = !templates;
const isEmpty = templates && templates.length === 0;
const navigate = useNavigate();
const multiOrgExperimentEnabled = experiments.includes("multi-organization");

const createTemplateAction = () => {
return multiOrgExperimentEnabled ? (
<Button
startIcon={<AddIcon />}
variant="contained"
onClick={() => {
navigate("/starter-templates");
}}
>
Create Template
</Button>
) : (
<CreateTemplateButton onNavigate={navigate} />
);
};

return (
<Margins>
<PageHeader
actions={
canCreateTemplates && (
<Button
startIcon={<AddIcon />}
variant="contained"
onClick={() => {
navigate("/starter-templates");
}}
>
Create Template
</Button>
)
}
>
<PageHeader actions={canCreateTemplates && createTemplateAction()}>
<PageHeaderTitle>
<Stack spacing={1} direction="row" alignItems="center">
Templates
<TemplateHelpTooltip />
</Stack>
</PageHeaderTitle>
{templates && templates.length > 0 && (
<PageHeaderSubtitle>
Select a template to create a workspace.
</PageHeaderSubtitle>
)}
<PageHeaderSubtitle>
Select a template to create a workspace.
</PageHeaderSubtitle>
</PageHeader>

{error ? (
Expand All @@ -212,7 +216,7 @@ export const TemplatesPageView: FC<TemplatesPageViewProps> = ({
<TableCell width="15%">{Language.usedByLabel}</TableCell>
<TableCell width="10%">{Language.buildTimeLabel}</TableCell>
<TableCell width="15%">{Language.lastUpdatedLabel}</TableCell>
<TableCell width="1%"></TableCell>
<TableCell width="1%" />
</TableRow>
</TableHead>
<TableBody>
Expand Down
Loading