import { Checkbox, Stack } from "@fluentui/react"; import { ThroughputInput } from "Explorer/Controls/ThroughputInput/ThroughputInput"; import { isFreeTierAccount } from "Explorer/Panes/AddCollectionPanel/AddCollectionPanelUtility"; import { useDatabases } from "Explorer/useDatabases"; import React from "react"; import { getCollectionName } from "Utils/APITypeUtils"; import { isServerlessAccount } from "Utils/CapabilityUtils"; export interface AddMVThroughputComponentProps { enableDedicatedThroughput: boolean; setEnabledDedicatedThroughput: React.Dispatch>; isSelectedSourceContainerSharedThroughput: () => boolean; showCollectionThroughputInput: () => boolean; materializedViewThroughputOnChange: (materializedViewThroughputValue: number) => void; isMaterializedViewAutoscaleOnChange: (isMaterializedViewAutoscaleValue: boolean) => void; setIsThroughputCapExceeded: React.Dispatch>; isCostAknowledgedOnChange: (isCostAknowledgedValue: boolean) => void; } export const AddMVThroughputComponent = (props: AddMVThroughputComponentProps): JSX.Element => { const { enableDedicatedThroughput, setEnabledDedicatedThroughput, isSelectedSourceContainerSharedThroughput, showCollectionThroughputInput, materializedViewThroughputOnChange, isMaterializedViewAutoscaleOnChange, setIsThroughputCapExceeded, isCostAknowledgedOnChange, } = props; return ( {!isServerlessAccount() && isSelectedSourceContainerSharedThroughput() && ( setEnabledDedicatedThroughput(isChecked)} /> )} {showCollectionThroughputInput() && ( { materializedViewThroughputOnChange(throughput); }} setIsAutoscale={(isAutoscale: boolean) => { isMaterializedViewAutoscaleOnChange(isAutoscale); }} setIsThroughputCapExceeded={(isThroughputCapExceeded: boolean) => { setIsThroughputCapExceeded(isThroughputCapExceeded); }} onCostAcknowledgeChange={(isAcknowledged: boolean) => { isCostAknowledgedOnChange(isAcknowledged); }} /> )} ); };