Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6c01a77

Browse files
authored
feat: show warning in AppLink if hostname is long enough to break port forwarding (#19506)
closes#15178 <img width="1840" height="1191" alt="image"src="https://github.com/user-attachments/assets/26d2002a-fa2f-46eb-9c06-b29420123f0a"/>
1 parentfe01ae7 commit6c01a77

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,21 @@ export const InternalApp: Story = {
168168
},
169169
};
170170

171+
exportconstInternalAppHostnameTooLong:Story={
172+
args:{
173+
workspace:MockWorkspace,
174+
app:{
175+
...MockWorkspaceApp,
176+
display_name:"Check my URL",
177+
subdomain:true,
178+
subdomain_name:
179+
// 64 characters long; surpasses DNS hostname limit of 63 characters
180+
"app_name_makes_subdomain64--agent_name--workspace_name--username",
181+
},
182+
agent:MockWorkspaceAgent,
183+
},
184+
};
185+
171186
exportconstBlockingStartupScriptRunning:Story={
172187
args:{
173188
workspace:MockWorkspace,

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

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
importtype*asTypesGenfrom"api/typesGenerated";
22
import{DropdownMenuItem}from"components/DropdownMenu/DropdownMenu";
3+
import{Link}from"components/Link/Link";
34
import{Spinner}from"components/Spinner/Spinner";
45
import{
56
Tooltip,
@@ -11,7 +12,7 @@ import { useProxy } from "contexts/ProxyContext";
1112
import{CircleAlertIcon}from"lucide-react";
1213
import{isExternalApp,needsSessionToken}from"modules/apps/apps";
1314
import{useAppLink}from"modules/apps/useAppLink";
14-
import{typeFC,useState}from"react";
15+
import{typeFC,typeReactNode,useState}from"react";
1516
import{AgentButton}from"../AgentButton";
1617
import{BaseIcon}from"./BaseIcon";
1718
import{ShareIcon}from"./ShareIcon";
@@ -48,7 +49,7 @@ export const AppLink: FC<AppLinkProps> = ({
4849
// To avoid bugs in the healthcheck code locking users out of apps, we no
4950
// longer block access to apps if they are unhealthy/initializing.
5051
letcanClick=true;
51-
letprimaryTooltip="";
52+
letprimaryTooltip:ReactNode="";
5253
leticon=!iconError&&(
5354
<BaseIconapp={app}onIconPathError={()=>setIconError(true)}/>
5455
);
@@ -80,6 +81,28 @@ export const AppLink: FC<AppLinkProps> = ({
8081
"Your admin has not configured subdomain application access";
8182
}
8283

84+
if(app.subdomain_name&&app.subdomain_name.length>63){
85+
icon=(
86+
<CircleAlertIcon
87+
aria-hidden="true"
88+
className="size-icon-sm text-content-warning"
89+
/>
90+
);
91+
primaryTooltip=(
92+
<>
93+
Port forwarding will not work because hostname is too long, see the{" "}
94+
<Link
95+
href="https://coder.com/docs/user-guides/workspace-access/port-forwarding#dashboard"
96+
target="_blank"
97+
size="sm"
98+
>
99+
documentation
100+
</Link>{" "}
101+
for more details
102+
</>
103+
);
104+
}
105+
83106
if(isExternalApp(app)&&needsSessionToken(app)&&!link.hasToken){
84107
canClick=false;
85108
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp