- Notifications
You must be signed in to change notification settings - Fork1k
feat(site): display warning messages when wildcard is not configured#19660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
13 commits Select commitHold shift + click to select a range
1b5a36d
add WildcardHostnameWarning component for workspace and template editor
kacpersawe524b35
refactor: simplify WildcardHostnameWarning component messages in temp…
kacpersaw0da6c1c
update workspace warning text
kacpersaw542bcf3
improve styling of warnings
kacpersaw4c4e3b3
Apply review suggestions
kacpersawbe5a517
merge warnings into one component
kacpersaw9db05c3
fix fmt
kacpersaw3641f59
Merge branch 'main' into kacpersaw/feat-wildcard-access-url-warnings
kacpersaw6759882
show different text based on user permissions
kacpersawf83949e
Merge branch 'main' into kacpersaw/feat-wildcard-access-url-warnings
kacpersawffdf340
Merge branch 'main' into kacpersaw/feat-wildcard-access-url-warnings
kacpersaw8ed13ae
Update docs url
kacpersawcd9e5a2
Fix format
kacpersawFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import AlertTitle from "@mui/material/AlertTitle"; | ||
import type { WorkspaceResource } from "api/typesGenerated"; | ||
import { Alert, AlertDetail } from "components/Alert/Alert"; | ||
import { Link } from "components/Link/Link"; | ||
import { useProxy } from "contexts/ProxyContext"; | ||
import { useAuthenticated } from "hooks/useAuthenticated"; | ||
import type { FC } from "react"; | ||
import { docs } from "utils/docs"; | ||
interface WildcardHostnameWarningProps { | ||
// If resources are provided, show template-focused warning | ||
resources?: WorkspaceResource[]; | ||
} | ||
export const WildcardHostnameWarning: FC<WildcardHostnameWarningProps> = ({ | ||
resources, | ||
}) => { | ||
const { proxy } = useProxy(); | ||
const { permissions } = useAuthenticated(); | ||
const hasResources = Boolean(resources); | ||
const canEditDeploymentConfig = Boolean(permissions.editDeploymentConfig); | ||
if (proxy.proxy?.wildcard_hostname) { | ||
return null; | ||
} | ||
if (hasResources) { | ||
const hasSubdomainCoderApp = resources!.some((resource) => { | ||
return resource.agents?.some((agent) => | ||
agent.apps?.some((app) => app.subdomain), | ||
); | ||
}); | ||
if (!hasSubdomainCoderApp) { | ||
return null; | ||
} | ||
} | ||
return ( | ||
<Alert | ||
severity="warning" | ||
className={ | ||
hasResources | ||
? "rounded-none border-0 border-l-2 border-l-warning border-b-divider" | ||
: undefined | ||
} | ||
> | ||
<AlertTitle>Some workspace applications will not work</AlertTitle> | ||
<AlertDetail> | ||
<div> | ||
{hasResources | ||
? "This template contains coder_app resources with" | ||
: "One or more apps in this workspace have"}{" "} | ||
<code className="py-px px-1 bg-surface-tertiary rounded-sm text-content-primary"> | ||
subdomain = true | ||
</code> | ||
{canEditDeploymentConfig ? ( | ||
<> | ||
, but subdomain applications are not configured. Users won't be | ||
able to access these applications until you configure the{" "} | ||
<code className="py-px px-1 bg-surface-tertiary rounded-sm text-content-primary"> | ||
--wildcard-access-url | ||
</code>{" "} | ||
flag when starting the Coder server. | ||
</> | ||
) : ( | ||
", which requires a Coder deployment with a Wildcard Access URL configured. Please contact your administrator." | ||
)} | ||
</div> | ||
<div className="pt-2"> | ||
<Link | ||
href={docs("/admin/networking/wildcard-access-url")} | ||
target="_blank" | ||
> | ||
<span className="font-semibold"> | ||
Learn more about wildcard access URL | ||
</span> | ||
</Link> | ||
</div> | ||
</AlertDetail> | ||
</Alert> | ||
); | ||
}; |
7 changes: 6 additions & 1 deletionsite/src/pages/TemplateVersionEditorPage/TemplateVersionEditor.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.