@@ -18,39 +18,33 @@ export interface ActionButtonProps {
18
18
handleAction : ( buildParameters ?: WorkspaceBuildParameter [ ] ) => void ;
19
19
disabled ?: boolean ;
20
20
tooltipText ?: string ;
21
+ isRunning ?: boolean ;
22
+ requireActiveVersion ?: boolean ;
21
23
}
22
24
23
- export const UpdateAndStartButton : FC < ActionButtonProps > = ( {
25
+ export const UpdateButton : FC < ActionButtonProps > = ( {
24
26
handleAction,
25
27
loading,
28
+ isRunning,
29
+ requireActiveVersion,
26
30
} ) => {
27
31
return (
28
- < Tooltip title = "Start workspace with the latest template version." >
32
+ < Tooltip
33
+ title = {
34
+ requireActiveVersion
35
+ ? "This template requires automatic updates on workspace startup. Contact your administrator if you want to preserve the template version."
36
+ : isRunning
37
+ ? "Stop workspace and restart it with the latest template version."
38
+ : "Start workspace with the latest template version."
39
+ }
40
+ >
29
41
< TopbarButton
30
- disabled = { loading }
31
42
data-testid = "workspace-update-button"
32
- onClick = { ( ) => handleAction ( ) }
33
- >
34
- < CirclePlayIcon />
35
- { loading ? < > Updating…</ > : < > Update…</ > }
36
- </ TopbarButton >
37
- </ Tooltip >
38
- ) ;
39
- } ;
40
-
41
- export const UpdateAndRestartButton : FC < ActionButtonProps > = ( {
42
- handleAction,
43
- loading,
44
- } ) => {
45
- return (
46
- < Tooltip title = "Stop workspace, if running, and restart it with the latest template version." >
47
- < TopbarButton
48
43
disabled = { loading }
49
- data-testid = "workspace-update-and-restart-button"
50
44
onClick = { ( ) => handleAction ( ) }
51
45
>
52
- < RotateCcwIcon />
53
- { loading ? < > Updating…</ > : < > Update and restart …</ > }
46
+ { isRunning ? < RotateCcwIcon /> : < CirclePlayIcon /> }
47
+ { loading ? < > Updating…</ > : < > Update…</ > }
54
48
</ TopbarButton >
55
49
</ Tooltip >
56
50
) ;
@@ -103,19 +97,6 @@ export const StartButton: FC<ActionButtonPropsWithWorkspace> = ({
103
97
) ;
104
98
} ;
105
99
106
- export const UpdateAndStartButtonRequireActiveVersion : FC <
107
- ActionButtonProps
108
- > = ( { handleAction } ) => {
109
- return (
110
- < Tooltip title = "This template requires automatic updates on workspace startup. Contact your administrator if you want to preserve the template version." >
111
- < TopbarButton onClick = { ( ) => handleAction ( ) } >
112
- < CirclePlayIcon />
113
- Update and start…
114
- </ TopbarButton >
115
- </ Tooltip >
116
- ) ;
117
- } ;
118
-
119
100
export const StopButton : FC < ActionButtonProps > = ( {
120
101
handleAction,
121
102
loading,
@@ -157,19 +138,6 @@ export const RestartButton: FC<ActionButtonPropsWithWorkspace> = ({
157
138
) ;
158
139
} ;
159
140
160
- export const UpdateAndRestartButtonRequireActiveVersion : FC <
161
- ActionButtonProps
162
- > = ( { handleAction } ) => {
163
- return (
164
- < Tooltip title = "This template requires automatic updates on workspace startup. Contact your administrator if you want to preserve the template version." >
165
- < TopbarButton onClick = { ( ) => handleAction ( ) } >
166
- < RotateCcwIcon />
167
- Update and restart…
168
- </ TopbarButton >
169
- </ Tooltip >
170
- ) ;
171
- } ;
172
-
173
141
export const CancelButton : FC < ActionButtonProps > = ( { handleAction } ) => {
174
142
return (
175
143
< TopbarButton onClick = { ( ) => handleAction ( ) } >
0 commit comments