@@ -239,7 +239,7 @@ export async function registerWorkspaceCommands(context: GitpodExtensionContext)
239
239
return context . gitpod . server . stopWorkspace ( context . info . workspaceId ) ;
240
240
} ) ) ;
241
241
context . subscriptions . push ( vscode . commands . registerCommand ( 'gitpod.upgradeSubscription' , ( ) => {
242
- const url = new GitpodHostUrl ( context . info . gitpodHost ) . asUpgradeSubscription ( ) . toString ( ) ;
242
+ const url = new GitpodHostUrl ( context . info . gitpodHost ) . asBilling ( ) . toString ( ) ;
243
243
context . fireAnalyticsEvent ( {
244
244
eventName : 'vscode_execute_command_gitpod_open_link' ,
245
245
properties : { url }
@@ -387,36 +387,57 @@ export async function registerWorkspaceTimeout(context: GitpodExtensionContext):
387
387
}
388
388
} ) ;
389
389
try {
390
- const result = await context . gitpod . server . setWorkspaceTimeout ( context . info . workspaceId , '180m' ) ;
391
- if ( result . resetTimeoutOnWorkspaces ?. length > 0 ) {
392
- vscode . window . showWarningMessage ( 'Workspace timeout has been extended to three hours. This reset the workspace timeout for other workspaces.' ) ;
393
- } else {
394
- vscode . window . showInformationMessage ( 'Workspace timeout has been extended to three hours.' ) ;
395
- }
390
+ await context . gitpod . server . setWorkspaceTimeout ( context . info . workspaceId , '180m' ) ;
391
+ vscode . window . showWarningMessage ( `Workspace timeout has been extended to 180m.` ) ;
396
392
} catch ( err ) {
397
393
vscode . window . showErrorMessage ( `Cannot extend workspace timeout: ${ err . toString ( ) } ` ) ;
398
394
}
399
395
} ) ) ;
400
396
397
+
398
+ context . subscriptions . push ( vscode . commands . registerCommand ( 'gitpod.setWorkspaceTimeout' , async ( ) => {
399
+ const timeout = await vscode . window . showInputBox ( {
400
+ value : '180m' ,
401
+ prompt : 'Please input the timeout time, such as 30m, 1h, 2h, 3h' ,
402
+ } ) ;
403
+ if ( ! timeout ) {
404
+ return ;
405
+ }
406
+ context . fireAnalyticsEvent ( {
407
+ eventName : 'vscode_execute_command_gitpod_workspace' ,
408
+ properties : {
409
+ action : 'configure-timeout'
410
+ }
411
+ } ) ;
412
+ try {
413
+ const { humanReadableDuration } = await context . gitpod . server . setWorkspaceTimeout ( context . info . workspaceId , timeout ) ;
414
+ vscode . window . showWarningMessage ( `Workspace timeout has been changed to ${ humanReadableDuration ?? timeout } .` ) ;
415
+ } catch ( err ) {
416
+ vscode . window . showErrorMessage ( `Cannot configure workspace timeout: ${ err . toString ( ) } ` ) ;
417
+ }
418
+ } ) ) ;
419
+
401
420
const workspaceTimeout = await context . gitpod . server . getWorkspaceTimeout ( context . info . workspaceId ) ;
402
421
if ( ! workspaceTimeout . canChange ) {
403
422
return ;
404
423
}
405
424
406
425
const listener = await context . instanceListener ;
407
426
const extendTimeoutStatusBarItem = vscode . window . createStatusBarItem ( 'gitpod.extendTimeout' , vscode . StatusBarAlignment . Right , - 100 ) ;
408
- extendTimeoutStatusBarItem . name = 'Click to extend the workspace timeout.' ;
427
+ extendTimeoutStatusBarItem . name = 'Extend the workspace timeout.' ;
409
428
context . subscriptions . push ( extendTimeoutStatusBarItem ) ;
410
429
extendTimeoutStatusBarItem . text = '$(watch)' ;
411
- extendTimeoutStatusBarItem . command = 'gitpod.ExtendTimeout ' ;
430
+ extendTimeoutStatusBarItem . command = 'gitpod.setWorkspaceTimeout ' ;
412
431
const update = ( ) => {
413
432
const instance = listener . info . latestInstance ;
414
433
if ( ! instance ) {
415
434
extendTimeoutStatusBarItem . hide ( ) ;
416
435
return ;
417
436
}
418
437
extendTimeoutStatusBarItem . tooltip = `Workspace Timeout: ${ instance . status . timeout } . Click to extend.` ;
419
- extendTimeoutStatusBarItem . color = instance . status . timeout === '180m' ? new vscode . ThemeColor ( 'notificationsWarningIcon.foreground' ) : undefined ;
438
+
439
+ // TODO: query default timeout, currently all paid plan default timeout is 60m.
440
+ extendTimeoutStatusBarItem . color = instance . status . timeout !== '60m' ? new vscode . ThemeColor ( 'notificationsWarningIcon.foreground' ) : undefined ;
420
441
extendTimeoutStatusBarItem . show ( ) ;
421
442
} ;
422
443
update ( ) ;
0 commit comments