Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Send info to open issue
  • Loading branch information
BrunoQuaresma committed Apr 27, 2023
commit b183d4ea682244d2ef4b6e0eaff59006b64b25d5
2 changes: 1 addition & 1 deletion site/src/components/Margins/Margins.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const useStyles = makeStyles(() => ({
},
}))

export const Margins: FC<JSX.IntrinsicElements["div"] & { size: Size }> = ({
export const Margins: FC<JSX.IntrinsicElements["div"] & { size?: Size }> = ({
size = "regular",
...divProps
}) => {
Expand Down
27 changes: 26 additions & 1 deletion site/src/components/RuntimeErrorState/RuntimeErrorState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Button from "@material-ui/core/Button"
import Link from "@material-ui/core/Link"
import { makeStyles } from "@material-ui/core/styles"
import RefreshOutlined from "@material-ui/icons/RefreshOutlined"
import { BuildInfoResponse } from "api/typesGenerated"
import { CoderIcon } from "components/Icons/CoderIcon"
import { FullScreenLoader } from "components/Loader/FullScreenLoader"
import { Stack } from "components/Stack/Stack"
Expand Down Expand Up @@ -51,7 +52,16 @@ export const RuntimeErrorState: FC<{ error: Error }> = ({ error }) => {
Coder Discord community
</Link>{" "}
or{" "}
<Link href="https://github.com/coder/coder/issues/new">
<Link
href={`https://github.com/coder/coder/issues/new?body=${encodeURIComponent(
[
["**Version**", getStaticBuildInfo()].join("\n"),
["**Path**", "`" + location.pathname + "`"].join("\n"),
["**Error**", "```\n" + error.stack + "\n```"].join("\n"),
].join("\n\n"),
)}`}
target="_blank"
>
open an issue
</Link>
.
Expand All @@ -78,6 +88,21 @@ export const RuntimeErrorState: FC<{ error: Error }> = ({ error }) => {
)
}

// During the build process, we inject the build info into the HTML
const getStaticBuildInfo = () => {
const buildInfoJson = document
.querySelector("meta[property=build-info]")
?.getAttribute("content")

if (buildInfoJson) {
try {
return JSON.parse(buildInfoJson) as BuildInfoResponse
} catch {
return "-- Set the version --"
}
}
}

const useStyles = makeStyles((theme) => ({
root: {
paddingTop: theme.spacing(4),
Expand Down