修改资产管理

pull/26/head
ibuler 2015-09-09 00:19:17 +08:00
parent 4eb78e151e
commit 8bf9103fcf
29 changed files with 1280 additions and 2369 deletions

View File

@ -127,14 +127,14 @@ def test_add_log():
if __name__ == '__main__':
install()
test_add_dept()
test_add_group()
test_add_user()
test_add_idc()
test_add_asset_group()
# install()
# test_add_dept()
# test_add_group()
# test_add_user()
# test_add_idc()
# test_add_asset_group()
test_add_asset()
test_add_log()
# test_add_log()

View File

@ -3,15 +3,7 @@ from django.db import models
from juser.models import User, UserGroup
class IDC(models.Model):
name = models.CharField(max_length=40, unique=True)
comment = models.CharField(max_length=80, blank=True, null=True)
def __unicode__(self):
return self.name
class BisGroup(models.Model):
class AssetGroup(models.Model):
GROUP_TYPE = (
('P', 'PRIVATE'),
('A', 'ASSET'),
@ -67,17 +59,12 @@ class BisGroup(models.Model):
class Asset(models.Model):
LOGIN_TYPE_CHOICES = (
('L', 'LDAP'),
('M', 'MAP'),
)
ip = models.IPAddressField(unique=True)
port = models.IntegerField(max_length=6)
idc = models.ForeignKey(IDC)
bis_group = models.ManyToManyField(BisGroup)
login_type = models.CharField(max_length=1, choices=LOGIN_TYPE_CHOICES, default='L')
group = models.ManyToManyField(AssetGroup)
username = models.CharField(max_length=20, blank=True, null=True)
password = models.CharField(max_length=80, blank=True, null=True)
use_default_auth = models.BooleanField(default=True)
date_added = models.DateTimeField(auto_now=True, default=datetime.datetime.now(), null=True)
is_active = models.BooleanField(default=True)
comment = models.CharField(max_length=100, blank=True, null=True)
@ -108,4 +95,4 @@ class AssetAlias(models.Model):
alias = models.CharField(max_length=100, blank=True, null=True)
def __unicode__(self):
return self.comment
return self.alias

View File

@ -3,26 +3,23 @@ from django.conf.urls import patterns, include, url
from jasset.views import *
urlpatterns = patterns('',
url(r'^host_add/$', host_add),
url(r"^host_add_multi/$", host_add_batch),
url(r'^host_list/$', host_list),
url(r'^search/$', host_search),
url(r"^host_detail/$", host_detail),
url(r"^dept_host_ajax/$", dept_host_ajax),
url(r"^show_all_ajax/$", show_all_ajax),
url(r'^idc_add/$', idc_add),
url(r'^idc_list/$', idc_list),
url(r'^idc_edit/$', idc_edit),
url(r'^idc_detail/$', idc_detail),
url(r'^idc_del/$', idc_del),
url(r'^asset_add/$', asset_add),
# url(r"^host_add_multi/$", host_add_batch),
url(r'^group_add/$', group_add),
url(r'^group_edit/$', group_edit),
url(r'^group_list/$', group_list),
url(r'^group_detail/$', group_detail),
url(r'^group_del_host/$', group_del_host),
url(r'^group_del/$', group_del),
url(r'^host_del/(\w+)/$', host_del),
url(r'^host_edit/$', view_splitter, {'su': host_edit, 'adm': host_edit_adm}),
url(r'^host_edit/batch/$', host_edit_batch),
url(r'^host_edit_common/batch/$', host_edit_common_batch),
url(r'^asset_list/$', asset_list),
url(r'^asset_del/$', asset_del),
url(r"^asset_detail/$", asset_detail),
url(r'^asset_edit/$', asset_edit),
# url(r'^search/$', host_search),
# url(r"^host_detail/$", host_detail),
# url(r"^dept_host_ajax/$", dept_host_ajax),
# url(r"^show_all_ajax/$", show_all_ajax),
# url(r'^group_edit/$', group_edit),
# url(r'^group_list/$', group_list),
# url(r'^group_detail/$', group_detail),
# url(r'^group_del_host/$', group_del_host),
# url(r'^group_del/$', group_del),
# url(r'^host_edit/batch/$', host_edit_batch),
# url(r'^host_edit_common/batch/$', host_edit_common_batch),
)

File diff suppressed because it is too large Load Diff

View File

@ -4,12 +4,12 @@ from uuidfield import UUIDField
from django.db import models
from juser.models import UserGroup
from jasset.models import Asset, BisGroup
from jasset.models import Asset, AssetGroup
class Perm(models.Model):
user_group = models.ForeignKey(UserGroup)
asset_group = models.ForeignKey(BisGroup)
asset_group = models.ForeignKey(AssetGroup)
def __unicode__(self):
return '%s_%s' % (self.user_group.name, self.asset_group.name)
@ -27,7 +27,7 @@ class CmdGroup(models.Model):
class SudoPerm(models.Model):
user_group = models.ForeignKey(UserGroup)
user_runas = models.CharField(max_length=100)
asset_group = models.ManyToManyField(BisGroup)
asset_group = models.ManyToManyField(AssetGroup)
cmd_group = models.ManyToManyField(CmdGroup)
comment = models.CharField(max_length=30, null=True, blank=True)

View File

@ -17,7 +17,7 @@ from django.core.paginator import Paginator, EmptyPage, InvalidPage
from django.http import HttpResponse, Http404
from django.template import RequestContext
from juser.models import User, UserGroup
from jasset.models import Asset, BisGroup, IDC
from jasset.models import Asset, AssetGroup
from jlog.models import Log
from jasset.models import AssetAlias
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
@ -177,6 +177,7 @@ def pages(post_objects, request):
else:
show_end = 0
# 所有对象, 分页器, 本页对象, 所有页码, 本页页码,是否显示第一页,是否显示最后一页
return post_objects, paginator, page_objects, page_range, current_page, show_first, show_end
@ -429,7 +430,7 @@ class PyCrypt(object):
"""
return crypt.crypt(password, '$6$%s$' % salt)
def encrypt(self, passwd=None):
def encrypt(self, passwd=None, length=32):
"""
encrypt gen password
对称加密之加密生成密码
@ -438,7 +439,6 @@ class PyCrypt(object):
passwd = self.random_pass()
cryptor = AES.new(self.key, self.mode, b'8122ca7d906ad5e1')
length = 64
try:
count = len(passwd)
except TypeError:

View File

@ -56,8 +56,8 @@ INSTALLED_APPS = (
'django.contrib.humanize',
'jumpserver',
'juser',
# 'jasset',
# 'jperm',
'jasset',
'jperm',
# 'jlog',
)

View File

@ -12,21 +12,28 @@ from jasset.models import AssetAlias
register = template.Library()
@register.filter(name='stamp2str')
def stamp2str(value):
try:
return time.strftime('%Y/%m/%d %H:%M:%S', time.localtime(value))
except AttributeError:
return '0000/00/00 00:00:00'
# @register.filter(name='stamp2str')
# def stamp2str(value):
# try:
# return time.strftime('%Y/%m/%d %H:%M:%S', time.localtime(value))
# except AttributeError:
# return '0000/00/00 00:00:00'
@register.filter(name='int2str')
def int2str(value):
"""
int 转换为 str
"""
return str(value)
@register.filter(name='get_role')
def get_role(user_id):
"""
根据用户id获取用户权限
"""
user_role = {'SU': u'超级管理员', 'GA': u'组管理员', 'CU': u'普通用户'}
user = get_object(User, id=user_id)
if user:
@ -35,66 +42,69 @@ def get_role(user_id):
return u"普通用户"
@register.filter(name='groups_str')
def groups_str(user_id):
groups = []
user = User.objects.get(id=user_id)
for group in user.group.all():
groups.append(group.name)
if len(groups) < 3:
return ' '.join(groups)
else:
return "%s ..." % ' '.join(groups[0:2])
# @register.filter(name='groups_str')
# def groups_str(user_id):
# groups = []
# user = User.objects.get(id=user_id)
# for group in user.group.all():
# groups.append(group.name)
# if len(groups) < 3:
# return ' '.join(groups)
# else:
# return "%s ..." % ' '.join(groups[0:2])
#
@register.filter(name='group_str2')
def groups_str2(group_list):
"""
将用户组列表转换为str
"""
if len(group_list) < 3:
return ' '.join([group.name for group in group_list])
else:
return '%s ...' % ' '.join([group.name for group in group_list[0:2]])
@register.filter(name='group_str2_all')
def group_str2_all(group_list):
group_lis = []
for i in group_list:
if str(i) != 'ALL':
group_lis.append(i)
if len(group_lis) < 3:
return ' '.join([group.name for group in group_lis])
else:
return '%s ...' % ' '.join([group.name for group in group_lis[0:2]])
@register.filter(name='group_dept_all')
def group_dept_all(group_list):
group_lis = []
for i in group_list:
if str(i) != 'ALL':
group_lis.append(i)
return ' '.join([group.name for group in group_lis])
@register.filter(name='group_manage_str')
def group_manage_str(username):
user = User.objects.get(username=username)
group = user.user_group.filter(type='M')
if group:
return group[0].name
else:
return ''
@register.filter(name='get_item')
def get_item(dictionary, key):
return dictionary.get(key)
@register.filter(name='get_login_type')
def get_login_type(login):
login_types = {'L': 'LDAP', 'M': 'MAP'}
return login_types[login]
#
# @register.filter(name='group_str2_all')
# def group_str2_all(group_list):
# group_lis = []
# for i in group_list:
# if str(i) != 'ALL':
# group_lis.append(i)
# if len(group_lis) < 3:
# return ' '.join([group.name for group in group_lis])
# else:
# return '%s ...' % ' '.join([group.name for group in group_lis[0:2]])
#
#
# @register.filter(name='group_dept_all')
# def group_dept_all(group_list):
# group_lis = []
# for i in group_list:
# if str(i) != 'ALL':
# group_lis.append(i)
# return ' '.join([group.name for group in group_lis])
#
#
# @register.filter(name='group_manage_str')
# def group_manage_str(username):
# user = User.objects.get(username=username)
# group = user.user_group.filter(type='M')
# if group:
# return group[0].name
# else:
# return ''
#
#
# @register.filter(name='get_item')
# def get_item(dictionary, key):
# return dictionary.get(key)
#
#
# @register.filter(name='get_login_type')
# def get_login_type(login):
# login_types = {'L': 'LDAP', 'M': 'MAP'}
# return login_types[login]
@register.filter(name='bool2str')
@ -105,169 +115,171 @@ def bool2str(value):
return u''
# @register.filter(name='user_readonly')
# def user_readonly(user_id):
# user = User.objects.filter(id=user_id)
# if user:
# user = user[0]
# if user.role == 'CU':
# return False
# return True
#
# # @register.filter(name='user_readonly')
# # def user_readonly(user_id):
# # user = User.objects.filter(id=user_id)
# # if user:
# # user = user[0]
# # if user.role == 'CU':
# # return False
# # return True
@register.filter(name='members_count')
def members_count(group_id):
"""统计用户组下成员数量"""
group = get_object(UserGroup, id=group_id)
if group:
return group.user_set.count()
else:
return 0
@register.filter(name='group_user_count')
def group_user_count(group_id):
group = UserGroup.objects.get(id=group_id)
return group.user_set.count()
@register.filter(name='dept_user_num')
def dept_user_num(dept_id):
dept = DEPT.objects.filter(id=dept_id)
if dept:
dept = dept[0]
return dept.user_set.count()
else:
return 0
@register.filter(name='dept_group_num')
def dept_group_num(dept_id):
dept = DEPT.objects.filter(id=dept_id)
if dept:
dept = dept[0]
return dept.usergroup_set.all().count()
else:
return 0
@register.filter(name='perm_count')
def perm_count(group_id):
group = UserGroup.objects.get(id=group_id)
return group.perm_set.count()
@register.filter(name='dept_asset_num')
def dept_asset_num(dept_id):
dept = DEPT.objects.filter(id=dept_id)
if dept:
dept = dept[0]
return dept.asset_set.all().count()
return 0
@register.filter(name='ugrp_perm_agrp_count')
def ugrp_perm_agrp_count(user_group_id):
user_group = UserGroup.objects.filter(id=user_group_id)
if user_group:
user_group = user_group[0]
return user_group.perm_set.all().count()
return 0
@register.filter(name='ugrp_sudo_agrp_count')
def ugrp_sudo_agrp_count(user_group_id):
user_group = UserGroup.objects.filter(id=user_group_id)
asset_groups = []
if user_group:
user_group = user_group[0]
for perm in user_group.sudoperm_set.all():
asset_groups.extend(perm.asset_group.all())
return len(set(asset_groups))
return 0
@register.filter(name='ugrp_perm_asset_count')
def ugrp_perm_asset_count(user_group_id):
user_group = UserGroup.objects.filter(id=user_group_id)
assets = []
if user_group:
user_group = user_group[0]
asset_groups = [perm.asset_group for perm in user_group.perm_set.all()]
for asset_group in asset_groups:
assets.extend(asset_group.asset_set.all())
return len(set(assets))
@register.filter(name='ugrp_sudo_asset_count')
def ugrp_sudo_asset_count(user_group_id):
user_group = UserGroup.objects.filter(id=user_group_id)
asset_groups = []
assets = []
if user_group:
user_group = user_group[0]
for perm in user_group.sudoperm_set.all():
asset_groups.extend(perm.asset_group.all())
for asset_group in asset_groups:
assets.extend(asset_group.asset_set.all())
return len(set(assets))
@register.filter(name='get_user_alias')
def get_user_alias(post, user_id):
user = User.objects.get(id=user_id)
host = Asset.objects.get(id=post.id)
alias = AssetAlias.objects.filter(user=user, host=host)
if alias:
return alias[0].alias
else:
return ''
@register.filter(name='group_type_to_str')
def group_type_to_str(type_name):
group_types = {
'P': '用户',
'M': '部门',
'A': '用户组',
}
return group_types.get(type_name)
@register.filter(name='ast_to_list')
def ast_to_list(lis):
ast_lis = ast.literal_eval(lis)
if len(ast_lis) <= 2:
return ','.join([i for i in ast_lis])
else:
restr = ','.join([i for i in ast_lis[0:2]]) + '...'
return restr
@register.filter(name='get_group_count')
def get_group_count(post, dept):
count = post.asset_set.filter(dept=dept).count()
return count
@register.filter(name='get_idc_count')
def get_idc_count(post, dept):
count = post.asset_set.filter(dept=dept).count()
return count
@register.filter(name='ast_to_list_1')
def ast_to_list_1(lis):
return ast.literal_eval(lis)
@register.filter(name='string_length')
def string_length(string, length):
return '%s ...' % string[0:length]
#
# @register.filter(name='group_user_count')
# def group_user_count(group_id):
# group = UserGroup.objects.get(id=group_id)
# return group.user_set.count()
#
#
# @register.filter(name='dept_user_num')
# def dept_user_num(dept_id):
# dept = DEPT.objects.filter(id=dept_id)
# if dept:
# dept = dept[0]
# return dept.user_set.count()
# else:
# return 0
#
#
# @register.filter(name='dept_group_num')
# def dept_group_num(dept_id):
# dept = DEPT.objects.filter(id=dept_id)
# if dept:
# dept = dept[0]
# return dept.usergroup_set.all().count()
# else:
# return 0
#
#
# @register.filter(name='perm_count')
# def perm_count(group_id):
# group = UserGroup.objects.get(id=group_id)
# return group.perm_set.count()
#
#
# @register.filter(name='dept_asset_num')
# def dept_asset_num(dept_id):
# dept = DEPT.objects.filter(id=dept_id)
# if dept:
# dept = dept[0]
# return dept.asset_set.all().count()
# return 0
#
#
# @register.filter(name='ugrp_perm_agrp_count')
# def ugrp_perm_agrp_count(user_group_id):
# user_group = UserGroup.objects.filter(id=user_group_id)
# if user_group:
# user_group = user_group[0]
# return user_group.perm_set.all().count()
# return 0
#
#
# @register.filter(name='ugrp_sudo_agrp_count')
# def ugrp_sudo_agrp_count(user_group_id):
# user_group = UserGroup.objects.filter(id=user_group_id)
# asset_groups = []
# if user_group:
# user_group = user_group[0]
# for perm in user_group.sudoperm_set.all():
# asset_groups.extend(perm.asset_group.all())
# return len(set(asset_groups))
# return 0
#
#
# @register.filter(name='ugrp_perm_asset_count')
# def ugrp_perm_asset_count(user_group_id):
# user_group = UserGroup.objects.filter(id=user_group_id)
# assets = []
# if user_group:
# user_group = user_group[0]
# asset_groups = [perm.asset_group for perm in user_group.perm_set.all()]
# for asset_group in asset_groups:
# assets.extend(asset_group.asset_set.all())
# return len(set(assets))
#
#
# @register.filter(name='ugrp_sudo_asset_count')
# def ugrp_sudo_asset_count(user_group_id):
# user_group = UserGroup.objects.filter(id=user_group_id)
# asset_groups = []
# assets = []
# if user_group:
# user_group = user_group[0]
# for perm in user_group.sudoperm_set.all():
# asset_groups.extend(perm.asset_group.all())
#
# for asset_group in asset_groups:
# assets.extend(asset_group.asset_set.all())
# return len(set(assets))
#
#
# @register.filter(name='get_user_alias')
# def get_user_alias(post, user_id):
# user = User.objects.get(id=user_id)
# host = Asset.objects.get(id=post.id)
# alias = AssetAlias.objects.filter(user=user, host=host)
# if alias:
# return alias[0].alias
# else:
# return ''
#
#
# @register.filter(name='group_type_to_str')
# def group_type_to_str(type_name):
# group_types = {
# 'P': '用户',
# 'M': '部门',
# 'A': '用户组',
# }
# return group_types.get(type_name)
#
#
# @register.filter(name='ast_to_list')
# def ast_to_list(lis):
# ast_lis = ast.literal_eval(lis)
# if len(ast_lis) <= 2:
# return ','.join([i for i in ast_lis])
# else:
# restr = ','.join([i for i in ast_lis[0:2]]) + '...'
# return restr
#
#
# @register.filter(name='get_group_count')
# def get_group_count(post, dept):
# count = post.asset_set.filter(dept=dept).count()
# return count
#
#
# @register.filter(name='get_idc_count')
# def get_idc_count(post, dept):
# count = post.asset_set.filter(dept=dept).count()
# return count
#
#
# @register.filter(name='ast_to_list_1')
# def ast_to_list_1(lis):
# return ast.literal_eval(lis)
#
#
# @register.filter(name='string_length')
# def string_length(string, length):
# return '%s ...' % string[0:length]
@register.filter(name='to_name')
def to_name(user_id):
"""user id 转位用户名称"""
try:
user = User.objects.filter(id=int(user_id))
if user:
@ -277,120 +289,122 @@ def to_name(user_id):
return '非法用户'
@register.filter(name='to_dept_name')
def to_dept_name(user_id):
try:
user = User.objects.filter(id=int(user_id))
if user:
user = user[0]
return user.dept.name
except:
return '非法部门'
# @register.filter(name='to_dept_name')
# def to_dept_name(user_id):
# try:
# user = User.objects.filter(id=int(user_id))
# if user:
# user = user[0]
# return user.dept.name
# except:
# return '非法部门'
@register.filter(name='to_role_name')
def to_role_name(role_id):
"""role_id 转变为角色名称"""
role_dict = {'0': '普通用户', '1': '组管理员', '2': '超级管理员'}
return role_dict.get(str(role_id), '未知')
@register.filter(name='to_avatar')
def to_avatar(role_id='0'):
"""不同角色不同头像"""
role_dict = {'0': 'user', '1': 'admin', '2': 'root'}
return role_dict.get(str(role_id), 'user')
@register.filter(name='get_user_asset_group')
def get_user_asset_group(user):
return user.get_asset_group()
@register.filter(name='group_asset_list')
def group_asset_list(group):
return group.asset_set.all()
@register.filter(name='group_asset_list_count')
def group_asset_list_count(group):
return group.asset_set.all().count()
@register.filter(name='time_delta')
def time_delta(time_before):
delta = datetime.datetime.now() - time_before
days = delta.days
if days:
return "%s 天前" % days
else:
hours = delta.seconds/3600
if hours:
return "%s 小时前" % hours
else:
mins = delta.seconds/60
if mins:
return '%s 分钟前' % mins
else:
return '%s 秒前' % delta.seconds
@register.filter(name='sudo_cmd_list')
def sudo_cmd_list(cmd_group_id):
cmd_group = CmdGroup.objects.filter(id=cmd_group_id)
if cmd_group:
cmd_group = cmd_group[0]
return cmd_group.cmd.split(',')
@register.filter(name='sudo_cmd_count')
def sudo_cmd_count(user_group_id):
user_group = UserGroup.objects.filter(id=user_group_id)
cmds = []
if user_group:
user_group = user_group[0]
cmd_groups = []
for perm in user_group.sudoperm_set.all():
cmd_groups.extend(perm.cmd_group.all())
for cmd_group in cmd_groups:
cmds.extend(cmd_group.cmd.split(','))
return len(set(cmds))
else:
return 0
@register.filter(name='sudo_cmd_count')
def sudo_cmd_count(user_group_id):
user_group = UserGroup.objects.filter(id=user_group_id)
cmds = []
if user_group:
user_group = user_group[0]
cmd_groups = []
for perm in user_group.sudoperm_set.all():
cmd_groups.extend(perm.cmd_group.all())
for cmd_group in cmd_groups:
cmds.extend(cmd_group.cmd.split(','))
return len(set(cmds))
else:
return 0
@register.filter(name='sudo_cmd_ids')
def sudo_cmd_ids(user_group_id):
user_group = UserGroup.objects.filter(id=user_group_id)
if user_group:
user_group = user_group[0]
cmd_groups = []
for perm in user_group.sudoperm_set.all():
cmd_groups.extend(perm.cmd_group.all())
cmd_ids = [str(cmd_group.id) for cmd_group in cmd_groups]
return ','.join(cmd_ids)
else:
return '0'
@register.filter(name='cmd_group_split')
def cmd_group_split(cmd_group):
return cmd_group.cmd.split(',')
#
#
# @register.filter(name='get_user_asset_group')
# def get_user_asset_group(user):
# return user.get_asset_group()
#
#
# @register.filter(name='group_asset_list')
# def group_asset_list(group):
# return group.asset_set.all()
#
#
# @register.filter(name='group_asset_list_count')
# def group_asset_list_count(group):
# return group.asset_set.all().count()
#
#
# @register.filter(name='time_delta')
# def time_delta(time_before):
# delta = datetime.datetime.now() - time_before
# days = delta.days
# if days:
# return "%s 天前" % days
# else:
# hours = delta.seconds/3600
# if hours:
# return "%s 小时前" % hours
# else:
# mins = delta.seconds/60
# if mins:
# return '%s 分钟前' % mins
# else:
# return '%s 秒前' % delta.seconds
#
#
# @register.filter(name='sudo_cmd_list')
# def sudo_cmd_list(cmd_group_id):
# cmd_group = CmdGroup.objects.filter(id=cmd_group_id)
# if cmd_group:
# cmd_group = cmd_group[0]
# return cmd_group.cmd.split(',')
#
#
# @register.filter(name='sudo_cmd_count')
# def sudo_cmd_count(user_group_id):
# user_group = UserGroup.objects.filter(id=user_group_id)
# cmds = []
# if user_group:
# user_group = user_group[0]
# cmd_groups = []
#
# for perm in user_group.sudoperm_set.all():
# cmd_groups.extend(perm.cmd_group.all())
#
# for cmd_group in cmd_groups:
# cmds.extend(cmd_group.cmd.split(','))
# return len(set(cmds))
#
# else:
# return 0
#
#
# @register.filter(name='sudo_cmd_count')
# def sudo_cmd_count(user_group_id):
# user_group = UserGroup.objects.filter(id=user_group_id)
# cmds = []
# if user_group:
# user_group = user_group[0]
# cmd_groups = []
# for perm in user_group.sudoperm_set.all():
# cmd_groups.extend(perm.cmd_group.all())
#
# for cmd_group in cmd_groups:
# cmds.extend(cmd_group.cmd.split(','))
# return len(set(cmds))
# else:
# return 0
#
#
# @register.filter(name='sudo_cmd_ids')
# def sudo_cmd_ids(user_group_id):
# user_group = UserGroup.objects.filter(id=user_group_id)
# if user_group:
# user_group = user_group[0]
# cmd_groups = []
# for perm in user_group.sudoperm_set.all():
# cmd_groups.extend(perm.cmd_group.all())
# cmd_ids = [str(cmd_group.id) for cmd_group in cmd_groups]
# return ','.join(cmd_ids)
# else:
# return '0'
#
#
# @register.filter(name='cmd_group_split')
# def cmd_group_split(cmd_group):
# return cmd_group.cmd.split(',')

View File

@ -14,7 +14,7 @@ urlpatterns = patterns('',
(r'^file/download/$', 'jumpserver.views.download'),
(r'^error/$', 'jumpserver.views.httperror'),
(r'^juser/', include('juser.urls')),
# (r'^jasset/', include('jasset.urls')),
(r'^jasset/', include('jasset.urls')),
# (r'^jlog/', include('jlog.urls')),
# (r'^jperm/', include('jperm.urls')),
(r'^node_auth/', 'jumpserver.views.node_auth'),

View File

@ -71,7 +71,7 @@ def group_list(request):
if keyword:
user_group_list = user_group_list.filter(Q(name__icontains=keyword) | Q(comment__icontains=keyword))
contacts, p, contacts, page_range, current_page, show_first, show_end = pages(user_group_list, request)
user_group_list, p, user_groups, page_range, current_page, show_first, show_end = pages(user_group_list, request)
return my_render('juser/group_list.html', locals(), request)
@ -356,18 +356,18 @@ def user_list(request):
header_title, path1, path2 = '查看用户', '用户管理', '用户列表'
keyword = request.GET.get('keyword', '')
gid = request.GET.get('gid', '')
contact_list = User.objects.all().order_by('name')
users_list = User.objects.all().order_by('username')
if gid:
user_group = UserGroup.objects.filter(id=gid)
if user_group:
user_group = user_group[0]
contact_list = user_group.user_set.all()
users_list = user_group.user_set.all()
if keyword:
contact_list = contact_list.filter(Q(username__icontains=keyword) | Q(name__icontains=keyword)).order_by('name')
users_list = users_list.filter(Q(username__icontains=keyword) | Q(name__icontains=keyword)).order_by('username')
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(contact_list, request)
users_list, p, users, page_range, current_page, show_first, show_end = pages(users_list, request)
return my_render('juser/user_list.html', locals(), request)
@ -568,8 +568,6 @@ def user_edit(request):
role=role_post,
is_active=is_active)
print '#'* 10 + role_post
if email_need:
msg = u"""
Hi %s:

View File

@ -70,17 +70,17 @@ function move(from, to, from_o, to_o) {
});
}
function move_left(from, to, from_o, to_o) {
$("#" + from + " option").each(function () {
if ($(this).prop("selected") == true) {
$("#" + to).append(this);
if( typeof from_o !== 'undefined'){
$("#"+to_o).append($("#"+from_o +" option[value='"+this.value+"']"));
}
}
$(this).attr("selected",'true');
});
}
//function move_left(from, to, from_o, to_o) {
// $("#" + from + " option").each(function () {
// if ($(this).prop("selected") == true) {
// $("#" + to).append(this);
// if( typeof from_o !== 'undefined'){
// $("#"+to_o).append($("#"+from_o +" option[value='"+this.value+"']"));
// }
// }
// $(this).attr("selected",'true');
// });
//}
//function move_all(from, to) {
// $("#" + from).children().each(function () {

View File

@ -114,8 +114,8 @@
<small class="pull-right">{{ perm.date_add|naturaltime }}</small>
{% endifequal %}
<strong>{{ perm.applyer }}</strong>
<div>申请 {{ perm.bisgroup|ast_to_list }} 主机组权限</div>
<div>申请 {{ perm.asset|ast_to_list }} 主机权限</div>
{# <div>申请 {{ perm.bisgroup|ast_to_list }} 主机组权限</div>#}
{# <div>申请 {{ perm.asset|ast_to_list }} 主机权限</div>#}
<small class="text-muted">{{ perm.date_add }}</small>
</div>
</div>

View File

@ -7,7 +7,7 @@
<div class="col-lg-10">
<div class="ibox float-e-margins">
<div id="ibox-content" class="ibox-title">
<h5> 填写主机基本信息 </h5>
<h5> 填写资产基本信息 </h5>
<div class="ibox-tools">
<a class="collapse-link">
<i class="fa fa-chevron-up"></i>
@ -15,12 +15,6 @@
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-wrench"></i>
</a>
<ul class="dropdown-menu dropdown-user">
<li><a href="#">未启用 1</a>
</li>
<li><a href="#">未启用 2</a>
</li>
</ul>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
@ -31,87 +25,61 @@
<div class="panel blank-panel">
<div class="panel-options">
<ul class="nav nav-tabs">
<li class="active"><a href="/jasset/host_add/" class="text-center"><i class="fa fa-laptop"></i> 单台添加 </a></li>
<li class="active"><a href="/jasset/asset_add/" class="text-center"><i class="fa fa-laptop"></i> 单台添加 </a></li>
<li><a href="/jasset/host_add_multi" class="text-center"><i class="fa fa-bar-chart-o"></i> 批量添加 </a></li>
</ul>
</div>
<div class="panel-body">
<div class="tab-content">
<div id="tab-1" class="ibox float-e-margins tab-pane active">
{% if emg %}
<div class="alert alert-warning text-center">{{ emg }}</div>
{% if error %}
<div class="alert alert-warning text-center">{{ error }}</div>
{% endif %}
{% if smg %}
<div class="alert alert-success text-center">{{ smg }}</div>
{% if msg %}
<div class="alert alert-success text-center">{{ msg }}</div>
{% endif %}
<form id="assetForm" method="post" class="form-horizontal">
<div class="form-group"><label class="col-sm-2 control-label"> IP地址<span class="red-fonts">*</span> </label>
<div class="col-sm-8"><input type="text" name="j_ip" placeholder="192.168.1.1" class="form-control"></div>
<div class="col-sm-8"><input type="text" name="ip" placeholder="IP" class="form-control"></div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group"><label class="col-sm-2 control-label"> 端口号<span class="red-fonts">*</span> </label>
<div class="col-sm-8"><input type="text" placeholder="22" name="j_port" class="form-control"></div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group"><label class="col-sm-2 control-label"> 登录方式<span class="red-fonts">*</span> </label>
<div class="form-group">
<label class="col-sm-2 control-label"> 端口号<span class="red-fonts">*</span> </label>
<div class="col-sm-8">
<div class="radio i-checks"><label> <input type="radio" id="L" checked="" value="L" name="j_type" onclick="show(this)"> <i> LDAP </i></label></div>
<div class="radio i-checks"><label> <input type="radio" id="M" value="M" name="j_type" onclick="show(this)"> <i> MAP </i></label></div>
</div>
<div name="a1" id=a1 style="display:none;">
<div class="form-group"><label class="col-sm-2 col-sm-offset-1 control-label"> 普通用户名 </label>
<div class="col-sm-6"><input type="text" name="j_user" placeholder="lilei" class="form-control"></div>
</div>
<div class="form-group"><label class="col-sm-2 col-sm-offset-1 control-label"> 普通用户密码 </label>
<div class="col-sm-6"><input type="password" name="j_password" placeholder="Password" class="form-control"></div>
</div>
<input type="text" placeholder="Port" name="port" class="form-control">
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="j_idc" class="col-lg-2 control-label"> 所属IDC<span class="red-fonts">*</span> </label>
<div class="col-sm-8">
<select id="j_idc" name="j_idc" class="form-control m-b">
{% for i in eidc %}
<option value="{{i.id}}"> {{ i }} </option>
{% endfor %}
</select>
<label for="j_group" class="col-sm-2 control-label">使用默认管理账号</label>
<div class="col-sm-1">
<div class="radio i-checks">
<label>
<input type="checkbox" checked="" value="1" id="use_default_auth" name="use_default_auth">
</label>
</div>
</div>
</div>
{% ifequal session_role_id 2 %}
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="j_dept" class="col-lg-2 control-label">所属部门<span class="red-fonts">*</span></label>
<div class="col-sm-8">
<select id="j_dept" name="j_dept" class="form-control m-b" multiple size="10">
{% for d in edept %}
<option type="checkbox" value="{{ d.id }}">{{ d.name }} {% if d.comment %} --- {{ d.comment }} {% endif %}</option>
{% endfor %}
</select>
<div class="form-group" id="admin_account" style="display: none">
<label class="col-sm-2 control-label"> 管理用户名<span class="red-fonts">*</span> </label>
<div class="col-sm-3">
<input type="text" placeholder="Username" name="username" class="form-control">
</div>
</div>
{% endifequal %}
{% ifequal session_role_id 1 %}
<div class="hr-line-dashed"></div>
<div class="form-group"><label class="col-sm-2 control-label"> 所属部门 <span class="red-fonts">*</span></label>
<input type="text" name="j_dept" value="{{ dept.id }}" style="display: none">
<div class="col-sm-8"><input type="text" value="{{ dept.name }}" class="form-control" readonly="readonly"></div>
<label class="col-sm-1 control-label"> 密码<span class="red-fonts">*</span> </label>
<div class="col-sm-4">
<input type="password" placeholder="Password" name="password" class="form-control">
</div>
</div>
{% endifequal %}
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="j_group" class="col-lg-2 control-label">所属主机组</label>
<label for="groups" class="col-sm-2 control-label">所属主机组</label>
<div class="col-sm-8">
<select id="j_group" name="j_group" class="form-control m-b" multiple size="10">
<select id="groups" name="groups" class="form-control m-b" multiple size="10">
{% for g in egroup %}
<option type="checkbox" value="{{ g.id }}">{{ g.name }} {% if g.comment %} --- {{ g.comment }} {% endif %}</option>
{% endfor %}
@ -122,20 +90,22 @@
<div class="hr-line-dashed"></div>
<div class="form-group"><label class="col-sm-2 control-label"> 是否激活<span class="red-fonts">*</span> </label>
<div class="col-sm-8">
<div class="radio i-checks"><label> <input type="radio" checked="" value="1" name="j_active"> <i> 激活 </i></label></div>
<div class="radio i-checks"><label> <input type="radio" value="0" name="j_active"> <i> 禁用 </i></label></div>
<div class="radio i-checks">
<label> <input type="radio" checked="" value="1" name="is_active">激活 </label>
<label> <input type="radio" value="0" name="is_active"> 禁用</label>
</div>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group"><label class="col-sm-2 control-label"> 备注 </label>
<div class="col-sm-8"><input type="text" placeholder="hadoop01" name="j_comment" class="form-control"></div>
<div class="col-sm-8"><input type="text" placeholder="comment" name="comment" class="form-control"></div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-5">
<button class="btn btn-white" type="submit"> 重置 </button>
<div class="col-sm-4 col-sm-offset-2">
<button class="btn btn-white" type="reset"> 重置 </button>
<button class="btn btn-primary" type="submit"> 提交 </button>
</div>
</div>
@ -149,17 +119,21 @@
</div>
</div>
</div>
{% endblock %}
{% block self_footer_js %}
<script>
var showFlag={};
function show(o){
showFlag[o.name]=o.value;
if(showFlag.j_type=="M"){
document.getElementById("a1").style.display="";
$('document').ready(function(){
$('#use_default_auth').click(function(){
if ($(this).is(':checked')){
$('#admin_account').css('display', 'none')
}
else {
document.getElementById("a1").style.display="none";
}};
$('#admin_account').css('display', 'block')
}
})
});
$('#assetForm').validator({
timely: 2,
@ -167,34 +141,19 @@ $('#assetForm').validator({
rules: {
check_ip: [/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])(\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])){3}$/, 'ip地址不正确'],
check_port: [/^\d{1,5}$/, '端口号不正确'],
type_m: function(element){
return $("#M").is(":checked");
}
},
fields: {
"j_ip": {
"ip": {
rule: "required;check_ip",
tip: "输入IP",
ok: "",
msg: {required: "必须填写!"}
},
"j_port": {
"port": {
rule: "required;check_port",
tip: "输入端口号",
ok: "",
msg: {required: "必须填写!"}
},
"j_idc": {
rule: "required",
tip: "选择IDC",
ok: "",
msg: {checked: "必须填写!"}
},
"j_dept": {
rule: "required",
tip: "选择部门",
ok: "",
msg: {checked: "至少选择一个部门"}
}
},
valid: function(form) {

View File

@ -9,14 +9,11 @@
<div class="col-lg-4">
<div class="ibox float-e-margins">
<div class="ibox-title">
<span class="text text-primary"><b>{{ post.ip }}</b></span>
<span class="text text-primary"><b>{{ asset.ip }}</b></span>
<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">
@ -34,55 +31,35 @@
<table class="table">
<tr>
<td class="text-navy">IP</td>
<td>{{ post.ip }}</td>
<td>{{ asset.ip }}</td>
</tr>
<tr>
<td class="text-navy">端口</td>
<td>{{ post.port }}</td>
</tr>
<tr>
<td class="text-navy">登录方式</td>
<td>{{ post.login_type|get_login_type }}</td>
</tr>
<tr>
<td class="text-navy">IDC</td>
<td>{{ post.idc.name }} </td>
</tr>
<tr>
<td class="text-navy">部门</td>
<td>
<table class="table">
{% for dept in post.dept.all %}
<tr>
<td>{{ dept.name }}</td>
</tr>
{% endfor %}
</table>
</td>
<td>{{ asset.port }}</td>
</tr>
<tr>
<td class="text-navy">主机组</td>
<td>
<table class="table">
{% for group in post.bis_group.all %}
<tr>
<td>{{ group.name }}</td>
</tr>
{% endfor %}
</table>
</td>
</tr>
<tr>
<td class="text-navy">使用默认管理账号</td>
<td>{{ asset.use_default_auth|bool2str }}</td>
</tr>
<tr>
<td class="text-navy">激活</td>
<td>{{ post.is_active|bool2str }}</td>
<td>{{ asset.is_active|bool2str }}</td>
</tr>
<tr>
<td class="text-navy">添加日期</td>
<td>{{ post.date_added|date:"Y-m-d H:i:s" }}</td>
<td>{{ asset.date_added|date:"Y-m-d H:i:s" }}</td>
</tr>
<tr>
<td class="text-navy">备注</td>
<td>{{ post.comment }}</td>
<td>{{ asset.comment }}</td>
</tr>
</table>
</div>
@ -116,17 +93,17 @@
<div>
<div class="text-left">
<table class="table">
{% if user_permed_list %}
{% for user in user_permed_list %}
<tr>
<td class="text-navy">{{ user.name }}</td>
<td>{{ user.dept.name }}</td>
<td><a href="/juser/user_detail/?id={{ user.id }}">详情</a></td>
</tr>
{% endfor %}
{% else %}
<p class="text-center">(暂无)</p>
{% endif %}
{# {% if user_permed_list %}#}
{# {% for user in user_permed_list %}#}
{# <tr>#}
{# <td class="text-navy">{{ user.name }}</td>#}
{# <td>{{ user.dept.name }}</td>#}
{# <td><a href="/juser/user_detail/?id={{ user.id }}">详情</a></td>#}
{# </tr>#}
{# {% endfor %}#}
{# {% else %}#}
{# <p class="text-center">(暂无)</p>#}
{# {% endif %}#}
</table>
</div>
</div>
@ -157,49 +134,49 @@
<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/>
<strong>{{l.dept_name}}</strong>
</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/>
<strong>{{l.dept_name}}</strong>
</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 %}
{# {% 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/>#}
{# <strong>{{l.dept_name}}</strong>#}
{# </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/>#}
{# <strong>{{l.dept_name}}</strong>#}
{# </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>

View File

@ -0,0 +1,164 @@
{% extends 'base.html' %}
{% load mytags %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-lg-10">
<div class="ibox float-e-margins">
<div id="ibox-content" 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>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<div class="ibox-content">
<div class="panel-body">
<div class="tab-content">
<div id="tab-1" class="ibox float-e-margins tab-pane active">
{% if error %}
<div class="alert alert-warning text-center">{{ error }}</div>
{% endif %}
{% if msg %}
<div class="alert alert-success text-center">{{ msg }}</div>
{% endif %}
<form id="assetForm" method="post" class="form-horizontal">
<div class="form-group"><label class="col-sm-2 control-label"> IP地址<span class="red-fonts">*</span> </label>
<div class="col-sm-8"><input type="text" name="ip" value="{{ asset.ip }}" class="form-control"></div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label class="col-sm-2 control-label"> 端口号<span class="red-fonts">*</span> </label>
<div class="col-sm-8">
<input type="text" value="{{ asset.port }}" name="port" class="form-control">
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="j_group" class="col-sm-2 control-label">使用默认管理账号</label>
<div class="col-sm-1">
<div class="radio i-checks">
<label>
<input type="checkbox" {% ifequal asset.use_default_auth 1 %} checked="" {% endifequal %} value="1" id="use_default_auth" name="use_default_auth">
</label>
</div>
</div>
</div>
<div class="form-group" id="admin_account" {% ifequal asset.use_default_auth 1 %} style="display: none" {% endifequal %}>
<label class="col-sm-2 control-label"> 管理用户名<span class="red-fonts">*</span> </label>
<div class="col-sm-3">
<input type="text" {% ifnotequal asset.use_default_auth 1 %} value="{{ asset.username }}" {% endifnotequal %} name="username" class="form-control">
</div>
<label class="col-sm-1 control-label"> 密码<span class="red-fonts">*</span> </label>
<div class="col-sm-4">
<input type="password" {% ifnotequal asset.use_default_auth 1 %} value="{{ asset.password }}" {% endifnotequal %} name="password" class="form-control">
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="groups" class="col-sm-2 control-label">所属主机组</label>
<div class="col-sm-8">
<select id="groups" name="groups" class="form-control m-b" multiple size="10">
{% for g in egroup %}
<option type="checkbox" value="{{ g.id }}">{{ g.name }} {% if g.comment %} --- {{ g.comment }} {% endif %}</option>
{% endfor %}
</select>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group"><label class="col-sm-2 control-label"> 是否激活<span class="red-fonts">*</span> </label>
<div class="col-sm-8">
<div class="radio i-checks">
{% ifequal asset.is_active 1 %}
<label> <input type="radio" checked="" value="1" name="is_active">激活 </label>
<label> <input type="radio" value="0" name="is_active"> 禁用</label>
{% else %}
<label> <input type="radio" value="1" name="is_active">激活 </label>
<label> <input type="radio" checked="" value="0" name="is_active"> 禁用</label>
{% endifequal %}
</div>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group"><label class="col-sm-2 control-label"> 备注 </label>
<div class="col-sm-8"><input type="text" value="{{ asset.comment }}" name="comment" class="form-control"></div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-2">
<button class="btn btn-white" type="reset"> 重置 </button>
<button class="btn btn-primary" type="submit"> 提交 </button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block self_footer_js %}
<script>
$('document').ready(function(){
$('#use_default_auth').click(function(){
if ($(this).is(':checked')){
$('#admin_account').css('display', 'none')
}
else {
$('#admin_account').css('display', 'block')
}
})
});
$('#assetForm').validator({
timely: 2,
theme: "yellow_right_effect",
rules: {
check_ip: [/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])(\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])){3}$/, 'ip地址不正确'],
check_port: [/^\d{1,5}$/, '端口号不正确'],
},
fields: {
"ip": {
rule: "required;check_ip",
tip: "输入IP",
ok: "",
msg: {required: "必须填写!"}
},
"port": {
rule: "required;check_port",
tip: "输入端口号",
ok: "",
msg: {required: "必须填写!"}
}
},
valid: function(form) {
form.submit();
}
});
</script>
{% endblock %}

View File

@ -16,12 +16,6 @@
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-wrench"></i>
</a>
<ul class="dropdown-menu dropdown-user">
<li><a href="#">未启用 1</a>
</li>
<li><a href="#">未启用 2</a>
</li>
</ul>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
@ -30,14 +24,14 @@
<div class="ibox-content">
<div>
<a target="_blank" href="/jasset/host_add" class="btn btn-sm btn-primary "> 添加 </a>
<a target="_blank" href="/jasset/asset_add/" class="btn btn-sm btn-primary "> 添加 </a>
<form id="search_form" method="get" action="" class="pull-right mail-search">
<div class="input-group">
<input type="text" class="form-control input-sm" id="search_input" name="keyword" placeholder="Search">
<input type="text" style="display: none">
<div class="input-group-btn">
<button id='search_btn' type="button" class="btn btn-sm btn-primary" onclick="host_search()">
Search
<button type="submit" class="btn btn-sm btn-primary">
- 搜索 -
</button>
</div>
</div>
@ -48,37 +42,35 @@
<table class="table table-striped table-bordered table-hover " id="editable" name="editable">
<thead>
<tr>
<th class="text-center"><input id="checkall" type="checkbox" class="i-checks" name="checkall" value="checkall" data-editable='false' onclick="check_all('contents_form')"></th>
<th class="text-center" name="j_ip"> IP地址 </th>
<th class="text-center">
<input id="checkall" type="checkbox" class="i-checks" name="checkall" value="checkall" data-editable='false' onclick="check_all('contents_form')">
</th>
<th class="text-center" name="ip"> IP地址 </th>
<th class="text-center"> 端口号 </th>
<th class="text-center" name="j_type"> 登录方式 </th>
<th class="text-center" name="j_idc"> 所属IDC </th>
<th class="text-center"> 所属部门 </th>
<th class="text-center"> 所属主机组 </th>
<th class="text-center"> 是否激活 </th>
<th class="text-center" name="j_comment"> 备注 </th>
<th class="text-center"> 使用默认管理 </th>
<th class="text-center"> 激活 </th>
<th class="text-center" name="comment"> 备注 </th>
<th class="text-center"> 操作 </th>
</tr>
</thead>
<tbody>
{% for post in contacts.object_list %}
{% for asset in assets.object_list %}
<tr class="gradeX">
<td class="text-center" name="j_id" value="{{ post.id }}" data-editable='false'><input name="id" value="{{ post.id }}" type="checkbox" class="i-checks"></td>
<td class="text-center" name="j_ip"> {{ post.ip }} </td>
<td class="text-center" name="j_port"> {{ post.port }} </td>
<td class="text-center" name="j_type"> {{ post.login_type|get_login_type }} </td>
<td class="text-center" name="j_idc"> {{ post.idc.name }} </td>
<td class="text-center" name="j_dept">{{ post.dept.all | group_str2 }}</td>
<!--<td class="text-center" id="j_dept_{{post.id}}" name="j_dept" onclick="show_all('dept', '{{post.id}}')">{{ post.dept.all | group_str2 }}</td>-->
<td class="text-center" name="j_group">{{ post.bis_group.all | group_str2_all }}</td>
<!--<td class="text-center" id="j_group_{{post.id}}" name="j_group" onclick="show_all('group', '{{post.id}}')">{{ post.bis_group.all | group_str2_all }}</td>-->
<td class="text-center" name="j_active"> {{ post.is_active|bool2str }} </td>
<td class="text-center" name="j_comment"> {{ post.comment }} </td>
<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"> {{ asset.ip }} </td>
<td class="text-center"> {{ asset.port }} </td>
<td class="text-center">{{ asset.port }}</td>
<td class="text-center"> {{ asset.use_default_auth|bool2str }} </td>
<td class="text-center"> {{ asset.is_active|bool2str }} </td>
<td class="text-center"> {{ asset.comment }} </td>
<td class="text-center" data-editable='false'>
<a href="/jasset/host_detail/?id={{ post.id }}" class="btn btn-xs btn-primary">详情</a>
<a href="/jasset/asset_detail/?id={{ asset.id }}" class="btn btn-xs btn-primary">详情</a>
{% ifnotequal session_role_id 0 %}
<a href="/jasset/host_edit/?id={{ post.id }}" class="btn btn-xs btn-info">编辑</a>
<a href="/jasset/host_del/{{ post.id }}" class="btn btn-xs btn-danger">删除</a>
<a href="/jasset/asset_edit/?id={{ asset.id }}" class="btn btn-xs btn-info">编辑</a>
<a value="/jasset/asset_del/?id={{ asset.id }}" class="btn btn-xs btn-danger asset_del">删除</a>
{% endifnotequal %}
</td>
</tr>
@ -98,7 +90,9 @@
</div>
</div>
</div>
{% endblock %}
{% block self_footer_js %}
<script>
$('table td').on('change', function(env, id){
var url = "/jasset/show_all_ajax/?env=" + env + "&id=" + id;
@ -111,10 +105,21 @@
$("#j_dept_"+id).html(data);
}
});
})
});
$(document).ready(function(){
$('#editable').editableTableWidget({editor: $('<textarea>')});
$('.asset_del').click(function(){
var row = $(this).closest('tr');
$.get(
$(this).attr('value'),
{},
function(data){
alert(data);
row.remove()
}
)
})
});
@ -157,22 +162,22 @@
}
}
function host_search(){
$.ajax({
type: "GET",
url: "/jasset/search/",
data: $("#search_form").serialize(),
success: function (data) {
$("#contents_form").html(data);
}
});
}
{# function host_search(){#}
{# $.ajax({#}
{# type: "GET",#}
{# url: "/jasset/search/",#}
{# data: $("#search_form").serialize(),#}
{# success: function (data) {#}
{# $("#contents_form").html(data);#}
{# }#}
{# });#}
{# }#}
$("#search_input").keydown(function(e){
if(e.keyCode==13){
host_search()
}
})
});
function show_all(env, id) {
var url = "/jasset/show_all_ajax/?env=" + env + "&id=" + id;

View File

@ -22,7 +22,7 @@
<div class="col-lg-10">
<div class="ibox float-e-margins">
<div id="ibox-content" class="ibox-title">
<h5> 填写主机组基本信息 </h5>
<h5> 填写资产组基本信息 </h5>
<div class="ibox-tools">
<a class="collapse-link">
<i class="fa fa-chevron-up"></i>
@ -30,64 +30,38 @@
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-wrench"></i>
</a>
<ul class="dropdown-menu dropdown-user">
<li><a href="#">未启用 1</a>
</li>
<li><a href="#">未启用 2</a>
</li>
</ul>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<select id="assets_total" name="assets" class="form-control m-b" size="12" multiple style="display: none">
{% for asset in posts %}
<option value="{{ asset.id }}">{{ asset.ip }}</option>
{% endfor %}
</select>
<select id="asset_select_total" name="j_hosts" class="form-control m-b" size="12" multiple style="display: none">
{% for asset in eposts %}
<option value="{{ asset.id }}">{{ asset.ip }}</option>
{% endfor %}
</select>
{# <select id="assets_total" name="assets" class="form-control m-b" size="12" multiple style="display: none">#}
{# {% for asset in assets_all %}#}
{# <option value="{{ asset.id }}">{{ asset.ip }}</option>#}
{# {% endfor %}#}
{# </select>#}
{##}
{# <select id="asset_select_total" name="j_hosts" class="form-control m-b" size="12" multiple style="display: none">#}
{# {% for asset in eposts %}#}
{# <option value="{{ asset.id }}">{{ asset.ip }}</option>#}
{# {% endfor %}#}
{# </select>#}
<div class="ibox-content">
{% if emg %}
<div class="alert alert-warning text-center">{{ emg }}</div>
{% if error %}
<div class="alert alert-warning text-center">{{ error }}</div>
{% endif %}
{% if smg %}
<div class="alert alert-success text-center">{{ smg }}</div>
{% if msg %}
<div class="alert alert-success text-center">{{ msg }}</div>
{% endif %}
<form id="assetForm" method="post" class="form-horizontal">
<div class="form-group"><label class="col-sm-2 control-label"> 主机组名<span class="red-fonts">*</span></label>
<div class="col-sm-8" name="group_id" value="{{ post.id }}"><input type="text" value="{{ group.name }}" placeholder="网站" name="j_group" class="form-control"></div>
</div>
{% ifequal session_role_id 2 %}
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="j_dept" class="col-lg-2 control-label">所属部门<span class="red-fonts">*</span></label>
<label class="col-sm-2 control-label"> 主机组名<span class="red-fonts">*</span></label>
<div class="col-sm-8">
<select id="j_dept" name="j_dept" class="form-control m-b" onchange="change_dept(this.value)">
{% for d in edept %}
<option value="{{ d.id }}">{{ d.name }}</option>
{% endfor %}
</select>
<input type="text" placeholder="Name" name="name" class="form-control">
</div>
</div>
{% endifequal %}
{% ifequal session_role_id 1 %}
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="j_dept" class="col-lg-2 control-label">所属部门<span class="red-fonts" style="">*</span></label>
<input type="text" name="j_dept" value="{{ edept.id }}" style="display: none">
<div class="col-sm-8"><input type="text" value="{{ edept.name }}" class="form-control" readonly="readonly"></div>
</div>
{% endifequal %}
<div class="hr-line-dashed"></div>
<div class="form-group">
@ -108,8 +82,8 @@
<div class="col-sm-4">
<div>
<select id="assets" name="assets" class="form-control m-b" size="12" multiple>
{% for post in posts %}
<option value="{{ post.id }}">{{ post.ip }}</option>
{% for asset in asset_all %}
<option value="{{ asset.id }}">{{ asset.ip }}</option>
{% endfor %}
</select>
</div>
@ -118,27 +92,30 @@
<div class="col-sm-1">
<div class="btn-group" style="margin-top: 60px;">
<button type="button" class="btn btn-white" onclick="move('assets', 'asset_select', 'assets_total', 'asset_select_total' )"><i class="fa fa-chevron-right"></i></button>
<button type="button" class="btn btn-white" onclick="move_left('asset_select', 'assets', 'asset_select_total', 'assets_total')"><i class="fa fa-chevron-left"></i> </button>
<button type="button" class="btn btn-white" onclick="move('asset_select', 'assets', 'asset_select_total', 'assets_total')"><i class="fa fa-chevron-left"></i> </button>
</div>
</div>
<div class="col-sm-3">
<div>
<select id="asset_select" name="j_hosts" class="form-control m-b" size="12" multiple></select>
<select id="asset_select" name="asset_select" class="form-control m-b" size="12" multiple></select>
</div>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group"><label class="col-sm-2 control-label"> 备注 </label>
<div class="col-sm-8"><input type="text" value="{{ j_comment }}" placeholder=包括web组所有主机 name="j_comment" class="form-control"></div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-5">
<button class="btn btn-white" type="submit"> 重置 </button>
<button class="btn btn-primary" id="submit_button" type="submit" onclick="on_submit('groups_selected') "> 提交 </button>
<label class="col-sm-2 control-label"> 备注 </label>
<div class="col-sm-8">
<input type="text" placeholder="Comment" name="comment" class="form-control">
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-2">
<button class="btn btn-white" type="reset"> 重置 </button>
<button class="btn btn-primary" type="submit" onclick="on_submit('groups_selected') "> 提交 </button>
</div>
</div>
</form>

View File

@ -16,12 +16,6 @@
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-wrench"></i>
</a>
<ul class="dropdown-menu dropdown-user">
<li><a href="#">未启用 1</a>
</li>
<li><a href="#">未启用 2</a>
</li>
</ul>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
@ -29,14 +23,14 @@
</div>
<div class="ibox-content">
<div class="">
<a target="_blank" href="/jasset/group_add" class="btn btn-sm btn-primary "> 添加主机组 </a>
<a target="_blank" href="/jasset/group_add/" class="btn btn-sm btn-primary "> 添加主机组 </a>
<form id="search_form" method="get" action="" class="pull-right mail-search">
<div class="input-group">
<input type="text" class="form-control input-sm" id="search_input" name="keyword" placeholder="Search">
<input type="text" style="display: none">
<div class="input-group-btn">
<button id='search_btn' type="submit" class="btn btn-sm btn-primary">
Search
- 搜索 -
</button>
</div>
</div>
@ -47,26 +41,24 @@
<table class="table table-striped table-bordered table-hover " id="editable" >
<thead>
<tr>
<th class="text-center"><input id="checkall" type="checkbox" class="i-checks" name="checkall" value="checkall" data-editable='false' onclick="check_all('contents_form')"></th>
<th class="text-center">
<input id="checkall" type="checkbox" class="i-checks" name="checkall" value="checkall" data-editable='false' onclick="check_all('contents_form')">
</th>
<th class="text-center"> 主机组名 </th>
<th class="text-center"> 所属部门 </th>
<th class="text-center"> 主机数量 </th>
<th class="text-center"> 备注 </th>
<th class="text-center"> 操作 </th>
</tr>
</thead>
<tbody>
{% for post in contacts.object_list %}
{% for asset_group in asset_groups.object_list %}
<tr class="gradeX">
<td class="text-center" name="j_id" value="{{ post.id }}" data-editable='false'><input name="id" value="{{ post.id }}" type="checkbox" class="i-checks"></td>
<td class="text-center"> {{ post.name }} </td>
<td class="text-center"> {{ post.dept.name }} </td>
{% ifequal session_role_id 2 %}
<td class="text-center"> <a href="/jasset/group_detail/?id={{ post.id }}">{{ post.asset_set.count }}</a> </td>
{% else %}
<td class="text-center"> <a href="/jasset/group_detail/?id={{ post.id }}">{{ post|get_group_count:dept }}</a> </td>
{% endifequal %}
<td class="text-center"> {{ post.comment }} </td>
<td class="text-center" name="id" value="{{ asset_group.id }}" data-editable='false'>
<input name="id" value="{{ post.id }}" type="checkbox" class="i-checks">
</td>
<td class="text-center"> {{ asset_group.name }} </td>
<td class="text-center"> <a href="/jasset/group_detail/?id={{ post.id }}">{{ asset_group.asset_set.count }}</a> </td>
<td class="text-center"> {{ asset_group.comment }} </td>
<td class="text-center">
<a href="/jasset/group_detail/?id={{ post.id }}" class="btn btn-xs btn-info">详情</a>
<a href="/jasset/group_edit/?id={{ post.id }}" class="btn btn-xs btn-info">编辑</a>

View File

@ -1,228 +0,0 @@
{% extends 'base.html' %}
{% load mytags %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-lg-10">
<div class="ibox float-e-margins">
<div id="ibox-content" 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">
<li><a href="#">未启用 1</a>
</li>
<li><a href="#">未启用 2</a>
</li>
</ul>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<div class="ibox-content">
{% if emg %}
<div class="alert alert-warning text-center">{{ emg }}</div>
{% endif %}
{% if smg %}
<div class="alert alert-success text-center">{{ smg }}</div>
{% endif %}
<form id="assetForm" method="post" class="form-horizontal" autocomplete="off">
<div class="form-group"><label class="col-sm-2 control-label"> IP地址<span class="red-fonts">*</span> </label>
<div class="col-sm-8"><input type="text" name="j_ip" value="{{ post.ip }}" placeholder="192.168.1.1" class="form-control"></div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group"><label class="col-sm-2 control-label"> 端口号<span class="red-fonts">*</span> </label>
<div class="col-sm-8"><input type="text" placeholder="22" name="j_port" value="{{ post.port }}" class="form-control"></div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group"><label class="col-sm-2 control-label"> 登录方式<span class="red-fonts">*</span> </label>
<div class="col-sm-8">
{% for t, type in login_types.items %}
{% ifequal t post.login_type %}
<div class="radio i-checks"><label> <input type="radio" checked="" value="{{ t }}" name="j_type" onclick="show(this)"> <i> {{ type }} </i></label></div>
{% else %}
<div class="radio i-checks"><label> <input type="radio" value="{{ t }}" name="j_type" onclick="show(this)"> <i> {{ type }} </i></label></div>
{% endifequal %}
{% endfor %}
</div>
{% ifequal post.login_type 'M' %}
<div name="type" id="type">
<div class="form-group"><label class="col-sm-2 col-sm-offset-1 control-label"> 普通用户名 </label>
<div class="col-sm-6"><input type="text" name="j_user" value="{{ post.username }}" class="form-control"></div>
</div>
<div class="form-group"><label class="col-sm-2 col-sm-offset-1 control-label"> 普通用户密码 </label>
<div class="col-sm-6"><input type="password" name="j_password" value="{{ post.password }}" class="form-control"></div>
</div>
</div>
{% endifequal %}
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="j_idc" class="col-lg-2 control-label"> 所属IDC<span class="red-fonts">*</span> </label>
<div class="col-sm-8">
<select id="j_idc" name="j_idc" class="form-control m-b">
{% for i in eidc %}
{% ifequal i.id post.idc_id %}
<option value="{{i.id}}" selected> {{ i }} </option>
{% else %}
<option value="{{i.id}}"> {{ i }} </option>
{% endifequal %}
{% endfor %}
</select>
</div>
</div>
{% ifequal session_role_id 2 %}
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="j_dept" class="col-lg-2 control-label">所属部门<span class="red-fonts">*</span></label>
<div class="col-sm-8">
<select id="j_dept" name="j_dept" class="form-control m-b" multiple size="10">
{% for d in edept %}
{% if d in e_dept %}
<option type="checkbox" selected value="{{ d.id }}">{{ d.name }} {% if d.comment %} --- {{ d.comment }} {% endif %}</option>
{% else %}
<option type="checkbox" value="{{ d.id }}">{{ d.name }} {% if d.comment %} --- {{ d.comment }} {% endif %}</option>
{% endif %}
{% endfor %}
</select>
</div>
</div>
{% endifequal %}
{% ifequal session_role_id 1 %}
<div class="hr-line-dashed"></div>
<div class="form-group"><label class="col-sm-2 control-label"> 所属部门<span class="red-fonts">*</span> </label>
<input type="text" name="j_dept" value="{{ dept.id }}" style="display: none">
<div class="col-sm-8"><input type="text" value="{{ dept.name }}" class="form-control" readonly="readonly"></div>
</div>
{% endifequal %}
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="j_group" class="col-lg-2 control-label"> 所属主机组</label>
<div class="col-sm-8">
<select id="j_group" name="j_group" class="form-control m-b" multiple size="10">
{% for g in egroup %}
{% if g in e_group %}
<option type="checkbox" value="{{ g.id }}" selected>{{ g.name }} {% if g.comment %} --- {{ g.comment }} {% endif %}</option>
{% else %}
<option type="checkbox" value="{{ g.id }}" >{{ g.name }} {% if g.comment %} --- {{ g.comment }} {% endif %}</option>
{% endif %}
{% endfor %}
</select>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group"><label class="col-sm-2 control-label"> 是否激活<span class="red-fonts">*</span> </label>
<div class="col-sm-8">
{% for a,active in actives.items %}
{% ifequal a post.is_active %}
<div class="radio i-checks"><label> <input type="radio" checked value="{{ a }}" name="j_active"> <i> {{ active }} </i></label></div>
{% else %}
<div class="radio i-checks"><label> <input type="radio" value="{{ a }}" name="j_active"> <i> {{ active }} </i></label></div>
{% endifequal %}
{% endfor %}
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group"><label class="col-sm-2 control-label"> 备注 </label>
<div class="col-sm-8"><input type="text" placeholder="hadoop01" value="{{ post.comment }}" name="j_comment" class="form-control"></div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-5">
<button class="btn btn-white" type="submit"> 重置 </button>
<button class="btn btn-primary" type="submit" style="display: i"> 提交 </button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
var showFlag={};
function show(o){
showFlag[o.name]=o.value;
if(showFlag.j_type=="M"){
document.getElementById("type").style.display="";
}
else{
document.getElementById("type").style.display="none";
}};
$('#assetForm').validator({
timely: 2,
theme: "yellow_right_effect",
rules: {
check_ip: [/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])(\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])){3}$/, 'ip地址不正确'],
check_port: [/^\d{1,5}$/, '端口号不正确'],
type_m: function(element){
return $("#M").is(":checked");
}
},
fields: {
"j_ip": {
rule: "required;check_ip",
tip: "输入IP",
ok: "",
msg: {required: "必须填写!"}
},
"j_port": {
rule: "required;check_port",
tip: "输入端口号",
ok: "",
msg: {required: "必须填写!"}
},
"j_idc": {
rule: "required",
tip: "选择IDC",
ok: "",
msg: {checked: "必须填写!"}
},
"j_dept": {
rule: "required",
tip: "选择部门",
ok: "",
msg: {checked: "至少选择一个部门"}
},
"j_user": {
rule: "required(type_m)",
tip: "普通用户名",
ok: "",
msg: {required: "请填写用户名"}
},
"j_password": {
rule: "required(type_m);length[6~100]",
tip: "密码6-16位",
ok: "",
msg: {required: "6-16位"}
}
},
valid: function(form) {
form.submit();
}
});
</script>
{% endblock %}

View File

@ -1,79 +0,0 @@
{% extends 'base.html' %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-lg-10">
<div class="ibox float-e-margins">
<div id="ibox-content" class="ibox-title">
<h5> 填写IDC基本信息 </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">
<li><a href="#">未启用 1</a>
</li>
<li><a href="#">未启用 2</a>
</li>
</ul>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<div class="ibox-content">
{% if emg %}
<div class="alert alert-warning text-center">{{ emg }}</div>
{% endif %}
{% if smg %}
<div class="alert alert-success text-center">{{ smg }}</div>
{% endif %}
<form id="assetForm" method="post" class="form-horizontal">
<div class="form-group"><label class="col-sm-2 control-label"> IDC名 <span class="red-fonts">*</span></label>
<div class="col-sm-8"><input type="text" value="{{ idc.name }}" placeholder="北京联通" name="j_idc" class="form-control"></div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group"><label class="col-sm-2 control-label"> 备注 </label>
<div class="col-sm-8"><input type="text" value="{{ idc.comment }}" placeholder="核心联通机房" name="j_comment" class="form-control"></div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-5">
<button class="btn btn-white" type="submit"> 重置 </button>
<button class="btn btn-primary" type="sumbit"> 提交 </button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
$('#assetForm').validator({
timely: 2,
theme: "yellow_right_effect",
fields: {
"j_idc": {
rule: "required",
tip: "输入IDC名",
ok: "",
msg: {required: "IDC名必须填写!"},
data: {'data-ok':"主机名可以使用", 'data-msg-required': '主机名已正确'}
}
},
valid: function(form) {
form.submit();
}
});
</script>
{% endblock %}

View File

@ -1,211 +0,0 @@
{% extends 'base.html' %}
{% load mytags %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-lg-12">
<div class="ibox float-e-margins" id="all">
<div class="ibox-title">
<h5> IDC<span class="text-info"> {{ idc.name }} </span>详细信息列表 </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">
<li><a href="#">未启用 1</a>
</li>
<li><a href="#">未启用 2</a>
</li>
</ul>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<div class="ibox-content">
{% if emg %}
<div class="alert alert-warning text-center">{{ emg }}</div>
{% endif %}
{% if smg %}
<div class="alert alert-success text-center">{{ smg }}</div>
{% endif %}
<div class="">
<a target="_blank" href="/jasset/host_add" class="btn btn-sm btn-primary "> 添加主机 </a>
</div>
<form id="contents_form" name="contents_form">
<table class="table table-striped table-bordered table-hover " id="editable" name="editable">
<thead>
<tr>
<th class="text-center"><input id="checkall" type="checkbox" class="i-checks" name="checkall" value="checkall" data-editable='false' onclick="check_all('contents_form')"></th>
<th class="text-center" name="j_ip"> IP地址 </th>
<th class="text-center"> 端口号 </th>
<th class="text-center" name="j_type"> 登录方式 </th>
<th class="text-center" id="j_group_name" value="{{ idc_name }}"> 所属IDC </th>
<th class="text-center"> 所属业务组 </th>
<th class="text-center"> 是否激活 </th>
<th class="text-center" name="j_time"> 添加时间 </th>
<th class="text-center" name="j_comment"> 备注 </th>
<th class="text-center"> 操作 </th>
</tr>
</thead>
<tbody>
{% for post in contacts.object_list %}
<tr class="gradeX">
<td class="text-center" name="j_id" value="{{ post.id }}" data-editable='false'><input name="id" value="{{ post.id }}" type="checkbox" class="i-checks"></td>
<td class="text-center" name="j_ip"> {{ post.ip }} </td>
<td class="text-center" name="j_port"> {{ post.port }} </td>
<td class="text-center" name="j_type"> {{ post.login_type|get_login_type }} </td>
<td class="text-center" name="j_idc"> {{ post.idc.name }} </td>
<td class="text-center" name="j_dept">{{ post.dept.all | group_str2 }}</td>
<td class="text-center" name="j_group">{{ post.bis_group.all | group_str2_all }}</td>
<td class="text-center" name="j_active"> {{ post.is_active|bool2str }} </td>
<td class="text-center" name="j_comment"> {{ post.comment }} </td>
<td class="text-center" data-editable='false'>
<a href="/jasset/host_detail/?id={{ post.id }}" class="btn btn-xs btn-primary">详情</a>
{% ifnotequal session_role_id 0 %}
<a href="/jasset/host_edit/?id={{ post.id }}" class="btn btn-xs btn-info">编辑</a>
<a href="/jasset/host_del/{{ post.id }}" class="btn btn-xs btn-danger">删除</a>
{% endifnotequal %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="row">
<div class="col-sm-6">
<input type="button" id="del_button" class="btn btn-danger btn-sm" name="del_button" value="删除" onclick="del('contents_form')" />
<input type="button" id="alter_button" class="btn btn-warning btn-sm" name="alter_button" value="修改" onclick="alter('contents_form')" />
</div>
<div class="col-sm-6">
<div class="dataTables_paginate paging_simple_numbers" id="editable_paginate">
<ul class="pagination" style="margin-top: 0; float: right">
{% if keyword %}
{% if contacts.has_previous %}
<li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">
<a href="?keyword={{ keyword }}&page={{ contacts.previous_page_number }}">Previous</a>
</li>
{% else %}
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous">
<a href="#">Previous</a>
</li>
{% endif %}
{% ifequal show_first 1 %}
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?keyword={{ keyword }}&page=1&id={{ idc.id }}" title="第1页">1...</a></li>
{% endifequal %}
{% for page in page_range %}
{% ifequal current_page page %}
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?keyword={{ keyword }}&page={{ page }}&id={{ idc.id }}" title="第{{ page }}页">{{ page }}</a></li>
{% else %}
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?keyword={{ keyword }}&page={{ page }}&id={{ idc.id }}" title="第{{ page }}页">{{ page }}</a></li>
{% endifequal %}
{% endfor %}
{% ifequal show_end 1 %}
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?keyword={{ keyword }}&page={{ p.num_pages }}&id={{ idc.id }}" title="第{{ page }}页">...{{ p.num_pages }}</a></li>
{% endifequal %}
{% if contacts.has_next %}
<li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">
<a href="?keyword={{ keyword }}&page={{ contacts.next_page_number }}&id={{ idc.id }}">Next</a>
</li>
{% else %}
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">
<a href="#">Next</a>
</li>
{% endif %}
{% else %}
{% if contacts.has_previous %}
<li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">
<a href="?page={{ contacts.previous_page_number }}&id={{ idc.id }}">Previous</a>
</li>
{% else %}
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous">
<a href="#">Previous</a>
</li>
{% endif %}
{% ifequal show_first 1 %}
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page=1&id={{ idc.id }}" title="第1页">1...</a></li>
{% endifequal %}
{% for page in page_range %}
{% ifequal current_page page %}
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?page={{ page }}&id={{ idc.id }}" title="第{{ page }}页">{{ page }}</a></li>
{% else %}
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ page }}&id={{ idc.id }}" title="第{{ page }}页">{{ page }}</a></li>
{% endifequal %}
{% endfor %}
{% ifequal show_end 1 %}
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ p.num_pages }}&id={{ idc.id }}" title="第{{ page }}页">...{{ p.num_pages }}</a></li>
{% endifequal %}
{% if contacts.has_next %}
<li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">
<a href="?page={{ contacts.next_page_number }}&id={{ idc.id }}">Next</a>
</li>
{% else %}
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">
<a href="#">Next</a>
</li>
{% endif %}
{% endif %}
</ul>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function(){
$('#editable').editableTableWidget();
});
function alter(form) {
selectData = GetTableDataBox();
if (selectData[1] != 0) {
$.ajax({
type: "post",
url: "/jasset/host_edit/batch/",
data: {"editable": selectData[0], "len_table": selectData[1]},
success: function (data) {
alert("修改成功");
window.open("/jasset/host_list/", "_self");
}
});
}
}
function del(form) {
var checkboxes = document.getElementById(form);
var id_list = {};
var group_name = $('#j_group_name').attr("value");
console.log(group_name);
var j = 0;
for (var i = 0; i < checkboxes.elements.length; i++) {
if (checkboxes.elements[i].type == "checkbox" && checkboxes.elements[i].checked == true && checkboxes.elements[i].value != "checkall") {
id_list[j] = checkboxes.elements[i].value;
j++;
}
}
if (confirm("确定从该IDC中删除")) {
$.ajax({
type: "POST",
url: "/jasset/host_del/multi/",
data: {"id_list": id_list, "len_list": j, "group_name": group_name},
success: function (data) {
window.open(window.location.href, "_self");
}
});
}
}
</script>
{% endblock %}

View File

@ -1,109 +0,0 @@
{% extends 'base.html' %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-lg-10">
<div class="ibox float-e-margins">
<div id="ibox-content" class="ibox-title">
<h5> 填写IDC基本信息 </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">
<li><a href="#">未启用 1</a>
</li>
<li><a href="#">未启用 2</a>
</li>
</ul>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<div class="ibox-content">
{% if emg %}
<div class="alert alert-warning text-center">{{ emg }}</div>
{% endif %}
{% if smg %}
<div class="alert alert-success text-center">{{ smg }}</div>
{% endif %}
<form id="assetForm" method="post" class="form-horizontal">
<div class="form-group"><label class="col-sm-2 control-label"> IDC名 <span class="red-fonts">*</span></label>
<div class="col-sm-8">
<input name="id" type="text" value="{{ idc.id }}" style="display: none;">
<input type="text" value="{{ idc.name }}" placeholder="北京联通" name="j_idc" class="form-control">
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group"><label class="col-sm-2 control-label"> 备注 </label>
<div class="col-sm-8"><input type="text" value="{{ idc.comment }}" placeholder="核心联通机房" name="j_comment" class="form-control"></div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="groups" class="col-lg-2 control-label">主机</label>
<div class="col-sm-3">
<select id="groups" name="idc_default" size="12" class="form-control m-b" multiple>
{% for post in posts %}
<option value="{{ post.id }}">{{ post.ip }}</option>
{% endfor %}
</select>
</div>
<div class="col-sm-1">
<div class="btn-group" style="margin-top: 50px;">
<button type="button" class="btn btn-white" onclick="move('groups', 'groups_selected')"><i class="fa fa-chevron-right"></i></button>
<button type="button" class="btn btn-white" onclick="move_left('groups_selected', 'groups')"><i class="fa fa-chevron-left"></i> </button>
</div>
</div>
<div class="col-sm-3">
<div>
<select id="groups_selected" name="j_hosts" class="form-control m-b" size="12" multiple>
{% for post in eposts %}
<option value="{{ post.id }}">{{ post.ip }}</option>
{% endfor %}
</select>
</div>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-5">
<button class="btn btn-white" type="submit"> 重置 </button>
<button class="btn btn-primary" type="sumbit"> 提交 </button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
$('#assetForm').validator({
timely: 2,
theme: "yellow_right_effect",
fields: {
"j_idc": {
rule: "required",
tip: "输入IDC名",
ok: "",
msg: {required: "IDC名必须填写!"},
data: {'data-ok':"主机名可以使用", 'data-msg-required': '主机名已正确'}
}
},
valid: function(form) {
form.submit();
}
});
</script>
{% endblock %}

View File

@ -1,125 +0,0 @@
{% extends 'base.html' %}
{% load mytags %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-lg-10">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5> IDC详细信息列表</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">
<li><a href="#">未启用 1</a>
</li>
<li><a href="#">未启用 2</a>
</li>
</ul>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<div class="ibox-content">
<div class="">
{% ifequal session_role_id 2 %}
<a target="_blank" href="/jasset/idc_add" class="btn btn-sm btn-primary "> 添加IDC </a>
{% endifequal %}
<form id="search_form" method="get" action="" class="pull-right mail-search">
<div class="input-group">
<input type="text" class="form-control input-sm" id="search_input" name="keyword" placeholder="Search">
<input type="text" style="display: none">
<div class="input-group-btn">
<button id='search_btn' type="submit" class="btn btn-sm btn-primary">
Search
</button>
</div>
</div>
</form>
</div>
<form id="contents_form" name="contents_form">
<table class="table table-striped table-bordered table-hover " id="editable" >
<thead>
<tr>
{% ifequal session_role_id 2 %}
<th class="text-center"><input id="checkall" type="checkbox" class="i-checks" name="checkall" value="checkall" data-editable='false' onclick="check_all('contents_form')"></th>
{% endifequal %}
<th class="text-center"> 机房名 </th>
<th class="text-center"> 主机数量 </th>
<th class="text-center"> 备注 </th>
<th class="text-center"> 操作 </th>
</tr>
</thead>
<tbody>
{% for post in contacts.object_list %}
<tr class="gradeX">
{% ifequal session_role_id 2 %}
<td class="text-center" name="j_id" value="{{ post.id }}" data-editable='false'><input name="id" value="{{ post.id }}" type="checkbox" class="i-checks"></td>
{% endifequal %}
<td class="text-center"> {{ post.name }} </td>
{% ifequal session_role_id 2 %}
<td class="text-center"> <a href="/jasset/idc_detail/?id={{ post.id }}">{{ post.asset_set.count }}</a> </td>
{% else %}
<td class="text-center"> <a href="/jasset/idc_detail/?id={{ post.id }}">{{ post|get_idc_count:dept }}</a> </td>
{% endifequal %}
<td class="text-center"> {{ post.comment }} </td>
<td class="text-center">
<a href="/jasset/idc_detail/?id={{ post.id }}" class="iframe btn btn-xs btn-primary">详情</a>
{% ifequal session_role_id 2 %}
<a href="/jasset/idc_edit/?id={{ post.id }}" class="btn btn-xs btn-info">编辑</a>
<a href="/jasset/idc_del/?id={{ post.id }}" class="btn btn-xs btn-danger">删除</a>
{% endifequal %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="row">
<div class="col-sm-6">
{% ifequal session_role_id 2 %}
<input type="button" id="del_button" class="btn btn-danger btn-sm" name="del_button" value="删除" onclick="del('contents_form')" />
<!--<input type="button" id="alter_button" class="btn btn-warning btn-sm" name="alter_button" value="修改" onclick="alter('contents_form')" />-->
{% endifequal %}
</div>
{% include 'paginator.html' %}
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
function del(form) {
var checkboxes = document.getElementById(form);
var id_list = {};
var j = 0;
for (var i = 0; i < checkboxes.elements.length; i++) {
if (checkboxes.elements[i].type == "checkbox" && checkboxes.elements[i].checked == true && checkboxes.elements[i].value != "checkall") {
id_list[j] = checkboxes.elements[i].value;
j++;
}
}
if (confirm("确定删除")) {
$.ajax({
type: "POST",
url: "/jasset/idc_del/?id=multi",
data: {"id_list": id_list, "len_list": j},
success: function (data) {
window.open("/jasset/idc_list/", "_self");
}
});
}
}
</script>
{% endblock %}

View File

@ -52,7 +52,7 @@
</tr>
</thead>
<tbody>
{% for group in contacts.object_list %}
{% for group in user_groups.object_list %}
<tr class="gradeX">
<td class="text-center">
<input type="checkbox" name="selected" value="{{ group.id }}">

View File

@ -109,30 +109,30 @@
<small><i class="fa fa-map-marker"></i> 这里包含了用户所有的主机组和组下的主机.</small>
</div>
<div class="ibox-content inspinia-timeline">
{% for group in user|get_user_asset_group %}
<div class="timeline-item">
<div class="row">
<div class="col-xs-3 date">
<i class="fa fa-repeat"></i>
<b><a href="/jperm/perm_list/?uid={{ user.id }}&agid={{ group.id }}">{{ group.name }}</a></b>
<br>
<small class="text-navy">共: {{ group | group_asset_list_count }}台</small>
</div>
<div class="col-xs-7 content no-top-border">
<p class="m-b-xs"><strong>{{ group.comment }}</strong></p>
<p>
{% for asset in group|group_asset_list %}
{{ asset.ip }}<br>
{% endfor %}
</p>
<p></p>
</div>
</div>
</div>
{% endfor %}
{% if not user|get_user_asset_group %}
(无)
{% endif %}
{# {% for group in user|get_user_asset_group %}#}
{# <div class="timeline-item">#}
{# <div class="row">#}
{# <div class="col-xs-3 date">#}
{# <i class="fa fa-repeat"></i>#}
{# <b><a href="/jperm/perm_list/?uid={{ user.id }}&agid={{ group.id }}">{{ group.name }}</a></b>#}
{# <br>#}
{# <small class="text-navy">共: {{ group | group_asset_list_count }}台</small>#}
{# </div>#}
{# <div class="col-xs-7 content no-top-border">#}
{# <p class="m-b-xs"><strong>{{ group.comment }}</strong></p>#}
{# <p>#}
{# {% for asset in group|group_asset_list %}#}
{# {{ asset.ip }}<br>#}
{# {% endfor %}#}
{# </p>#}
{# <p></p>#}
{# </div>#}
{# </div>#}
{# </div>#}
{# {% endfor %}#}
{# {% if not user|get_user_asset_group %}#}
{# (无)#}
{# {% endif %}#}
</div>
</div>
</div>
@ -154,7 +154,8 @@
<img alt="image" class="img-circle" src="/static/img/{{ session_role_id | to_avatar }}.png">
</a>
<div class="media-body ">
<small class="pull-right">{{ log.start_time|time_delta }}</small>
{# <small class="pull-right">{{ log.start_time|time_delta }}</small>#}
<small class="pull-right">{{ log.start_time }}</small>
<strong>{{ log.user }}</strong> 登录了 <span class="text-navy">{{ log.host }}. </span><br>
<small class="text-muted">{{ log.start_time|date:"Y-m-d H:i:s" }}</small>
</div>
@ -177,21 +178,18 @@
<img alt="image" class="img-circle" src="/static/img/{{ session_role_id | to_avatar }}.png">
</a>
<div class="media-body ">
<small class="pull-right">{{ log.start_time|time_delta }}</small>
<small class="pull-right">{{ log.start_time }}</small>
{# <small class="pull-right">{{ log.start_time|time_delta }}</small>#}
<strong>{{ log.user }}</strong> 登录了 <span class="text-navy">{{ log.host }}. </span><br>
<small class="text-muted">{{ log.start_time|date:"Y-m-d H:i:s" }}</small>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -54,7 +54,7 @@
</tr>
</thead>
<tbody>
{% for user in contacts.object_list %}
{% for user in users.object_list %}
<tr class="gradeX">
<td class="text-center">
<input type="checkbox" name="selected" value="{{ user.id }}">
@ -78,7 +78,7 @@
<div class="row">
<div class="col-sm-6">
<div class="dataTables_info" id="editable_info" role="status" aria-live="polite">
Showing {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries
Showing {{ users.start_index }} to {{ users.end_index }} of {{ p.count }} entries
</div>
</div>
{% include 'paginator.html' %}
@ -93,25 +93,27 @@
{% block self_head_css_js %}
<script>
$(document).ready(function(){
$(".iframe").on('click', function() {
var url = $(this).attr("value");
$.layer({
type: 2,
title: '用户详情',
maxmin: true,
shift: 'top',
border: [2, 0.3, '#1AB394'],
shade: [0.5, '#000000'],
shadeClose: true,
area: ['800px', '600px'],
iframe: {src: url}
})
});
{# $(".iframe").on('click', function() {#}
{# var url = $(this).attr("value");#}
{# $.layer({#}
{# type: 2,#}
{# title: '用户详情',#}
{# maxmin: true,#}
{# shift: 'top',#}
{# border: [2, 0.3, '#1AB394'],#}
{# shade: [0.5, '#000000'],#}
{# shadeClose: true,#}
{# area: ['800px', '600px'],#}
{# iframe: {src: url}#}
{# })#}
{# });#}
var check_array = [];
$('#del_btn').click(function(){
if (confirm("确定删除")) {
$(".gradeX input:checked").each(function() {check_array.push($(this).attr("value")) });
$(".gradeX input:checked").each(function() {
check_array.push($(this).attr("value"))
});
$.post("/juser/user_del_ajax/",
{ids: check_array.join(",")},
function(data){

View File

@ -18,12 +18,10 @@
<li id="jasset">
<a><i class="fa fa-cube"></i> <span class="nav-label">资产管理</span><span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li class="host_add host_add_multi"><a href="/jasset/host_add/">添加资产</a></li>
<li class="host_list host_detail host_edit"><a href="/jasset/host_list/">查看资产<span class="label label-info pull-right">{{ host_active_num }}/{{ host_total_num}}</span></a></li>
<li class="idc_add"><a href="/jasset/idc_add/">添加IDC</a></li>
<li class="idc_list idc_detail idc_edit"><a href="/jasset/idc_list/">查看IDC</a></li>
<li class="group_add"><a href="/jasset/group_add/">添加主机组</a></li>
<li class="group_list group_detail group_edit"><a href="/jasset/group_list/">查看主机组</a></li>
<li class="group_add"><a href="/jasset/group_add/">添加资产组</a></li>
<li class="group_list group_detail group_edit"><a href="/jasset/group_list/">查看资产组</a></li>
<li class="asset_add asset_add_multi"><a href="/jasset/asset_add/">添加资产</a></li>
<li class="host_list host_detail host_edit"><a href="/jasset/asset_list/">查看资产<span class="label label-info pull-right">{{ host_active_num }}/{{ host_total_num}}</span></a></li>
</ul>
</li>
<li id="jperm">

View File

@ -26,11 +26,11 @@
<img alt="image" class="img-circle" src="/static/img/a4.jpg">
</a>
<div class="media-body">
<small class="pull-right text-navy">{{ apply.date_add|naturaltime }}</small>
<strong>{{ apply.applyer }}</strong><br>
<small class="text-muted">主机组: {{ apply.bisgroup|ast_to_list }}</small><br/>
<small class="text-muted">主机: {{ apply.asset|ast_to_list }}</small><br/>
<small class="text-muted">申请时间: {{ apply.date_add|date:"Y-m-d H:i:s" }}</small>
{# <small class="pull-right text-navy">{{ apply.date_add|naturaltime }}</small>#}
{# <strong>{{ apply.applyer }}</strong><br>#}
{# <small class="text-muted">主机组: {{ apply.bisgroup|ast_to_list }}</small><br/>#}
{# <small class="text-muted">主机: {{ apply.asset|ast_to_list }}</small><br/>#}
{# <small class="text-muted">申请时间: {{ apply.date_add|date:"Y-m-d H:i:s" }}</small>#}
</div>
</div>
</li>

View File

@ -10,7 +10,7 @@
<strong class="font-bold">{{ session_user_id | to_name}} <span style="color: #8095a8"></span></strong>
</span>
<span class="text-muted text-xs block">
{{ session_role_id | to_role_name }} <b class="caret"></b>
{{ session_user_id | get_role }} <b class="caret"></b>
</span>
</span>
</a>