Skip to content

Commit

Permalink
Fix multiclick by disabling the button. (#1023)
Browse files Browse the repository at this point in the history
Signed-off-by: Tatsat Mishra <[email protected]>
Co-authored-by: Tatsat Mishra <[email protected]>
  • Loading branch information
Tatsinnit and Tatsat Mishra authored Oct 25, 2024
1 parent 8c9de92 commit 57ac2c6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/panels/KaitoPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export class KaitoPanelDataProvider implements PanelDataProvider<"kaito"> {
};

try {
const poller = await longRunning(`Configuring the KAITO for ${this.clusterName} cluster.`, () => {
const poller = await longRunning("", () => {
return this.containerServiceClient.managedClusters.beginCreateOrUpdate(
this.resourceGroupName,
this.clusterName,
Expand Down
11 changes: 10 additions & 1 deletion webview-ui/src/Kaito/Kaito.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@ import { InitialState, ProgressEventType } from "../../../src/webview-contract/w
import { useStateManagement } from "../utilities/state";
import styles from "./Kaito.module.css";
import kaitoimage from "./kaitoimage.png";
import { useState } from "react";

// import { KaitoModels } from "./KaitoModels";
import { stateUpdater, vscode } from "./state";
export function Kaito(initialState: InitialState) {
const { state } = useStateManagement(stateUpdater, initialState, vscode);
const [isDisabled, setIsDisabled] = useState(false);

const handleClick = () => {
onClickKaitoInstall();
setIsDisabled(true); // Disable the button after click
};

function onClickKaitoInstall() {
vscode.postInstallKaitoRequest();
Expand Down Expand Up @@ -51,7 +58,9 @@ export function Kaito(initialState: InitialState) {
</div>
<div>
{state.kaitoInstallStatus === ProgressEventType.NotStarted && (
<VSCodeButton onClick={onClickKaitoInstall}>Install</VSCodeButton>
<VSCodeButton onClick={handleClick} disabled={isDisabled}>
Install
</VSCodeButton>
)}
{state.kaitoInstallStatus === ProgressEventType.InProgress &&
state.operationDescription.includes("Installing Kaito") && (
Expand Down

0 comments on commit 57ac2c6

Please sign in to comment.