mirror of https://github.com/jumpserver/jumpserver
仪表盘全局组织报500错误
parent
d2dc2ab02c
commit
20dacea260
|
@ -221,6 +221,8 @@ class IndexApi(DatesLoginMetricMixin, APIView):
|
||||||
query_params = self.request.query_params
|
query_params = self.request.query_params
|
||||||
|
|
||||||
caches = OrgResourceStatisticsCache(current_org)
|
caches = OrgResourceStatisticsCache(current_org)
|
||||||
|
if current_org.is_root():
|
||||||
|
caches.refresh()
|
||||||
|
|
||||||
_all = query_params.get('all')
|
_all = query_params.get('all')
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,8 @@ class OrgResourceStatisticsCache(OrgRelatedCache):
|
||||||
return users_amount
|
return users_amount
|
||||||
|
|
||||||
def compute_assets_amount(self):
|
def compute_assets_amount(self):
|
||||||
|
if self.org.is_root():
|
||||||
|
return Asset.objects.all().count()
|
||||||
node = Node.org_root()
|
node = Node.org_root()
|
||||||
return node.assets_amount
|
return node.assets_amount
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue