Skip to content

Commit 85d4738

Browse files
committed
Continue beautifying
1 parent 1c6245d commit 85d4738

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

coderd/workspaceagents.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,8 @@ func (api *API) watchWorkspaceAgentMetadata(rw http.ResponseWriter, r *http.Requ
11931193
}
11941194

11951195
func convertWorkspaceAgentMetadata(db []database.WorkspaceAgentMetadatum) []codersdk.WorkspaceAgentMetadata {
1196-
var result []codersdk.WorkspaceAgentMetadata
1196+
// An empty array is easier for clients to handle than a null.
1197+
result := []codersdk.WorkspaceAgentMetadata{}
11971198
for _, datum := range db {
11981199
result = append(result, codersdk.WorkspaceAgentMetadata{
11991200
Result: codersdk.WorkspaceAgentMetadataResult{

site/src/components/Resources/AgentMetadata.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,25 @@ const MetadataItem: FC<{ item: WorkspaceAgentMetadata }> = ({ item }) => {
2222
)
2323
const staleThreshold = Math.max(
2424
item.description.interval + item.description.timeout * 2,
25-
5,
25+
10,
2626
)
2727

2828
// Stale data is as good as no data. Plus, we want to build confidence in our
2929
// users that what's shown is real. If times aren't correctly synced this
3030
// could be buggy. But, how common is that anyways?
3131
const value =
3232
secondsSinceLastCollected < staleThreshold ? (
33-
<div className={styles.metadataValue}>{item.result.value}</div>
33+
<div
34+
className={
35+
styles.metadataValue +
36+
" " +
37+
(item.result.error.length === 0
38+
? styles.metadataValueSuccess
39+
: styles.metadataValueError)
40+
}
41+
>
42+
{item.result.value}
43+
</div>
3444
) : (
3545
<CircularProgress size={12} />
3646
)
@@ -117,7 +127,13 @@ const useStyles = makeStyles((theme) => ({
117127
metadataValue: {
118128
textOverflow: "ellipsis",
119129
overflow: "hidden",
120-
color: theme.palette.success.light,
121130
whiteSpace: "nowrap",
122131
},
132+
133+
metadataValueSuccess: {
134+
color: theme.palette.success.light,
135+
},
136+
metadataValueError: {
137+
color: theme.palette.error.main,
138+
},
123139
}))

0 commit comments

Comments
 (0)