mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-07-22 02:21:58 +00:00
temp: deactive test
This commit is contained in:
parent
61d1d9ec90
commit
515406c05d
@ -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 @@
|
|||||||
{% 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 %}
|
||||||
|
Loading…
Reference in New Issue
Block a user