@@ -2,6 +2,7 @@ import Button from "@material-ui/core/Button"
2
2
import Link from "@material-ui/core/Link"
3
3
import { makeStyles } from "@material-ui/core/styles"
4
4
import RefreshOutlined from "@material-ui/icons/RefreshOutlined"
5
+ import { BuildInfoResponse } from "api/typesGenerated"
5
6
import { CoderIcon } from "components/Icons/CoderIcon"
6
7
import { FullScreenLoader } from "components/Loader/FullScreenLoader"
7
8
import { Stack } from "components/Stack/Stack"
@@ -51,7 +52,16 @@ export const RuntimeErrorState: FC<{ error: Error }> = ({ error }) => {
51
52
Coder Discord community
52
53
</ Link > { " " }
53
54
or{ " " }
54
- < Link href = "https://github.com/coder/coder/issues/new" >
55
+ < Link
56
+ href = { `https://github.com/coder/coder/issues/new?body=${ encodeURIComponent (
57
+ [
58
+ [ "**Version**" , getStaticBuildInfo ( ) ] . join ( "\n" ) ,
59
+ [ "**Path**" , "`" + location . pathname + "`" ] . join ( "\n" ) ,
60
+ [ "**Error**" , "```\n" + error . stack + "\n```" ] . join ( "\n" ) ,
61
+ ] . join ( "\n\n" ) ,
62
+ ) } `}
63
+ target = "_blank"
64
+ >
55
65
open an issue
56
66
</ Link >
57
67
.
@@ -78,6 +88,21 @@ export const RuntimeErrorState: FC<{ error: Error }> = ({ error }) => {
78
88
)
79
89
}
80
90
91
+ // During the build process, we inject the build info into the HTML
92
+ const getStaticBuildInfo = ( ) => {
93
+ const buildInfoJson = document
94
+ . querySelector ( "meta[property=build-info]" )
95
+ ?. getAttribute ( "content" )
96
+
97
+ if ( buildInfoJson ) {
98
+ try {
99
+ return JSON . parse ( buildInfoJson ) as BuildInfoResponse
100
+ } catch {
101
+ return "-- Set the version --"
102
+ }
103
+ }
104
+ }
105
+
81
106
const useStyles = makeStyles ( ( theme ) => ( {
82
107
root : {
83
108
paddingTop : theme . spacing ( 4 ) ,
0 commit comments