Initial add of index advisor tab.

This commit is contained in:
Chuck Skelton 2023-07-10 12:32:25 -07:00
parent ceed162491
commit 7c0d1642fd
2 changed files with 50 additions and 1 deletions

View File

@ -0,0 +1,46 @@
import {
Checkbox,
CheckboxVisibility,
DetailsHeader,
DetailsList,
IDetailsHeaderProps,
IDetailsListCheckboxProps,
IRenderFunction,
Stack,
Text
} from "@fluentui/react";
import React from "react";
interface IndexAdvisorComponentProps { };
export const IndexAdvisorComponent: React.FC = (): JSX.Element => {
const onRenderCheckbox = (props: IDetailsListCheckboxProps, _defaultRender?: IRenderFunction<IDetailsListCheckboxProps>) => {
return <Checkbox {...props} />;
};
const onRenderDetailsHeader = (props: IDetailsHeaderProps, _defaultRender?: IRenderFunction<IDetailsHeaderProps>) => {
return <DetailsHeader {...props} ariaLabelForSelectAllCheckbox="Select all" />;
};
return (
<Stack>
<Text>
Here is an analysis on the indexes utilized for executing this query.
Based on the analysis, Cosmos DB recommends adding the selected index(es) to your indexing policy to
optimize your query performance.
</Text>
<Text>Indexes analysis</Text>
<DetailsList
items={[]}
groups={[]}
columns={[]}
onRenderCheckbox={onRenderCheckbox}
checkboxVisibility={CheckboxVisibility.always}
onRenderDetailsHeader={onRenderDetailsHeader}
groupProps={{
showEmptyGroups: true,
}}/>
</Stack>
);
};

View File

@ -195,7 +195,10 @@ export default class QueryTabComponent extends React.Component<IQueryTabComponen
this.props.collection.databaseId,
this.props.collection.id(),
this.state.selectedContent || this.state.sqlQueryEditorContent,
{ enableCrossPartitionQuery: HeadersUtility.shouldEnableCrossPartitionKey() } as FeedOptions
{
enableCrossPartitionQuery: HeadersUtility.shouldEnableCrossPartitionKey(),
populateIndexMetrics: userContext.apiType === "SQL",
} as FeedOptions
);
}