perf: 修改k8s tree

pull/9218/head
feng 2 years ago
parent 69fe0b07fd
commit d7a793b4c4

@ -10,7 +10,6 @@ from kubernetes.client.exceptions import ApiException
from rest_framework.generics import get_object_or_404
from common.utils import get_logger
from common.tree import TreeNode
from assets.models import Account, Asset
from ..const import CloudTypes, Category

@ -160,7 +160,7 @@ class UserGrantedK8sAsTreeApi(
asset_id = parent_info.get('asset_id')
asset_id = tree_id if not asset_id else asset_id
if tree_id and not account_username:
if tree_id and not key and not account_username:
asset = self.asset(asset_id)
accounts = self.get_accounts(asset)
asset_node = KubernetesTree(tree_id).as_asset_tree_node(asset)
@ -170,6 +170,6 @@ class UserGrantedK8sAsTreeApi(
account, parent_info,
)
tree.append(account_node)
else:
elif key and account_username:
tree = KubernetesTree(key).async_tree_node(parent_info)
return Response(data=tree)

Loading…
Cancel
Save