Skip to content

feat: add port sharing frontend #12119

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix template settings input
  • Loading branch information
f0ssel committed Feb 15, 2024
commit 43be95ef43b267a6840fa6dbaccd471a4c366e3a
25 changes: 25 additions & 0 deletions site/src/api/queries/workspaceportsharing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { deleteWorkspaceAgentSharedPort, getWorkspaceAgentSharedPorts, upsertWorkspaceAgentSharedPort } from "api/api"
import { DeleteWorkspaceAgentPortShareRequest, UpsertWorkspaceAgentPortShareRequest } from "api/typesGenerated"

export const workspacePortShares = (workspaceId: string) => {
return {
queryKey: ["sharedPorts", workspaceId],
queryFn: () => getWorkspaceAgentSharedPorts(workspaceId),
}
}

export const upsertWorkspacePortShare = (workspaceId: string) => {
return {
mutationFn: async (options: UpsertWorkspaceAgentPortShareRequest) => {
await upsertWorkspaceAgentSharedPort(workspaceId, options);
},
}
}

export const deleteWorkspacePortShare = (workspaceId: string) => {
return {
mutationFn: async (options: DeleteWorkspaceAgentPortShareRequest) => {
await deleteWorkspaceAgentSharedPort(workspaceId, options);
},
}
}
3 changes: 2 additions & 1 deletion site/src/modules/resources/AgentRow.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MockWorkspace, MockWorkspaceAgent } from "testHelpers/entities";
import { MockTemplate, MockWorkspace, MockWorkspaceAgent } from "testHelpers/entities";
import { AgentRow, AgentRowProps } from "./AgentRow";
import { DisplayAppNameMap } from "./AppLink/AppLink";
import { screen } from "@testing-library/react";
Expand Down Expand Up @@ -80,6 +80,7 @@ describe.each<{
const props: AgentRowProps = {
agent: MockWorkspaceAgent,
workspace: MockWorkspace,
template: MockTemplate,
showApps: false,
serverVersion: "",
serverAPIVersion: "",
Expand Down
4 changes: 4 additions & 0 deletions site/src/modules/resources/AgentRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import AutoSizer from "react-virtualized-auto-sizer";
import { FixedSizeList as List, ListOnScrollProps } from "react-window";
import * as API from "api/api";
import type {
Template,
Workspace,
WorkspaceAgent,
WorkspaceAgentLogSource,
Expand Down Expand Up @@ -59,13 +60,15 @@ export interface AgentRowProps {
serverVersion: string;
serverAPIVersion: string;
onUpdateAgent: () => void;
template: Template;
storybookLogs?: LineWithID[];
storybookAgentMetadata?: WorkspaceAgentMetadata[];
}

export const AgentRow: FC<AgentRowProps> = ({
agent,
workspace,
template,
showApps,
showBuiltinApps = true,
hideSSHButton,
Expand Down Expand Up @@ -221,6 +224,7 @@ export const AgentRow: FC<AgentRowProps> = ({
agent={agent}
username={workspace.owner_name}
workspaceID={workspace.id}
template={template}
/>
)}
</div>
Expand Down
Loading