mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
feat: add view workspace button to app error page (#20960)
Closes #19984 As part of this, I refactored the error template to take in a slice of actions rather than using individual booleans and strings to control the behavior. We decided a link resolves the issue for now so that is what I added, although we may want to consider a way to start the workspace and follow the logs dynamically on that page and then show the app when finished (similar to the tasks page), or at least make the link automatically start the workspace instead of only taking you to the dashboard where you have to then start the workspace.
This commit is contained in:
+27
-13
@@ -676,11 +676,18 @@ func TestRenderStaticErrorPage(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
d := site.ErrorPageData{
|
||||
Status: http.StatusBadGateway,
|
||||
Title: "Bad Gateway 1234",
|
||||
Description: "shout out colin",
|
||||
RetryEnabled: true,
|
||||
DashboardURL: "https://example.com",
|
||||
Status: http.StatusBadGateway,
|
||||
Title: "Bad Gateway 1234",
|
||||
Description: "shout out colin",
|
||||
Actions: []site.Action{
|
||||
{
|
||||
Text: "Retry",
|
||||
},
|
||||
{
|
||||
URL: "https://example.com",
|
||||
Text: "Back to site",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
rw := httptest.NewRecorder()
|
||||
@@ -699,19 +706,26 @@ func TestRenderStaticErrorPage(t *testing.T) {
|
||||
require.Contains(t, bodyStr, d.Title)
|
||||
require.Contains(t, bodyStr, d.Description)
|
||||
require.Contains(t, bodyStr, "Retry")
|
||||
require.Contains(t, bodyStr, d.DashboardURL)
|
||||
require.Contains(t, bodyStr, "https://example.com")
|
||||
}
|
||||
|
||||
func TestRenderStaticErrorPageNoStatus(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
d := site.ErrorPageData{
|
||||
HideStatus: true,
|
||||
Status: http.StatusBadGateway,
|
||||
Title: "Bad Gateway 1234",
|
||||
Description: "shout out colin",
|
||||
RetryEnabled: true,
|
||||
DashboardURL: "https://example.com",
|
||||
HideStatus: true,
|
||||
Status: http.StatusBadGateway,
|
||||
Title: "Bad Gateway 1234",
|
||||
Description: "shout out colin",
|
||||
Actions: []site.Action{
|
||||
{
|
||||
Text: "Retry",
|
||||
},
|
||||
{
|
||||
URL: "https://example.com",
|
||||
Text: "Back to site",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
rw := httptest.NewRecorder()
|
||||
@@ -730,7 +744,7 @@ func TestRenderStaticErrorPageNoStatus(t *testing.T) {
|
||||
require.Contains(t, bodyStr, d.Title)
|
||||
require.Contains(t, bodyStr, d.Description)
|
||||
require.Contains(t, bodyStr, "Retry")
|
||||
require.Contains(t, bodyStr, d.DashboardURL)
|
||||
require.Contains(t, bodyStr, "https://example.com")
|
||||
}
|
||||
|
||||
func TestJustFilesSystem(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user