Skip to content
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
26 changes: 25 additions & 1 deletion site/src/components/Resources/Resources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ export const Resources: React.FC<ResourcesProps> = ({ resources, getResourcesErr
if (!agent) {
return (
<TableRow>
<TableCell className={styles.resourceNameCell}>{resource.name}</TableCell>
<TableCell className={styles.resourceNameCell}>
{resource.name}
<span className={styles.resourceType}>{resource.type}</span>
</TableCell>
<TableCell colSpan={3}></TableCell>
</TableRow>
)
Expand All @@ -71,6 +74,7 @@ export const Resources: React.FC<ResourcesProps> = ({ resources, getResourcesErr
{agentIndex === 0 && (
<TableCell className={styles.resourceNameCell} rowSpan={agents.length}>
{resource.name}
<span className={styles.resourceType}>{resource.type}</span>
</TableCell>
)}

Expand All @@ -85,6 +89,7 @@ export const Resources: React.FC<ResourcesProps> = ({ resources, getResourcesErr
<TableCell>
{agent.status === "connected" && (
<TerminalLink
className={styles.accessLink}
workspaceName={workspace.name}
agentName={agent.name}
userName={workspace.owner_name}
Expand Down Expand Up @@ -115,8 +120,27 @@ const useStyles = makeStyles((theme) => ({
borderRight: `1px solid ${theme.palette.divider}`,
},

resourceType: {
fontSize: 14,
color: theme.palette.text.secondary,
marginTop: theme.spacing(0.5),
display: "block",
},

// Adds some left spacing
agentColumn: {
paddingLeft: `${theme.spacing(2)}px !important`,
},

accessLink: {
color: theme.palette.text.secondary,
display: "flex",
alignItems: "center",

"& svg": {
width: 16,
height: 16,
marginRight: theme.spacing(1.5),
},
},
}))
13 changes: 10 additions & 3 deletions site/src/components/TerminalLink/TerminalLink.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import Link from "@material-ui/core/Link"
import ComputerIcon from "@material-ui/icons/Computer"
import React from "react"
import * as TypesGen from "../../api/typesGenerated"

export const Language = {
linkText: "Open in terminal",
linkText: "Open terminal",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kylecarbs which makes more sense?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this to save some space 😆

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm impartial! I think it's fair to remove the in to save space, but up to you!

}

export interface TerminalLinkProps {
agentName?: TypesGen.WorkspaceAgent["name"]
userName?: TypesGen.User["username"]
workspaceName: TypesGen.Workspace["name"]
className?: string
}

/**
Expand All @@ -19,9 +21,14 @@ export interface TerminalLinkProps {
* If no user name is provided "me" is used however it makes the link not
* shareable.
*/
export const TerminalLink: React.FC<TerminalLinkProps> = ({ agentName, userName = "me", workspaceName }) => {
export const TerminalLink: React.FC<TerminalLinkProps> = ({ agentName, userName = "me", workspaceName, className }) => {
return (
<Link href={`/${userName}/${workspaceName}${agentName ? `.${agentName}` : ""}/terminal`} target="_blank">
<Link
href={`/${userName}/${workspaceName}${agentName ? `.${agentName}` : ""}/terminal`}
className={className}
target="_blank"
>
<ComputerIcon />
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version of Material UI we are using does not have the Terminal icon 😢

{Language.linkText}
</Link>
)
Expand Down