@@ -11,13 +11,9 @@ import { TableEmpty } from "components/TableEmpty/TableEmpty"
11
11
import { TableLoader } from "components/TableLoader/TableLoader"
12
12
import { FC } from "react"
13
13
import { AlertBanner } from "components/AlertBanner/AlertBanner"
14
- import IconButton from "@material-ui/core/IconButton/IconButton"
15
14
import { useTranslation } from "react-i18next"
16
15
import { Region } from "api/typesGenerated"
17
- import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank' ;
18
- import { Avatar } from "components/Avatar/Avatar"
19
- import { AvatarData } from "components/AvatarData/AvatarData"
20
- import { HealthyBadge , NotHealthyBadge } from "components/DeploySettingsLayout/Badges"
16
+ import { ProxyRow } from "./WorkspaceProxyRow"
21
17
22
18
23
19
@@ -27,6 +23,7 @@ export interface WorkspaceProxyPageViewProps {
27
23
isLoading : boolean
28
24
hasLoaded : boolean
29
25
onSelect : ( proxy : Region ) => void
26
+ preferredProxy ?: Region
30
27
selectProxyError ?: Error | unknown
31
28
}
32
29
@@ -39,8 +36,8 @@ export const WorkspaceProxyPageView: FC<
39
36
hasLoaded,
40
37
onSelect,
41
38
selectProxyError,
39
+ preferredProxy,
42
40
} ) => {
43
- const theme = useTheme ( )
44
41
const { t } = useTranslation ( "proxyPage" )
45
42
46
43
return (
@@ -58,7 +55,6 @@ export const WorkspaceProxyPageView: FC<
58
55
< TableCell width = "40%" > { t ( "table.icon" ) } </ TableCell >
59
56
< TableCell width = "30%" > { t ( "table.url" ) } </ TableCell >
60
57
< TableCell width = "10%" > { t ( "table.status" ) } </ TableCell >
61
- < TableCell width = "0%" > </ TableCell >
62
58
</ TableRow >
63
59
</ TableHead >
64
60
< TableBody >
@@ -70,67 +66,14 @@ export const WorkspaceProxyPageView: FC<
70
66
< TableEmpty message = { t ( "emptyState" ) } />
71
67
</ Cond >
72
68
< Cond >
73
- { proxies ?. map ( ( proxy ) => {
74
- return (
75
- < TableRow
76
- key = { proxy . name }
77
- data-testid = { `${ proxy . name } ` }
78
- tabIndex = { 0 }
79
- >
80
- < TableCell >
81
- < AvatarData
82
- title = {
83
- proxy . display_name && proxy . display_name . length > 0
84
- ? proxy . display_name
85
- : proxy . name
86
- }
87
- // subtitle={proxy.description}
88
- avatar = {
89
- proxy . icon_url !== "" && < Avatar src = { proxy . icon_url } variant = "square" fitImage />
90
- }
91
- />
92
- </ TableCell >
93
-
94
- { /* <TableCell>
95
- <span style={{ color: theme.palette.text.secondary }}>
96
- {proxy.name}
97
- </span>
98
- </TableCell> */ }
99
-
100
- < TableCell > { proxy . path_app_url } </ TableCell >
101
- { /* <TableCell>{lastUsedOrNever(token.last_used)}</TableCell> */ }
102
- { /* <TableCell>{proxy.wildcard_hostname}</TableCell> */ }
103
- { /* <TableCell>
104
- <span
105
- style={{ color: theme.palette.text.secondary }}
106
- data-chromatic="ignore"
107
- >
108
- {dayjs(token.expires_at).fromNow()}
109
- </span>
110
- </TableCell> */ }
111
- < TableCell > < ProxyStatus proxy = { proxy } /> </ TableCell >
112
- { /* <TableCell>
113
- <span style={{ color: theme.palette.text.secondary }}>
114
- {dayjs(token.created_at).fromNow()}
115
- </span>
116
- </TableCell> */ }
117
-
118
- < TableCell >
119
- < span style = { { color : theme . palette . text . secondary } } >
120
- < IconButton
121
- onClick = { ( ) => {
122
- onSelect ( proxy )
123
- } }
124
- size = "medium"
125
- aria-label = { t ( "proxyActions.selectProxy.select" ) }
126
- >
127
- < CheckBoxOutlineBlankIcon />
128
- </ IconButton >
129
- </ span >
130
- </ TableCell >
131
- </ TableRow >
132
- )
133
- } ) }
69
+ { proxies ?. map ( ( proxy ) => (
70
+ < ProxyRow
71
+ key = { proxy . id }
72
+ proxy = { proxy }
73
+ onSelectRegion = { onSelect }
74
+ preferred = { preferredProxy ? proxy . id === preferredProxy . id : false }
75
+ />
76
+ ) ) }
134
77
</ Cond >
135
78
</ ChooseOne >
136
79
</ TableBody >
@@ -139,17 +82,3 @@ export const WorkspaceProxyPageView: FC<
139
82
</ Stack >
140
83
)
141
84
}
142
-
143
-
144
- export interface WorkspaceProxyStatusProps {
145
- proxy : Region
146
- }
147
-
148
- const ProxyStatus : FC < React . PropsWithChildren < WorkspaceProxyStatusProps > > = ( { proxy } ) => {
149
- let icon = < NotHealthyBadge />
150
- if ( proxy . healthy ) {
151
- icon = < HealthyBadge />
152
- }
153
-
154
- return icon
155
- }
0 commit comments