({
app,
workspace,
agent,
grouped,
})
| 40 | } |
| 41 | |
| 42 | export const AppLink: FC<AppLinkProps> = ({ |
| 43 | app, |
| 44 | workspace, |
| 45 | agent, |
| 46 | grouped, |
| 47 | }) => { |
| 48 | const { proxy } = useProxy(); |
| 49 | const host = proxy.preferredWildcardHostname; |
| 50 | const [iconError, setIconError] = useState(false); |
| 51 | const link = useAppLink(app, { agent, workspace }); |
| 52 | |
| 53 | // canClick is ONLY false when it's a subdomain app and the admin hasn't |
| 54 | // enabled wildcard access URL or the session token is being fetched. |
| 55 | // |
| 56 | // To avoid bugs in the healthcheck code locking users out of apps, we no |
| 57 | // longer block access to apps if they are unhealthy/initializing. |
| 58 | let canClick = true; |
| 59 | let primaryTooltip: ReactNode = ""; |
| 60 | let icon = !iconError && ( |
| 61 | <BaseIcon app={app} onIconPathError={() => setIconError(true)} /> |
| 62 | ); |
| 63 | |
| 64 | if (app.health === "initializing") { |
| 65 | icon = <Spinner loading />; |
| 66 | primaryTooltip = "Initializing..."; |
| 67 | } |
| 68 | |
| 69 | if (app.health === "unhealthy") { |
| 70 | icon = ( |
| 71 | <CircleAlertIcon |
| 72 | aria-hidden="true" |
| 73 | className="size-icon-sm text-content-warning" |
| 74 | /> |
| 75 | ); |
| 76 | primaryTooltip = "Unhealthy"; |
| 77 | } |
| 78 | |
| 79 | if (!host && app.subdomain) { |
| 80 | canClick = false; |
| 81 | icon = ( |
| 82 | <CircleAlertIcon |
| 83 | aria-hidden="true" |
| 84 | className="size-icon-sm text-content-secondary" |
| 85 | /> |
| 86 | ); |
| 87 | primaryTooltip = |
| 88 | "Your admin has not configured subdomain application access"; |
| 89 | } |
| 90 | |
| 91 | if (app.subdomain_name && app.subdomain_name.length > 63) { |
| 92 | icon = ( |
| 93 | <CircleAlertIcon |
| 94 | aria-hidden="true" |
| 95 | className="size-icon-sm text-content-warning" |
| 96 | /> |
| 97 | ); |
| 98 | primaryTooltip = ( |
| 99 | <> |
nothing calls this directly
no test coverage detected