Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions site/src/modules/resources/AppLink/AppLink.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,21 @@ export const InternalApp: Story = {
},
};

export const InternalAppHostnameTooLong: Story = {
args: {
workspace: MockWorkspace,
app: {
...MockWorkspaceApp,
display_name: "Check my URL",
subdomain: true,
subdomain_name:
// 64 characters long; surpasses DNS hostname limit of 63 characters
"app_name_makes_subdomain64--agent_name--workspace_name--username",
},
agent: MockWorkspaceAgent,
},
};

export const BlockingStartupScriptRunning: Story = {
args: {
workspace: MockWorkspace,
Expand Down
27 changes: 25 additions & 2 deletions site/src/modules/resources/AppLink/AppLink.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type * as TypesGen from "api/typesGenerated";
import { DropdownMenuItem } from "components/DropdownMenu/DropdownMenu";
import { Link } from "components/Link/Link";
import { Spinner } from "components/Spinner/Spinner";
import {
Tooltip,
Expand All @@ -11,7 +12,7 @@ import { useProxy } from "contexts/ProxyContext";
import { CircleAlertIcon } from "lucide-react";
import { isExternalApp, needsSessionToken } from "modules/apps/apps";
import { useAppLink } from "modules/apps/useAppLink";
import { type FC, useState } from "react";
import { type FC, type ReactNode, useState } from "react";
import { AgentButton } from "../AgentButton";
import { BaseIcon } from "./BaseIcon";
import { ShareIcon } from "./ShareIcon";
Expand Down Expand Up @@ -48,7 +49,7 @@ export const AppLink: FC<AppLinkProps> = ({
// To avoid bugs in the healthcheck code locking users out of apps, we no
// longer block access to apps if they are unhealthy/initializing.
let canClick = true;
let primaryTooltip = "";
let primaryTooltip: ReactNode = "";
let icon = !iconError && (
<BaseIcon app={app} onIconPathError={() => setIconError(true)} />
);
Expand Down Expand Up @@ -80,6 +81,28 @@ export const AppLink: FC<AppLinkProps> = ({
"Your admin has not configured subdomain application access";
}

if (app.subdomain_name && app.subdomain_name.length > 63) {
icon = (
<CircleAlertIcon
aria-hidden="true"
className="size-icon-sm text-content-warning"
/>
);
primaryTooltip = (
<>
Port forwarding will not work because hostname is too long, see the{" "}
<Link
href="https://coder.com/docs/user-guides/workspace-access/port-forwarding#dashboard"
target="_blank"
size="sm"
>
documentation
</Link>{" "}
for more details
</>
);
}

if (isExternalApp(app) && needsSessionToken(app) && !link.hasToken) {
canClick = false;
}
Expand Down
Loading
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