Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5492ab7

Browse files
feat: Add resource type and restyle terminal link (#1722)
1 parentc5f4d80 commit5492ab7

File tree

2 files changed

+56
-4
lines changed

2 files changed

+56
-4
lines changed

‎site/src/components/Resources/Resources.tsx

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ export const Resources: React.FC<ResourcesProps> = ({ resources, getResourcesErr
5858
if(!agent){
5959
return(
6060
<TableRow>
61-
<TableCellclassName={styles.resourceNameCell}>{resource.name}</TableCell>
61+
<TableCellclassName={styles.resourceNameCell}>
62+
{resource.name}
63+
<spanclassName={styles.resourceType}>{resource.type}</span>
64+
</TableCell>
6265
<TableCellcolSpan={3}></TableCell>
6366
</TableRow>
6467
)
@@ -71,6 +74,7 @@ export const Resources: React.FC<ResourcesProps> = ({ resources, getResourcesErr
7174
{agentIndex===0&&(
7275
<TableCellclassName={styles.resourceNameCell}rowSpan={agents.length}>
7376
{resource.name}
77+
<spanclassName={styles.resourceType}>{resource.type}</span>
7478
</TableCell>
7579
)}
7680

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

123+
resourceType:{
124+
fontSize:14,
125+
color:theme.palette.text.secondary,
126+
marginTop:theme.spacing(0.5),
127+
display:"block",
128+
},
129+
118130
// Adds some left spacing
119131
agentColumn:{
120132
paddingLeft:`${theme.spacing(2)}px !important`,
121133
},
134+
135+
accessLink:{
136+
color:theme.palette.text.secondary,
137+
display:"flex",
138+
alignItems:"center",
139+
140+
"& svg":{
141+
width:16,
142+
height:16,
143+
marginRight:theme.spacing(1.5),
144+
},
145+
},
122146
}))
Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
importLinkfrom"@material-ui/core/Link"
2+
import{makeStyles}from"@material-ui/core/styles"
3+
importComputerIconfrom"@material-ui/icons/Computer"
24
importReactfrom"react"
35
import*asTypesGenfrom"../../api/typesGenerated"
6+
import{combineClasses}from"../../util/combineClasses"
47

58
exportconstLanguage={
6-
linkText:"Openinterminal",
9+
linkText:"Open terminal",
710
}
811

912
exportinterfaceTerminalLinkProps{
1013
agentName?:TypesGen.WorkspaceAgent["name"]
1114
userName?:TypesGen.User["username"]
1215
workspaceName:TypesGen.Workspace["name"]
16+
className?:string
1317
}
1418

1519
/**
@@ -19,10 +23,34 @@ export interface TerminalLinkProps {
1923
* If no user name is provided "me" is used however it makes the link not
2024
* shareable.
2125
*/
22-
exportconstTerminalLink:React.FC<TerminalLinkProps>=({ agentName, userName="me", workspaceName})=>{
26+
exportconstTerminalLink:React.FC<TerminalLinkProps>=({ agentName, userName="me", workspaceName, className})=>{
27+
conststyles=useStyles()
28+
2329
return(
24-
<Linkhref={`/${userName}/${workspaceName}${agentName ?`.${agentName}` :""}/terminal`}target="_blank">
30+
<Link
31+
href={`/${userName}/${workspaceName}${agentName ?`.${agentName}` :""}/terminal`}
32+
className={combineClasses([styles.link,className])}
33+
target="_blank"
34+
>
35+
<ComputerIconclassName={styles.icon}/>
2536
{Language.linkText}
2637
</Link>
2738
)
2839
}
40+
41+
// Replicating these from accessLink style from Resources component until we
42+
// define if we want these styles coming from the parent or having a
43+
// ResourceLink component for that
44+
constuseStyles=makeStyles((theme)=>({
45+
link:{
46+
color:theme.palette.text.secondary,
47+
display:"flex",
48+
alignItems:"center",
49+
},
50+
51+
icon:{
52+
width:16,
53+
height:16,
54+
marginRight:theme.spacing(1.5),
55+
},
56+
}))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp