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

Commit7c8f8f4

Browse files
authored
feat(site): display warning messages when wildcard is not configured (#19660)
Closes#19606This PR adds warnings to alert uses when workspace applications withsubdomain access won't work due to missing wildcard access urlconfiguration.### Workspace Page warningThis warning is shown when wildcard hostname is not configured and agenthas subdomain applications.User:<img width="1230" height="488" alt="image"src="https://github.com/user-attachments/assets/66ead7b1-690c-4195-a560-2c5e9ecdf521"/>Administrator:<img width="1231" height="492" alt="image"src="https://github.com/user-attachments/assets/96f7d6fc-a993-4bbb-bd97-80a750caf3fa"/>### Template Editor Warning:This warning is shown in the output panel (after the user clicks build)when wildcard hostname is not configured and template contains coder_appresource and subdomain is set to true.<img width="1446" height="186" alt="image"src="https://github.com/user-attachments/assets/ba8e0c8e-1b7f-4722-8cee-24be21b8fc69"/>
1 parentd238480 commit7c8f8f4

File tree

3 files changed

+99
-2
lines changed

3 files changed

+99
-2
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import { TerminalLink } from "./TerminalLink/TerminalLink";
4141
import{useAgentContainers}from"./useAgentContainers";
4242
import{useAgentLogs}from"./useAgentLogs";
4343
import{VSCodeDesktopButton}from"./VSCodeDesktopButton/VSCodeDesktopButton";
44+
import{WildcardHostnameWarning}from"./WildcardHostnameWarning";
4445

4546
interfaceAgentRowProps{
4647
agent:WorkspaceAgent;
@@ -155,6 +156,10 @@ export const AgentRow: FC<AgentRowProps> = ({
155156
// Check if any devcontainers have errors to gray out agent border
156157
consthasDevcontainerErrors=devcontainers?.some((dc)=>dc.error);
157158

159+
consthasSubdomainApps=agent.apps?.some((app)=>app.subdomain);
160+
constshouldShowWildcardWarning=
161+
hasSubdomainApps&&!proxy.proxy?.wildcard_hostname;
162+
158163
return(
159164
<Stack
160165
key={agent.id}
@@ -164,7 +169,8 @@ export const AgentRow: FC<AgentRowProps> = ({
164169
styles.agentRow,
165170
styles[`agentRow-${agent.status}`],
166171
styles[`agentRow-lifecycle-${agent.lifecycle_state}`],
167-
hasDevcontainerErrors&&styles.agentRowWithErrors,
172+
(hasDevcontainerErrors||shouldShowWildcardWarning)&&
173+
styles.agentRowWithErrors,
168174
]}
169175
>
170176
<headercss={styles.header}>
@@ -226,6 +232,8 @@ export const AgentRow: FC<AgentRowProps> = ({
226232
</section>
227233
)}
228234

235+
{shouldShowWildcardWarning&&<WildcardHostnameWarning/>}
236+
229237
{shouldDisplayAppsSection&&(
230238
<sectioncss={styles.apps}>
231239
{shouldDisplayAgentApps&&(
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
importAlertTitlefrom"@mui/material/AlertTitle";
2+
importtype{WorkspaceResource}from"api/typesGenerated";
3+
import{Alert,AlertDetail}from"components/Alert/Alert";
4+
import{Link}from"components/Link/Link";
5+
import{useProxy}from"contexts/ProxyContext";
6+
import{useAuthenticated}from"hooks/useAuthenticated";
7+
importtype{FC}from"react";
8+
import{docs}from"utils/docs";
9+
10+
interfaceWildcardHostnameWarningProps{
11+
// If resources are provided, show template-focused warning
12+
resources?:WorkspaceResource[];
13+
}
14+
15+
exportconstWildcardHostnameWarning:FC<WildcardHostnameWarningProps>=({
16+
resources,
17+
})=>{
18+
const{ proxy}=useProxy();
19+
const{ permissions}=useAuthenticated();
20+
21+
consthasResources=Boolean(resources);
22+
constcanEditDeploymentConfig=Boolean(permissions.editDeploymentConfig);
23+
24+
if(proxy.proxy?.wildcard_hostname){
25+
returnnull;
26+
}
27+
28+
if(hasResources){
29+
consthasSubdomainCoderApp=resources!.some((resource)=>{
30+
returnresource.agents?.some((agent)=>
31+
agent.apps?.some((app)=>app.subdomain),
32+
);
33+
});
34+
35+
if(!hasSubdomainCoderApp){
36+
returnnull;
37+
}
38+
}
39+
40+
return(
41+
<Alert
42+
severity="warning"
43+
className={
44+
hasResources
45+
?"rounded-none border-0 border-l-2 border-l-warning border-b-divider"
46+
:undefined
47+
}
48+
>
49+
<AlertTitle>Some workspace applications will not work</AlertTitle>
50+
<AlertDetail>
51+
<div>
52+
{hasResources
53+
?"This template contains coder_app resources with"
54+
:"One or more apps in this workspace have"}{" "}
55+
<codeclassName="py-px px-1 bg-surface-tertiary rounded-sm text-content-primary">
56+
subdomain = true
57+
</code>
58+
{canEditDeploymentConfig ?(
59+
<>
60+
, but subdomain applications are not configured. Users won't be
61+
able to access these applications until you configure the{" "}
62+
<codeclassName="py-px px-1 bg-surface-tertiary rounded-sm text-content-primary">
63+
--wildcard-access-url
64+
</code>{" "}
65+
flag when starting the Coder server.
66+
</>
67+
) :(
68+
", which requires a Coder deployment with a Wildcard Access URL configured. Please contact your administrator."
69+
)}
70+
</div>
71+
<divclassName="pt-2">
72+
<Link
73+
href={docs("/admin/networking/wildcard-access-url")}
74+
target="_blank"
75+
>
76+
<spanclassName="font-semibold">
77+
Learn more about wildcard access URL
78+
</span>
79+
</Link>
80+
</div>
81+
</AlertDetail>
82+
</Alert>
83+
);
84+
};

‎site/src/pages/TemplateVersionEditorPage/TemplateVersionEditor.tsx‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
ProvisionerAlert,
3838
}from"modules/provisioners/ProvisionerAlert";
3939
import{ProvisionerStatusAlert}from"modules/provisioners/ProvisionerStatusAlert";
40+
import{WildcardHostnameWarning}from"modules/resources/WildcardHostnameWarning";
4041
import{isBinaryData}from"modules/templates/TemplateFiles/isBinaryData";
4142
import{TemplateFileTree}from"modules/templates/TemplateFiles/TemplateFileTree";
4243
import{TemplateResourcesTable}from"modules/templates/TemplateResourcesTable/TemplateResourcesTable";
@@ -203,7 +204,7 @@ export const TemplateVersionEditor: FC<TemplateVersionEditorProps> = ({
203204
if(logsContentRef.current){
204205
logsContentRef.current.scrollTop=logsContentRef.current.scrollHeight;
205206
}
206-
},[buildLogs]);
207+
},[buildLogs,resources]);
207208

208209
useLeaveSiteWarning(dirty);
209210

@@ -630,6 +631,10 @@ export const TemplateVersionEditor: FC<TemplateVersionEditorProps> = ({
630631
logs={buildLogs}
631632
/>
632633
)}
634+
635+
{resources&&(
636+
<WildcardHostnameWarningresources={resources}/>
637+
)}
633638
</div>
634639
)}
635640

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp