提交 92251f2a 编写于 作者: baltery's avatar baltery

Merge with master

上级 374dfbda
......@@ -289,10 +289,10 @@ def get_default_idc():
class Asset(models.Model):
ip = models.GenericIPAddressField(max_length=32, verbose_name=_('IP'))
ip = models.GenericIPAddressField(max_length=32, verbose_name=_('IP'), db_index=True)
other_ip = models.CharField(max_length=255, null=True, blank=True, verbose_name=_('Other IP'))
remote_card_ip = models.CharField(max_length=16, null=True, blank=True, verbose_name=_('Remote card IP'))
hostname = models.CharField(max_length=128, blank=True, verbose_name=_('Hostname'))
hostname = models.CharField(max_length=128, unique=True, verbose_name=_('Hostname'))
port = models.IntegerField(default=22, verbose_name=_('Port'))
groups = models.ManyToManyField(AssetGroup, blank=True, related_name='assets', verbose_name=_('Asset groups'))
admin_user = models.ForeignKey(AdminUser, null=True, blank=True, related_name='assets',
......
......@@ -132,7 +132,6 @@ div.dataTables_wrapper div.dataTables_filter,
};//onload;
$(document).ready(function(){
<<<<<<< HEAD
$('#modal').modal({
show: false,
backdrop: 'static',
......@@ -169,22 +168,6 @@ div.dataTables_wrapper div.dataTables_filter,
$('#editable_length').before("<a href=\"{% url 'assets:asset-create' %}\" class=\"btn btn-sm btn-primary custom \"> {% trans 'Create asset' %} </a>&nbsp; <button class='btn btn-sm btn-primary custom' id='zksx' onclick='tagShow()'>标签</button>");
$('#editable').before(oTags);
},
=======
var oTags = document.getElementById("ydxbd");
var table = $('#editable').DataTable({
"aLengthMenu": [[10, 25, 50, -1], ["10", "25", "50", "all"]],
"iDisplayLength":25,
"aaSorting": [[7, "asc"]],
"aoColumnDefs": [ { "bSortable": false, "aTargets": [ 0 ] }],
"bAutoWidth": false,
"language": {"url": "/static/js/plugins/dataTables/i18n/zh-hans.json"},
"dom": '<"custom">lftip',
"initComplete": function() {
//alert( 'DataTables has finished its initialisation.' );
$('#editable_length').before("<a href=\"{% url 'assets:asset-create' %}\" class=\"btn btn-sm btn-primary custom \"> {% trans 'Create asset' %} </a>&nbsp; <button class='btn btn-sm btn-primary custom' id='zksx' onclick='tagShow()'>标签</button>");
$('#editable').before(oTags);
},
>>>>>>> 534321d1aa42f0853083876b807d0258dafc0b0c
columns: [
{data: "checkbox"},
{data: "id"},
......
......@@ -82,7 +82,10 @@ class CommandLog(models.Model):
@property
def output_decode(self):
return base64.b64decode(self.output).replace('\n', '<br />')
try:
return base64.b64decode(self.output).replace('\n', '<br />')
except UnicodeDecodeError:
return 'UnicodeDecodeError'
class Meta:
db_table = 'command_log'
......
......@@ -15,6 +15,7 @@
<th>Command</th>
<th>Username</th>
<th>IP</th>
<th>System user</th>
<th>Datetime</th>
<th data-hide="all">Output</th>
</tr>
......@@ -26,6 +27,7 @@
<td>{{ command.command }}</td>
<td>{{ command.proxy_log.username }}</td>
<td>{{ command.proxy_log.ip }}</td>
<td>{{ command.proxy_log.system_user }}</td>
<td>{{ command.datetime }}</td>
<td>{{ command.output_decode |safe }}</td>
</tr>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册