mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-07-21 12:57:38 +01:00
Enable throughput switch for GSI source containers
This commit is contained in:
@@ -179,7 +179,8 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
private shouldShowComputedPropertiesEditor: boolean;
|
private shouldShowComputedPropertiesEditor: boolean;
|
||||||
private shouldShowIndexingPolicyEditor: boolean;
|
private shouldShowIndexingPolicyEditor: boolean;
|
||||||
private shouldShowPartitionKeyEditor: boolean;
|
private shouldShowPartitionKeyEditor: boolean;
|
||||||
private isGlobalSecondaryIndex: boolean;
|
private isGlobalSecondaryIndexSource: boolean;
|
||||||
|
private isGlobalSecondaryIndexTarget: boolean;
|
||||||
private isVectorSearchEnabled: boolean;
|
private isVectorSearchEnabled: boolean;
|
||||||
private isFullTextSearchEnabled: boolean;
|
private isFullTextSearchEnabled: boolean;
|
||||||
private totalThroughputUsed: number;
|
private totalThroughputUsed: number;
|
||||||
@@ -197,8 +198,8 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
this.shouldShowComputedPropertiesEditor = userContext.apiType === "SQL";
|
this.shouldShowComputedPropertiesEditor = userContext.apiType === "SQL";
|
||||||
this.shouldShowIndexingPolicyEditor = userContext.apiType !== "Cassandra" && userContext.apiType !== "Mongo";
|
this.shouldShowIndexingPolicyEditor = userContext.apiType !== "Cassandra" && userContext.apiType !== "Mongo";
|
||||||
this.shouldShowPartitionKeyEditor = userContext.apiType === "SQL" && isRunningOnPublicCloud();
|
this.shouldShowPartitionKeyEditor = userContext.apiType === "SQL" && isRunningOnPublicCloud();
|
||||||
this.isGlobalSecondaryIndex =
|
this.isGlobalSecondaryIndexSource = !!this.collection?.materializedViews();
|
||||||
!!this.collection?.materializedViewDefinition() || !!this.collection?.materializedViews();
|
this.isGlobalSecondaryIndexTarget = !!this.collection?.materializedViewDefinition();
|
||||||
this.isVectorSearchEnabled = isVectorSearchEnabled() && !hasDatabaseSharedThroughput(this.collection);
|
this.isVectorSearchEnabled = isVectorSearchEnabled() && !hasDatabaseSharedThroughput(this.collection);
|
||||||
this.isFullTextSearchEnabled = userContext.apiType === "SQL";
|
this.isFullTextSearchEnabled = userContext.apiType === "SQL";
|
||||||
|
|
||||||
@@ -1287,7 +1288,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
collection: this.collection,
|
collection: this.collection,
|
||||||
database: this.database,
|
database: this.database,
|
||||||
isFixedContainer: this.isFixedContainer,
|
isFixedContainer: this.isFixedContainer,
|
||||||
isGlobalSecondaryIndex: this.isGlobalSecondaryIndex,
|
isGlobalSecondaryIndexTarget: this.isGlobalSecondaryIndexTarget,
|
||||||
onThroughputChange: this.onThroughputChange,
|
onThroughputChange: this.onThroughputChange,
|
||||||
throughput: this.state.throughput,
|
throughput: this.state.throughput,
|
||||||
throughputBaseline: this.state.throughputBaseline,
|
throughputBaseline: this.state.throughputBaseline,
|
||||||
@@ -1356,7 +1357,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
isFullTextSearchEnabled: this.isFullTextSearchEnabled,
|
isFullTextSearchEnabled: this.isFullTextSearchEnabled,
|
||||||
shouldDiscardContainerPolicies: this.state.shouldDiscardContainerPolicies,
|
shouldDiscardContainerPolicies: this.state.shouldDiscardContainerPolicies,
|
||||||
resetShouldDiscardContainerPolicyChange: this.resetShouldDiscardContainerPolicies,
|
resetShouldDiscardContainerPolicyChange: this.resetShouldDiscardContainerPolicies,
|
||||||
isGlobalSecondaryIndex: this.isGlobalSecondaryIndex,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const indexingPolicyComponentProps: IndexingPolicyComponentProps = {
|
const indexingPolicyComponentProps: IndexingPolicyComponentProps = {
|
||||||
@@ -1509,7 +1509,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isGlobalSecondaryIndex) {
|
if (this.isGlobalSecondaryIndexTarget || this.isGlobalSecondaryIndexSource) {
|
||||||
tabs.push({
|
tabs.push({
|
||||||
tab: SettingsV2TabTypes.GlobalSecondaryIndexTab,
|
tab: SettingsV2TabTypes.GlobalSecondaryIndexTab,
|
||||||
content: <GlobalSecondaryIndexComponent {...globalSecondaryIndexComponentProps} />,
|
content: <GlobalSecondaryIndexComponent {...globalSecondaryIndexComponentProps} />,
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ export interface ContainerPolicyComponentProps {
|
|||||||
isFullTextSearchEnabled: boolean;
|
isFullTextSearchEnabled: boolean;
|
||||||
shouldDiscardContainerPolicies: boolean;
|
shouldDiscardContainerPolicies: boolean;
|
||||||
resetShouldDiscardContainerPolicyChange: () => void;
|
resetShouldDiscardContainerPolicyChange: () => void;
|
||||||
isGlobalSecondaryIndex?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ContainerPolicyComponent: React.FC<ContainerPolicyComponentProps> = ({
|
export const ContainerPolicyComponent: React.FC<ContainerPolicyComponentProps> = ({
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ describe("ScaleComponent", () => {
|
|||||||
collection: collection,
|
collection: collection,
|
||||||
database: undefined,
|
database: undefined,
|
||||||
isFixedContainer: false,
|
isFixedContainer: false,
|
||||||
isGlobalSecondaryIndex: false,
|
isGlobalSecondaryIndexTarget: false,
|
||||||
onThroughputChange: () => {
|
onThroughputChange: () => {
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export interface ScaleComponentProps {
|
|||||||
collection: ViewModels.Collection;
|
collection: ViewModels.Collection;
|
||||||
database: ViewModels.Database;
|
database: ViewModels.Database;
|
||||||
isFixedContainer: boolean;
|
isFixedContainer: boolean;
|
||||||
isGlobalSecondaryIndex: boolean;
|
isGlobalSecondaryIndexTarget: boolean;
|
||||||
onThroughputChange: (newThroughput: number) => void;
|
onThroughputChange: (newThroughput: number) => void;
|
||||||
throughput: number;
|
throughput: number;
|
||||||
throughputBaseline: number;
|
throughputBaseline: number;
|
||||||
@@ -147,7 +147,7 @@ export class ScaleComponent extends React.Component<ScaleComponentProps> {
|
|||||||
throughputError={this.props.throughputError}
|
throughputError={this.props.throughputError}
|
||||||
instantMaximumThroughput={this.offer?.instantMaximumThroughput}
|
instantMaximumThroughput={this.offer?.instantMaximumThroughput}
|
||||||
softAllowedMaximumThroughput={this.offer?.softAllowedMaximumThroughput}
|
softAllowedMaximumThroughput={this.offer?.softAllowedMaximumThroughput}
|
||||||
isGlobalSecondaryIndex={this.props.isGlobalSecondaryIndex}
|
isGlobalSecondaryIndexTarget={this.props.isGlobalSecondaryIndexTarget}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ describe("ThroughputInputAutoPilotV3Component", () => {
|
|||||||
},
|
},
|
||||||
instantMaximumThroughput: 5000,
|
instantMaximumThroughput: 5000,
|
||||||
softAllowedMaximumThroughput: 1000000,
|
softAllowedMaximumThroughput: 1000000,
|
||||||
isGlobalSecondaryIndex: false,
|
isGlobalSecondaryIndexTarget: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
it("throughput input visible", () => {
|
it("throughput input visible", () => {
|
||||||
|
|||||||
+2
-2
@@ -81,7 +81,7 @@ export interface ThroughputInputAutoPilotV3Props {
|
|||||||
throughputError?: string;
|
throughputError?: string;
|
||||||
instantMaximumThroughput: number;
|
instantMaximumThroughput: number;
|
||||||
softAllowedMaximumThroughput: number;
|
softAllowedMaximumThroughput: number;
|
||||||
isGlobalSecondaryIndex: boolean;
|
isGlobalSecondaryIndexTarget: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ThroughputInputAutoPilotV3State {
|
interface ThroughputInputAutoPilotV3State {
|
||||||
@@ -427,7 +427,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
|
|||||||
toolTipElement={getToolTipContainer(this.props.infoBubbleText)}
|
toolTipElement={getToolTipContainer(this.props.infoBubbleText)}
|
||||||
/>
|
/>
|
||||||
</Label>
|
</Label>
|
||||||
{!this.props.isGlobalSecondaryIndex && (
|
{!this.props.isGlobalSecondaryIndexTarget && (
|
||||||
<>
|
<>
|
||||||
{this.overrideWithProvisionedThroughputSettings() && (
|
{this.overrideWithProvisionedThroughputSettings() && (
|
||||||
<MessageBar
|
<MessageBar
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
}
|
}
|
||||||
isAutoPilotSelected={false}
|
isAutoPilotSelected={false}
|
||||||
isFixedContainer={false}
|
isFixedContainer={false}
|
||||||
isGlobalSecondaryIndex={true}
|
isGlobalSecondaryIndexTarget={true}
|
||||||
onAutoPilotSelected={[Function]}
|
onAutoPilotSelected={[Function]}
|
||||||
onMaxAutoPilotThroughputChange={[Function]}
|
onMaxAutoPilotThroughputChange={[Function]}
|
||||||
onScaleDiscardableChange={[Function]}
|
onScaleDiscardableChange={[Function]}
|
||||||
@@ -350,7 +350,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
fullTextPolicy={{}}
|
fullTextPolicy={{}}
|
||||||
fullTextPolicyBaseline={{}}
|
fullTextPolicyBaseline={{}}
|
||||||
isFullTextSearchEnabled={true}
|
isFullTextSearchEnabled={true}
|
||||||
isGlobalSecondaryIndex={true}
|
|
||||||
isVectorSearchEnabled={false}
|
isVectorSearchEnabled={false}
|
||||||
onFullTextPolicyChange={[Function]}
|
onFullTextPolicyChange={[Function]}
|
||||||
onFullTextPolicyDirtyChange={[Function]}
|
onFullTextPolicyDirtyChange={[Function]}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export interface ThroughputInputProps {
|
|||||||
isFreeTier: boolean;
|
isFreeTier: boolean;
|
||||||
showFreeTierExceedThroughputTooltip: boolean;
|
showFreeTierExceedThroughputTooltip: boolean;
|
||||||
isQuickstart?: boolean;
|
isQuickstart?: boolean;
|
||||||
isGlobalSecondaryIndex?: boolean;
|
isGlobalSecondaryIndexTarget?: boolean;
|
||||||
setThroughputValue: (throughput: number) => void;
|
setThroughputValue: (throughput: number) => void;
|
||||||
setIsAutoscale: (isAutoscale: boolean) => void;
|
setIsAutoscale: (isAutoscale: boolean) => void;
|
||||||
setIsThroughputCapExceeded: (isThroughputCapExceeded: boolean) => void;
|
setIsThroughputCapExceeded: (isThroughputCapExceeded: boolean) => void;
|
||||||
@@ -32,7 +32,7 @@ export const ThroughputInput: FunctionComponent<ThroughputInputProps> = ({
|
|||||||
isFreeTier,
|
isFreeTier,
|
||||||
showFreeTierExceedThroughputTooltip,
|
showFreeTierExceedThroughputTooltip,
|
||||||
isQuickstart,
|
isQuickstart,
|
||||||
isGlobalSecondaryIndex,
|
isGlobalSecondaryIndexTarget,
|
||||||
setThroughputValue,
|
setThroughputValue,
|
||||||
setIsAutoscale,
|
setIsAutoscale,
|
||||||
setIsThroughputCapExceeded,
|
setIsThroughputCapExceeded,
|
||||||
@@ -202,7 +202,7 @@ export const ThroughputInput: FunctionComponent<ThroughputInputProps> = ({
|
|||||||
</Text>
|
</Text>
|
||||||
<InfoTooltip>{PricingUtils.getRuToolTipText()}</InfoTooltip>
|
<InfoTooltip>{PricingUtils.getRuToolTipText()}</InfoTooltip>
|
||||||
</Stack>
|
</Stack>
|
||||||
{!isGlobalSecondaryIndex && (
|
{!isGlobalSecondaryIndexTarget && (
|
||||||
<Stack horizontal verticalAlign="center">
|
<Stack horizontal verticalAlign="center">
|
||||||
<div role="radiogroup">
|
<div role="radiogroup">
|
||||||
<input
|
<input
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export interface IVectorEmbeddingPoliciesComponentProps {
|
|||||||
vectorIndexes?: VectorIndex[];
|
vectorIndexes?: VectorIndex[];
|
||||||
discardChanges?: boolean;
|
discardChanges?: boolean;
|
||||||
onChangesDiscarded?: () => void;
|
onChangesDiscarded?: () => void;
|
||||||
isGlobalSecondaryIndex?: boolean;
|
isGlobalSecondaryIndexTarget?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VectorEmbeddingPolicyData {
|
export interface VectorEmbeddingPolicyData {
|
||||||
@@ -95,7 +95,7 @@ export const VectorEmbeddingPoliciesComponent: FunctionComponent<IVectorEmbeddin
|
|||||||
onVectorEmbeddingChange,
|
onVectorEmbeddingChange,
|
||||||
discardChanges,
|
discardChanges,
|
||||||
onChangesDiscarded,
|
onChangesDiscarded,
|
||||||
isGlobalSecondaryIndex,
|
isGlobalSecondaryIndexTarget,
|
||||||
}): JSX.Element => {
|
}): JSX.Element => {
|
||||||
const isExistingPolicy = (policy: VectorEmbeddingPolicyData): boolean => {
|
const isExistingPolicy = (policy: VectorEmbeddingPolicyData): boolean => {
|
||||||
if (!vectorEmbeddingsBaseline || vectorEmbeddingsBaseline.length === 0) {
|
if (!vectorEmbeddingsBaseline || vectorEmbeddingsBaseline.length === 0) {
|
||||||
@@ -327,7 +327,7 @@ export const VectorEmbeddingPoliciesComponent: FunctionComponent<IVectorEmbeddin
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getQuantizationByteSizeTooltipContent = (): string => {
|
const getQuantizationByteSizeTooltipContent = (): string => {
|
||||||
const containerName = isGlobalSecondaryIndex
|
const containerName = isGlobalSecondaryIndexTarget
|
||||||
? t(Keys.controls.vectorEmbeddingPolicies.quantizationByteSizeTooltipGlobalSecondaryIndexName)
|
? t(Keys.controls.vectorEmbeddingPolicies.quantizationByteSizeTooltipGlobalSecondaryIndexName)
|
||||||
: t(Keys.controls.vectorEmbeddingPolicies.quantizationByteSizeTooltipContainerName);
|
: t(Keys.controls.vectorEmbeddingPolicies.quantizationByteSizeTooltipContainerName);
|
||||||
return t(Keys.controls.vectorEmbeddingPolicies.quantizationByteSizeTooltip, { containerName });
|
return t(Keys.controls.vectorEmbeddingPolicies.quantizationByteSizeTooltip, { containerName });
|
||||||
|
|||||||
@@ -88,12 +88,12 @@ export const AddGlobalSecondaryIndexPanel = (props: AddGlobalSecondaryIndexPanel
|
|||||||
});
|
});
|
||||||
|
|
||||||
database.collections().forEach((collection: Collection) => {
|
database.collections().forEach((collection: Collection) => {
|
||||||
const isGlobalSecondaryIndex: boolean = !!collection.materializedViewDefinition();
|
const isGlobalSecondaryIndexTarget: boolean = !!collection.materializedViewDefinition();
|
||||||
sourceContainerOptions.push({
|
sourceContainerOptions.push({
|
||||||
key: collection.rid,
|
key: collection.rid,
|
||||||
text: collection.id(),
|
text: collection.id(),
|
||||||
disabled: isGlobalSecondaryIndex,
|
disabled: isGlobalSecondaryIndexTarget,
|
||||||
...(isGlobalSecondaryIndex && {
|
...(isGlobalSecondaryIndexTarget && {
|
||||||
title: "This is a global secondary index.",
|
title: "This is a global secondary index.",
|
||||||
}),
|
}),
|
||||||
data: collection,
|
data: collection,
|
||||||
@@ -382,7 +382,7 @@ export const AddGlobalSecondaryIndexPanel = (props: AddGlobalSecondaryIndexPanel
|
|||||||
setVectorIndexingPolicy,
|
setVectorIndexingPolicy,
|
||||||
vectorPolicyValidated,
|
vectorPolicyValidated,
|
||||||
setVectorPolicyValidated,
|
setVectorPolicyValidated,
|
||||||
isGlobalSecondaryIndex: true,
|
isGlobalSecondaryIndexTarget: true,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export const ThroughputComponent = (props: ThroughputComponentProps): JSX.Elemen
|
|||||||
isSharded={true}
|
isSharded={true}
|
||||||
isFreeTier={isFreeTierAccount()}
|
isFreeTier={isFreeTierAccount()}
|
||||||
isQuickstart={false}
|
isQuickstart={false}
|
||||||
isGlobalSecondaryIndex={true}
|
isGlobalSecondaryIndexTarget={true}
|
||||||
setThroughputValue={(throughput: number) => {
|
setThroughputValue={(throughput: number) => {
|
||||||
globalSecondaryIndexThroughputOnChange(throughput);
|
globalSecondaryIndexThroughputOnChange(throughput);
|
||||||
}}
|
}}
|
||||||
|
|||||||
+3
-3
@@ -14,7 +14,7 @@ export interface VectorSearchComponentProps {
|
|||||||
vectorIndexingPolicy: VectorIndex[];
|
vectorIndexingPolicy: VectorIndex[];
|
||||||
setVectorIndexingPolicy: React.Dispatch<React.SetStateAction<VectorIndex[]>>;
|
setVectorIndexingPolicy: React.Dispatch<React.SetStateAction<VectorIndex[]>>;
|
||||||
setVectorPolicyValidated: React.Dispatch<React.SetStateAction<boolean>>;
|
setVectorPolicyValidated: React.Dispatch<React.SetStateAction<boolean>>;
|
||||||
isGlobalSecondaryIndex?: boolean;
|
isGlobalSecondaryIndexTarget?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const VectorSearchComponent = (props: VectorSearchComponentProps): JSX.Element => {
|
export const VectorSearchComponent = (props: VectorSearchComponentProps): JSX.Element => {
|
||||||
@@ -24,7 +24,7 @@ export const VectorSearchComponent = (props: VectorSearchComponentProps): JSX.El
|
|||||||
vectorIndexingPolicy,
|
vectorIndexingPolicy,
|
||||||
setVectorIndexingPolicy,
|
setVectorIndexingPolicy,
|
||||||
setVectorPolicyValidated,
|
setVectorPolicyValidated,
|
||||||
isGlobalSecondaryIndex,
|
isGlobalSecondaryIndexTarget,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -52,7 +52,7 @@ export const VectorSearchComponent = (props: VectorSearchComponentProps): JSX.El
|
|||||||
setVectorIndexingPolicy(vectorIndexingPolicy);
|
setVectorIndexingPolicy(vectorIndexingPolicy);
|
||||||
setVectorPolicyValidated(vectorPolicyValidated);
|
setVectorPolicyValidated(vectorPolicyValidated);
|
||||||
}}
|
}}
|
||||||
isGlobalSecondaryIndex={isGlobalSecondaryIndex}
|
isGlobalSecondaryIndexTarget={isGlobalSecondaryIndexTarget}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
Reference in New Issue
Block a user