static getProductItems()

in src/explorer.ts [26:68]


  static getProductItems(element = null) {
    if (element.contextValue === "productGroup2") {
      const productGroups = _.groupBy(element.children, (item) => {
        if (item?.categoryName?.length) {
          return item.categoryName;
        } else {
          return I18N.src.explorer.other;
        }
      });
      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: "",
        contextValue: "PRODUCT",
        label: `${product.name}`,
        iconPath: vscode.Uri.joinPath(alicloudAPIMessageService.context.extensionUri, `resources/product.svg`),
        description: product.code,
        collapsibleState: vscode.TreeItemCollapsibleState.None,
        command: {
          command: "alicloud.api.addSubscription",
          title: "subscribe",
          arguments: [
            {
              specName: product.code,
              modName: "clickItem",
              label: product.name,
            },
          ],
        },
      };
    });
  }