Commit 599431f4 authored by BaiJiangJie's avatar BaiJiangJie

[Update] 去掉添加windows相关配置时的一些无用功能,网域网关/会话列表

parent 718715cc
......@@ -186,7 +186,7 @@ class NodeAddChildrenApi(generics.UpdateAPIView):
continue
# node.parent = instance
# node.save()
node.move(instance)
node.set_parent(instance)
return Response("OK")
......
......@@ -39,7 +39,7 @@ class Node(models.Model):
def level(self):
return len(self.key.split(':'))
def move(self, instance):
def set_parent(self, instance):
children = self.get_all_children()
old_key = self.key
with transaction.atomic():
......
......@@ -87,6 +87,16 @@
var sudo_id = '#' + '{{ form.sudo.id_for_label }}';
var shell_id = '#' + '{{ form.shell.id_for_label }}';
var div_auto_generate_key = $(auto_generate_key).parent().parent();
var div_ssh_private_key = $(private_key_id).parent().parent().parent().parent();
var div_auto_push = $(auto_push_id).parent().parent();
var div_sudo = $(sudo_id).parent().parent();
var div_shell = $(shell_id).parent().parent();
var need_change_div = [
div_auto_generate_key, div_ssh_private_key,
div_auto_push, div_sudo, div_shell
];
function authFieldsDisplay() {
if ($(auto_generate_key).prop('checked')) {
$('.auth-fields').addClass('hidden');
......@@ -96,16 +106,6 @@
}
function protocolChange() {
var div_auto_generate_key = $(auto_generate_key).parent().parent();
var div_ssh_private_key = $(private_key_id).parent().parent().parent().parent();
var div_auto_push = $(auto_push_id).parent().parent();
var div_sudo = $(sudo_id).parent().parent();
var div_shell = $(shell_id).parent().parent();
var need_change_div = [
div_auto_generate_key, div_ssh_private_key,
div_auto_push, div_sudo, div_shell
];
if ($(protocol_id + " option:selected").text() === 'rdp') {
$('.auth-fields').removeClass('hidden');
$.each(need_change_div, function (index, value) {
......
......@@ -85,6 +85,9 @@ function initTable() {
var update_btn = '<a href="{% url "assets:domain-gateway-update" pk=DEFAULT_PK %}" class="btn btn-xs btn-info">{% trans "Update" %}</a>'.replace('{{ DEFAULT_PK }}', cellData);
var del_btn = '<a class="btn btn-xs btn-danger m-l-xs btn-delete" data-uid="{{ DEFAULT_PK }}">{% trans "Delete" %}</a>'.replace('{{ DEFAULT_PK }}', cellData);
var test_btn = '<a class="btn btn-xs btn-warning m-l-xs btn-test" data-uid="{{ DEFAULT_PK }}">{% trans "Test connection" %}</a>'.replace('{{ DEFAULT_PK }}', cellData);
if(rowData.protocol === 'rdp'){
test_btn = '<a class="btn btn-xs btn-warning m-l-xs btn-test" disabled data-uid="{{ DEFAULT_PK }}">{% trans "Test connection" %}</a>'.replace('{{ DEFAULT_PK }}', cellData);
}
$(td).html(update_btn + test_btn + del_btn)
}}
],
......@@ -120,7 +123,6 @@ $(document).ready(function(){
success_message: "可连接",
fail_message: "连接失败"
})
})
});
</script>
{% endblock %}
......@@ -66,3 +66,29 @@
</div>
</div>
{% endblock %}
{% block custom_foot_js %}
<script>
var protocol_id = '#' + '{{ form.protocol.id_for_label }}';
var private_key_id = '#' + '{{ form.private_key_file.id_for_label }}';
var port = '#' + '{{ form.port.id_for_label }}';
var div_ssh_private_key = $(private_key_id).parent().parent().parent().parent();
function protocolChange() {
if ($(protocol_id + " option:selected").text() === 'rdp') {
$(port).val(3389);
$(div_ssh_private_key).addClass('hidden')
} else {
$(port).val(22);
$(div_ssh_private_key).removeClass('hidden')
}
}
$(document).ready(function(){
protocolChange();
});
$(protocol_id).change(function (){
protocolChange();
});
</script>
{% endblock %}
\ No newline at end of file
......@@ -102,7 +102,11 @@
<a onclick="window.open('/luna/replay/{{ session.id }}','luna', 'height=600, width=800, top=400, left=400, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')" class="btn btn-xs btn-warning btn-replay" >{% trans "Replay" %}</a>
{% else %}
<!--<a onclick="window.open('/luna/monitor/{{ session.id }}','luna', 'height=600, width=800, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')" class="btn btn-xs btn-warning btn-monitor" >{% trans "Monitor" %}</a>-->
<a class="btn btn-xs btn-danger btn-term" value="{{ session.id }}" terminal="{{ session.terminal.id }}" >{% trans "Terminate" %}</a>
{% if session.protocol == 'rdp' %}
<a class="btn btn-xs btn-danger btn-term" disabled value="{{ session.id }}" terminal="{{ session.terminal.id }}" >{% trans "Terminate" %}</a>
{% else %}
<a class="btn btn-xs btn-danger btn-term" value="{{ session.id }}" terminal="{{ session.terminal.id }}" >{% trans "Terminate" %}</a>
{% endif %}
{% endif %}
</td>
</tr>
......
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