function getBody()

in webview-ui/src/CreateCluster/CreateCluster.tsx [26:74]


    function getBody() {
        switch (state.stage) {
            case Stage.Uninitialized:
            case Stage.Loading:
                return <p>Loading...</p>;
            case Stage.CollectingInput:
                return (
                    <CreateClusterInput
                        locations={state.locations!}
                        resourceGroups={state.resourceGroups!}
                        eventHandlers={eventHandlers}
                        vscode={vscode}
                    />
                );
            case Stage.Creating:
                console.log("Creating cluster");
                return (
                    <>
                        <h3>
                            Creating Cluster {state.createParams?.name} in {state.createParams?.location}
                        </h3>
                        {state.deploymentPortalUrl && (
                            <p>
                                Click <a href={state.deploymentPortalUrl}>here</a> to view the deployment in the Azure
                                Portal.
                            </p>
                        )}

                        <ProgressRing />
                    </>
                );
            case Stage.Failed:
                return (
                    <>
                        <h3>Error Creating Cluster</h3>
                        <p>{state.message}</p>
                    </>
                );
            case Stage.Succeeded:
                return (
                    <Success
                        portalClusterUrl={state.createdCluster?.portalUrl || ""}
                        name={state.createParams?.name || ""}
                    />
                );
            default:
                throw new Error(`Unexpected stage ${state.stage}`);
        }
    }