[Bugfix] 修复了一些显示上的bug

pull/915/head
ibuler 7 years ago
parent b2b123b41e
commit 3223d3b74d

@ -93,7 +93,7 @@ class AssetBulkUpdateForm(forms.ModelForm):
model = Asset model = Asset
fields = [ fields = [
'assets', 'port', 'groups', "cluster", 'assets', 'port', 'groups', "cluster",
'type', 'env', 'status', 'type', 'env',
] ]
widgets = { widgets = {
'groups': forms.SelectMultiple(attrs={'class': 'select2', 'data-placeholder': _('Select asset groups')}), 'groups': forms.SelectMultiple(attrs={'class': 'select2', 'data-placeholder': _('Select asset groups')}),

@ -34,7 +34,7 @@
<div class="col-sm-8" style="padding-left: 0;"> <div class="col-sm-8" style="padding-left: 0;">
<div class="ibox float-e-margins"> <div class="ibox float-e-margins">
<div class="ibox-title"> <div class="ibox-title">
<span style="float: left">{% trans 'Asset list of ' %} <b>{{ admin_user.name }}</b> <span class="badge"> {{ total_amount }}</span> <span class="badge badge-danger">{{ unreachable_amount }}</span></span> <span style="float: left">{% trans 'Asset list of ' %} <b>{{ admin_user.name }}</b></span>
<div class="ibox-tools"> <div class="ibox-tools">
<a class="collapse-link"> <a class="collapse-link">
<i class="fa fa-chevron-up"></i> <i class="fa fa-chevron-up"></i>

@ -178,9 +178,15 @@ $(document).ready(function(){
var obj = {"pk": object_id, "is_active": false}; var obj = {"pk": object_id, "is_active": false};
data.push(obj); data.push(obj);
}); });
APIUpdateAttr({url: the_url, method: 'PATCH', body: JSON.stringify(data)}); function success() {
$data_table.ajax.reload(); location.reload()
jumpserver.checked = false; }
APIUpdateAttr({
url: the_url,
method: 'PATCH',
body: JSON.stringify(data),
success: success
});
} }
function doActive() { function doActive() {
var data = []; var data = [];
@ -188,9 +194,15 @@ $(document).ready(function(){
var obj = {"pk": object_id, "is_active": true}; var obj = {"pk": object_id, "is_active": true};
data.push(obj); data.push(obj);
}); });
APIUpdateAttr({url: the_url, method: 'PATCH', body: JSON.stringify(data)}); function success() {
$data_table.ajax.reload(); location.reload();
jumpserver.checked = false; }
APIUpdateAttr({
url: the_url,
method: 'PATCH',
body: JSON.stringify(data),
success: success
});
} }
function doDelete() { function doDelete() {
swal({ swal({

@ -28,7 +28,7 @@
<div class="col-sm-8" style="padding-left: 0;"> <div class="col-sm-8" style="padding-left: 0;">
<div class="ibox float-e-margins"> <div class="ibox float-e-margins">
<div class="ibox-title"> <div class="ibox-title">
<span style="float: left">{% trans 'Cluster assets' %} <b>{{ cluster.name }} </b><span class="badge">{{ cluster.assets.all.count }}</span></span> <span style="float: left">{% trans 'Cluster assets' %} <b>{{ cluster.name }} </b></span>
<div class="ibox-tools"> <div class="ibox-tools">
<a class="collapse-link"> <a class="collapse-link">
<i class="fa fa-chevron-up"></i> <i class="fa fa-chevron-up"></i>

@ -156,7 +156,7 @@ class UserBulkUpdateForm(forms.ModelForm):
class Meta: class Meta:
model = User model = User
fields = ['users', 'role', 'groups', 'date_expired', 'is_active'] fields = ['users', 'role', 'groups', 'date_expired']
widgets = { widgets = {
"groups": forms.SelectMultiple( "groups": forms.SelectMultiple(
attrs={ attrs={
@ -172,6 +172,7 @@ class UserBulkUpdateForm(forms.ModelForm):
if self.data.get(field) is not None: if self.data.get(field) is not None:
changed_fields.append(field) changed_fields.append(field)
print(changed_fields)
cleaned_data = {k: v for k, v in self.cleaned_data.items() cleaned_data = {k: v for k, v in self.cleaned_data.items()
if k in changed_fields} if k in changed_fields}
users = cleaned_data.pop('users', '') users = cleaned_data.pop('users', '')
@ -186,7 +187,7 @@ class UserBulkUpdateForm(forms.ModelForm):
class UserGroupForm(forms.ModelForm): class UserGroupForm(forms.ModelForm):
users = forms.ModelMultipleChoiceField( users = forms.ModelMultipleChoiceField(
queryset=User.objects.all(), queryset=User.objects.exclude(role=User.ROLE_APP),
label=_("User"), label=_("User"),
widget=forms.SelectMultiple( widget=forms.SelectMultiple(
attrs={ attrs={

@ -161,18 +161,30 @@ $(document).ready(function(){
var body = $.each(id_list, function(index, user_object) { var body = $.each(id_list, function(index, user_object) {
user_object['is_active'] = false; user_object['is_active'] = false;
}); });
console.log(body); function success() {
APIUpdateAttr({url: the_url, method: 'PATCH', body: JSON.stringify(body)}); location.reload();
$data_table.ajax.reload(); }
jumpserver.checked = false; APIUpdateAttr({
url: the_url,
method: 'PATCH',
body: JSON.stringify(body),
success: success
});
location.reload();
} }
function doActive() { function doActive() {
var body = $.each(id_list, function(index, user_object) { var body = $.each(id_list, function(index, user_object) {
user_object['is_active'] = true; user_object['is_active'] = true;
}); });
APIUpdateAttr({url: the_url, method: 'PATCH', body: JSON.stringify(body)}); function success() {
$data_table.ajax.reload(); location.reload();
jumpserver.checked = false; }
APIUpdateAttr({
url: the_url,
method: 'PATCH',
body: JSON.stringify(body),
success: success
});
} }
function doDelete() { function doDelete() {
swal({ swal({

Loading…
Cancel
Save