mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-24 19:31:36 +00:00
Compare commits
2 Commits
cloudshell
...
users/chsk
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dda648fa27 | ||
|
|
7c0d1642fd |
19
package-lock.json
generated
19
package-lock.json
generated
@@ -9,7 +9,7 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@azure/arm-cosmosdb": "9.1.0",
|
"@azure/arm-cosmosdb": "9.1.0",
|
||||||
"@azure/cosmos": "3.16.2",
|
"@azure/cosmos": "3.17.4-beta.1",
|
||||||
"@azure/cosmos-language-service": "0.0.5",
|
"@azure/cosmos-language-service": "0.0.5",
|
||||||
"@azure/identity": "1.2.1",
|
"@azure/identity": "1.2.1",
|
||||||
"@azure/ms-rest-nodeauth": "3.0.7",
|
"@azure/ms-rest-nodeauth": "3.0.7",
|
||||||
@@ -396,10 +396,12 @@
|
|||||||
"integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ=="
|
"integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ=="
|
||||||
},
|
},
|
||||||
"node_modules/@azure/cosmos": {
|
"node_modules/@azure/cosmos": {
|
||||||
"version": "3.16.2",
|
"version": "3.17.4-beta.1",
|
||||||
"resolved": "https://registry.npmjs.org/@azure/cosmos/-/cosmos-3.16.2.tgz",
|
"resolved": "https://msazure.pkgs.visualstudio.com/_packaging/AzurePortal/npm/registry/@azure/cosmos/-/cosmos-3.17.4-beta.1.tgz",
|
||||||
"integrity": "sha512-sceY5LWj0BHGj8PSyaVCfDRQLVZyoCfIY78kyIROJVEw0k+p9XFs8fhpykN8JklkCftL0WlaVY+X25SQwnhZsw==",
|
"integrity": "sha1-axE6QafE98LT4IOEeug1NB2hC74=",
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@azure/abort-controller": "^1.0.0",
|
||||||
"@azure/core-auth": "^1.3.0",
|
"@azure/core-auth": "^1.3.0",
|
||||||
"@azure/core-rest-pipeline": "^1.2.0",
|
"@azure/core-rest-pipeline": "^1.2.0",
|
||||||
"@azure/core-tracing": "^1.0.0",
|
"@azure/core-tracing": "^1.0.0",
|
||||||
@@ -414,7 +416,7 @@
|
|||||||
"uuid": "^8.3.0"
|
"uuid": "^8.3.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12.0.0"
|
"node": ">=14.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@azure/cosmos-language-service": {
|
"node_modules/@azure/cosmos-language-service": {
|
||||||
@@ -31470,10 +31472,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@azure/cosmos": {
|
"@azure/cosmos": {
|
||||||
"version": "3.16.2",
|
"version": "3.17.4-beta.1",
|
||||||
"resolved": "https://registry.npmjs.org/@azure/cosmos/-/cosmos-3.16.2.tgz",
|
"resolved": "https://msazure.pkgs.visualstudio.com/_packaging/AzurePortal/npm/registry/@azure/cosmos/-/cosmos-3.17.4-beta.1.tgz",
|
||||||
"integrity": "sha512-sceY5LWj0BHGj8PSyaVCfDRQLVZyoCfIY78kyIROJVEw0k+p9XFs8fhpykN8JklkCftL0WlaVY+X25SQwnhZsw==",
|
"integrity": "sha1-axE6QafE98LT4IOEeug1NB2hC74=",
|
||||||
"requires": {
|
"requires": {
|
||||||
|
"@azure/abort-controller": "^1.0.0",
|
||||||
"@azure/core-auth": "^1.3.0",
|
"@azure/core-auth": "^1.3.0",
|
||||||
"@azure/core-rest-pipeline": "^1.2.0",
|
"@azure/core-rest-pipeline": "^1.2.0",
|
||||||
"@azure/core-tracing": "^1.0.0",
|
"@azure/core-tracing": "^1.0.0",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@azure/arm-cosmosdb": "9.1.0",
|
"@azure/arm-cosmosdb": "9.1.0",
|
||||||
"@azure/cosmos": "3.16.2",
|
"@azure/cosmos": "3.17.4-beta.1",
|
||||||
"@azure/cosmos-language-service": "0.0.5",
|
"@azure/cosmos-language-service": "0.0.5",
|
||||||
"@azure/identity": "1.2.1",
|
"@azure/identity": "1.2.1",
|
||||||
"@azure/ms-rest-nodeauth": "3.0.7",
|
"@azure/ms-rest-nodeauth": "3.0.7",
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ interface QueryResponse {
|
|||||||
hasMoreResults: boolean;
|
hasMoreResults: boolean;
|
||||||
activityId: string;
|
activityId: string;
|
||||||
requestCharge: number;
|
requestCharge: number;
|
||||||
|
indexMetrics: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MinimalQueryIterator {
|
export interface MinimalQueryIterator {
|
||||||
@@ -30,6 +31,7 @@ export function nextPage(documentsIterator: MinimalQueryIterator, firstItemIndex
|
|||||||
headers,
|
headers,
|
||||||
activityId: response.activityId,
|
activityId: response.activityId,
|
||||||
requestCharge: response.requestCharge,
|
requestCharge: response.requestCharge,
|
||||||
|
indexMetrics: response.indexMetrics,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ export interface QueryResults extends QueryResultsMetadata {
|
|||||||
roundTrips?: number;
|
roundTrips?: number;
|
||||||
headers?: any;
|
headers?: any;
|
||||||
queryMetrics?: QueryMetrics;
|
queryMetrics?: QueryMetrics;
|
||||||
|
indexMetrics?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Button {
|
export interface Button {
|
||||||
|
|||||||
46
src/Explorer/Controls/Query/IndexAdvisorComponent.tsx
Normal file
46
src/Explorer/Controls/Query/IndexAdvisorComponent.tsx
Normal 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>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -195,7 +195,10 @@ export default class QueryTabComponent extends React.Component<IQueryTabComponen
|
|||||||
this.props.collection.databaseId,
|
this.props.collection.databaseId,
|
||||||
this.props.collection.id(),
|
this.props.collection.id(),
|
||||||
this.state.selectedContent || this.state.sqlQueryEditorContent,
|
this.state.selectedContent || this.state.sqlQueryEditorContent,
|
||||||
{ enableCrossPartitionQuery: HeadersUtility.shouldEnableCrossPartitionKey() } as FeedOptions
|
{
|
||||||
|
enableCrossPartitionQuery: HeadersUtility.shouldEnableCrossPartitionKey(),
|
||||||
|
populateIndexMetrics: userContext.apiType === "SQL",
|
||||||
|
} as FeedOptions
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,10 +219,12 @@ export default class QueryTabComponent extends React.Component<IQueryTabComponen
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
//CTODO: Add index metrics to the following method?
|
||||||
const queryResults: ViewModels.QueryResults = await QueryUtils.queryPagesUntilContentPresent(
|
const queryResults: ViewModels.QueryResults = await QueryUtils.queryPagesUntilContentPresent(
|
||||||
firstItemIndex,
|
firstItemIndex,
|
||||||
queryDocuments
|
queryDocuments
|
||||||
);
|
);
|
||||||
|
console.log("Index Metrics: " + queryResults.indexMetrics);
|
||||||
this.setState({ queryResults, error: "" });
|
this.setState({ queryResults, error: "" });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.props.tabsBaseInstance.isExecutionError(true);
|
this.props.tabsBaseInstance.isExecutionError(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user