mirror of https://github.com/jumpserver/jumpserver
仪表盘全局组织统计
parent
20dacea260
commit
c8d7d42f66
|
@ -221,8 +221,6 @@ class IndexApi(DatesLoginMetricMixin, APIView):
|
|||
query_params = self.request.query_params
|
||||
|
||||
caches = OrgResourceStatisticsCache(current_org)
|
||||
if current_org.is_root():
|
||||
caches.refresh()
|
||||
|
||||
_all = query_params.get('all')
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ def refresh_user_amount_on_user_create_or_delete(user_id):
|
|||
for org in orgs:
|
||||
org_cache = OrgResourceStatisticsCache(org)
|
||||
org_cache.expire('users_amount')
|
||||
OrgResourceStatisticsCache(Organization.root()).expire('users_amount')
|
||||
|
||||
|
||||
@receiver(post_save, sender=User)
|
||||
|
@ -44,6 +45,7 @@ def on_org_user_changed_refresh_cache(sender, action, instance, reverse, pk_set,
|
|||
for org in orgs:
|
||||
org_cache = OrgResourceStatisticsCache(org)
|
||||
org_cache.expire('users_amount')
|
||||
OrgResourceStatisticsCache(Organization.root()).expire('users_amount')
|
||||
|
||||
|
||||
class OrgResourceStatisticsRefreshUtil:
|
||||
|
@ -67,6 +69,7 @@ class OrgResourceStatisticsRefreshUtil:
|
|||
if cache_field_name:
|
||||
org_cache = OrgResourceStatisticsCache(instance.org)
|
||||
org_cache.expire(*cache_field_name)
|
||||
OrgResourceStatisticsCache(Organization.root()).expire(*cache_field_name)
|
||||
|
||||
|
||||
@receiver(pre_save)
|
||||
|
|
Loading…
Reference in New Issue