@@ -49,6 +49,7 @@ require("../src/shared/index.css");
49
49
50
50
import { WorkspaceInstancePhase } from "@gitpod/gitpod-protocol" ;
51
51
import { DisposableCollection } from "@gitpod/gitpod-protocol/lib/util/disposable" ;
52
+ import { IDEFrontendDashboardService } from "@gitpod/gitpod-protocol/lib/frontend-dashboard-service" ;
52
53
import * as heartBeat from "./ide/heart-beat" ;
53
54
import * as IDEFrontendService from "./ide/ide-frontend-service-impl" ;
54
55
import * as IDEWorker from "./ide/ide-worker" ;
@@ -286,7 +287,7 @@ LoadingFrame.load().then(async (loading) => {
286
287
IDEWebSocket . connectWorkspace ( ) ,
287
288
frontendDashboardServiceClient . onInfoUpdate ( ( status ) => {
288
289
if ( status . statusPhase === "stopping" || status . statusPhase === "stopped" ) {
289
- maybeRedirectToCustomUrl ( ) ;
290
+ maybeRedirectToCustomUrl ( frontendDashboardServiceClient . latestInfo ) ;
290
291
toStop . dispose ( ) ;
291
292
}
292
293
} ) ,
@@ -299,14 +300,29 @@ LoadingFrame.load().then(async (loading) => {
299
300
} ) ( ) ;
300
301
} ) ;
301
302
302
- async function maybeRedirectToCustomUrl ( ) {
303
- const redirectURL = await experimentsClient . getValueAsync ( "dataops" , "" , { } ) ;
304
- if ( ! redirectURL ) {
303
+ async function maybeRedirectToCustomUrl ( info : IDEFrontendDashboardService . Info ) {
304
+ const isDataOps = await experimentsClient . getValueAsync ( "dataops" , false , {
305
+ user : { id : info . loggedUserId } ,
306
+ } ) ;
307
+ const dataOpsRedirectUrl = await experimentsClient . getValueAsync ( "dataops_redirect_url" , "undefined" , {
308
+ user : { id : info . loggedUserId } ,
309
+ } ) ;
310
+
311
+ if ( ! isDataOps ) {
305
312
return ;
306
313
}
307
314
308
315
try {
316
+ const params : Record < string , string > = { workspaceID : info . workspaceID } ;
317
+ let redirectURL : string ;
318
+ if ( dataOpsRedirectUrl === "undefined" ) {
319
+ redirectURL = info . contextUrl ;
320
+ } else {
321
+ redirectURL = dataOpsRedirectUrl ;
322
+ params . contextURL = info . contextUrl ;
323
+ }
309
324
const url = new URL ( redirectURL ) ;
325
+ url . search = new URLSearchParams ( params ) . toString ( ) ;
310
326
window . location . href = url . toString ( ) ;
311
327
} catch {
312
328
console . error ( "Invalid redirect URL" ) ;
0 commit comments