@@ -8,24 +8,24 @@ import {
8
8
ActiveTransition ,
9
9
WorkspaceBuildProgress ,
10
10
} from "components/WorkspaceBuildProgress/WorkspaceBuildProgress"
11
- import { WorkspaceStatusBadge } from "components/WorkspaceStatusBadge/WorkspaceStatusBadge"
12
11
import { FC } from "react"
13
12
import { useTranslation } from "react-i18next"
14
13
import { useNavigate } from "react-router-dom"
15
14
import * as TypesGen from "../../api/typesGenerated"
16
15
import { AlertBanner } from "../AlertBanner/AlertBanner"
17
16
import { BuildsTable } from "../BuildsTable/BuildsTable"
18
17
import { Margins } from "../Margins/Margins"
19
- import {
20
- PageHeader ,
21
- PageHeaderSubtitle ,
22
- PageHeaderTitle ,
23
- } from "../PageHeader/PageHeader"
24
18
import { Resources } from "../Resources/Resources"
25
19
import { Stack } from "../Stack/Stack"
26
20
import { WorkspaceActions } from "../WorkspaceActions/WorkspaceActions"
27
21
import { WorkspaceDeletedBanner } from "../WorkspaceDeletedBanner/WorkspaceDeletedBanner"
28
22
import { WorkspaceStats } from "../WorkspaceStats/WorkspaceStats"
23
+ import {
24
+ FullWidthPageHeader ,
25
+ PageHeaderActions ,
26
+ PageHeaderTitle ,
27
+ PageHeaderSubtitle ,
28
+ } from "components/PageHeader/FullWidthPageHeader"
29
29
30
30
export enum WorkspaceErrors {
31
31
GET_BUILDS_ERROR = "getBuildsError" ,
@@ -125,64 +125,22 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
125
125
transitionStats = ActiveTransition ( template , workspace )
126
126
}
127
127
return (
128
- < Margins >
129
- < PageHeader
130
- actions = {
131
- < Stack direction = "row" spacing = { 1 } className = { styles . actions } >
132
- < WorkspaceActions
133
- workspaceStatus = { workspace . latest_build . status }
134
- isOutdated = { workspace . outdated }
135
- handleStart = { handleStart }
136
- handleStop = { handleStop }
137
- handleRestart = { handleRestart }
138
- handleDelete = { handleDelete }
139
- handleUpdate = { handleUpdate }
140
- handleCancel = { handleCancel }
141
- handleSettings = { handleSettings }
142
- handleChangeVersion = { handleChangeVersion }
143
- canChangeVersions = { canChangeVersions }
144
- isUpdating = { isUpdating }
145
- isRestarting = { isRestarting }
146
- />
147
- </ Stack >
148
- }
149
- >
128
+ < >
129
+ < FullWidthPageHeader >
150
130
< Stack direction = "row" spacing = { 3 } alignItems = "center" >
151
131
< Avatar
152
- size = "xl "
132
+ size = "md "
153
133
src = { workspace . template_icon }
154
134
variant = { workspace . template_icon ? "square" : undefined }
155
135
fitImage = { Boolean ( workspace . template_icon ) }
156
136
>
157
137
{ workspace . name }
158
138
</ Avatar >
159
139
< div >
160
- < PageHeaderTitle >
161
- { workspace . name }
162
- < WorkspaceStatusBadge
163
- build = { workspace . latest_build }
164
- className = { styles . statusBadge }
165
- />
166
- </ PageHeaderTitle >
167
- < PageHeaderSubtitle condensed >
168
- { workspace . owner_name }
169
- </ PageHeaderSubtitle >
140
+ < PageHeaderTitle > { workspace . name } </ PageHeaderTitle >
141
+ < PageHeaderSubtitle > { workspace . owner_name } </ PageHeaderSubtitle >
170
142
</ div >
171
143
</ Stack >
172
- </ PageHeader >
173
-
174
- < Stack
175
- direction = "column"
176
- className = { styles . firstColumnSpacer }
177
- spacing = { 4 }
178
- >
179
- { buildError }
180
- { cancellationError }
181
-
182
- < WorkspaceDeletedBanner
183
- workspace = { workspace }
184
- handleClick = { ( ) => navigate ( `/templates` ) }
185
- />
186
144
187
145
< WorkspaceStats
188
146
workspace = { workspace }
@@ -195,83 +153,121 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
195
153
onDeadlinePlus = { scheduleProps . onDeadlinePlus }
196
154
/>
197
155
198
- { failedBuildLogs && (
199
- < Stack >
200
- < AlertBanner severity = "error" >
201
- < Stack
202
- className = { styles . fullWidth }
203
- direction = "row"
204
- alignItems = "center"
205
- justifyContent = "space-between"
206
- >
207
- < Stack spacing = { 0 } >
208
- < span > Workspace build failed</ span >
209
- < span className = { styles . errorDetails } >
210
- { workspace . latest_build . job . error }
211
- </ span >
212
- </ Stack >
156
+ < PageHeaderActions >
157
+ < WorkspaceActions
158
+ workspaceStatus = { workspace . latest_build . status }
159
+ isOutdated = { workspace . outdated }
160
+ handleStart = { handleStart }
161
+ handleStop = { handleStop }
162
+ handleRestart = { handleRestart }
163
+ handleDelete = { handleDelete }
164
+ handleUpdate = { handleUpdate }
165
+ handleCancel = { handleCancel }
166
+ handleSettings = { handleSettings }
167
+ handleChangeVersion = { handleChangeVersion }
168
+ canChangeVersions = { canChangeVersions }
169
+ isUpdating = { isUpdating }
170
+ isRestarting = { isRestarting }
171
+ />
172
+ </ PageHeaderActions >
173
+ </ FullWidthPageHeader >
213
174
214
- { canUpdateTemplate && (
215
- < div >
216
- < Button
217
- onClick = { handleBuildRetry }
218
- startIcon = { < RefreshOutlined /> }
219
- size = "small"
220
- variant = "outlined"
221
- >
222
- { t ( "actionButton.retryDebugMode" ) }
223
- </ Button >
224
- </ div >
225
- ) }
226
- </ Stack >
227
- </ AlertBanner >
228
- < WorkspaceBuildLogs logs = { failedBuildLogs } />
229
- </ Stack >
230
- ) }
175
+ < Margins className = { styles . content } >
176
+ < Stack
177
+ direction = "column"
178
+ className = { styles . firstColumnSpacer }
179
+ spacing = { 4 }
180
+ >
181
+ { buildError }
182
+ { cancellationError }
231
183
232
- { transitionStats !== undefined && (
233
- < WorkspaceBuildProgress
184
+ < WorkspaceDeletedBanner
234
185
workspace = { workspace }
235
- transitionStats = { transitionStats }
186
+ handleClick = { ( ) => navigate ( `/templates` ) }
236
187
/>
237
- ) }
238
188
239
- { typeof resources !== "undefined" && resources . length > 0 && (
240
- < Resources
241
- resources = { resources }
242
- agentRow = { ( agent ) => (
243
- < AgentRow
244
- key = { agent . id }
245
- agent = { agent }
246
- workspace = { workspace }
247
- sshPrefix = { sshPrefix }
248
- showApps = { canUpdateWorkspace }
249
- hideSSHButton = { hideSSHButton }
250
- hideVSCodeDesktopButton = { hideVSCodeDesktopButton }
251
- serverVersion = { serverVersion }
252
- onUpdateAgent = { handleUpdate } // On updating the workspace the agent version is also updated
253
- />
254
- ) }
255
- />
256
- ) }
189
+ { failedBuildLogs && (
190
+ < Stack >
191
+ < AlertBanner severity = "error" >
192
+ < Stack
193
+ className = { styles . fullWidth }
194
+ direction = "row"
195
+ alignItems = "center"
196
+ justifyContent = "space-between"
197
+ >
198
+ < Stack spacing = { 0 } >
199
+ < span > Workspace build failed</ span >
200
+ < span className = { styles . errorDetails } >
201
+ { workspace . latest_build . job . error }
202
+ </ span >
203
+ </ Stack >
257
204
258
- { workspaceErrors [ WorkspaceErrors . GET_BUILDS_ERROR ] ? (
259
- < AlertBanner
260
- severity = "error"
261
- error = { workspaceErrors [ WorkspaceErrors . GET_BUILDS_ERROR ] }
262
- />
263
- ) : (
264
- < BuildsTable builds = { builds } />
265
- ) }
266
- </ Stack >
267
- </ Margins >
205
+ { canUpdateTemplate && (
206
+ < div >
207
+ < Button
208
+ onClick = { handleBuildRetry }
209
+ startIcon = { < RefreshOutlined /> }
210
+ size = "small"
211
+ variant = "outlined"
212
+ >
213
+ { t ( "actionButton.retryDebugMode" ) }
214
+ </ Button >
215
+ </ div >
216
+ ) }
217
+ </ Stack >
218
+ </ AlertBanner >
219
+ < WorkspaceBuildLogs logs = { failedBuildLogs } />
220
+ </ Stack >
221
+ ) }
222
+
223
+ { transitionStats !== undefined && (
224
+ < WorkspaceBuildProgress
225
+ workspace = { workspace }
226
+ transitionStats = { transitionStats }
227
+ />
228
+ ) }
229
+
230
+ { typeof resources !== "undefined" && resources . length > 0 && (
231
+ < Resources
232
+ resources = { resources }
233
+ agentRow = { ( agent ) => (
234
+ < AgentRow
235
+ key = { agent . id }
236
+ agent = { agent }
237
+ workspace = { workspace }
238
+ sshPrefix = { sshPrefix }
239
+ showApps = { canUpdateWorkspace }
240
+ hideSSHButton = { hideSSHButton }
241
+ hideVSCodeDesktopButton = { hideVSCodeDesktopButton }
242
+ serverVersion = { serverVersion }
243
+ onUpdateAgent = { handleUpdate } // On updating the workspace the agent version is also updated
244
+ />
245
+ ) }
246
+ />
247
+ ) }
248
+
249
+ { workspaceErrors [ WorkspaceErrors . GET_BUILDS_ERROR ] ? (
250
+ < AlertBanner
251
+ severity = "error"
252
+ error = { workspaceErrors [ WorkspaceErrors . GET_BUILDS_ERROR ] }
253
+ />
254
+ ) : (
255
+ < BuildsTable builds = { builds } />
256
+ ) }
257
+ </ Stack >
258
+ </ Margins >
259
+ </ >
268
260
)
269
261
}
270
262
271
263
const spacerWidth = 300
272
264
273
265
export const useStyles = makeStyles ( ( theme ) => {
274
266
return {
267
+ content : {
268
+ marginTop : theme . spacing ( 4 ) ,
269
+ } ,
270
+
275
271
statusBadge : {
276
272
marginLeft : theme . spacing ( 2 ) ,
277
273
} ,
0 commit comments