mirror of https://github.com/jumpserver/jumpserver
add asset detail and list
parent
fcd39370ed
commit
3771b2ff70
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10 on 2016-08-14 08:12
|
||||
# Generated by Django 1.10 on 2016-08-21 09:52
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
@ -19,26 +19,26 @@ class Migration(migrations.Migration):
|
|||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('ip', models.CharField(blank=True, max_length=32, verbose_name='\u4e3b\u673aIP')),
|
||||
('other_ip', models.CharField(blank=True, max_length=255, null=True, verbose_name='\u5176\u4ed6IP')),
|
||||
('remote_card_ip', models.CharField(blank=True, max_length=16, null=True, verbose_name='\u8fdc\u63a7\u5361IP')),
|
||||
('hostname', models.CharField(max_length=128, unique=True, verbose_name='\u4e3b\u673a\u540d')),
|
||||
('port', models.IntegerField(blank=True, null=True, verbose_name='\u7aef\u53e3\u53f7')),
|
||||
('username', models.CharField(blank=True, max_length=16, null=True, verbose_name='\u7ba1\u7406\u7528\u6237\u540d')),
|
||||
('password', models.CharField(blank=True, max_length=256, null=True, verbose_name='\u5bc6\u7801')),
|
||||
('mac_addr', models.CharField(blank=True, max_length=20, null=True, verbose_name='MAC\u5730\u5740')),
|
||||
('brand', models.CharField(blank=True, max_length=64, null=True, verbose_name='\u786c\u4ef6\u5382\u5546\u578b\u53f7')),
|
||||
('cpu', models.CharField(blank=True, max_length=64, null=True, verbose_name='CPU')),
|
||||
('memory', models.CharField(blank=True, max_length=128, null=True, verbose_name='\u5185\u5b58')),
|
||||
('disk', models.CharField(blank=True, max_length=1024, null=True, verbose_name='\u786c\u76d8')),
|
||||
('os', models.CharField(blank=True, max_length=128, null=True, verbose_name='\u7cfb\u7edf\u4fe1\u606f')),
|
||||
('cabinet_no', models.CharField(blank=True, max_length=32, null=True, verbose_name='\u673a\u67dc\u53f7')),
|
||||
('cabinet_pos', models.IntegerField(blank=True, null=True, verbose_name='\u673a\u5668\u4f4d\u7f6e')),
|
||||
('number', models.CharField(blank=True, max_length=32, null=True, verbose_name='\u8d44\u4ea7\u7f16\u53f7')),
|
||||
('sn', models.CharField(blank=True, max_length=128, null=True, verbose_name='SN\u7f16\u53f7')),
|
||||
('created_by', models.CharField(blank=True, max_length=32, null=True, verbose_name='\u521b\u5efa\u8005')),
|
||||
('other_ip', models.CharField(blank=True, max_length=255, verbose_name='\u5176\u4ed6IP')),
|
||||
('remote_card_ip', models.CharField(blank=True, max_length=16, verbose_name='\u8fdc\u63a7\u5361IP')),
|
||||
('hostname', models.CharField(blank=True, max_length=128, unique=True, verbose_name='\u4e3b\u673a\u540d')),
|
||||
('port', models.IntegerField(blank=True, verbose_name='\u7aef\u53e3\u53f7')),
|
||||
('username', models.CharField(blank=True, max_length=16, verbose_name='\u7ba1\u7406\u7528\u6237\u540d')),
|
||||
('password', models.CharField(blank=True, max_length=256, verbose_name='\u5bc6\u7801')),
|
||||
('mac_addr', models.CharField(blank=True, max_length=20, unique=True, verbose_name='MAC\u5730\u5740')),
|
||||
('brand', models.CharField(blank=True, max_length=64, verbose_name='\u786c\u4ef6\u5382\u5546\u578b\u53f7')),
|
||||
('cpu', models.CharField(blank=True, max_length=64, verbose_name='CPU')),
|
||||
('memory', models.CharField(blank=True, max_length=128, verbose_name='\u5185\u5b58')),
|
||||
('disk', models.CharField(blank=True, max_length=1024, verbose_name='\u786c\u76d8')),
|
||||
('os', models.CharField(blank=True, max_length=128, verbose_name='\u7cfb\u7edf\u4fe1\u606f')),
|
||||
('cabinet_no', models.CharField(blank=True, max_length=32, verbose_name='\u673a\u67dc\u53f7')),
|
||||
('cabinet_pos', models.IntegerField(blank=True, verbose_name='\u673a\u5668\u4f4d\u7f6e')),
|
||||
('number', models.CharField(blank=True, max_length=32, unique=True, verbose_name='\u8d44\u4ea7\u7f16\u53f7')),
|
||||
('sn', models.CharField(blank=True, max_length=128, unique=True, verbose_name='SN\u7f16\u53f7')),
|
||||
('created_by', models.CharField(blank=True, max_length=32, verbose_name='\u521b\u5efa\u8005')),
|
||||
('is_active', models.BooleanField(default=True, verbose_name='\u662f\u5426\u6fc0\u6d3b')),
|
||||
('date_added', models.DateTimeField(auto_now=True, null=True)),
|
||||
('comment', models.CharField(blank=True, max_length=128, null=True, verbose_name='\u5907\u6ce8')),
|
||||
('comment', models.CharField(blank=True, max_length=128, verbose_name='\u5907\u6ce8')),
|
||||
],
|
||||
options={
|
||||
'db_table': 'asset',
|
||||
|
@ -55,7 +55,7 @@ class Migration(migrations.Migration):
|
|||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=64, unique=True)),
|
||||
('created_by', models.CharField(blank=True, max_length=32, null=True, verbose_name='\u521b\u5efa\u8005')),
|
||||
('created_by', models.CharField(blank=True, max_length=32, verbose_name='\u521b\u5efa\u8005')),
|
||||
('comment', models.CharField(blank=True, max_length=128, null=True)),
|
||||
],
|
||||
options={
|
||||
|
@ -67,15 +67,15 @@ class Migration(migrations.Migration):
|
|||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=32, verbose_name='\u673a\u623f\u540d\u79f0')),
|
||||
('bandwidth', models.CharField(blank=True, default='', max_length=32, null=True, verbose_name='\u673a\u623f\u5e26\u5bbd')),
|
||||
('contact', models.CharField(blank=True, default='', max_length=16, null=True, verbose_name='\u8054\u7cfb\u4eba')),
|
||||
('phone', models.CharField(blank=True, default='', max_length=32, null=True, verbose_name='\u8054\u7cfb\u7535\u8bdd')),
|
||||
('address', models.CharField(blank=True, default='', max_length=128, null=True, verbose_name='\u673a\u623f\u5730\u5740')),
|
||||
('network', models.TextField(blank=True, default='', null=True, verbose_name='IP\u5730\u5740\u6bb5')),
|
||||
('bandwidth', models.CharField(blank=True, max_length=32, verbose_name='\u673a\u623f\u5e26\u5bbd')),
|
||||
('contact', models.CharField(blank=True, max_length=16, verbose_name='\u8054\u7cfb\u4eba')),
|
||||
('phone', models.CharField(blank=True, max_length=32, verbose_name='\u8054\u7cfb\u7535\u8bdd')),
|
||||
('address', models.CharField(blank=True, max_length=128, verbose_name='\u673a\u623f\u5730\u5740')),
|
||||
('network', models.TextField(blank=True, verbose_name='IP\u5730\u5740\u6bb5')),
|
||||
('date_added', models.DateField(auto_now=True, null=True)),
|
||||
('operator', models.CharField(blank=True, default='', max_length=32, null=True, verbose_name='\u8fd0\u8425\u5546')),
|
||||
('created_by', models.CharField(blank=True, max_length=32, null=True, verbose_name='\u521b\u5efa\u8005')),
|
||||
('comment', models.CharField(blank=True, default='', max_length=128, null=True, verbose_name='\u5907\u6ce8')),
|
||||
('operator', models.CharField(blank=True, max_length=32, verbose_name='\u8fd0\u8425\u5546')),
|
||||
('created_by', models.CharField(blank=True, max_length=32, verbose_name='\u521b\u5efa\u8005')),
|
||||
('comment', models.CharField(blank=True, max_length=128, verbose_name='\u5907\u6ce8')),
|
||||
],
|
||||
options={
|
||||
'db_table': 'idc',
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10 on 2016-08-21 09:57
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('assets', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='asset',
|
||||
name='cabinet_pos',
|
||||
field=models.IntegerField(blank=True, max_length=4, verbose_name='\u673a\u5668\u4f4d\u7f6e'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10 on 2016-08-21 09:59
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('assets', '0002_auto_20160821_1757'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='asset',
|
||||
name='cabinet_pos',
|
||||
field=models.IntegerField(blank=True, max_length=4, null=True, verbose_name='\u673a\u5668\u4f4d\u7f6e'),
|
||||
),
|
||||
]
|
|
@ -6,7 +6,7 @@ from django.db import models
|
|||
|
||||
class AssetGroup(models.Model):
|
||||
name = models.CharField(max_length=64, unique=True)
|
||||
created_by = models.CharField(max_length=32, blank=True, null=True, verbose_name=u"创建者")
|
||||
created_by = models.CharField(max_length=32, blank=True, verbose_name=u"创建者")
|
||||
comment = models.CharField(max_length=128, blank=True, null=True)
|
||||
|
||||
def __unicode__(self):
|
||||
|
@ -18,15 +18,15 @@ class AssetGroup(models.Model):
|
|||
|
||||
class IDC(models.Model):
|
||||
name = models.CharField(max_length=32, verbose_name=u'机房名称')
|
||||
bandwidth = models.CharField(max_length=32, blank=True, null=True, default='', verbose_name=u'机房带宽')
|
||||
contact = models.CharField(max_length=16, blank=True, null=True, default='', verbose_name=u'联系人')
|
||||
phone = models.CharField(max_length=32, blank=True, null=True, default='', verbose_name=u'联系电话')
|
||||
address = models.CharField(max_length=128, blank=True, null=True, default='', verbose_name=u"机房地址")
|
||||
network = models.TextField(blank=True, null=True, default='', verbose_name=u"IP地址段")
|
||||
bandwidth = models.CharField(max_length=32, blank=True, verbose_name=u'机房带宽')
|
||||
contact = models.CharField(max_length=16, blank=True, verbose_name=u'联系人')
|
||||
phone = models.CharField(max_length=32, blank=True, verbose_name=u'联系电话')
|
||||
address = models.CharField(max_length=128, blank=True, verbose_name=u"机房地址")
|
||||
network = models.TextField(blank=True, verbose_name=u"IP地址段")
|
||||
date_added = models.DateField(auto_now=True, null=True)
|
||||
operator = models.CharField(max_length=32, blank=True, default='', null=True, verbose_name=u"运营商")
|
||||
created_by = models.CharField(max_length=32, blank=True, null=True, verbose_name=u"创建者")
|
||||
comment = models.CharField(max_length=128, blank=True, default='', null=True, verbose_name=u"备注")
|
||||
operator = models.CharField(max_length=32, blank=True, verbose_name=u"运营商")
|
||||
created_by = models.CharField(max_length=32, blank=True, verbose_name=u"创建者")
|
||||
comment = models.CharField(max_length=128, blank=True, verbose_name=u"备注")
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
|
@ -43,31 +43,34 @@ class AssetExtend(models.Model):
|
|||
|
||||
class Asset(models.Model):
|
||||
ip = models.CharField(max_length=32, blank=True, verbose_name="主机IP")
|
||||
other_ip = models.CharField(max_length=255, blank=True, null=True, verbose_name="其他IP")
|
||||
remote_card_ip = models.CharField(max_length=16, blank=True, null=True, verbose_name=u'远控卡IP')
|
||||
hostname = models.CharField(unique=True, max_length=128, verbose_name=u"主机名")
|
||||
port = models.IntegerField(blank=True, null=True, verbose_name=u"端口号")
|
||||
other_ip = models.CharField(max_length=255, blank=True, verbose_name="其他IP")
|
||||
remote_card_ip = models.CharField(max_length=16, blank=True, verbose_name=u'远控卡IP')
|
||||
hostname = models.CharField(max_length=128, unique=True, blank=True, verbose_name=u"主机名")
|
||||
port = models.IntegerField(blank=True, verbose_name=u"端口号")
|
||||
group = models.ManyToManyField(AssetGroup, blank=True, verbose_name=u"所属主机组")
|
||||
username = models.CharField(max_length=16, blank=True, null=True, verbose_name=u"管理用户名")
|
||||
password = models.CharField(max_length=256, blank=True, null=True, verbose_name=u"密码")
|
||||
idc = models.ForeignKey(IDC, blank=True, null=True, on_delete=models.SET_NULL, verbose_name=u'机房')
|
||||
mac_addr = models.CharField(max_length=20, blank=True, null=True, verbose_name=u"MAC地址")
|
||||
brand = models.CharField(max_length=64, blank=True, null=True, verbose_name=u'硬件厂商型号')
|
||||
cpu = models.CharField(max_length=64, blank=True, null=True, verbose_name=u'CPU')
|
||||
memory = models.CharField(max_length=128, blank=True, null=True, verbose_name=u'内存')
|
||||
disk = models.CharField(max_length=1024, blank=True, null=True, verbose_name=u'硬盘')
|
||||
os = models.CharField(max_length=128, blank=True, null=True, verbose_name=u'系统信息')
|
||||
cabinet_no = models.CharField(max_length=32, blank=True, null=True, verbose_name=u'机柜号')
|
||||
cabinet_pos = models.IntegerField(blank=True, null=True, verbose_name=u'机器位置')
|
||||
number = models.CharField(max_length=32, blank=True, null=True, verbose_name=u'资产编号')
|
||||
status = models.ManyToManyField(AssetExtend, blank=True, related_name="asset_status_extend", verbose_name="机器状态")
|
||||
type = models.ManyToManyField(AssetExtend, blank=True, related_name="asset_type_extend", verbose_name="机器类型")
|
||||
env = models.ManyToManyField(AssetExtend, blank=True, related_name="asset_env_extend", verbose_name="所属主机组环境")
|
||||
sn = models.CharField(max_length=128, blank=True, null=True, verbose_name=u"SN编号")
|
||||
created_by = models.CharField(max_length=32, blank=True, null=True, verbose_name=u"创建者")
|
||||
username = models.CharField(max_length=16, blank=True, verbose_name=u"管理用户名")
|
||||
password = models.CharField(max_length=256, blank=True, verbose_name=u"密码")
|
||||
idc = models.ForeignKey(IDC, blank=True, null=True, on_delete=models.SET_NULL, verbose_name=u'机房')
|
||||
mac_addr = models.CharField(max_length=20, blank=True, unique=True, verbose_name=u"MAC地址")
|
||||
brand = models.CharField(max_length=64, blank=True, verbose_name=u'硬件厂商型号')
|
||||
cpu = models.CharField(max_length=64, blank=True, verbose_name=u'CPU')
|
||||
memory = models.CharField(max_length=128, blank=True, verbose_name=u'内存')
|
||||
disk = models.CharField(max_length=1024, blank=True, verbose_name=u'硬盘')
|
||||
os = models.CharField(max_length=128, blank=True, verbose_name=u'系统信息')
|
||||
cabinet_no = models.CharField(max_length=32, blank=True, verbose_name=u'机柜号')
|
||||
cabinet_pos = models.IntegerField(max_length=4, null=True, blank=True, verbose_name=u'机器位置')
|
||||
number = models.CharField(max_length=32, blank=True, unique=True, verbose_name=u'资产编号')
|
||||
status = models.ManyToManyField(AssetExtend, blank=True,
|
||||
related_name="asset_status_extend", verbose_name="机器状态")
|
||||
type = models.ManyToManyField(AssetExtend, blank=True,
|
||||
related_name="asset_type_extend", verbose_name="机器类型")
|
||||
env = models.ManyToManyField(AssetExtend, blank=True,
|
||||
related_name="asset_env_extend", verbose_name="所属主机组环境")
|
||||
sn = models.CharField(max_length=128, blank=True, unique=True, verbose_name=u"SN编号")
|
||||
created_by = models.CharField(max_length=32, blank=True, verbose_name=u"创建者")
|
||||
is_active = models.BooleanField(default=True, verbose_name=u"是否激活")
|
||||
date_added = models.DateTimeField(auto_now=True, null=True)
|
||||
comment = models.CharField(max_length=128, blank=True, null=True, verbose_name=u"备注")
|
||||
comment = models.CharField(max_length=128, blank=True, verbose_name=u"备注")
|
||||
|
||||
def __unicode__(self):
|
||||
return self.ip
|
||||
|
|
|
@ -0,0 +1,374 @@
|
|||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<span class="text text-primary"><b>{{ asset.ip }}</b></span>
|
||||
<div class="ibox-tools">
|
||||
{# <a class="" href="{% url 'assets:asset-update' %}">#}
|
||||
<i class="fa fa-refresh"></i>
|
||||
</a>
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content ibox-heading">
|
||||
<h3>主机详细信息</h3>
|
||||
<small><i class="fa fa-map-marker"></i> 此主机详细信息.</small>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div>
|
||||
<div class="text-left">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td class="text-navy">主机名</td>
|
||||
<td>{{ asset.hostname|default_if_none:"" }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">IP</td>
|
||||
<td>{{ asset.ip|default_if_none:"" }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">其他IP</td>
|
||||
<td>
|
||||
<table class="table">
|
||||
{% if asset.other_ip %}
|
||||
{% for ip in asset.other_ip %}
|
||||
<tr>
|
||||
<td>{{ ip }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">远控IP</td>
|
||||
<td>{{ asset.remote_ip|default_if_none:"" }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">端口</td>
|
||||
<td>{{ asset.port|default_if_none:"" }}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="text-navy">主机组</td>
|
||||
<td>
|
||||
<table class="table">
|
||||
{% for asset_group in asset.group.all %}
|
||||
<tr>
|
||||
<td>{{ asset_group.name|default_if_none:"" }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">使用默认管理账号</td>
|
||||
{# <td>{{ asset.use_default_auth|bool2str }}</td>#}
|
||||
{# <td>{{ asset.use_default_auth|bool2str }} {% if not asset.use_default_auth %} <span class="text-info">{{ asset.username }}</span> {% endif %}</td>#}
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">机房</td>
|
||||
<td>{{ asset.idc.name|default_if_none:"" }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">硬件厂商型号</td>
|
||||
<td>{{ asset.brand|default_if_none:"" }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">CPU</td>
|
||||
<td>{{ asset.cpu|default_if_none:"" }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">内存</td>
|
||||
<td>{{ asset.memory|default_if_none:"" }}{% if asset.memory %}G{% endif %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">硬盘</td>
|
||||
<td>
|
||||
<table class="table">
|
||||
{% if asset.disk %}
|
||||
{% for disk, value in asset.disk %}
|
||||
<tr>
|
||||
<td><span class="text-navy">{{ disk|default_if_none:"" }}</span>     {{ value|default_if_none:"" }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">资产编号</td>
|
||||
<td>{{ asset.number|default_if_none:"" }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">SN</td>
|
||||
<td>{{ asset.sn|default_if_none:"" }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">主机类型</td>
|
||||
<td>{{ asset.get_asset_type_display|default_if_none:"" }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">系统版本</td>
|
||||
<td>{{ asset.system_type|default_if_none:"" }} {{ asset.system_version|default_if_none:"" }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">系统平台</td>
|
||||
<td>{{ asset.system_arch|default_if_none:"" }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">运行环境</td>
|
||||
<td>{{ asset.get_env_display|default_if_none:"" }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">机器状态</td>
|
||||
<td>{{ asset.get_status_display|default_if_none:"" }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">机柜号</td>
|
||||
<td>{{ asset.cabinet|default_if_none:"" }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">机柜位置</td>
|
||||
<td>{{ asset.position|default_if_none:"" }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">激活</td>
|
||||
<td>{{ asset.is_active }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">添加日期</td>
|
||||
<td>{{ asset.date_added|date:"Y-m-d H:i:s" }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-navy">备注</td>
|
||||
<td>{{ asset.comment|default_if_none:"" }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>拥有权限的用户</h5>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content ibox-heading">
|
||||
<h3>主机所有授权的信息</h3>
|
||||
<small><i class="fa fa-map-marker"></i> 包含了此主机所有授权的信息.</small>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div>
|
||||
<div class="text-left">
|
||||
{% if perm_info %}
|
||||
{% if user_perm %}
|
||||
<table class="table">
|
||||
<p>授权用户信息</p>
|
||||
<td class="text-navy">授权用户</td>
|
||||
<td class="text-navy">关联用户</td>
|
||||
{% for perm in user_perm %}
|
||||
<tr>
|
||||
<td class="text-navy"><a href="{% url 'user_detail' %}?id={{ perm.0.id }}">{{ perm.0 }}</a></td>
|
||||
<td>
|
||||
<table class="table">
|
||||
{% if perm.1 %}
|
||||
{% for role in perm.1 %}
|
||||
<tr>
|
||||
<td class="text-navy"><a href="{% url 'role_detail' %}?id={{ role.id }}">{{ role }}</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endif %}
|
||||
{% if user_group_perm %}
|
||||
<table class="table">
|
||||
<p>授权用户组信息</p>
|
||||
<td class="text-navy">授权用户组</td>
|
||||
<td class="text-navy">组详情</td>
|
||||
{% for user_group in user_group_perm %}
|
||||
<tr>
|
||||
<td class="text-navy">{{ user_group }}</td>
|
||||
<td class="text-navy"><a href="{% url 'user_group_list' %}?gid={{ user_group.id }}">详情</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
{% if user_rule_perm %}
|
||||
<table class="table">
|
||||
<p>授权规则信息</p>
|
||||
<td class="text-navy">授权规则</td>
|
||||
<td class="text-navy">详情</td>
|
||||
{% for rule in user_rule_perm %}
|
||||
<tr>
|
||||
<td class="text-navy">{{ rule }}</td>
|
||||
<td class="text-navy"><a href="{% url 'rule_detail' %}?id={{ rule.id }}">详情</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<p class="text-center">(暂无)</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-title">
|
||||
<h5>主机修改记录</h5>
|
||||
{# <a href="{% url 'asset_edit' %}?id={{ asset.id }}" data-toggle="tooltip" class="text-success pull-center" data-placement="bottom" title="修改">    点击修改</a>#}
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content ibox-heading">
|
||||
<h3>主机修改记录</h3>
|
||||
<small><i class="fa fa-map-marker"></i> 包含了此主机所有历史修改记录.</small>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div class="feed-activity-list">
|
||||
{% if asset_record %}
|
||||
{# {% for r in asset_record %}#}
|
||||
{# <div class="feed-element">#}
|
||||
{# <div>#}
|
||||
{# <small class="pull-right">{{ r.alert_time|naturaltime }}</small>#}
|
||||
{# <strong class="text-navy">{{ r.username }}</strong>#}
|
||||
{# {% for i in r.content|str_to_list %}#}
|
||||
{# <div>{{ i.0 }} 由 <span class="text-success">{{ i.1|str_to_code }}</span> 改为 <span class="text-warning">{{ i.2|str_to_code }}</span></div>#}
|
||||
{# {% endfor %}#}
|
||||
{# <small class="text-success">{{ r.alert_time }}</small>#}
|
||||
{# </div>#}
|
||||
{# </div>#}
|
||||
{# {% endfor %}#}
|
||||
{% else %}
|
||||
<p class="text-center">(暂无)</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-4">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>最近一周登录记录</h5>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content ibox-heading">
|
||||
<h3>最近一周登录记录</h3>
|
||||
<small><i class="fa fa-map-marker"></i> 此主机最近一周用户登录信息.</small>
|
||||
</div>
|
||||
<div class="ibox-content inspinia-timeline">
|
||||
{% if log %}
|
||||
{% for l in log %}
|
||||
<div class="timeline-item">
|
||||
<div class="row">
|
||||
<div class="col-xs-5 date">
|
||||
<i class="fa fa-info-circle"></i>
|
||||
<small class="text-navy">{{ l.user }}</small>
|
||||
<br/>
|
||||
</div>
|
||||
<div class="col-xs-7 content no-top-border">
|
||||
<p class="m-b-xs"><strong>详细信息</strong></p>
|
||||
<p>来源IP: {{ l.remote_ip }}</p>
|
||||
<p>开始: {{ l.start_time |date:"Y-m-d H:i:s" }}</p>
|
||||
<p>结束: {{ l.end_time |date:"Y-m-d H:i:s" }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<button id="show" class="btn btn-primary btn-block m-t"><i class="fa fa-arrow-down"></i> 所有 </button>
|
||||
<div id='more' style="display: none">
|
||||
<br/>
|
||||
{% for l in log_more %}
|
||||
<div class="timeline-item">
|
||||
<div class="row">
|
||||
<div class="col-xs-5 date">
|
||||
<i class="fa fa-info-circle"></i>
|
||||
<small class="text-navy">{{ l.user }}</small>
|
||||
<br/>
|
||||
</div>
|
||||
<div class="col-xs-7 content no-top-border">
|
||||
<p class="m-b-xs"><strong>详细信息</strong></p>
|
||||
<p>来源IP: {{ l.remote_ip }}</p>
|
||||
<p>开始: {{ l.start_time |date:"Y-m-d H:i:s" }}</p>
|
||||
<p>结束: {{ l.end_time |date:"Y-m-d H:i:s" }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<p class="text-center">(暂无)</p>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#show').click(function(){
|
||||
$('#show').css('display', 'none');
|
||||
$('#more').css('display', 'block');
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
{% endblock %}
|
|
@ -119,7 +119,7 @@
|
|||
<td class="text-center" name="id" value="{{ asset.id }}" data-editable='false'>
|
||||
<input name="id" value="{{ asset.id }}" type="checkbox" class="i-checks">
|
||||
</td>
|
||||
<td class="text-center hostname"> <a href="{% url 'assets:asset-detail' %}?id={{ asset.id }}">{{ asset.hostname|default_if_none:"" }}</a></td>
|
||||
<td class="text-center hostname"> <a href="{% url 'assets:asset-detail' %}/{{ asset.id }}">{{ asset.hostname|default_if_none:"" }}</a></td>
|
||||
<td class="text-center"> {{ asset.ip|default_if_none:"" }} </td>
|
||||
<td class="text-center"> {{ asset.idc.name|default_if_none:"" }} </td>
|
||||
{# <td class="text-center">{{ asset.group.all|group_str2 }}</td>#}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10 on 2016-08-21 09:54
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('users', '0003_auto_20160814_1758'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='user',
|
||||
name='email',
|
||||
field=models.EmailField(max_length=30, unique=True, verbose_name='\u90ae\u4ef6'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='user',
|
||||
name='groups',
|
||||
field=models.ManyToManyField(to='users.UserGroup', verbose_name='\u7528\u6237\u7ec4'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='user',
|
||||
name='name',
|
||||
field=models.CharField(max_length=20, verbose_name='\u59d3\u540d'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='user',
|
||||
name='username',
|
||||
field=models.CharField(max_length=20, unique=True, verbose_name='\u7528\u6237\u540d'),
|
||||
),
|
||||
]
|
Loading…
Reference in New Issue