mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-07-08 12:29:06 +00:00
commit
c3101dba29
@ -43,6 +43,7 @@ class AssetViewSet(IDInFilterMixin, LabelFilter, BulkModelViewSet):
|
|||||||
queryset = super().get_queryset()
|
queryset = super().get_queryset()
|
||||||
admin_user_id = self.request.query_params.get('admin_user_id')
|
admin_user_id = self.request.query_params.get('admin_user_id')
|
||||||
node_id = self.request.query_params.get("node_id")
|
node_id = self.request.query_params.get("node_id")
|
||||||
|
show_current_asset = self.request.query_params.get("show_current_asset")
|
||||||
|
|
||||||
if admin_user_id:
|
if admin_user_id:
|
||||||
admin_user = get_object_or_404(AdminUser, id=admin_user_id)
|
admin_user = get_object_or_404(AdminUser, id=admin_user_id)
|
||||||
@ -51,8 +52,11 @@ class AssetViewSet(IDInFilterMixin, LabelFilter, BulkModelViewSet):
|
|||||||
node = get_object_or_404(Node, id=node_id)
|
node = get_object_or_404(Node, id=node_id)
|
||||||
if not node.is_root():
|
if not node.is_root():
|
||||||
queryset = queryset.filter(
|
queryset = queryset.filter(
|
||||||
nodes__key__regex='{}(:[0-9]+)*$'.format(node.key),
|
nodes__key__regex='^{}(:[0-9]+)*$'.format(node.key),
|
||||||
).distinct()
|
).distinct()
|
||||||
|
if show_current_asset and node_id:
|
||||||
|
queryset = queryset.filter(nodes=node_id).distinct()
|
||||||
|
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from rest_framework import generics, mixins
|
from rest_framework import generics, mixins
|
||||||
|
from rest_framework.serializers import ValidationError
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework_bulk import BulkModelViewSet
|
from rest_framework_bulk import BulkModelViewSet
|
||||||
@ -41,7 +42,14 @@ __all__ = [
|
|||||||
class NodeViewSet(BulkModelViewSet):
|
class NodeViewSet(BulkModelViewSet):
|
||||||
queryset = Node.objects.all()
|
queryset = Node.objects.all()
|
||||||
permission_classes = (IsSuperUser,)
|
permission_classes = (IsSuperUser,)
|
||||||
serializer_class = serializers.NodeSerializer
|
# serializer_class = serializers.NodeSerializer
|
||||||
|
|
||||||
|
def get_serializer_class(self):
|
||||||
|
show_current_asset = self.request.query_params.get('show_current_asset')
|
||||||
|
if show_current_asset:
|
||||||
|
return serializers.NodeCurrentSerializer
|
||||||
|
else:
|
||||||
|
return serializers.NodeSerializer
|
||||||
|
|
||||||
def perform_create(self, serializer):
|
def perform_create(self, serializer):
|
||||||
child_key = Node.root().get_next_child_key()
|
child_key = Node.root().get_next_child_key()
|
||||||
@ -83,16 +91,29 @@ class NodeChildrenApi(mixins.ListModelMixin, generics.CreateAPIView):
|
|||||||
serializer_class = serializers.NodeSerializer
|
serializer_class = serializers.NodeSerializer
|
||||||
instance = None
|
instance = None
|
||||||
|
|
||||||
|
def counter(self):
|
||||||
|
values = [
|
||||||
|
child.value[child.value.rfind(' '):]
|
||||||
|
for child in self.get_object().get_children()
|
||||||
|
if child.value.startswith("新节点 ")
|
||||||
|
]
|
||||||
|
values = [int(value) for value in values if value.strip().isdigit()]
|
||||||
|
count = max(values)+1 if values else 1
|
||||||
|
return count
|
||||||
|
|
||||||
def post(self, request, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
if not request.data.get("value"):
|
if not request.data.get("value"):
|
||||||
request.data["value"] = _("New node {}").format(
|
request.data["value"] = _("New node {}").format(self.counter())
|
||||||
Node.root().get_next_child_key().split(":")[-1]
|
|
||||||
)
|
|
||||||
return super().post(request, *args, **kwargs)
|
return super().post(request, *args, **kwargs)
|
||||||
|
|
||||||
def create(self, request, *args, **kwargs):
|
def create(self, request, *args, **kwargs):
|
||||||
instance = self.get_object()
|
instance = self.get_object()
|
||||||
value = request.data.get("value")
|
value = request.data.get("value")
|
||||||
|
values = [child.value for child in instance.get_children()]
|
||||||
|
if value in values:
|
||||||
|
raise ValidationError(
|
||||||
|
'The same level node name cannot be the same'
|
||||||
|
)
|
||||||
node = instance.create_child(value=value)
|
node = instance.create_child(value=value)
|
||||||
return Response(
|
return Response(
|
||||||
{"id": node.id, "key": node.key, "value": node.value},
|
{"id": node.id, "key": node.key, "value": node.value},
|
||||||
@ -163,8 +184,9 @@ class NodeAddChildrenApi(generics.UpdateAPIView):
|
|||||||
for node in children:
|
for node in children:
|
||||||
if not node:
|
if not node:
|
||||||
continue
|
continue
|
||||||
node.parent = instance
|
# node.parent = instance
|
||||||
node.save()
|
# node.save()
|
||||||
|
node.set_parent(instance)
|
||||||
return Response("OK")
|
return Response("OK")
|
||||||
|
|
||||||
|
|
||||||
@ -191,6 +213,9 @@ class NodeRemoveAssetsApi(generics.UpdateAPIView):
|
|||||||
instance = self.get_object()
|
instance = self.get_object()
|
||||||
if instance != Node.root():
|
if instance != Node.root():
|
||||||
instance.assets.remove(*tuple(assets))
|
instance.assets.remove(*tuple(assets))
|
||||||
|
else:
|
||||||
|
assets = [asset for asset in assets if asset.nodes.count() > 1]
|
||||||
|
instance.assets.remove(*tuple(assets))
|
||||||
|
|
||||||
|
|
||||||
class NodeReplaceAssetsApi(generics.UpdateAPIView):
|
class NodeReplaceAssetsApi(generics.UpdateAPIView):
|
||||||
|
@ -58,6 +58,9 @@ class SystemUserPushApi(generics.RetrieveAPIView):
|
|||||||
|
|
||||||
def retrieve(self, request, *args, **kwargs):
|
def retrieve(self, request, *args, **kwargs):
|
||||||
system_user = self.get_object()
|
system_user = self.get_object()
|
||||||
|
nodes = system_user.nodes.all()
|
||||||
|
for node in nodes:
|
||||||
|
system_user.assets.add(*tuple(node.get_all_assets()))
|
||||||
task = push_system_user_to_assets_manual.delay(system_user)
|
task = push_system_user_to_assets_manual.delay(system_user)
|
||||||
return Response({"task": task.id})
|
return Response({"task": task.id})
|
||||||
|
|
||||||
|
@ -104,10 +104,15 @@ class AssetUser(models.Model):
|
|||||||
if update_fields:
|
if update_fields:
|
||||||
self.save(update_fields=update_fields)
|
self.save(update_fields=update_fields)
|
||||||
|
|
||||||
|
def clear_auth(self):
|
||||||
|
self._password = ''
|
||||||
|
self._private_key = ''
|
||||||
|
self.save()
|
||||||
|
|
||||||
def auto_gen_auth(self):
|
def auto_gen_auth(self):
|
||||||
password = str(uuid.uuid4())
|
password = str(uuid.uuid4())
|
||||||
private_key, public_key = ssh_key_gen(
|
private_key, public_key = ssh_key_gen(
|
||||||
username=self.username, password=password
|
username=self.username
|
||||||
)
|
)
|
||||||
self.set_auth(password=password,
|
self.set_auth(password=password,
|
||||||
private_key=private_key,
|
private_key=private_key,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models, transaction
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
|
||||||
@ -12,7 +12,10 @@ __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, unique=True, verbose_name=_("Value"))
|
# value = models.CharField(
|
||||||
|
# max_length=128, unique=True, verbose_name=_("Value")
|
||||||
|
# )
|
||||||
|
value = models.CharField(max_length=128, 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)
|
||||||
|
|
||||||
@ -36,6 +39,16 @@ class Node(models.Model):
|
|||||||
def level(self):
|
def level(self):
|
||||||
return len(self.key.split(':'))
|
return len(self.key.split(':'))
|
||||||
|
|
||||||
|
def set_parent(self, instance):
|
||||||
|
children = self.get_all_children()
|
||||||
|
old_key = self.key
|
||||||
|
with transaction.atomic():
|
||||||
|
self.parent = instance
|
||||||
|
for child in children:
|
||||||
|
child.key = child.key.replace(old_key, self.key, 1)
|
||||||
|
child.save()
|
||||||
|
self.save()
|
||||||
|
|
||||||
def get_next_child_key(self):
|
def get_next_child_key(self):
|
||||||
mark = self.child_mark
|
mark = self.child_mark
|
||||||
self.child_mark += 1
|
self.child_mark += 1
|
||||||
@ -48,7 +61,7 @@ class Node(models.Model):
|
|||||||
return child
|
return child
|
||||||
|
|
||||||
def get_children(self):
|
def get_children(self):
|
||||||
return self.__class__.objects.filter(key__regex=r'{}:[0-9]+$'.format(self.key))
|
return self.__class__.objects.filter(key__regex=r'^{}:[0-9]+$'.format(self.key))
|
||||||
|
|
||||||
def get_all_children(self):
|
def get_all_children(self):
|
||||||
return self.__class__.objects.filter(key__startswith='{}:'.format(self.key))
|
return self.__class__.objects.filter(key__startswith='{}:'.format(self.key))
|
||||||
@ -75,6 +88,11 @@ class Node(models.Model):
|
|||||||
assets = Asset.objects.filter(nodes__in=nodes).distinct()
|
assets = Asset.objects.filter(nodes__in=nodes).distinct()
|
||||||
return assets
|
return assets
|
||||||
|
|
||||||
|
def get_current_assets(self):
|
||||||
|
from .asset import Asset
|
||||||
|
assets = Asset.objects.filter(nodes=self).distinct()
|
||||||
|
return assets
|
||||||
|
|
||||||
def has_assets(self):
|
def has_assets(self):
|
||||||
return self.get_all_assets()
|
return self.get_all_assets()
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ from .asset import AssetGrantedSerializer
|
|||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'NodeSerializer', "NodeGrantedSerializer", "NodeAddChildrenSerializer",
|
'NodeSerializer', "NodeGrantedSerializer", "NodeAddChildrenSerializer",
|
||||||
"NodeAssetsSerializer",
|
"NodeAssetsSerializer", "NodeCurrentSerializer",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -51,6 +51,17 @@ class NodeSerializer(serializers.ModelSerializer):
|
|||||||
fields = ['id', 'key', 'value', 'parent', 'assets_amount', 'is_node']
|
fields = ['id', 'key', 'value', 'parent', 'assets_amount', 'is_node']
|
||||||
list_serializer_class = BulkListSerializer
|
list_serializer_class = BulkListSerializer
|
||||||
|
|
||||||
|
def validate(self, data):
|
||||||
|
value = data.get('value')
|
||||||
|
instance = self.instance if self.instance else Node.root()
|
||||||
|
children = instance.parent.get_children().exclude(key=instance.key)
|
||||||
|
values = [child.value for child in children]
|
||||||
|
if value in values:
|
||||||
|
raise serializers.ValidationError(
|
||||||
|
'The same level node name cannot be the same'
|
||||||
|
)
|
||||||
|
return data
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_parent(obj):
|
def get_parent(obj):
|
||||||
return obj.parent.id
|
return obj.parent.id
|
||||||
@ -66,6 +77,12 @@ class NodeSerializer(serializers.ModelSerializer):
|
|||||||
return fields
|
return fields
|
||||||
|
|
||||||
|
|
||||||
|
class NodeCurrentSerializer(NodeSerializer):
|
||||||
|
@staticmethod
|
||||||
|
def get_assets_amount(obj):
|
||||||
|
return obj.get_current_assets().count()
|
||||||
|
|
||||||
|
|
||||||
class NodeAssetsSerializer(serializers.ModelSerializer):
|
class NodeAssetsSerializer(serializers.ModelSerializer):
|
||||||
assets = serializers.PrimaryKeyRelatedField(many=True, queryset=Asset.objects.all())
|
assets = serializers.PrimaryKeyRelatedField(many=True, queryset=Asset.objects.all())
|
||||||
|
|
||||||
|
@ -98,7 +98,10 @@ function initTree2() {
|
|||||||
$.get("{% url 'api-assets:node-list' %}", function(data, status){
|
$.get("{% url 'api-assets:node-list' %}", function(data, status){
|
||||||
$.each(data, function (index, value) {
|
$.each(data, function (index, value) {
|
||||||
value["pId"] = value["parent"];
|
value["pId"] = value["parent"];
|
||||||
|
{#value["open"] = true;#}
|
||||||
|
if (value["key"] === "0") {
|
||||||
value["open"] = true;
|
value["open"] = true;
|
||||||
|
}
|
||||||
value["name"] = value["value"] + ' (' + value['assets_amount'] + ')';
|
value["name"] = value["value"] + ' (' + value['assets_amount'] + ')';
|
||||||
value['value'] = value['value'];
|
value['value'] = value['value'];
|
||||||
});
|
});
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
{% bootstrap_field form.private_key_file layout="horizontal" %}
|
{% bootstrap_field form.private_key_file layout="horizontal" %}
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="{{ form.as_push.id_for_label }}" class="col-sm-2 control-label">{% trans 'Auto push' %}</label>
|
<label for="{{ form.auto_push.id_for_label }}" class="col-sm-2 control-label">{% trans 'Auto push' %}</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
{{ form.auto_push}}
|
{{ form.auto_push}}
|
||||||
</div>
|
</div>
|
||||||
@ -79,43 +79,50 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block custom_foot_js %}
|
{% block custom_foot_js %}
|
||||||
<script>
|
<script>
|
||||||
var auto_generate_key = '#'+'{{ form.auto_generate_key.id_for_label }}';
|
var auto_generate_key = '#'+'{{ form.auto_generate_key.id_for_label }}';
|
||||||
var protocol_id = '#' + '{{ form.protocol.id_for_label }}';
|
var protocol_id = '#' + '{{ form.protocol.id_for_label }}';
|
||||||
var password_id = '#' + '{{ form.password.id_for_label }}';
|
var private_key_id = '#' + '{{ form.private_key_file.id_for_label }}';
|
||||||
var private_key_id = '#' + '{{ form.private_key_file.id_for_label }}';
|
var auto_push_id = '#' + '{{ form.auto_push.id_for_label }}';
|
||||||
var sudo_id = '#' + '{{ form.sudo.id_for_label }}';
|
var sudo_id = '#' + '{{ form.sudo.id_for_label }}';
|
||||||
var shell_id = '#' + '{{ form.shell.id_for_label }}';
|
var shell_id = '#' + '{{ form.shell.id_for_label }}';
|
||||||
|
var need_change_field = [
|
||||||
|
auto_generate_key, private_key_id, auto_push_id, sudo_id, shell_id
|
||||||
|
];
|
||||||
|
|
||||||
var need_change_field = [auto_generate_key, private_key_id, sudo_id, shell_id] ;
|
function protocolChange() {
|
||||||
|
if ($(protocol_id + " option:selected").text() === 'rdp') {
|
||||||
|
$('.auth-fields').removeClass('hidden');
|
||||||
|
$.each(need_change_field, function (index, value) {
|
||||||
|
$(value).closest('.form-group').addClass('hidden')
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
authFieldsDisplay();
|
||||||
|
$.each(need_change_field, function (index, value) {
|
||||||
|
$(value).closest('.form-group').removeClass('hidden')
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function authFieldsDisplay() {
|
function authFieldsDisplay() {
|
||||||
if ($(auto_generate_key).prop('checked')) {
|
if ($(auto_generate_key).prop('checked')) {
|
||||||
$('.auth-fields').addClass('hidden');
|
$('.auth-fields').addClass('hidden');
|
||||||
} else {
|
} else {
|
||||||
$('.auth-fields').removeClass('hidden');
|
$('.auth-fields').removeClass('hidden');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function protocolChange() {
|
$(document).ready(function () {
|
||||||
if ($(protocol_id).attr('value') === 'rdp') {
|
|
||||||
$.each(need_change_field, function (index, value) {
|
|
||||||
$(value).addClass('hidden')
|
|
||||||
});
|
|
||||||
$(password_id).removeClass('hidden')
|
|
||||||
} else {
|
|
||||||
$.each(need_change_field, function (index, value) {
|
|
||||||
$(value).removeClass('hidden')
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$(document).ready(function () {
|
|
||||||
$('.select2').select2();
|
$('.select2').select2();
|
||||||
authFieldsDisplay();
|
authFieldsDisplay();
|
||||||
protocolChange();
|
protocolChange();
|
||||||
$(auto_generate_key).change(function () {
|
})
|
||||||
|
.on('change', protocol_id, function(){
|
||||||
|
protocolChange();
|
||||||
|
})
|
||||||
|
.on('change', auto_generate_key, function(){
|
||||||
authFieldsDisplay();
|
authFieldsDisplay();
|
||||||
});
|
});
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -124,7 +124,7 @@ $(document).ready(function () {
|
|||||||
var success = function (data) {
|
var success = function (data) {
|
||||||
var task_id = data.task;
|
var task_id = data.task;
|
||||||
var url = '{% url "ops:celery-task-log" pk=DEFAULT_PK %}'.replace("{{ DEFAULT_PK }}", task_id);
|
var url = '{% url "ops:celery-task-log" pk=DEFAULT_PK %}'.replace("{{ DEFAULT_PK }}", task_id);
|
||||||
window.open(url, '', 'width=800,height=600')
|
window.open(url, '', 'width=800,height=600,left=400,top=400')
|
||||||
};
|
};
|
||||||
APIUpdateAttr({
|
APIUpdateAttr({
|
||||||
url: the_url,
|
url: the_url,
|
||||||
|
@ -190,7 +190,7 @@
|
|||||||
<td colspan="2" class="no-borders">
|
<td colspan="2" class="no-borders">
|
||||||
<select data-placeholder="{% trans 'Nodes' %}" id="groups_selected" class="select2 groups" style="width: 100%" multiple="" tabindex="4">
|
<select data-placeholder="{% trans 'Nodes' %}" id="groups_selected" class="select2 groups" 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 }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
@ -204,7 +204,7 @@
|
|||||||
|
|
||||||
{% for node in asset.nodes.all %}
|
{% for node in asset.nodes.all %}
|
||||||
<tr>
|
<tr>
|
||||||
<td ><b class="bdg_node" data-gid={{ node.id }}>{{ node.name }}</b></td>
|
<td ><b class="bdg_node" data-gid={{ node.id }}>{{ node }}</b></td>
|
||||||
<td>
|
<td>
|
||||||
<button class="btn btn-danger pull-right btn-xs btn-leave-node" type="button"><i class="fa fa-minus"></i></button>
|
<button class="btn btn-danger pull-right btn-xs btn-leave-node" type="button"><i class="fa fa-minus"></i></button>
|
||||||
</td>
|
</td>
|
||||||
|
@ -47,7 +47,6 @@
|
|||||||
<div class="file-manager ">
|
<div class="file-manager ">
|
||||||
<div id="assetTree" class="ztree">
|
<div id="assetTree" class="ztree">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -87,7 +86,7 @@
|
|||||||
<th class="text-center">{% trans 'IP' %}</th>
|
<th class="text-center">{% trans 'IP' %}</th>
|
||||||
<th class="text-center">{% trans 'Hardware' %}</th>
|
<th class="text-center">{% trans 'Hardware' %}</th>
|
||||||
<th class="text-center">{% trans 'Active' %}</th>
|
<th class="text-center">{% trans 'Active' %}</th>
|
||||||
<th class="text-center">{% trans 'Reachable' %}</th>
|
{# <th class="text-center">{% trans 'Reachable' %}</th>#}
|
||||||
<th class="text-center">{% trans 'Action' %}</th>
|
<th class="text-center">{% trans 'Action' %}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -127,6 +126,9 @@
|
|||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<li id="menu_refresh_hardware_info" class="btn-refresh-hardware" tabindex="-1"><a><i class="fa fa-refresh"></i> {% trans 'Refresh node hardware info' %}</a></li>
|
<li id="menu_refresh_hardware_info" class="btn-refresh-hardware" tabindex="-1"><a><i class="fa fa-refresh"></i> {% trans 'Refresh node hardware info' %}</a></li>
|
||||||
<li id="menu_test_connective" class="btn-test-connective" tabindex="-1"><a><i class="fa fa-chain"></i> {% trans 'Test node connective' %}</a></li>
|
<li id="menu_test_connective" class="btn-test-connective" tabindex="-1"><a><i class="fa fa-chain"></i> {% trans 'Test node connective' %}</a></li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
<li id="show_current_asset" class="btn-show-current-asset" style="display: none;" tabindex="-1"><a><i class="fa fa-hand-o-up"></i> {% trans 'Display only current node assets' %}</a></li>
|
||||||
|
<li id="show_all_asset" class="btn-show-all-asset" style="display: none;" tabindex="-1"><a><i class="fa fa-th"></i> {% trans 'Displays all child node assets' %}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -157,26 +159,35 @@ function initTable() {
|
|||||||
$(td).html('<i class="fa fa-check text-navy"></i>')
|
$(td).html('<i class="fa fa-check text-navy"></i>')
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
{targets: 5, createdCell: function (td, cellData) {
|
|
||||||
if (cellData === 'Unknown'){
|
{#{targets: 5, createdCell: function (td, cellData) {#}
|
||||||
$(td).html('<i class="fa fa-circle text-warning"></i>')
|
{# if (cellData === 'Unknown'){#}
|
||||||
} else if (!cellData) {
|
{# $(td).html('<i class="fa fa-circle text-warning"></i>')#}
|
||||||
$(td).html('<i class="fa fa-circle text-danger"></i>')
|
{# } else if (!cellData) {#}
|
||||||
} else {
|
{# $(td).html('<i class="fa fa-circle text-danger"></i>')#}
|
||||||
$(td).html('<i class="fa fa-circle text-navy"></i>')
|
{# } else {#}
|
||||||
}
|
{# $(td).html('<i class="fa fa-circle text-navy"></i>')#}
|
||||||
}},
|
{# }#}
|
||||||
{targets: 6, createdCell: function (td, cellData, rowData) {
|
{# }},#}
|
||||||
|
|
||||||
|
{targets: 5, createdCell: function (td, cellData, rowData) {
|
||||||
var update_btn = '<a href="{% url "assets:asset-update" pk=DEFAULT_PK %}" class="btn btn-xs btn-info">{% trans "Update" %}</a>'.replace("{{ DEFAULT_PK }}", cellData);
|
var update_btn = '<a href="{% url "assets:asset-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_asset_delete" data-uid="{{ DEFAULT_PK }}">{% trans "Delete" %}</a>'.replace('{{ DEFAULT_PK }}', cellData);
|
var del_btn = '<a class="btn btn-xs btn-danger m-l-xs btn_asset_delete" data-uid="{{ DEFAULT_PK }}">{% trans "Delete" %}</a>'.replace('{{ DEFAULT_PK }}', cellData);
|
||||||
$(td).html(update_btn + del_btn)
|
$(td).html(update_btn + del_btn)
|
||||||
}}
|
}}
|
||||||
],
|
],
|
||||||
ajax_url: '{% url "api-assets:asset-list" %}',
|
ajax_url: '{% url "api-assets:asset-list" %}',
|
||||||
|
|
||||||
|
{#columns: [#}
|
||||||
|
{# {data: "id"}, {data: "hostname" }, {data: "ip" },#}
|
||||||
|
{# {data: "cpu_cores"}, {data: "is_active", orderable: false },#}
|
||||||
|
{# {data: "is_connective", orderable: false}, {data: "id", orderable: false }#}
|
||||||
|
{#],#}
|
||||||
|
|
||||||
columns: [
|
columns: [
|
||||||
{data: "id"}, {data: "hostname" }, {data: "ip" },
|
{data: "id"}, {data: "hostname" }, {data: "ip" },
|
||||||
{data: "cpu_cores"}, {data: "is_active", orderable: false },
|
{data: "cpu_cores"}, {data: "is_active", orderable: false },
|
||||||
{data: "is_connective", orderable: false}, {data: "id", orderable: false }
|
{data: "id", orderable: false }
|
||||||
],
|
],
|
||||||
op_html: $('#actions').html()
|
op_html: $('#actions').html()
|
||||||
};
|
};
|
||||||
@ -200,6 +211,8 @@ function addTreeNode() {
|
|||||||
};
|
};
|
||||||
newNode.checked = zTree.getSelectedNodes()[0].checked;
|
newNode.checked = zTree.getSelectedNodes()[0].checked;
|
||||||
zTree.addNodes(parentNode, 0, newNode);
|
zTree.addNodes(parentNode, 0, newNode);
|
||||||
|
var node = zTree.getNodeByParam('id', newNode.id, parentNode)
|
||||||
|
zTree.editName(node);
|
||||||
} else {
|
} else {
|
||||||
alert("{% trans 'Create node failed' %}")
|
alert("{% trans 'Create node failed' %}")
|
||||||
}
|
}
|
||||||
@ -290,6 +303,7 @@ function onRename(event, treeId, treeNode, isCancel){
|
|||||||
function onSelected(event, treeNode) {
|
function onSelected(event, treeNode) {
|
||||||
var url = asset_table.ajax.url();
|
var url = asset_table.ajax.url();
|
||||||
url = setUrlParam(url, "node_id", treeNode.id);
|
url = setUrlParam(url, "node_id", treeNode.id);
|
||||||
|
url = setUrlParam(url, "show_current_asset", getCookie('show_current_asset'));
|
||||||
setCookie('node_selected', treeNode.id);
|
setCookie('node_selected', treeNode.id);
|
||||||
asset_table.ajax.url(url);
|
asset_table.ajax.url(url);
|
||||||
asset_table.ajax.reload();
|
asset_table.ajax.reload();
|
||||||
@ -382,12 +396,13 @@ function initTree() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var zNodes = [];
|
var zNodes = [];
|
||||||
$.get("{% url 'api-assets:node-list' %}", function(data, status){
|
var query_params = {'show_current_asset': getCookie('show_current_asset')};
|
||||||
|
$.get("{% url 'api-assets:node-list' %}", query_params, function(data, status){
|
||||||
$.each(data, function (index, value) {
|
$.each(data, function (index, value) {
|
||||||
value["pId"] = value["parent"];
|
value["pId"] = value["parent"];
|
||||||
{#if (value["key"] === "0") {#}
|
if (value["key"] === "0") {
|
||||||
value["open"] = true;
|
value["open"] = true;
|
||||||
{# }#}
|
}
|
||||||
value["name"] = value["value"] + ' (' + value['assets_amount'] + ')';
|
value["name"] = value["value"] + ' (' + value['assets_amount'] + ')';
|
||||||
value['value'] = value['value'];
|
value['value'] = value['value'];
|
||||||
});
|
});
|
||||||
@ -417,6 +432,13 @@ function toggle() {
|
|||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
initTable();
|
initTable();
|
||||||
initTree();
|
initTree();
|
||||||
|
|
||||||
|
if(getCookie('show_current_asset') === 'yes'){
|
||||||
|
$('#show_all_asset').css('display', 'inline-block');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('#show_current_asset').css('display', 'inline-block');
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.on('click', '.labels li', function () {
|
.on('click', '.labels li', function () {
|
||||||
var val = $(this).text();
|
var val = $(this).text();
|
||||||
@ -535,6 +557,20 @@ $(document).ready(function(){
|
|||||||
flash_message: false
|
flash_message: false
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
.on('click', '.btn-show-current-asset', function(){
|
||||||
|
hideRMenu();
|
||||||
|
$(this).css('display', 'none');
|
||||||
|
$('#show_all_asset').css('display', 'inline-block');
|
||||||
|
setCookie('show_current_asset', 'yes');
|
||||||
|
location.reload();
|
||||||
|
})
|
||||||
|
.on('click', '.btn-show-all-asset', function(){
|
||||||
|
hideRMenu();
|
||||||
|
$(this).css('display', 'none');
|
||||||
|
$('#show_current_asset').css('display', 'inline-block');
|
||||||
|
setCookie('show_current_asset', '');
|
||||||
|
location.reload();
|
||||||
|
})
|
||||||
.on('click', '.btn_asset_delete', function () {
|
.on('click', '.btn_asset_delete', function () {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var $data_table = $("#asset_list_table").DataTable();
|
var $data_table = $("#asset_list_table").DataTable();
|
||||||
|
@ -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 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 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);
|
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)
|
$(td).html(update_btn + test_btn + del_btn)
|
||||||
}}
|
}}
|
||||||
],
|
],
|
||||||
@ -120,7 +123,6 @@ $(document).ready(function(){
|
|||||||
success_message: "可连接",
|
success_message: "可连接",
|
||||||
fail_message: "连接失败"
|
fail_message: "连接失败"
|
||||||
})
|
})
|
||||||
|
});
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -66,3 +66,28 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% 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 }}';
|
||||||
|
|
||||||
|
function protocolChange() {
|
||||||
|
if ($(protocol_id + " option:selected").text() === 'rdp') {
|
||||||
|
$(port).val(3389);
|
||||||
|
$(private_key_id).closest('.form-group').addClass('hidden')
|
||||||
|
} else {
|
||||||
|
$(port).val(22);
|
||||||
|
$(private_key_id).closest('.form-group').removeClass('hidden')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
protocolChange();
|
||||||
|
})
|
||||||
|
.on('change', protocol_id, function(){
|
||||||
|
protocolChange();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
@ -64,14 +64,14 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{% trans 'Protocol' %}:</td>
|
<td>{% trans 'Protocol' %}:</td>
|
||||||
<td><b>{{ system_user.protocol }}</b></td>
|
<td><b id="id_protocol_type">{{ system_user.protocol }}</b></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr class="only-ssh">
|
||||||
<td>{% trans 'Sudo' %}:</td>
|
<td>{% trans 'Sudo' %}:</td>
|
||||||
<td><b>{{ system_user.sudo }}</b></td>
|
<td><b>{{ system_user.sudo }}</b></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% if system_user.shell %}
|
{% if system_user.shell %}
|
||||||
<tr>
|
<tr class="only-ssh">
|
||||||
<td>{% trans 'Shell' %}:</td>
|
<td>{% trans 'Shell' %}:</td>
|
||||||
<td><b>{{ system_user.shell }}</b></td>
|
<td><b>{{ system_user.shell }}</b></td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -107,7 +107,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-4" style="padding-left: 0;padding-right: 0">
|
<div class="col-sm-4" style="padding-left: 0;padding-right: 0">
|
||||||
<div class="panel panel-primary">
|
<div class="panel panel-primary only-ssh">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<i class="fa fa-info-circle"></i> {% trans 'Quick update' %}
|
<i class="fa fa-info-circle"></i> {% trans 'Quick update' %}
|
||||||
</div>
|
</div>
|
||||||
@ -236,6 +236,9 @@ function updateSystemUserNode(nodes) {
|
|||||||
}
|
}
|
||||||
jumpserver.nodes_selected = {};
|
jumpserver.nodes_selected = {};
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
if($('#id_protocol_type').text() === 'rdp'){
|
||||||
|
$('.only-ssh').addClass('hidden')
|
||||||
|
}
|
||||||
$('.select2').select2()
|
$('.select2').select2()
|
||||||
.on('select2:select', function(evt) {
|
.on('select2:select', function(evt) {
|
||||||
var data = evt.params.data;
|
var data = evt.params.data;
|
||||||
@ -296,7 +299,7 @@ $(document).ready(function () {
|
|||||||
var success = function (data) {
|
var success = function (data) {
|
||||||
var task_id = data.task;
|
var task_id = data.task;
|
||||||
var url = '{% url "ops:celery-task-log" pk=DEFAULT_PK %}'.replace("{{ DEFAULT_PK }}", task_id);
|
var url = '{% url "ops:celery-task-log" pk=DEFAULT_PK %}'.replace("{{ DEFAULT_PK }}", task_id);
|
||||||
window.open(url, '', 'width=800,height=600')
|
window.open(url, '', 'width=800,height=600,left=400,top=400')
|
||||||
};
|
};
|
||||||
APIUpdateAttr({
|
APIUpdateAttr({
|
||||||
url: the_url,
|
url: the_url,
|
||||||
|
@ -15,10 +15,3 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block custom_foot_js %}
|
|
||||||
<script>
|
|
||||||
$(document).ready(function () {
|
|
||||||
$('.select2').select2();
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
@ -96,14 +96,7 @@ class LDAPTestingAPI(APIView):
|
|||||||
|
|
||||||
class DjangoSettingsAPI(APIView):
|
class DjangoSettingsAPI(APIView):
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
if not settings.DEBUG:
|
return Response('Danger, Close now')
|
||||||
return Response('Only debug mode support')
|
|
||||||
|
|
||||||
configs = {}
|
|
||||||
for i in dir(settings):
|
|
||||||
if i.isupper():
|
|
||||||
configs[i] = str(getattr(settings, i))
|
|
||||||
return Response(configs)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Binary file not shown.
@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Jumpserver 0.3.3\n"
|
"Project-Id-Version: Jumpserver 0.3.3\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2018-04-27 11:39+0800\n"
|
"POT-Creation-Date: 2018-05-08 17:24+0800\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: ibuler <ibuler@qq.com>\n"
|
"Last-Translator: ibuler <ibuler@qq.com>\n"
|
||||||
"Language-Team: Jumpserver team<ibuler@qq.com>\n"
|
"Language-Team: Jumpserver team<ibuler@qq.com>\n"
|
||||||
@ -17,15 +17,15 @@ msgstr ""
|
|||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: assets/api/node.py:88
|
#: assets/api/node.py:96
|
||||||
msgid "New node {}"
|
msgid "New node {}"
|
||||||
msgstr "新节点 {}"
|
msgstr "新节点 {}"
|
||||||
|
|
||||||
#: assets/api/node.py:217
|
#: assets/api/node.py:225
|
||||||
msgid "更新节点资产硬件信息: {}"
|
msgid "更新节点资产硬件信息: {}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/api/node.py:230
|
#: assets/api/node.py:238
|
||||||
msgid "测试节点下资产是否可连接: {}"
|
msgid "测试节点下资产是否可连接: {}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ msgstr "管理用户"
|
|||||||
#: assets/forms/asset.py:30 assets/forms/asset.py:69 assets/forms/asset.py:125
|
#: assets/forms/asset.py:30 assets/forms/asset.py:69 assets/forms/asset.py:125
|
||||||
#: assets/templates/assets/asset_create.html:35
|
#: assets/templates/assets/asset_create.html:35
|
||||||
#: assets/templates/assets/asset_create.html:37
|
#: assets/templates/assets/asset_create.html:37
|
||||||
#: assets/templates/assets/asset_list.html:75
|
#: assets/templates/assets/asset_list.html:74
|
||||||
#: assets/templates/assets/asset_update.html:40
|
#: assets/templates/assets/asset_update.html:40
|
||||||
#: assets/templates/assets/asset_update.html:42
|
#: assets/templates/assets/asset_update.html:42
|
||||||
#: assets/templates/assets/user_asset_list.html:34
|
#: assets/templates/assets/user_asset_list.html:34
|
||||||
@ -206,7 +206,7 @@ msgstr "高优先级的系统用户将会作为默认登录用户"
|
|||||||
#: assets/templates/assets/_asset_list_modal.html:46
|
#: assets/templates/assets/_asset_list_modal.html:46
|
||||||
#: assets/templates/assets/admin_user_assets.html:52
|
#: assets/templates/assets/admin_user_assets.html:52
|
||||||
#: assets/templates/assets/asset_detail.html:61
|
#: assets/templates/assets/asset_detail.html:61
|
||||||
#: assets/templates/assets/asset_list.html:87
|
#: assets/templates/assets/asset_list.html:86
|
||||||
#: assets/templates/assets/domain_gateway_list.html:57
|
#: assets/templates/assets/domain_gateway_list.html:57
|
||||||
#: assets/templates/assets/system_user_asset.html:50
|
#: assets/templates/assets/system_user_asset.html:50
|
||||||
#: assets/templates/assets/user_asset_list.html:46 common/forms.py:144
|
#: assets/templates/assets/user_asset_list.html:46 common/forms.py:144
|
||||||
@ -220,7 +220,7 @@ msgstr "IP"
|
|||||||
#: assets/models/asset.py:62 assets/templates/assets/_asset_list_modal.html:45
|
#: assets/models/asset.py:62 assets/templates/assets/_asset_list_modal.html:45
|
||||||
#: assets/templates/assets/admin_user_assets.html:51
|
#: assets/templates/assets/admin_user_assets.html:51
|
||||||
#: assets/templates/assets/asset_detail.html:57
|
#: assets/templates/assets/asset_detail.html:57
|
||||||
#: assets/templates/assets/asset_list.html:86
|
#: assets/templates/assets/asset_list.html:85
|
||||||
#: assets/templates/assets/system_user_asset.html:49
|
#: assets/templates/assets/system_user_asset.html:49
|
||||||
#: assets/templates/assets/user_asset_list.html:45 common/forms.py:143
|
#: assets/templates/assets/user_asset_list.html:45 common/forms.py:143
|
||||||
#: perms/templates/perms/asset_permission_asset.html:54
|
#: perms/templates/perms/asset_permission_asset.html:54
|
||||||
@ -650,7 +650,7 @@ msgstr "重置"
|
|||||||
#: assets/templates/assets/admin_user_create_update.html:46
|
#: assets/templates/assets/admin_user_create_update.html:46
|
||||||
#: assets/templates/assets/asset_bulk_update.html:24
|
#: assets/templates/assets/asset_bulk_update.html:24
|
||||||
#: assets/templates/assets/asset_create.html:67
|
#: assets/templates/assets/asset_create.html:67
|
||||||
#: assets/templates/assets/asset_list.html:108
|
#: assets/templates/assets/asset_list.html:107
|
||||||
#: assets/templates/assets/asset_update.html:71
|
#: assets/templates/assets/asset_update.html:71
|
||||||
#: assets/templates/assets/domain_create_update.html:17
|
#: assets/templates/assets/domain_create_update.html:17
|
||||||
#: assets/templates/assets/gateway_create_update.html:59
|
#: assets/templates/assets/gateway_create_update.html:59
|
||||||
@ -699,7 +699,6 @@ msgstr "资产列表"
|
|||||||
|
|
||||||
#: assets/templates/assets/admin_user_assets.html:54
|
#: assets/templates/assets/admin_user_assets.html:54
|
||||||
#: assets/templates/assets/admin_user_list.html:26
|
#: assets/templates/assets/admin_user_list.html:26
|
||||||
#: assets/templates/assets/asset_list.html:90
|
|
||||||
#: assets/templates/assets/system_user_asset.html:52
|
#: assets/templates/assets/system_user_asset.html:52
|
||||||
#: assets/templates/assets/system_user_list.html:30
|
#: assets/templates/assets/system_user_list.html:30
|
||||||
#: users/templates/users/user_group_granted_asset.html:47
|
#: users/templates/users/user_group_granted_asset.html:47
|
||||||
@ -728,7 +727,7 @@ msgstr "测试"
|
|||||||
#: assets/templates/assets/admin_user_detail.html:24
|
#: assets/templates/assets/admin_user_detail.html:24
|
||||||
#: assets/templates/assets/admin_user_list.html:85
|
#: assets/templates/assets/admin_user_list.html:85
|
||||||
#: assets/templates/assets/asset_detail.html:24
|
#: assets/templates/assets/asset_detail.html:24
|
||||||
#: assets/templates/assets/asset_list.html:170
|
#: assets/templates/assets/asset_list.html:174
|
||||||
#: assets/templates/assets/domain_detail.html:24
|
#: assets/templates/assets/domain_detail.html:24
|
||||||
#: assets/templates/assets/domain_detail.html:103
|
#: assets/templates/assets/domain_detail.html:103
|
||||||
#: assets/templates/assets/domain_gateway_list.html:85
|
#: assets/templates/assets/domain_gateway_list.html:85
|
||||||
@ -752,7 +751,7 @@ msgstr "更新"
|
|||||||
#: assets/templates/assets/admin_user_detail.html:28
|
#: assets/templates/assets/admin_user_detail.html:28
|
||||||
#: assets/templates/assets/admin_user_list.html:86
|
#: assets/templates/assets/admin_user_list.html:86
|
||||||
#: assets/templates/assets/asset_detail.html:28
|
#: assets/templates/assets/asset_detail.html:28
|
||||||
#: assets/templates/assets/asset_list.html:171
|
#: assets/templates/assets/asset_list.html:175
|
||||||
#: assets/templates/assets/domain_detail.html:28
|
#: assets/templates/assets/domain_detail.html:28
|
||||||
#: assets/templates/assets/domain_detail.html:104
|
#: assets/templates/assets/domain_detail.html:104
|
||||||
#: assets/templates/assets/domain_gateway_list.html:86
|
#: assets/templates/assets/domain_gateway_list.html:86
|
||||||
@ -783,7 +782,7 @@ msgstr "选择节点"
|
|||||||
|
|
||||||
#: assets/templates/assets/admin_user_detail.html:100
|
#: assets/templates/assets/admin_user_detail.html:100
|
||||||
#: assets/templates/assets/asset_detail.html:200
|
#: assets/templates/assets/asset_detail.html:200
|
||||||
#: assets/templates/assets/asset_list.html:600
|
#: assets/templates/assets/asset_list.html:634
|
||||||
#: assets/templates/assets/system_user_detail.html:183
|
#: assets/templates/assets/system_user_detail.html:183
|
||||||
#: assets/templates/assets/system_user_list.html:138 templates/_modal.html:22
|
#: assets/templates/assets/system_user_list.html:138 templates/_modal.html:22
|
||||||
#: terminal/templates/terminal/session_detail.html:108
|
#: terminal/templates/terminal/session_detail.html:108
|
||||||
@ -815,7 +814,7 @@ msgid "Ratio"
|
|||||||
msgstr "比例"
|
msgstr "比例"
|
||||||
|
|
||||||
#: assets/templates/assets/admin_user_list.html:30
|
#: assets/templates/assets/admin_user_list.html:30
|
||||||
#: assets/templates/assets/asset_list.html:91
|
#: assets/templates/assets/asset_list.html:90
|
||||||
#: assets/templates/assets/domain_gateway_list.html:62
|
#: assets/templates/assets/domain_gateway_list.html:62
|
||||||
#: assets/templates/assets/domain_list.html:18
|
#: assets/templates/assets/domain_list.html:18
|
||||||
#: assets/templates/assets/label_list.html:17
|
#: assets/templates/assets/label_list.html:17
|
||||||
@ -856,7 +855,7 @@ msgid "Quick modify"
|
|||||||
msgstr "快速修改"
|
msgstr "快速修改"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_detail.html:143
|
#: assets/templates/assets/asset_detail.html:143
|
||||||
#: assets/templates/assets/asset_list.html:89
|
#: assets/templates/assets/asset_list.html:88
|
||||||
#: assets/templates/assets/user_asset_list.html:47 perms/models.py:35
|
#: assets/templates/assets/user_asset_list.html:47 perms/models.py:35
|
||||||
#: perms/models.py:79
|
#: perms/models.py:79
|
||||||
#: perms/templates/perms/asset_permission_create_update.html:47
|
#: perms/templates/perms/asset_permission_create_update.html:47
|
||||||
@ -886,89 +885,97 @@ msgstr "刷新"
|
|||||||
msgid "Update successfully!"
|
msgid "Update successfully!"
|
||||||
msgstr "更新成功"
|
msgstr "更新成功"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:63 assets/views/asset.py:97
|
#: assets/templates/assets/asset_list.html:62 assets/views/asset.py:97
|
||||||
msgid "Create asset"
|
msgid "Create asset"
|
||||||
msgstr "创建资产"
|
msgstr "创建资产"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:67
|
#: assets/templates/assets/asset_list.html:66
|
||||||
#: users/templates/users/user_list.html:7
|
#: users/templates/users/user_list.html:7
|
||||||
msgid "Import"
|
msgid "Import"
|
||||||
msgstr "导入"
|
msgstr "导入"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:70
|
#: assets/templates/assets/asset_list.html:69
|
||||||
#: users/templates/users/user_list.html:10
|
#: users/templates/users/user_list.html:10
|
||||||
msgid "Export"
|
msgid "Export"
|
||||||
msgstr "导出"
|
msgstr "导出"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:88
|
#: assets/templates/assets/asset_list.html:87
|
||||||
msgid "Hardware"
|
msgid "Hardware"
|
||||||
msgstr "硬件"
|
msgstr "硬件"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:100
|
#: assets/templates/assets/asset_list.html:99
|
||||||
#: users/templates/users/user_list.html:37
|
#: users/templates/users/user_list.html:37
|
||||||
msgid "Delete selected"
|
msgid "Delete selected"
|
||||||
msgstr "批量删除"
|
msgstr "批量删除"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:101
|
#: assets/templates/assets/asset_list.html:100
|
||||||
#: users/templates/users/user_list.html:38
|
#: users/templates/users/user_list.html:38
|
||||||
msgid "Update selected"
|
msgid "Update selected"
|
||||||
msgstr "批量更新"
|
msgstr "批量更新"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:102
|
#: assets/templates/assets/asset_list.html:101
|
||||||
msgid "Remove from this node"
|
msgid "Remove from this node"
|
||||||
msgstr "从节点移除"
|
msgstr "从节点移除"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:103
|
#: assets/templates/assets/asset_list.html:102
|
||||||
#: users/templates/users/user_list.html:39
|
#: users/templates/users/user_list.html:39
|
||||||
msgid "Deactive selected"
|
msgid "Deactive selected"
|
||||||
msgstr "禁用所选"
|
msgstr "禁用所选"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:104
|
#: assets/templates/assets/asset_list.html:103
|
||||||
#: users/templates/users/user_list.html:40
|
#: users/templates/users/user_list.html:40
|
||||||
msgid "Active selected"
|
msgid "Active selected"
|
||||||
msgstr "激活所选"
|
msgstr "激活所选"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:121
|
#: assets/templates/assets/asset_list.html:120
|
||||||
msgid "Add node"
|
msgid "Add node"
|
||||||
msgstr "新建节点"
|
msgstr "新建节点"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:122
|
#: assets/templates/assets/asset_list.html:121
|
||||||
msgid "Rename node"
|
msgid "Rename node"
|
||||||
msgstr "重命名节点"
|
msgstr "重命名节点"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:123
|
#: assets/templates/assets/asset_list.html:122
|
||||||
msgid "Delete node"
|
msgid "Delete node"
|
||||||
msgstr "删除节点"
|
msgstr "删除节点"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:125
|
#: assets/templates/assets/asset_list.html:124
|
||||||
msgid "Add assets to node"
|
msgid "Add assets to node"
|
||||||
msgstr "添加资产到节点"
|
msgstr "添加资产到节点"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:126
|
#: assets/templates/assets/asset_list.html:125
|
||||||
msgid "Move assets to node"
|
msgid "Move assets to node"
|
||||||
msgstr "移动资产到节点"
|
msgstr "移动资产到节点"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:128
|
#: assets/templates/assets/asset_list.html:127
|
||||||
msgid "Refresh node hardware info"
|
msgid "Refresh node hardware info"
|
||||||
msgstr "更新节点资产硬件信息"
|
msgstr "更新节点资产硬件信息"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:129
|
#: assets/templates/assets/asset_list.html:128
|
||||||
msgid "Test node connective"
|
msgid "Test node connective"
|
||||||
msgstr "测试节点资产可连接性"
|
msgstr "测试节点资产可连接性"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:204
|
#: assets/templates/assets/asset_list.html:130
|
||||||
|
msgid "Display only current node assets"
|
||||||
|
msgstr "仅显示当前节点资产"
|
||||||
|
|
||||||
|
#: assets/templates/assets/asset_list.html:131
|
||||||
|
msgid "Displays all child node assets"
|
||||||
|
msgstr "显示所有子节点资产"
|
||||||
|
|
||||||
|
#: assets/templates/assets/asset_list.html:215
|
||||||
msgid "Create node failed"
|
msgid "Create node failed"
|
||||||
msgstr "创建节点失败"
|
msgstr "创建节点失败"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:216
|
#: assets/templates/assets/asset_list.html:227
|
||||||
msgid "Have child node, cancel"
|
msgid "Have child node, cancel"
|
||||||
msgstr "存在子节点,不能删除"
|
msgstr "存在子节点,不能删除"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:218
|
#: assets/templates/assets/asset_list.html:229
|
||||||
msgid "Have assets, cancel"
|
msgid "Have assets, cancel"
|
||||||
msgstr "存在资产,不能删除"
|
msgstr "存在资产,不能删除"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:595
|
#: assets/templates/assets/asset_list.html:629
|
||||||
#: assets/templates/assets/system_user_list.html:133
|
#: assets/templates/assets/system_user_list.html:133
|
||||||
#: users/templates/users/user_detail.html:357
|
#: users/templates/users/user_detail.html:357
|
||||||
#: users/templates/users/user_detail.html:382
|
#: users/templates/users/user_detail.html:382
|
||||||
@ -977,20 +984,20 @@ msgstr "存在资产,不能删除"
|
|||||||
msgid "Are you sure?"
|
msgid "Are you sure?"
|
||||||
msgstr "你确认吗?"
|
msgstr "你确认吗?"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:596
|
#: assets/templates/assets/asset_list.html:630
|
||||||
msgid "This will delete the selected assets !!!"
|
msgid "This will delete the selected assets !!!"
|
||||||
msgstr "删除选择资产"
|
msgstr "删除选择资产"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:604
|
#: assets/templates/assets/asset_list.html:638
|
||||||
msgid "Asset Deleted."
|
msgid "Asset Deleted."
|
||||||
msgstr "已被删除"
|
msgstr "已被删除"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:605
|
#: assets/templates/assets/asset_list.html:639
|
||||||
#: assets/templates/assets/asset_list.html:610
|
#: assets/templates/assets/asset_list.html:644
|
||||||
msgid "Asset Delete"
|
msgid "Asset Delete"
|
||||||
msgstr "删除"
|
msgstr "删除"
|
||||||
|
|
||||||
#: assets/templates/assets/asset_list.html:609
|
#: assets/templates/assets/asset_list.html:643
|
||||||
msgid "Asset Deleting failed."
|
msgid "Asset Deleting failed."
|
||||||
msgstr "删除失败"
|
msgstr "删除失败"
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ class CeleryTaskLogApi(generics.RetrieveAPIView):
|
|||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
mark = request.query_params.get("mark") or str(uuid.uuid4())
|
mark = request.query_params.get("mark") or str(uuid.uuid4())
|
||||||
task = super().get_object()
|
task = self.get_object()
|
||||||
log_path = task.full_log_path
|
log_path = task.full_log_path
|
||||||
|
|
||||||
if not log_path or not os.path.isfile(log_path):
|
if not log_path or not os.path.isfile(log_path):
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
<a href="{% url 'ops:adhoc-history-detail' pk=object.pk %}" class="text-center"><i class="fa fa-laptop"></i> {% trans 'Run history detail' %} </a>
|
<a href="{% url 'ops:adhoc-history-detail' pk=object.pk %}" class="text-center"><i class="fa fa-laptop"></i> {% trans 'Run history detail' %} </a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="text-center celery-task-log" onclick="window.open('{% url 'ops:celery-task-log' pk=object.pk %}','', 'width=800,height=600')"><i class="fa fa-laptop"></i> {% trans 'Output' %} </a>
|
<a class="text-center celery-task-log" onclick="window.open('{% url 'ops:celery-task-log' pk=object.pk %}','', 'width=800,height=600,left=400,top=400')"><i class="fa fa-laptop"></i> {% trans 'Output' %} </a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,38 +2,25 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>term.js</title>
|
<title>term.js</title>
|
||||||
<script src="{% static 'js/jquery-2.1.1.js' %}"></script>
|
<script src="{% static 'js/jquery-2.1.1.js' %}"></script>
|
||||||
|
<script src="{% static 'js/plugins/xterm/xterm.js' %}"></script>
|
||||||
|
<link rel="stylesheet" href="{% static 'js/plugins/xterm/xterm.css' %}" />
|
||||||
<style>
|
<style>
|
||||||
html {
|
body {
|
||||||
background: #000;
|
background-color: black;
|
||||||
}
|
}
|
||||||
h1 {
|
.xterm-rows {
|
||||||
margin-bottom: 20px;
|
{#padding: 15px;#}
|
||||||
font: 20px/1.5 sans-serif;
|
font-family: "Bitstream Vera Sans Mono", Monaco, "Consolas", Courier, monospace;
|
||||||
}
|
font-size: 13px;
|
||||||
.terminal {
|
|
||||||
float: left;
|
|
||||||
font-family: 'Monaco', 'Consolas', "DejaVu Sans Mono", "Liberation Mono", monospace;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #f0f0f0;
|
|
||||||
background-color: #555;
|
|
||||||
padding: 20px 20px 20px;
|
|
||||||
}
|
|
||||||
.terminal-cursor {
|
|
||||||
color: #000;
|
|
||||||
background: #f0f0f0;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<div class="container">
|
<div id="term" style="height: 100%;width: 100%">
|
||||||
<div id="term">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<script src="{% static 'js/term.js' %}"></script>
|
|
||||||
<script>
|
<script>
|
||||||
var rowHeight = 1;
|
var rowHeight = 18;
|
||||||
var colWidth = 1;
|
var colWidth = 10;
|
||||||
var mark = '';
|
var mark = '';
|
||||||
var url = "{% url 'api-ops:celery-task-log' pk=object.id %}";
|
var url = "{% url 'api-ops:celery-task-log' pk=object.id %}";
|
||||||
var term;
|
var term;
|
||||||
@ -42,13 +29,16 @@
|
|||||||
var interval = 200;
|
var interval = 200;
|
||||||
|
|
||||||
function calWinSize() {
|
function calWinSize() {
|
||||||
var t = $('.terminal');
|
var t = $('#marker');
|
||||||
rowHeight = 1.00 * t.height() / 24;
|
{#rowHeight = 1.00 * t.height();#}
|
||||||
colWidth = 1.00 * t.width() / 80;
|
{#colWidth = 1.00 * t.width() / 6;#}
|
||||||
}
|
}
|
||||||
function resize() {
|
function resize() {
|
||||||
var rows = Math.floor(window.innerHeight / rowHeight) - 2;
|
{#console.log(rowHeight, window.innerHeight);#}
|
||||||
var cols = Math.floor(window.innerWidth / colWidth) - 10;
|
{#console.log(colWidth, window.innerWidth);#}
|
||||||
|
var rows = Math.floor(window.innerHeight / rowHeight) - 1;
|
||||||
|
var cols = Math.floor(window.innerWidth / colWidth) - 2;
|
||||||
|
console.log(rows, cols);
|
||||||
term.resize(cols, rows);
|
term.resize(cols, rows);
|
||||||
}
|
}
|
||||||
function requestAndWrite() {
|
function requestAndWrite() {
|
||||||
@ -74,21 +64,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
term = new Terminal({
|
term = new Terminal();
|
||||||
cols: 80,
|
term.open(document.getElementById('term'));
|
||||||
rows: 24,
|
term.resize(80, 24);
|
||||||
useStyle: true,
|
|
||||||
screenKeys: false,
|
|
||||||
convertEol: false,
|
|
||||||
cursorBlink: false
|
|
||||||
});
|
|
||||||
term.open();
|
|
||||||
term.on('data', function (data) {
|
|
||||||
term.write(data.replace('\r', '\r\n'))
|
|
||||||
});
|
|
||||||
calWinSize();
|
|
||||||
resize();
|
resize();
|
||||||
$('.terminal').detach().appendTo('#term');
|
term.on('data', function (data) {
|
||||||
|
{#term.write(data.replace('\r', '\r\n'))#}
|
||||||
|
term.write(data);
|
||||||
|
});
|
||||||
|
window.onresize = function () {
|
||||||
|
resize()
|
||||||
|
};
|
||||||
|
{#$('.terminal').detach().appendTo('#term');#}
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
requestAndWrite()
|
requestAndWrite()
|
||||||
}, interval)
|
}, interval)
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<a href="{% url 'ops:task-history' pk=object.pk %}" class="text-center"><i class="fa fa-laptop"></i> {% trans 'Run history' %} </a>
|
<a href="{% url 'ops:task-history' pk=object.pk %}" class="text-center"><i class="fa fa-laptop"></i> {% trans 'Run history' %} </a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="text-center celery-task-log" onclick="window.open('{% url 'ops:celery-task-log' pk=object.latest_history.pk %}','', 'width=800,height=600')"><i class="fa fa-laptop"></i> {% trans 'Last run output' %} </a>
|
<a class="text-center celery-task-log" onclick="window.open('{% url 'ops:celery-task-log' pk=object.latest_history.pk %}','', 'width=800,height=600,left=400,top=400')"><i class="fa fa-laptop"></i> {% trans 'Last run output' %} </a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<a href="{% url 'ops:task-history' pk=object.pk %}" class="text-center"><i class="fa fa-laptop"></i> {% trans 'Run history' %} </a>
|
<a href="{% url 'ops:task-history' pk=object.pk %}" class="text-center"><i class="fa fa-laptop"></i> {% trans 'Run history' %} </a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="text-center celery-task-log" onclick="window.open('{% url 'ops:celery-task-log' pk=object.latest_history.pk %}','', 'width=800,height=600')"><i class="fa fa-laptop"></i> {% trans 'Last run output' %} </a>
|
<a class="text-center celery-task-log" onclick="window.open('{% url 'ops:celery-task-log' pk=object.latest_history.pk %}','', 'width=800,height=600,left=400,top=400')"><i class="fa fa-laptop"></i> {% trans 'Last run output' %} </a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<a href="{% url 'ops:task-history' pk=object.pk %}" class="text-center"><i class="fa fa-laptop"></i> {% trans 'Run history' %} </a>
|
<a href="{% url 'ops:task-history' pk=object.pk %}" class="text-center"><i class="fa fa-laptop"></i> {% trans 'Run history' %} </a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="text-center celery-task-log" onclick="window.open('{% url 'ops:celery-task-log' pk=object.latest_history.pk %}','', 'width=800,height=600')"><i class="fa fa-laptop"></i> {% trans 'Last run output' %} </a>
|
<a class="text-center celery-task-log" onclick="window.open('{% url 'ops:celery-task-log' pk=object.latest_history.pk %}','', 'width=800,height=600,left=400,top=400')"><i class="fa fa-laptop"></i> {% trans 'Last run output' %} </a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -115,7 +115,7 @@ $(document).ready(function() {
|
|||||||
var success = function(data) {
|
var success = function(data) {
|
||||||
var task_id = data.task;
|
var task_id = data.task;
|
||||||
var url = '{% url "ops:celery-task-log" pk=DEFAULT_PK %}'.replace("{{ DEFAULT_PK }}", task_id);
|
var url = '{% url "ops:celery-task-log" pk=DEFAULT_PK %}'.replace("{{ DEFAULT_PK }}", task_id);
|
||||||
window.open(url, '', 'width=800,height=600')
|
window.open(url, '', 'width=800,height=600,left=400,top=400')
|
||||||
};
|
};
|
||||||
APIUpdateAttr({
|
APIUpdateAttr({
|
||||||
url: the_url,
|
url: the_url,
|
||||||
|
@ -226,7 +226,7 @@ function initTree() {
|
|||||||
},
|
},
|
||||||
async: {
|
async: {
|
||||||
enable: true,
|
enable: true,
|
||||||
url: "{% url 'api-assets:node-children-2' %}?assets=1&all=1",
|
url: "{% url 'api-assets:node-children-2' %}?assets=1&all=",
|
||||||
autoParam:["id", "name=n", "level=lv"],
|
autoParam:["id", "name=n", "level=lv"],
|
||||||
dataFilter: filter,
|
dataFilter: filter,
|
||||||
type: 'get'
|
type: 'get'
|
||||||
@ -238,7 +238,7 @@ function initTree() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var zNodes = [];
|
var zNodes = [];
|
||||||
$.get("{% url 'api-assets:node-children-2' %}?assets=1&all=1", function(data, status){
|
$.get("{% url 'api-assets:node-children-2' %}?assets=1&all=", function(data, status){
|
||||||
$.each(data, function (index, value) {
|
$.each(data, function (index, value) {
|
||||||
value["pId"] = value["parent"];
|
value["pId"] = value["parent"];
|
||||||
value["name"] = value["value"];
|
value["name"] = value["value"];
|
||||||
@ -250,7 +250,7 @@ function initTree() {
|
|||||||
{#$.fn.zTree.init($("#assetTree"), setting);#}
|
{#$.fn.zTree.init($("#assetTree"), setting);#}
|
||||||
$.fn.zTree.init($("#assetTree"), setting, zNodes);
|
$.fn.zTree.init($("#assetTree"), setting, zNodes);
|
||||||
zTree = $.fn.zTree.getZTreeObj("assetTree");
|
zTree = $.fn.zTree.getZTreeObj("assetTree");
|
||||||
selectQueryNode();
|
{#selectQueryNode();#}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,6 +304,7 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
if (row.child.isShown()) {
|
if (row.child.isShown()) {
|
||||||
tr.removeClass('details');
|
tr.removeClass('details');
|
||||||
|
$(this).children('i:first-child').removeClass('fa-angle-down').addClass('fa-angle-right');
|
||||||
row.child.hide();
|
row.child.hide();
|
||||||
|
|
||||||
// Remove from the 'open' array
|
// Remove from the 'open' array
|
||||||
@ -311,7 +312,7 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tr.addClass('details');
|
tr.addClass('details');
|
||||||
$('.toggle i').removeClass('fa-angle-right').addClass('fa-angle-down');
|
$(this).children('i:first-child').removeClass('fa-angle-right').addClass('fa-angle-down');
|
||||||
row.child(format(row.data())).show();
|
row.child(format(row.data())).show();
|
||||||
// Add to the 'open' array
|
// Add to the 'open' array
|
||||||
if ( idx === -1 ) {
|
if ( idx === -1 ) {
|
||||||
|
@ -42,7 +42,7 @@ class AssetPermissionCreateView(AdminUserRequiredMixin, CreateView):
|
|||||||
|
|
||||||
if nodes_id:
|
if nodes_id:
|
||||||
nodes_id = nodes_id.split(",")
|
nodes_id = nodes_id.split(",")
|
||||||
nodes = Node.objects.filter(id__in=nodes_id)
|
nodes = Node.objects.filter(id__in=nodes_id).exclude(id=Node.root().id)
|
||||||
form['nodes'].initial = nodes
|
form['nodes'].initial = nodes
|
||||||
if assets_id:
|
if assets_id:
|
||||||
assets_id = assets_id.split(",")
|
assets_id = assets_id.split(",")
|
||||||
|
2261
apps/static/js/plugins/xterm/xterm.css
Normal file
2261
apps/static/js/plugins/xterm/xterm.css
Normal file
File diff suppressed because it is too large
Load Diff
5132
apps/static/js/plugins/xterm/xterm.js
Normal file
5132
apps/static/js/plugins/xterm/xterm.js
Normal file
File diff suppressed because it is too large
Load Diff
1
apps/static/js/plugins/xterm/xterm.js.map
Normal file
1
apps/static/js/plugins/xterm/xterm.js.map
Normal file
File diff suppressed because one or more lines are too long
@ -108,6 +108,9 @@ class StatusViewSet(viewsets.ModelViewSet):
|
|||||||
task_serializer_class = TaskSerializer
|
task_serializer_class = TaskSerializer
|
||||||
|
|
||||||
def create(self, request, *args, **kwargs):
|
def create(self, request, *args, **kwargs):
|
||||||
|
if self.request.query_params.get("from_guacamole", None):
|
||||||
|
return Response({"msg": "From guacamole, not support now"})
|
||||||
|
|
||||||
self.handle_sessions()
|
self.handle_sessions()
|
||||||
super().create(request, *args, **kwargs)
|
super().create(request, *args, **kwargs)
|
||||||
tasks = self.request.user.terminal.task_set.filter(is_finished=False)
|
tasks = self.request.user.terminal.task_set.filter(is_finished=False)
|
||||||
|
@ -88,7 +88,7 @@
|
|||||||
<td>{% trans 'Replay session' %}:</td>
|
<td>{% trans 'Replay session' %}:</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="pull-right">
|
<span class="pull-right">
|
||||||
<button type="button" onclick="window.open('/luna/replay/{{ object.id }}','luna', 'height=600, width=800, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')" class="btn btn-primary btn-xs" id="btn_reset_password" style="width: 54px">{% trans 'Go' %}</button>
|
<button type="button" onclick="window.open('/luna/replay/{{ object.id }}','luna', 'height=600, width=800, top=400, left=400, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')" class="btn btn-primary btn-xs" id="btn_reset_password" style="width: 54px">{% trans 'Go' %}</button>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -99,11 +99,15 @@
|
|||||||
<td class="text-center">{{ session.date_start|time_util_with_seconds:session.date_end }}</td>
|
<td class="text-center">{{ session.date_start|time_util_with_seconds:session.date_end }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if session.is_finished %}
|
{% if session.is_finished %}
|
||||||
<a onclick="window.open('/luna/replay/{{ 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-replay" >{% trans "Replay" %}</a>
|
<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 %}
|
{% 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 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>-->
|
||||||
|
{% 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>
|
<a class="btn btn-xs btn-danger btn-term" value="{{ session.id }}" terminal="{{ session.terminal.id }}" >{% trans "Terminate" %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -68,7 +68,7 @@ var asset_table;
|
|||||||
|
|
||||||
function initTable() {
|
function initTable() {
|
||||||
if (inited){
|
if (inited){
|
||||||
return
|
return asset_table
|
||||||
} else {
|
} else {
|
||||||
inited = true;
|
inited = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user