diff --git a/media/src/components/APIPage/API.tsx b/media/src/components/APIPage/API.tsx index 1c9e487..fe36ca7 100644 --- a/media/src/components/APIPage/API.tsx +++ b/media/src/components/APIPage/API.tsx @@ -229,7 +229,7 @@ export const API: React.FC = (props) => { }, []); return ( -
+
{/* */} = (props) => { ) : null; return ( -
+
, element: PontAPITreeItem = null) { - return products?.map((product) => { + static getProductItems(element = null) { + if (element.contextValue === "productGroup2") { + const productGroups = _.groupBy(element.children, (item) => { + if (item?.categoryName?.length) { + return item.categoryName; + } else { + return "其他"; + } + }); + return Object.keys(productGroups || {})?.map((group) => { + return { + specName: group, + contextValue: "productGroup", + label: `${group}`, + modName: group, + children: productGroups[group], + collapsibleState: vscode.TreeItemCollapsibleState.Collapsed, + }; + }); + } + return element.children?.map((product) => { return { specName: product.code, modName: "", @@ -243,13 +262,20 @@ export class AlicloudApiExplorer implements vscode.TreeDataProvider { if (element.contextValue === "alicloudProducts") { const productExplorer = getProductRequestInstance(); - const productGroups = _.groupBy(productExplorer?.products, (product) => product.group); + const productGroups = _.groupBy(productExplorer?.products, (product) => { + if (product?.category2Name?.length) { + return product.category2Name; + } else { + return "其他"; + } + }); return Object.keys(productGroups || {})?.map((group) => { return { specName: group, - contextValue: "productGroup", + contextValue: "productGroup2", label: `${group}`, modName: group, + children: productGroups[group], collapsibleState: vscode.TreeItemCollapsibleState.Collapsed, }; }); @@ -311,10 +337,10 @@ export class AlicloudApiExplorer implements vscode.TreeDataProvider product.group); - return PontAPIExplorer.getProductItems(productGroups[element?.modName?.toString()], element); + // const productGroups = _.groupBy(productExplorer?.products, (product) => product.category2Name); + return PontAPIExplorer.getProductItems(element); } else { return PontAPIExplorer.getDirItems(spec); } @@ -349,7 +375,9 @@ export class AlicloudApiExplorer implements vscode.TreeDataProvider; - defaultVersion: string; -} \ No newline at end of file + code: string; + name: string; + description: string; + shortName: string; + group: string; + style: string; + versions: Array; + defaultVersion: string; + categoryName: string; + category2Name: string; +}