Skip to content

Commit 9a5203d

Browse files
committed
Merge branch 'main' into bq/migrate-to-muiv5
2 parents d0b064a + 643a9ef commit 9a5203d

File tree

40 files changed

+264
-818
lines changed

40 files changed

+264
-818
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ site/e2e/test-results/*
2929
site/e2e/states/*.json
3030
site/playwright-report/*
3131
site/.swc
32+
site/dist/
3233

3334
# Make target for updating golden files (any dir).
3435
.gen-golden

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ site/e2e/test-results/*
3232
site/e2e/states/*.json
3333
site/playwright-report/*
3434
site/.swc
35+
site/dist/
3536

3637
# Make target for updating golden files (any dir).
3738
.gen-golden

codersdk/deployment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,7 @@ when required by your organization's security policy.`,
13501350
Description: "Whether Coder only allows connections to workspaces via the browser.",
13511351
Flag: "browser-only",
13521352
Env: "CODER_BROWSER_ONLY",
1353-
Annotations: clibase.Annotations{}.Mark(annotationEnterpriseKey, "true").Mark(annotationExternalProxies, "true"),
1353+
Annotations: clibase.Annotations{}.Mark(annotationEnterpriseKey, "true"),
13541354
Value: &c.BrowserOnly,
13551355
Group: &deploymentGroupNetworking,
13561356
YAML: "browserOnly",

enterprise/cli/workspaceproxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func (r *RootCmd) workspaceProxy() *clibase.Cmd {
1616
cmd := &clibase.Cmd{
1717
Use: "workspace-proxy",
1818
Short: "Manage workspace proxies",
19-
Aliases: []string{"proxy"},
19+
Aliases: []string{"wsproxy"},
2020
Hidden: true,
2121
Handler: func(inv *clibase.Invocation) error {
2222
return inv.Command.HelpHandler(inv)

enterprise/cli/workspaceproxy_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func Test_ProxyCRUD(t *testing.T) {
4545
ctx := testutil.Context(t, testutil.WaitLong)
4646
inv, conf := newCLI(
4747
t,
48-
"proxy", "create",
48+
"wsproxy", "create",
4949
"--name", expectedName,
5050
"--display-name", "Test Proxy",
5151
"--icon", "/emojis/1f4bb.png",
@@ -68,7 +68,7 @@ func Test_ProxyCRUD(t *testing.T) {
6868
// Fetch proxies and check output
6969
inv, conf = newCLI(
7070
t,
71-
"proxy", "ls",
71+
"wsproxy", "ls",
7272
)
7373

7474
pty = ptytest.New(t)
@@ -118,7 +118,7 @@ func Test_ProxyCRUD(t *testing.T) {
118118

119119
inv, conf := newCLI(
120120
t,
121-
"proxy", "delete", expectedName,
121+
"wsproxy", "delete", expectedName,
122122
)
123123

124124
pty := ptytest.New(t)

enterprise/coderd/templates.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@ func (api *API) moonsEnabledMW(next http.Handler) http.Handler {
293293
proxy := api.entitlements.Features[codersdk.FeatureWorkspaceProxy].Enabled
294294
api.entitlementsMu.RUnlock()
295295
if !proxy {
296-
httpapi.RouteNotFound(rw)
296+
httpapi.Write(r.Context(), rw, http.StatusForbidden, codersdk.Response{
297+
Message: "External workspace proxies is an Enterprise feature. Contact sales!",
298+
})
297299
return
298300
}
299301

enterprise/wsproxy/wsproxy.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,11 @@ func New(ctx context.Context, opts *Options) (*Server, error) {
235235
r.Get("/healthz-report", s.healthReport)
236236
r.NotFound(func(rw http.ResponseWriter, r *http.Request) {
237237
site.RenderStaticErrorPage(rw, r, site.ErrorPageData{
238-
Status: 404,
239-
Title: "Route Not Found",
240-
Description: "The route you requested does not exist on this workspace proxy. Maybe you intended to make this request to the primary dashboard? Click below to be redirected to the primary site.",
238+
Title: "Head to the Dashboard",
239+
Status: http.StatusBadRequest,
240+
HideStatus: true,
241+
Description: "Workspace Proxies route traffic in terminals and apps directly to your workspace. " +
242+
"This page must be loaded from the dashboard. Click to be redirected!",
241243
RetryEnabled: false,
242244
DashboardURL: opts.DashboardURL.String(),
243245
})

scripts/develop.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,11 @@ fatal() {
181181
log "Using external workspace proxy"
182182
(
183183
# Attempt to delete the proxy first, in case it already exists.
184-
"${CODER_DEV_SHIM}" proxy delete local-proxy || true
184+
"${CODER_DEV_SHIM}" wsproxy delete local-proxy || true
185185
# Create the proxy
186-
proxy_session_token=$("${CODER_DEV_SHIM}" proxy create --name=local-proxy --display-name="Local Proxy" --icon="/emojis/1f4bb.png" --only-token)
186+
proxy_session_token=$("${CODER_DEV_SHIM}" wsproxy create --name=local-proxy --display-name="Local Proxy" --icon="/emojis/1f4bb.png" --only-token)
187187
# Start the proxy
188-
start_cmd PROXY "" "${CODER_DEV_SHIM}" proxy server --http-address=localhost:3010 --proxy-session-token="${proxy_session_token}" --primary-access-url=http://localhost:3000
188+
start_cmd PROXY "" "${CODER_DEV_SHIM}" wsproxy server --http-address=localhost:3010 --proxy-session-token="${proxy_session_token}" --primary-access-url=http://localhost:3000
189189
) || echo "Failed to create workspace proxy. No workspace proxy created."
190190
fi
191191

scripts/linux-pkg/coder-workspace-proxy.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ CapabilityBoundingSet=CAP_SYSLOG CAP_IPC_LOCK CAP_NET_BIND_SERVICE
2222
KillSignal=SIGINT
2323
KillMode=mixed
2424
NoNewPrivileges=yes
25-
ExecStart=/usr/bin/coder proxy server
25+
ExecStart=/usr/bin/coder workspace-proxy server
2626
Restart=on-failure
2727
RestartSec=5
2828
TimeoutStopSec=90

site/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ e2e/test-results/*
3232
e2e/states/*.json
3333
playwright-report/*
3434
.swc
35+
dist/
3536

3637
# Make target for updating golden files (any dir).
3738
.gen-golden

site/.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ e2e/test-results/*
3232
e2e/states/*.json
3333
playwright-report/*
3434
.swc
35+
dist/
3536

3637
# Make target for updating golden files (any dir).
3738
.gen-golden

site/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@
7171
"react": "18.2.0",
7272
"react-chartjs-2": "4.3.1",
7373
"react-color": "2.19.3",
74-
"react-confetti": "^6.1.0",
74+
"react-confetti": "6.1.0",
7575
"react-dom": "18.2.0",
7676
"react-headless-tabs": "6.0.3",
7777
"react-helmet-async": "1.3.0",
7878
"react-i18next": "12.1.1",
7979
"react-markdown": "8.0.3",
8080
"react-router-dom": "6.4.1",
8181
"react-syntax-highlighter": "15.5.0",
82-
"react-use": "^17.4.0",
82+
"react-use": "17.4.0",
8383
"react-virtualized-auto-sizer": "1.0.7",
8484
"react-window": "1.8.8",
8585
"remark-gfm": "3.0.1",
@@ -148,7 +148,8 @@
148148
"semver": "7.3.7",
149149
"storybook": "7.0.4",
150150
"storybook-react-context": "0.6.0",
151-
"typescript": "4.8.2"
151+
"typescript": "4.8.2",
152+
"vite-plugin-checker": "0.6.0"
152153
},
153154
"browserslist": [
154155
"chrome 66",

site/site.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,9 @@ func extractBin(dest string, r io.Reader) (numExtracted int, err error) {
606606
// ErrorPageData contains the variables that are found in
607607
// site/static/error.html.
608608
type ErrorPageData struct {
609-
Status int
609+
Status int
610+
// HideStatus will remove the status code from the page.
611+
HideStatus bool
610612
Title string
611613
Description string
612614
RetryEnabled bool

site/site_test.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,3 +517,34 @@ func TestRenderStaticErrorPage(t *testing.T) {
517517
require.Contains(t, bodyStr, "Retry")
518518
require.Contains(t, bodyStr, d.DashboardURL)
519519
}
520+
521+
func TestRenderStaticErrorPageNoStatus(t *testing.T) {
522+
t.Parallel()
523+
524+
d := site.ErrorPageData{
525+
HideStatus: true,
526+
Status: http.StatusBadGateway,
527+
Title: "Bad Gateway 1234",
528+
Description: "shout out colin",
529+
RetryEnabled: true,
530+
DashboardURL: "https://example.com",
531+
}
532+
533+
rw := httptest.NewRecorder()
534+
r := httptest.NewRequest("GET", "/", nil)
535+
site.RenderStaticErrorPage(rw, r, d)
536+
537+
resp := rw.Result()
538+
defer resp.Body.Close()
539+
require.Equal(t, d.Status, resp.StatusCode)
540+
require.Contains(t, resp.Header.Get("Content-Type"), "text/html")
541+
542+
body, err := io.ReadAll(resp.Body)
543+
require.NoError(t, err)
544+
bodyStr := string(body)
545+
require.NotContains(t, bodyStr, strconv.Itoa(d.Status))
546+
require.Contains(t, bodyStr, d.Title)
547+
require.Contains(t, bodyStr, d.Description)
548+
require.Contains(t, bodyStr, "Retry")
549+
require.Contains(t, bodyStr, d.DashboardURL)
550+
}

site/src/__mocks__/monaco-editor.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ const monaco = {
1616
}
1717

1818
module.exports = monaco
19+
20+
export {}

site/src/components/AppLink/AppLinkSkeleton.tsx

Lines changed: 0 additions & 22 deletions
This file was deleted.

site/src/components/GlobalSnackbar/utils.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,6 @@ function dispatchNotificationEvent(
6464
})
6565
}
6666

67-
export const displayMsg = (msg: string, additionalMsg?: string): void => {
68-
dispatchNotificationEvent(
69-
MsgType.Info,
70-
msg,
71-
additionalMsg ? [additionalMsg] : undefined,
72-
)
73-
}
74-
7567
export const displaySuccess = (msg: string, additionalMsg?: string): void => {
7668
dispatchNotificationEvent(
7769
MsgType.Success,

site/src/components/RuntimeErrorState/RuntimeErrorReport.tsx

Lines changed: 0 additions & 108 deletions
This file was deleted.

0 commit comments

Comments
 (0)