@@ -25,6 +25,7 @@ import {
25
25
SidebarItem ,
26
26
} from "components/Sidebar/Sidebar"
27
27
import { BuildIcon } from "components/BuildIcon/BuildIcon"
28
+ import Skeleton from "@mui/material/Skeleton"
28
29
29
30
const sortLogsByCreatedAt = ( logs : ProvisionerJobLog [ ] ) => {
30
31
return [ ...logs ] . sort (
@@ -47,7 +48,6 @@ export const WorkspaceBuildPageView: FC<WorkspaceBuildPageViewProps> = ({
47
48
activeBuildNumber,
48
49
} ) => {
49
50
const styles = useStyles ( )
50
- const theme = useTheme ( )
51
51
52
52
if ( ! build ) {
53
53
return < Loader />
@@ -85,6 +85,11 @@ export const WorkspaceBuildPageView: FC<WorkspaceBuildPageViewProps> = ({
85
85
</ Link >
86
86
}
87
87
/>
88
+ < StatsItem
89
+ className = { styles . statsItem }
90
+ label = "Template version"
91
+ value = { build . template_version_name }
92
+ />
88
93
< StatsItem
89
94
className = { styles . statsItem }
90
95
label = "Duration"
@@ -98,7 +103,11 @@ export const WorkspaceBuildPageView: FC<WorkspaceBuildPageViewProps> = ({
98
103
< StatsItem
99
104
className = { styles . statsItem }
100
105
label = "Action"
101
- value = { build . transition }
106
+ value = {
107
+ < Box component = "span" sx = { { textTransform : "capitalize" } } >
108
+ { build . transition }
109
+ </ Box >
110
+ }
102
111
/>
103
112
</ Stats >
104
113
</ FullWidthPageHeader >
@@ -113,50 +122,16 @@ export const WorkspaceBuildPageView: FC<WorkspaceBuildPageViewProps> = ({
113
122
>
114
123
< Sidebar >
115
124
< SidebarCaption > Builds</ SidebarCaption >
116
- { builds ?. map ( ( b ) => (
117
- < Link
118
- key = { b . id }
119
- to = { `/@${ b . workspace_owner_name } /${ b . workspace_name } /builds/${ b . build_number } ` }
120
- >
121
- < SidebarItem
122
- active = { b . build_number === activeBuildNumber }
123
- sx = { { color : "red" } }
124
- >
125
- < Box sx = { { display : "flex" , alignItems : "center" , gap : 1 } } >
126
- < BuildIcon
127
- transition = { b . transition }
128
- sx = { {
129
- width : 16 ,
130
- height : 16 ,
131
- color : getDisplayWorkspaceBuildStatus ( theme , b ) . color ,
132
- } }
133
- />
134
- < Box sx = { { overflow : "hidden" } } >
135
- < Box
136
- sx = { {
137
- textTransform : "capitalize" ,
138
- color : ( theme ) => theme . palette . text . primary ,
139
- textOverflow : "ellipsis" ,
140
- overflow : "hidden" ,
141
- whiteSpace : "nowrap" ,
142
- } }
143
- >
144
- { b . transition } by{ " " }
145
- < strong > { getDisplayWorkspaceBuildInitiatedBy ( b ) } </ strong >
146
- </ Box >
147
- < Box
148
- sx = { {
149
- fontSize : 12 ,
150
- color : ( theme ) => theme . palette . text . secondary ,
151
- mt : 0.25 ,
152
- } }
153
- >
154
- { displayWorkspaceBuildDuration ( b ) }
155
- </ Box >
156
- </ Box >
157
- </ Box >
158
- </ SidebarItem >
159
- </ Link >
125
+ { ! builds &&
126
+ [ ...Array ( 15 ) . keys ( ) ] . map ( ( i ) => (
127
+ < BuildSidebarItemSkeleton key = { i } />
128
+ ) ) }
129
+ { builds ?. map ( ( build ) => (
130
+ < BuildSidebarItem
131
+ key = { build . id }
132
+ build = { build }
133
+ active = { build . build_number === activeBuildNumber }
134
+ />
160
135
) ) }
161
136
</ Sidebar >
162
137
@@ -177,6 +152,73 @@ export const WorkspaceBuildPageView: FC<WorkspaceBuildPageViewProps> = ({
177
152
)
178
153
}
179
154
155
+ const BuildSidebarItem = ( {
156
+ build,
157
+ active,
158
+ } : {
159
+ build : WorkspaceBuild
160
+ active : boolean
161
+ } ) => {
162
+ const theme = useTheme ( )
163
+
164
+ return (
165
+ < Link
166
+ key = { build . id }
167
+ to = { `/@${ build . workspace_owner_name } /${ build . workspace_name } /builds/${ build . build_number } ` }
168
+ >
169
+ < SidebarItem active = { active } >
170
+ < Box sx = { { display : "flex" , alignItems : "start" , gap : 1 } } >
171
+ < BuildIcon
172
+ transition = { build . transition }
173
+ sx = { {
174
+ width : 16 ,
175
+ height : 16 ,
176
+ color : getDisplayWorkspaceBuildStatus ( theme , build ) . color ,
177
+ } }
178
+ />
179
+ < Box sx = { { overflow : "hidden" } } >
180
+ < Box
181
+ sx = { {
182
+ textTransform : "capitalize" ,
183
+ color : ( theme ) => theme . palette . text . primary ,
184
+ textOverflow : "ellipsis" ,
185
+ overflow : "hidden" ,
186
+ whiteSpace : "nowrap" ,
187
+ } }
188
+ >
189
+ { build . transition } by{ " " }
190
+ < strong > { getDisplayWorkspaceBuildInitiatedBy ( build ) } </ strong >
191
+ </ Box >
192
+ < Box
193
+ sx = { {
194
+ fontSize : 12 ,
195
+ color : ( theme ) => theme . palette . text . secondary ,
196
+ mt : 0.25 ,
197
+ } }
198
+ >
199
+ { displayWorkspaceBuildDuration ( build ) }
200
+ </ Box >
201
+ </ Box >
202
+ </ Box >
203
+ </ SidebarItem >
204
+ </ Link >
205
+ )
206
+ }
207
+
208
+ const BuildSidebarItemSkeleton = ( ) => {
209
+ return (
210
+ < SidebarItem >
211
+ < Box sx = { { display : "flex" , alignItems : "start" , gap : 1 } } >
212
+ < Skeleton variant = "circular" width = { 16 } height = { 16 } />
213
+ < Box >
214
+ < Skeleton variant = "text" width = { 94 } height = { 16 } />
215
+ < Skeleton variant = "text" width = { 60 } height = { 14 } sx = { { mt : 0.25 } } />
216
+ </ Box >
217
+ </ Box >
218
+ </ SidebarItem >
219
+ )
220
+ }
221
+
180
222
const useStyles = makeStyles ( ( theme ) => ( {
181
223
stats : {
182
224
padding : 0 ,
0 commit comments