Skip to content

Commit 827a1a0

Browse files
authored
Revert "Redirect on workspace stop" (#19323)
1 parent fcccc0d commit 827a1a0

File tree

5 files changed

+6
-58
lines changed

5 files changed

+6
-58
lines changed

components/dashboard/src/service/service.tsx

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ export class IDEFrontendService implements IDEFrontendDashboardService.IServer {
221221
this.workspace = workspaceResponse.workspace!;
222222
this.user = user;
223223
this.ideCredentials = ideCredentials;
224-
const reconcile = async (status?: WorkspaceStatus) => {
224+
const reconcile = (status?: WorkspaceStatus) => {
225225
const info = this.parseInfo(status ?? this.workspace.status!);
226226
this.latestInfo = info;
227227
const oldInstanceID = this.instanceID;
@@ -231,15 +231,6 @@ export class IDEFrontendService implements IDEFrontendDashboardService.IServer {
231231
if (info.instanceId && oldInstanceID !== info.instanceId) {
232232
this.auth();
233233
}
234-
235-
// Redirect to custom url
236-
if (
237-
(info.statusPhase === "stopping" || info.statusPhase === "stopped") &&
238-
info.workspaceType === "regular"
239-
) {
240-
await this.redirectToCustomUrl(info);
241-
}
242-
243234
this.sendInfoUpdate(this.latestInfo);
244235
};
245236
reconcile();
@@ -264,37 +255,6 @@ export class IDEFrontendService implements IDEFrontendDashboardService.IServer {
264255
};
265256
}
266257

267-
private async redirectToCustomUrl(info: IDEFrontendDashboardService.Info) {
268-
const isDataOps = await getExperimentsClient().getValueAsync("dataops", false, {
269-
user: { id: this.user!.id },
270-
gitpodHost: gitpodHostUrl.toString(),
271-
});
272-
const dataOpsRedirectUrl = await getExperimentsClient().getValueAsync("dataops_redirect_url", "undefined", {
273-
user: { id: this.user!.id },
274-
gitpodHost: gitpodHostUrl.toString(),
275-
});
276-
277-
if (!isDataOps) {
278-
return;
279-
}
280-
281-
try {
282-
const params: Record<string, string> = { workspaceID: info.workspaceID };
283-
let redirectURL: string;
284-
if (dataOpsRedirectUrl === "undefined") {
285-
redirectURL = this.workspace.metadata?.originalContextUrl ?? "";
286-
} else {
287-
redirectURL = dataOpsRedirectUrl;
288-
params.contextURL = this.workspace.metadata?.originalContextUrl ?? "";
289-
}
290-
const url = new URL(redirectURL);
291-
url.search = new URLSearchParams(params).toString();
292-
this.relocate(url.toString());
293-
} catch {
294-
console.error("Invalid redirect URL");
295-
}
296-
}
297-
298258
// implements
299259

300260
private async auth() {

components/supervisor/frontend/src/index.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ IDEWebSocket.install();
6363
const ideService = IDEFrontendService.create();
6464
const loadingIDE = new Promise((resolve) => window.addEventListener("DOMContentLoaded", resolve, { once: true }));
6565
const toStop = new DisposableCollection();
66-
let willRedirect = false;
6766

67+
document.body.style.visibility = "hidden";
6868
LoadingFrame.load().then(async (loading) => {
6969
const frontendDashboardServiceClient = loading.frontendDashboardServiceClient;
7070
await frontendDashboardServiceClient.initialize();
@@ -73,10 +73,6 @@ LoadingFrame.load().then(async (loading) => {
7373
return;
7474
}
7575

76-
frontendDashboardServiceClient.onWillRedirect(() => {
77-
willRedirect = true;
78-
});
79-
8076
document.title = frontendDashboardServiceClient.latestInfo.workspaceDescription ?? "gitpod";
8177
window.gitpod.loggedUserID = frontendDashboardServiceClient.latestInfo.loggedUserId;
8278
window.gitpod.openDesktopIDE = frontendDashboardServiceClient.openDesktopIDE.bind(frontendDashboardServiceClient);
@@ -163,11 +159,11 @@ LoadingFrame.load().then(async (loading) => {
163159
};
164160
const updateCurrentFrame = () => {
165161
const newCurrent = nextFrame();
166-
if (current === newCurrent || willRedirect) {
162+
if (current === newCurrent) {
167163
return;
168164
}
169-
current.classList.toggle("hidden", true);
170-
newCurrent.classList.toggle("hidden", false);
165+
current.style.visibility = "hidden";
166+
newCurrent.style.visibility = "visible";
171167
if (current === document.body) {
172168
while (document.body.firstChild && document.body.firstChild !== newCurrent) {
173169
document.body.removeChild(document.body.firstChild);

components/supervisor/frontend/src/shared/frontend-dashboard-service.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ export class FrontendDashboardServiceClient implements IDEFrontendDashboardServi
2121
private readonly onOpenBrowserIDEEmitter = new Emitter<void>();
2222
readonly onOpenBrowserIDE = this.onOpenBrowserIDEEmitter.event;
2323

24-
private readonly onWillRedirectEmitter = new Emitter<void>();
25-
readonly onWillRedirect = this.onWillRedirectEmitter.event;
26-
2724
private resolveInit!: () => void;
2825
private initPromise = new Promise<void>((resolve) => (this.resolveInit = resolve));
2926

@@ -53,7 +50,6 @@ export class FrontendDashboardServiceClient implements IDEFrontendDashboardServi
5350
this.onDidChangeEmitter.fire(this.latestInfo);
5451
}
5552
if (IDEFrontendDashboardService.isRelocateEventData(event.data)) {
56-
this.onWillRedirectEmitter.fire();
5753
window.location.href = event.data.url;
5854
}
5955
if (IDEFrontendDashboardService.isOpenBrowserIDE(event.data)) {

components/supervisor/frontend/src/shared/index.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,3 @@
1515
border: 0px;
1616
overflow: hidden;
1717
}
18-
19-
.gitpod-frame.hidden {
20-
width: 0px;
21-
height: 0px;
22-
}

components/supervisor/frontend/src/shared/loading-frame.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export function load(): Promise<{
1414
return new Promise((resolve) => {
1515
const frame = document.createElement("iframe");
1616
frame.src = startUrl.toString();
17+
frame.style.visibility = "visible";
1718
frame.className = "gitpod-frame loading";
1819
document.body.prepend(frame);
1920

0 commit comments

Comments
 (0)