mirror of https://github.com/jumpserver/jumpserver
[Update] 修改bug
parent
c4afd04cbc
commit
d852f0182b
|
@ -12,7 +12,7 @@ __all__ = ['Node']
|
||||||
class Node(models.Model):
|
class Node(models.Model):
|
||||||
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
|
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
|
||||||
key = models.CharField(unique=True, max_length=64, verbose_name=_("Key")) # '1:1:1:1'
|
key = models.CharField(unique=True, max_length=64, verbose_name=_("Key")) # '1:1:1:1'
|
||||||
value = models.CharField(max_length=128, verbose_name=_("Value"))
|
value = models.CharField(max_length=128, unique=True, verbose_name=_("Value"))
|
||||||
child_mark = models.IntegerField(default=0)
|
child_mark = models.IntegerField(default=0)
|
||||||
date_create = models.DateTimeField(auto_now_add=True)
|
date_create = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
|
|
|
@ -164,12 +164,12 @@
|
||||||
<i class="fa fa-info-circle"></i> {% trans 'Nodes' %}
|
<i class="fa fa-info-circle"></i> {% trans 'Nodes' %}
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<table class="table cluster_edit" id="add-asset2group">
|
<table class="table node_edit" id="add-asset2group">
|
||||||
<tbody>
|
<tbody>
|
||||||
<form>
|
<form>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" class="no-borders">
|
<td colspan="2" class="no-borders">
|
||||||
<select data-placeholder="{% trans 'Add to node' %}" id="cluster_selected" class="select2" style="width: 100%" multiple="" tabindex="4">
|
<select data-placeholder="{% trans 'Add to node' %}" id="node_selected" class="select2" style="width: 100%" multiple="" tabindex="4">
|
||||||
{% for node in nodes_remain %}
|
{% for node in nodes_remain %}
|
||||||
<option value="{{ node.id }}" id="opt_{{ node.id }}" >{{ node.name }}</option>
|
<option value="{{ node.id }}" id="opt_{{ node.id }}" >{{ node.name }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -212,13 +212,13 @@ function updateSystemUserCluster(nodes) {
|
||||||
var success = function(data) {
|
var success = function(data) {
|
||||||
// remove all the selected groups from select > option and rendered ul element;
|
// remove all the selected groups from select > option and rendered ul element;
|
||||||
$('.select2-selection__rendered').empty();
|
$('.select2-selection__rendered').empty();
|
||||||
$('#cluster_selected').val('');
|
$('#node_selected').val('');
|
||||||
$.map(jumpserver.nodes_selected, function(cluster_name, index) {
|
$.map(jumpserver.nodes_selected, function(node_name, index) {
|
||||||
$('#opt_' + index).remove();
|
$('#opt_' + index).remove();
|
||||||
// change tr html of user groups.
|
// change tr html of user groups.
|
||||||
$('.cluster_edit tbody').append(
|
$('.node_edit tbody').append(
|
||||||
'<tr>' +
|
'<tr>' +
|
||||||
'<td><b class="bdg_node" data-gid="' + index + '">' + cluster_name + '</b></td>' +
|
'<td><b class="bdg_node" data-gid="' + index + '">' + node_name + '</b></td>' +
|
||||||
'<td><button class="btn btn-danger btn-xs pull-right btn-remove-from-node" type="button"><i class="fa fa-minus"></i></button></td>' +
|
'<td><button class="btn btn-danger btn-xs pull-right btn-remove-from-node" type="button"><i class="fa fa-minus"></i></button></td>' +
|
||||||
'</tr>'
|
'</tr>'
|
||||||
)
|
)
|
||||||
|
@ -277,10 +277,10 @@ $(document).ready(function () {
|
||||||
'<option value="' + gid + '" id="opt_' + gid + '">' + node_name + '</option>'
|
'<option value="' + gid + '" id="opt_' + gid + '">' + node_name + '</option>'
|
||||||
);
|
);
|
||||||
$tr.remove();
|
$tr.remove();
|
||||||
var clusters = $('.bdg_node').map(function () {
|
var nodes = $('.bdg_node').map(function () {
|
||||||
return $(this).data('gid');
|
return $(this).data('gid');
|
||||||
}).get();
|
}).get();
|
||||||
updateSystemUserCluster(clusters);
|
updateSystemUserCluster(nodes);
|
||||||
}).on('click', '.btn-del', function () {
|
}).on('click', '.btn-del', function () {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var name = "{{ system_user.name}}";
|
var name = "{{ system_user.name}}";
|
||||||
|
|
Loading…
Reference in New Issue