Skip to content

Commit

Permalink
perf: 优化树组件初始化展开状态;优化树刷新方法
Browse files Browse the repository at this point in the history
  • Loading branch information
huailei000 committed May 11, 2023
1 parent 2298f9b commit e4f436d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/app/elements/asset-tree/asset-tree.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export class ElementAssetTreeComponent implements OnInit {
this.currentOrgID = DEFAULT_ORG_ID;
}
this.initTree();
this.trees.map((tree, index) => (index === 0 ? tree.open = true : tree.open = false));
document.addEventListener('click', this.hideRMenu.bind(this), false);
}

Expand Down Expand Up @@ -301,14 +302,14 @@ export class ElementAssetTreeComponent implements OnInit {
});
}

async refreshTree(event) {
async refreshTree(event, tree) {
event.stopPropagation();
this.searchValue = '';
if (this.isK8s) {
this.initK8sTree(true).then();
} else {
this.initAssetTree(true).then();
this.initTypeTree(true).then();
if (tree.name === 'AssetTree') { this.initAssetTree(true).then(); }
if (tree.name === 'AssetTypeTree') { this.initTypeTree(true).then(); }
}
}

Expand Down

0 comments on commit e4f436d

Please sign in to comment.