Commit 515406c0 authored by xiaoyu's avatar xiaoyu

temp: deactive test

parent 61d1d9ec
...@@ -75,3 +75,5 @@ class UserBulkUpdateSerializer(BulkSerializerMixin, serializers.ModelSerializer) ...@@ -75,3 +75,5 @@ class UserBulkUpdateSerializer(BulkSerializerMixin, serializers.ModelSerializer)
class Meta(object): class Meta(object):
model = User model = User
list_serializer_class = BulkListSerializer list_serializer_class = BulkListSerializer
fields = ['id', 'is_active', 'username', 'name', 'email', 'role', 'avatar',
'enable_otp', 'comment', 'groups']
...@@ -66,21 +66,23 @@ ...@@ -66,21 +66,23 @@
{% endblock %} {% endblock %}
{% block custom_foot_js %} {% block custom_foot_js %}
<script> <script>
jumpserver.bulk_delete = function(){
}
$(document).on('click', '#btn_bulk_update', function(){ $(document).on('click', '#btn_bulk_update', function(){
var action = $('#slct_bulk_update').val(); var action = $('#slct_bulk_update').val();
var id_list = $('.ipt_bulk_update:checked').map(function(){return {'id': $(this).val()}}).get(); var id_list = $('.ipt_bulk_update:checked').map(function(){return {'id': parseInt($(this).val())}}).get();
console.log(id_list); var the_url = "{% url 'users:user-bulk-update-api' %}";
function doDeactive() { function doDeactive() {
var body = $.each(id_list, function(dict, index) { var body = $.each(id_list, function(index, user_object) {
}) user_object['is_active'] = false;
});
APIUpdateAttr({url: the_url, method: 'PATCH', body: JSON.stringify(body)});
}; };
switch(action) { switch(action) {
case 'deactive': case 'deactive':
doDeactive();
} break;
default:
break;
};
}) })
</script> </script>
{% endblock %} {% endblock %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment