mirror of https://github.com/jumpserver/jumpserver
				
				
				
			perf: 优化 msg
							parent
							
								
									63ca4f8fab
								
							
						
					
					
						commit
						22a1d60e3f
					
				| 
						 | 
				
			
			@ -29,7 +29,8 @@ class LabelSerializer(BulkOrgResourceModelSerializer):
 | 
			
		|||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def setup_eager_loading(cls, queryset):
 | 
			
		||||
        queryset = queryset.annotate(asset_count=Count('assets'))
 | 
			
		||||
        queryset = queryset.prefetch_related('assets') \
 | 
			
		||||
            .annotate(asset_count=Count('assets'))
 | 
			
		||||
        return queryset
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,9 +55,11 @@ class BulkSerializerMixin(object):
 | 
			
		|||
            # add update_lookup_field field back to validated data
 | 
			
		||||
            # since super by default strips out read-only fields
 | 
			
		||||
            # hence id will no longer be present in validated_data
 | 
			
		||||
            if all((isinstance(self.root, BulkListSerializer),
 | 
			
		||||
                    id_attr,
 | 
			
		||||
                    request_method in ('PUT', 'PATCH'))):
 | 
			
		||||
            if all([
 | 
			
		||||
                isinstance(self.root, BulkListSerializer),
 | 
			
		||||
                id_attr,
 | 
			
		||||
                request_method in ('PUT', 'PATCH')
 | 
			
		||||
            ]):
 | 
			
		||||
                id_field = self.fields.get("id") or self.fields.get('pk')
 | 
			
		||||
                if data.get("id"):
 | 
			
		||||
                    id_value = id_field.to_internal_value(data.get("id"))
 | 
			
		||||
| 
						 | 
				
			
			@ -135,7 +137,7 @@ class BulkListSerializerMixin:
 | 
			
		|||
                    pk = item["pk"]
 | 
			
		||||
                else:
 | 
			
		||||
                    raise ValidationError("id or pk not in data")
 | 
			
		||||
                child = self.instance.get(id=pk)
 | 
			
		||||
                child = self.instance.get(pk=pk)
 | 
			
		||||
                self.child.instance = child
 | 
			
		||||
                self.child.initial_data = item
 | 
			
		||||
                # raw
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,7 +32,7 @@ class Counter:
 | 
			
		|||
        return self.counter == other.counter
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def on_request_finished_logging_db_query(sender, **kwargs):
 | 
			
		||||
def digest_sql_query():
 | 
			
		||||
    queries = connection.queries
 | 
			
		||||
    counters = defaultdict(Counter)
 | 
			
		||||
    table_queries = defaultdict(list)
 | 
			
		||||
| 
						 | 
				
			
			@ -79,6 +79,9 @@ def on_request_finished_logging_db_query(sender, **kwargs):
 | 
			
		|||
            counter.counter, counter.time, name)
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def on_request_finished_logging_db_query(sender, **kwargs):
 | 
			
		||||
    digest_sql_query()
 | 
			
		||||
    on_request_finished_release_local(sender, **kwargs)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,7 +20,7 @@ default_context = {
 | 
			
		|||
    'LOGIN_WECOM_logo_logout': static('img/login_wecom_logo.png'),
 | 
			
		||||
    'LOGIN_DINGTALK_logo_logout': static('img/login_dingtalk_logo.png'),
 | 
			
		||||
    'LOGIN_FEISHU_logo_logout': static('img/login_feishu_logo.png'),
 | 
			
		||||
    'COPYRIGHT': 'FIT2CLOUD 飞致云' + ' © 2014-2022',
 | 
			
		||||
    'COPYRIGHT': 'FIT2CLOUD 飞致云' + ' © 2014-2023',
 | 
			
		||||
    'INTERFACE': default_interface,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,6 +18,10 @@
 | 
			
		|||
            margin: 0 auto;
 | 
			
		||||
            padding: 100px 20px 20px 20px;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        .ibox-content {
 | 
			
		||||
            padding: 30px;
 | 
			
		||||
        }
 | 
			
		||||
    </style>
 | 
			
		||||
    {% block custom_head_css_js %} {% endblock %}
 | 
			
		||||
</head>
 | 
			
		||||
| 
						 | 
				
			
			@ -30,7 +34,7 @@
 | 
			
		|||
                    <h2 class="font-bold">
 | 
			
		||||
                        {% block title %}{% endblock %}
 | 
			
		||||
                    </h2>
 | 
			
		||||
                    <div style="margin: 10px 0">
 | 
			
		||||
                    <div style="margin: 20px 0 0 0">
 | 
			
		||||
                        {% block content %} {% endblock %}
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,7 +23,7 @@
 | 
			
		|||
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            {% if has_cancel %}
 | 
			
		||||
            <div class="col-sm-3">
 | 
			
		||||
                <div class="col-sm-3">
 | 
			
		||||
                <a href="{{ cancel_url }}" class="btn btn-default block full-width m-b">
 | 
			
		||||
                    {% trans 'Cancel' %}
 | 
			
		||||
                </a>
 | 
			
		||||
| 
						 | 
				
			
			@ -43,7 +43,7 @@
 | 
			
		|||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block custom_foot_js %}
 | 
			
		||||
<script>
 | 
			
		||||
    <script>
 | 
			
		||||
    var message = ''
 | 
			
		||||
    var time = '{{ interval }}'
 | 
			
		||||
    {% if error %}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue