File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed
site/src/modules/resources/AppLink Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,19 @@ export const HealthUnhealthy: Story = {
155
155
} ,
156
156
} ;
157
157
158
+ export const HealthUnhealthyDueToHostnameLength : Story = {
159
+ args : {
160
+ workspace : MockWorkspace ,
161
+ app : {
162
+ ...MockWorkspaceApp ,
163
+ health : "unhealthy" ,
164
+ subdomain : true ,
165
+ subdomain_name : "very-long-application-name-that-exceeds-dns-limits-and-causes-failures--agent--workspace--user" ,
166
+ } ,
167
+ agent : MockWorkspaceAgent ,
168
+ } ,
169
+ } ;
170
+
158
171
export const InternalApp : Story = {
159
172
args : {
160
173
workspace : MockWorkspace ,
Original file line number Diff line number Diff line change @@ -17,6 +17,17 @@ import { AgentButton } from "../AgentButton";
17
17
import { BaseIcon } from "./BaseIcon" ;
18
18
import { ShareIcon } from "./ShareIcon" ;
19
19
20
+ // Check if an app's hostname has segments that exceed DNS label limits (63 characters)
21
+ const hasHostnameLengthIssue = ( app : TypesGen . WorkspaceApp ) : boolean => {
22
+ if ( ! app . subdomain || ! app . subdomain_name ) {
23
+ return false ;
24
+ }
25
+
26
+ // Split by '--' to get hostname segments (format: app--agent--workspace--user)
27
+ const segments = app . subdomain_name . split ( "--" ) ;
28
+ return segments . some ( segment => segment . length > 63 ) ;
29
+ } ;
30
+
20
31
export const DisplayAppNameMap : Record < TypesGen . DisplayApp , string > = {
21
32
port_forwarding_helper : "Ports" ,
22
33
ssh_helper : "SSH" ,
@@ -68,7 +79,13 @@ export const AppLink: FC<AppLinkProps> = ({
68
79
css = { { color : theme . palette . warning . light } }
69
80
/>
70
81
) ;
71
- primaryTooltip = "Unhealthy" ;
82
+
83
+ // Check if the unhealthy status is due to hostname length issues
84
+ if ( hasHostnameLengthIssue ( app ) ) {
85
+ primaryTooltip = "App name too long for DNS hostname. Please use a shorter app name, workspace name, or username." ;
86
+ } else {
87
+ primaryTooltip = "Unhealthy" ;
88
+ }
72
89
}
73
90
74
91
if ( ! host && app . subdomain ) {
You can’t perform that action at this time.
0 commit comments