mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-10-13 15:28:05 +01:00
Updated file IndexAdvisorUtils for lint errors
This commit is contained in:
parent
9c868b29c9
commit
fa3391bde2
@ -1,4 +1,15 @@
|
|||||||
import type { IIndexMetric } from "Explorer/Tabs/QueryTab/ResultsView";
|
import type { IIndexMetric } from "Explorer/Tabs/QueryTab/ResultsView";
|
||||||
|
interface IndexObject {
|
||||||
|
index: string;
|
||||||
|
impact: string;
|
||||||
|
section: "Included" | "Not Included" | "Header";
|
||||||
|
composite?: {
|
||||||
|
path: string;
|
||||||
|
order: "ascending" | "descending";
|
||||||
|
}[];
|
||||||
|
path?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface IndexMetricsJson {
|
export interface IndexMetricsJson {
|
||||||
included?: IIndexMetric[];
|
included?: IIndexMetric[];
|
||||||
notIncluded?: IIndexMetric[];
|
notIncluded?: IIndexMetric[];
|
||||||
@ -32,7 +43,13 @@ export function parseIndexMetrics(indexMetrics: string | IndexMetricsJson): {
|
|||||||
const impact = impactLine?.includes("Index Impact Score:") ? impactLine.split(":")[1].trim() : "Unknown";
|
const impact = impactLine?.includes("Index Impact Score:") ? impactLine.split(":")[1].trim() : "Unknown";
|
||||||
|
|
||||||
const isComposite = index.includes(",");
|
const isComposite = index.includes(",");
|
||||||
const indexObj: any = { index, impact };
|
|
||||||
|
const sectionMap: Record<string, "Included" | "Not Included"> = {
|
||||||
|
included: "Included",
|
||||||
|
notIncluded: "Not Included",
|
||||||
|
};
|
||||||
|
|
||||||
|
const indexObj: IndexObject = { index, impact, section: sectionMap[currentSection] ?? "Header", };
|
||||||
if (isComposite) {
|
if (isComposite) {
|
||||||
indexObj.composite = index.split(",").map((part: string) => {
|
indexObj.composite = index.split(",").map((part: string) => {
|
||||||
const [path, order] = part.trim().split(/\s+/);
|
const [path, order] = part.trim().split(/\s+/);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user