import { DefaultButton, IconButton, Image, Pivot, PivotItem, PrimaryButton, Stack, Text, TextField, } from "@fluentui/react"; import { distributeTableCommand, distributeTableCommandForDisplay, loadDataCommand, loadDataCommandForDisplay, newTableCommand, newTableCommandForDisplay, queryCommand, queryCommandForDisplay, } from "Explorer/Quickstart/PostgreQuickstartCommands"; import { customPivotHeaderRenderer } from "Explorer/Quickstart/Shared/QuickstartRenderUtilities"; import { useTerminal } from "hooks/useTerminal"; import React, { useState } from "react"; import Youtube from "react-youtube"; import CompleteIcon from "../../../images/QuickstartComplete.svg"; import { ReactTabKind, useTabs } from "../../hooks/useTabs"; enum GuideSteps { Login, NewTable, DistributeTable, LoadData, Query, } export const QuickstartGuide: React.FC = (): JSX.Element => { const [currentStep, setCurrentStep] = useState(0); const onCopyBtnClicked = (selector: string): void => { const textfield: HTMLInputElement = document.querySelector(selector); textfield.select(); document.execCommand("copy"); }; return ( Quick start guide {currentStep < 5 && ( setCurrentStep(Object.values(GuideSteps).indexOf(item.props.itemKey))} > customPivotHeaderRenderer(props, defaultRenderer, currentStep, 0) } itemKey={GuideSteps[0]} onClick={() => { setCurrentStep(0); }} > This tutorial guides you to create and query distributed tables using a sample dataset.

To begin, please enter the cluster's password in the PostgreSQL terminal.

Note: If you navigate out of the Quick Start tab (PostgreSQL Shell), the session will be closed and all ongoing commands might be interrupted.
customPivotHeaderRenderer(props, defaultRenderer, currentStep, 1) } itemKey={GuideSteps[1]} onClick={() => setCurrentStep(1)} > Let's create two tables github_users and github_events in “cosmosdb_tutorial” schema. useTerminal.getState().sendMessage(newTableCommand)} > Create new table onCopyBtnClicked("#newTableCommand")} /> customPivotHeaderRenderer(props, defaultRenderer, currentStep, 2) } itemKey={GuideSteps[2]} onClick={() => setCurrentStep(2)} > Let’s distribute the two tables using the create_distributed_table() function.

We are choosing “user_id” as the distribution column for our sample dataset.
useTerminal.getState().sendMessage(distributeTableCommand)} > Create distributed table onCopyBtnClicked("#distributeTableCommand")} />
customPivotHeaderRenderer(props, defaultRenderer, currentStep, 3) } itemKey={GuideSteps[3]} onClick={() => setCurrentStep(3)} > Let's load the two tables with a sample dataset generated from the GitHub API. useTerminal.getState().sendMessage(loadDataCommand)} > Load data onCopyBtnClicked("#loadDataCommand")} /> customPivotHeaderRenderer(props, defaultRenderer, currentStep, 4) } itemKey={GuideSteps[4]} onClick={() => setCurrentStep(4)} > Congratulations on creating and distributing your tables. Now, it's time to run your first query! useTerminal.getState().sendMessage(queryCommand)} > Try queries onCopyBtnClicked("#queryCommand")} />
)} {currentStep === 5 && ( You are all set! You have completed the quick start guide.{" "} )}
setCurrentStep(currentStep - 1)}> Previous {currentStep < 5 && ( setCurrentStep(currentStep + 1)} style={{ marginLeft: 8 }}> Next )} {currentStep === 5 && ( useTabs.getState().closeReactTab(ReactTabKind.Quickstart)} style={{ marginLeft: 8 }} > Close )}
); };