Skip to content

Commit 179e1f9

Browse files
Copilotmatifali
andcommitted
Add informative tooltip for hostname length validation in workspace apps
Co-authored-by: matifali <10648092+matifali@users.noreply.github.com>
1 parent e1701cf commit 179e1f9

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

site/src/modules/resources/AppLink/AppLink.stories.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,19 @@ export const HealthUnhealthy: Story = {
155155
},
156156
};
157157

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+
158171
export const InternalApp: Story = {
159172
args: {
160173
workspace: MockWorkspace,

site/src/modules/resources/AppLink/AppLink.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ import { AgentButton } from "../AgentButton";
1717
import { BaseIcon } from "./BaseIcon";
1818
import { ShareIcon } from "./ShareIcon";
1919

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+
2031
export const DisplayAppNameMap: Record<TypesGen.DisplayApp, string> = {
2132
port_forwarding_helper: "Ports",
2233
ssh_helper: "SSH",
@@ -68,7 +79,13 @@ export const AppLink: FC<AppLinkProps> = ({
6879
css={{ color: theme.palette.warning.light }}
6980
/>
7081
);
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+
}
7289
}
7390

7491
if (!host && app.subdomain) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy