Skip to content

Commit 55d7ff1

Browse files
committed
storybook
1 parent e914801 commit 55d7ff1

File tree

3 files changed

+43
-7
lines changed

3 files changed

+43
-7
lines changed

coderd/workspaceagents.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,6 +1324,25 @@ func convertProvisionedApps(dbApps []database.WorkspaceApp) []codersdk.Workspace
13241324
func convertApps(dbApps []database.WorkspaceApp, agent database.WorkspaceAgent, owner database.User, workspace database.Workspace) []codersdk.WorkspaceApp {
13251325
apps := make([]codersdk.WorkspaceApp, 0)
13261326
for _, dbApp := range dbApps {
1327+
/*
1328+
let appSlug = app.slug;
1329+
let appDisplayName = app.display_name;
1330+
if (!appSlug) {
1331+
appSlug = appDisplayName;
1332+
}
1333+
if (!appDisplayName) {
1334+
appDisplayName = appSlug;
1335+
}
1336+
1337+
1338+
1339+
if (appsHost && app.subdomain) {
1340+
const subdomain = `${appSlug}--${agent.name}--${workspace.name}--${username}`;
1341+
href = `${window.location.protocol}//${appsHost}/`.replace("*", subdomain);
1342+
}
1343+
1344+
*/
1345+
13271346
apps = append(apps, codersdk.WorkspaceApp{
13281347
ID: dbApp.ID,
13291348
URL: dbApp.Url.String,

site/src/components/Resources/AppLink/AppLink.stories.tsx

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ const meta: Meta<typeof AppLink> = {
1818
<ProxyContext.Provider
1919
value={{
2020
proxyLatencies: MockProxyLatencies,
21-
proxy: getPreferredProxy(
22-
MockWorkspaceProxies,
23-
MockPrimaryWorkspaceProxy,
24-
),
21+
proxy: {
22+
...getPreferredProxy(
23+
MockWorkspaceProxies,
24+
MockPrimaryWorkspaceProxy,
25+
),
26+
preferredWildcardHostname: "*.super_proxy.tld",
27+
},
2528
proxies: MockWorkspaceProxies,
2629
isLoading: false,
2730
isFetched: true,
@@ -135,3 +138,15 @@ export const HealthUnhealthy: Story = {
135138
agent: MockWorkspaceAgent,
136139
},
137140
};
141+
142+
export const InternalApp: Story = {
143+
args: {
144+
workspace: MockWorkspace,
145+
app: {
146+
...MockWorkspaceApp,
147+
subdomain: true,
148+
subdomain_name: "slug--agent_name--workspace_name--username",
149+
},
150+
agent: MockWorkspaceAgent,
151+
},
152+
};

site/src/components/Resources/AppLink/AppLink.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
5151
}/terminal?command=${encodeURIComponent(app.command)}`;
5252
}
5353

54-
if (appsHost && app.subdomain) {
55-
const subdomain = `${appSlug}--${agent.name}--${workspace.name}--${username}`;
56-
href = `${window.location.protocol}//${appsHost}/`.replace("*", subdomain);
54+
if (appsHost && app.subdomain && app.subdomain_name) {
55+
href = `${window.location.protocol}//${appsHost}/`.replace(
56+
"*",
57+
app.subdomain_name,
58+
);
5759
}
5860
if (app.external) {
5961
href = app.url;

0 commit comments

Comments
 (0)