From 7796eecf5a97a6baf4bc126ed0d855a820e34216 Mon Sep 17 00:00:00 2001 From: Jan Keromnes Date: Mon, 19 Apr 2021 08:00:34 +0000 Subject: [PATCH 1/2] [dashboard] Disable 'Continue with Default Image' button on click to prevent restart spam --- components/dashboard/src/start/StartWorkspace.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/dashboard/src/start/StartWorkspace.tsx b/components/dashboard/src/start/StartWorkspace.tsx index 352ae2bb43aeca..80ef249744056e 100644 --- a/components/dashboard/src/start/StartWorkspace.tsx +++ b/components/dashboard/src/start/StartWorkspace.tsx @@ -201,7 +201,7 @@ export default class StartWorkspace extends React.Component this.startWorkspace(true, true)} />; + return { (e.target as HTMLButtonElement).disabled = true; this.startWorkspace(true, true); }} />; // Pending means the workspace does not yet consume resources in the cluster, but rather is looking for // some space within the cluster. If for example the cluster needs to scale up to accomodate the @@ -267,7 +267,7 @@ export default class StartWorkspace extends React.Component this.startWorkspace(true, true)} phase={phase} error={error} />; + return { (e.target as HTMLButtonElement).disabled = true; this.startWorkspace(true, true); }} phase={phase} error={error} />; } if (!isHeadless && this.state.workspaceInstance.status.conditions.timeout) { title = 'Timed Out'; @@ -297,7 +297,7 @@ export default class StartWorkspace extends React.Component void; + onStartWithDefaultImage: (event: React.MouseEvent) => void; phase?: StartPhase; error?: StartWorkspaceError; } From 57748503dc92f1eecbb86f79996c394cee325217 Mon Sep 17 00:00:00 2001 From: Jan Keromnes Date: Thu, 29 Apr 2021 05:21:15 +0000 Subject: [PATCH 2/2] [dashboard] Don't show 'Continue with Default Image' button while the build is still running --- components/dashboard/src/start/StartWorkspace.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/components/dashboard/src/start/StartWorkspace.tsx b/components/dashboard/src/start/StartWorkspace.tsx index 80ef249744056e..3397d789558c3c 100644 --- a/components/dashboard/src/start/StartWorkspace.tsx +++ b/components/dashboard/src/start/StartWorkspace.tsx @@ -201,7 +201,7 @@ export default class StartWorkspace extends React.Component { (e.target as HTMLButtonElement).disabled = true; this.startWorkspace(true, true); }} />; + return ; // Pending means the workspace does not yet consume resources in the cluster, but rather is looking for // some space within the cluster. If for example the cluster needs to scale up to accomodate the @@ -267,7 +267,11 @@ export default class StartWorkspace extends React.Component { (e.target as HTMLButtonElement).disabled = true; this.startWorkspace(true, true); }} phase={phase} error={error} />; + const restartWithDefaultImage = (event: React.MouseEvent) => { + (event.target as HTMLButtonElement).disabled = true; + this.startWorkspace(true, true); + } + return ; } if (!isHeadless && this.state.workspaceInstance.status.conditions.timeout) { title = 'Timed Out'; @@ -297,7 +301,7 @@ export default class StartWorkspace extends React.Component void; + onStartWithDefaultImage?: (event: React.MouseEvent) => void; phase?: StartPhase; error?: StartWorkspaceError; } @@ -329,7 +333,7 @@ function ImageBuildView(props: ImageBuildViewProps) { }> - + {!!props.onStartWithDefaultImage && } ; }