Merge branch 'wangyong' of gitcafe.com:ibuler/jumpserver into guanghongwei

Conflicts:
	jumpserver/templatetags/mytags.py
	juser/views.py
pull/6/head
root 2015-01-21 23:05:42 +08:00
commit 244d0d2ba4
32 changed files with 2302 additions and 111 deletions

View File

@ -4,8 +4,16 @@ from jasset.views import *
urlpatterns = patterns('',
url(r'^$', index),
url(r'jadd', jadd),
url(r'jlist', jlist),
url(r'jadd_idc', jadd_idc),
url(r'jlist_idc', jlist_idc),
url(r'^host_add/$', jadd_host),
url(r'^host_list/$', jlist_host),
url(r"^(\d+.\d+.\d+.\d+)/$",jlist_ip),
url(r'^idc_add/$', jadd_idc),
url(r'^idc_list/$', jlist_idc),
url(r'^idc_del/(\d+)/$', idc_del),
url(r'^group_add/$', jadd_group),
url(r'^group_list/$', jlist_group),
url(r'^group_del/(\d+)/$', group_del),
url(r'^host_del/(\d+.\d+.\d+.\d+)/$', host_del),
url(r'^host_edit/(\d+.\d+.\d+.\d+)/$', host_edit),
url(r'^test/$', test),
)

View File

@ -1,28 +1,25 @@
# coding:utf-8
import datetime
from django.shortcuts import render
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.core.paginator import Paginator, EmptyPage
from models import IDC, Asset, UserGroup
from models import IDC, Asset, BisGroup
from connect import PyCrypt, KEY
cryptor = PyCrypt(KEY)
def index(request):
return render_to_response('jasset/jasset.html', )
def jadd(request):
global j_passwd
def jadd_host(request):
login_types = {'L': 'LDAP', 'S': 'SSH_KEY', 'P': 'PASSWORD', 'M': 'MAP'}
header_title, path1, path2 = u'添加主机 | Add Host', u'资产管理', u'添加主机'
groups = []
cryptor = PyCrypt(KEY)
eidc = IDC.objects.all()
egroup = UserGroup.objects.all()
is_actived = {'active': 1, 'no_active': 0}
login_typed = {'LDAP': 'L', 'SSH_KEY': 'S', 'PASSWORD': 'P', 'MAP': 'M'}
egroup = BisGroup.objects.all()
if request.method == 'POST':
j_ip = request.POST.get('j_ip')
@ -32,56 +29,48 @@ def jadd(request):
j_group = request.POST.getlist('j_group')
j_active = request.POST.get('j_active')
j_comment = request.POST.get('j_comment')
if j_type == 'MAP':
j_user = request.POST.get('j_user')
j_password = cryptor.encrypt(request.POST.get('j_password'))
j_root = request.POST.get('j_root')
j_passwd = cryptor.encrypt(request.POST.get('j_passwd'))
j_idc = IDC.objects.get(name=j_idc)
for group in j_group:
c = UserGroup.objects.get(name=group)
c = BisGroup.objects.get(name=group)
groups.append(c)
if Asset.objects.filter(ip=str(j_ip)):
emg = u'该IP已存在!'
return render_to_response('jasset/jadd.html', {'emg': emg, 'j_ip': j_ip})
return render_to_response('jasset/host_add.html', locals(), context_instance=RequestContext(request))
elif j_type == 'MAP':
a = Asset(ip=j_ip,
port=j_port,
login_type=login_typed[j_type],
idc=j_idc,
is_active=int(is_actived[j_active]),
if j_type == 'M':
j_user = request.POST.get('j_user')
j_password = cryptor.encrypt(request.POST.get('j_password'))
j_root = request.POST.get('j_root')
j_passwd = cryptor.encrypt(request.POST.get('j_passwd'))
a = Asset(ip=j_ip, port=j_port,
login_type=j_type, idc=j_idc,
is_active=int(j_active),
comment=j_comment,
username_common=j_user,
password_common=j_password,
username_super=j_root,
password_super=j_passwd,)
else:
a = Asset(ip=j_ip,
port=j_port,
login_type=login_typed[j_type],
idc=j_idc,
is_active=int(is_actived[j_active]),
a = Asset(ip=j_ip, port=j_port,
login_type=j_type, idc=j_idc,
is_active=int(j_active),
comment=j_comment)
a.save()
a.group = groups
print 'ok'
a.bis_group = groups
a.save()
return render_to_response('jasset/jadd.html',
{'header_title': u'添加主机 | Add Host',
'path1': '资产管理',
'path2': '添加主机',
'eidc': eidc,
'egroup': egroup, }
)
smg = u'主机 %s 添加成功' %j_ip
return render_to_response('jasset/host_add.html', locals(), context_instance=RequestContext(request))
def jlist(request):
def jlist_host(request):
header_title, path1, path2 = u'查看主机 | List Host', u'资产管理', u'查看主机'
login_types = {'L': 'LDAP', 'S': 'SSH_KEY', 'P': 'PASSWORD', 'M': 'MAP'}
posts = contact_list = Asset.objects.all().order_by('ip')
print posts
paginator = Paginator(contact_list, 5)
p = paginator = Paginator(contact_list, 5)
try:
page = int(request.GET.get('page', '1'))
except ValueError:
@ -92,19 +81,125 @@ def jlist(request):
except (EmptyPage, InvalidPage):
contacts = paginator.page(paginator.num_pages)
return render_to_response('jasset/jlist.html',
{"contacts": contacts,
'p': paginator,
'posts': posts,
'header_title': u'查看主机 | List Host',
'path1': '资产管理',
'path2': '查看主机', },
context_instance=RequestContext(request))
return render_to_response('jasset/host_list.html', locals(), context_instance=RequestContext(request))
def host_del(request, offset):
Asset.objects.filter(ip=str(offset)).delete()
return HttpResponseRedirect('/jasset/host_list/')
def host_edit(request, offset):
actives = {1: u'激活', 0: u'禁用'}
login_types = {'L': 'LDAP', 'S': 'SSH_KEY', 'P': 'PASSWORD', 'M': 'MAP'}
header_title, path1, path2 = u'修改主机 | Edit Host', u'资产管理', u'修改主机'
groups, e_group = [], []
eidc = IDC.objects.all()
egroup = BisGroup.objects.all()
for g in Asset.objects.get(ip=offset).bis_group.all():
e_group.append(g)
post = Asset.objects.get(ip = str(offset))
if request.method == 'POST':
j_ip = request.POST.get('j_ip')
j_idc = request.POST.get('j_idc')
j_port = request.POST.get('j_port')
j_type = request.POST.get('j_type')
j_group = request.POST.getlist('j_group')
j_active = request.POST.get('j_active')
j_comment = request.POST.get('j_comment')
j_idc = IDC.objects.get(name=j_idc)
for group in j_group:
c = BisGroup.objects.get(name=group)
groups.append(c)
a = Asset.objects.get(ip=str(offset))
if j_type == 'M':
j_user = request.POST.get('j_user')
j_password = cryptor.encrypt(request.POST.get('j_password'))
j_root = request.POST.get('j_root')
j_passwd = cryptor.encrypt(request.POST.get('j_passwd'))
a.ip = j_ip
a.port = j_port
a.login_type = j_type
a.idc = j_idc
a.is_active = j_active
a.comment = j_comment
a.username_common = j_user
a.password_common = j_password
a.username_super = j_root
a.password_super = j_passwd
else:
a.ip = j_ip
a.port = j_port
a.idc = j_idc
a.login_type = j_type
a.is_active = j_active
a.comment = j_comment
a.save()
a.bis_group = groups
a.save()
smg = u'主机 %s 修改成功' %j_ip
return HttpResponseRedirect('/jasset/host_list')
return render_to_response('jasset/host_edit.html', locals(), context_instance=RequestContext(request))
def jlist_ip(request, offset):
header_title, path1, path2 = u'主机详细信息 | Host Detail.', u'资产管理', u'主机详情'
print offset
post = contact_list = Asset.objects.get(ip = str(offset))
return render_to_response('jasset/jlist_ip.html', locals(), context_instance=RequestContext(request))
def jadd_idc(request):
pass
header_title, path1, path2 = u'添加IDC | Add IDC', u'资产管理', u'添加IDC'
if request.method == 'POST':
j_idc = request.POST.get('j_idc')
j_comment = request.POST.get('j_comment')
print j_idc,j_comment
if IDC.objects.filter(name=j_idc):
emg = u'该IDC已存在!'
return render_to_response('jasset/idc_add.html', locals(), context_instance=RequestContext(request))
else:
smg = u'IDC:%s添加成功' %j_idc
IDC.objects.create(name=j_idc, comment=j_comment)
return render_to_response('jasset/idc_add.html', locals(), context_instance=RequestContext(request))
def jlist_idc(request):
pass
header_title, path1, path2 = u'查看IDC | List Host', u'资产管理', u'查看IDC'
posts = IDC.objects.all().order_by('id')
return render_to_response('jasset/idc_list.html', locals(), context_instance=RequestContext(request))
def idc_del(request, offset):
IDC.objects.filter(id=offset).delete()
return HttpResponseRedirect('/jasset/idc_list/')
def jadd_group(request):
header_title, path1, path2 = u'添加业务组 | Add Group', u'资产管理', u'添加业务组'
if request.method == 'POST':
j_group = request.POST.get('j_group')
j_comment = request.POST.get('j_comment')
if BisGroup.objects.filter(name=j_group):
emg = u'该业务组已存在!'
return render_to_response('jasset/group_add.html', locals(), context_instance=RequestContext(request))
else:
smg = u'业务组%s添加成功' %j_group
BisGroup.objects.create(name=j_group, comment=j_comment)
return render_to_response('jasset/group_add.html', locals(), context_instance=RequestContext(request))
def jlist_group(request):
header_title, path1, path2 = u'查看业务组 | Add Group', u'资产管理', u'查看业务组'
posts = BisGroup.objects.all().order_by('id')
return render_to_response('jasset/group_list.html', locals(), context_instance=RequestContext(request))
def group_del(request, offset):
BisGroup.objects.filter(id=offset).delete()
return HttpResponseRedirect('/jasset/group_list/')
def test(request):
return render_to_response('jasset/test.html', locals())

View File

@ -8,7 +8,11 @@ password = mysql234
database = jumpserver
[ldap]
ldap_enable = 1
host_url = ldap://192.168.8.60:389
base_dn = dc=fengxing,dc=org
root_dn = cn=admin,dc=fengxing,dc=org
root_pw = 123456
ldap_enable = 0
host_url = ldap://127.0.0.1:389
base_dn = dc=jumpserver,dc=org
root_dn = cn=admin,dc=jumpserver,dc=org

View File

@ -34,3 +34,7 @@ def groups_str(username):
for group in user.user_group.all():
groups.append(group.name)
return ','.join(groups)
@register.filter(name='get_item')
def get_item(dictionary, key):
return dictionary.get(key)

View File

@ -107,7 +107,6 @@ class LDAPMgmt():
except ldap.LDAPError, e:
print e
def gen_sha512(salt, password):
return crypt.crypt(password, '$6$%s$' % salt)
@ -161,7 +160,6 @@ def user_list(request):
def db_add_user(**kwargs):
groups_post = kwargs.pop('groups')
user = User(**kwargs)
group_select = []
for group_id in groups_post:
group = UserGroup.objects.filter(id=group_id)
group_select.extend(group)

50
static/css/colorbox.css Executable file
View File

@ -0,0 +1,50 @@
/*
Colorbox Core Style:
The following CSS is consistent between example themes and should not be altered.
*/
#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
#cboxWrapper {max-width:none;}
#cboxOverlay{position:fixed; width:100%; height:100%;}
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
#cboxContent{position:relative;}
#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;}
#cboxTitle{margin:0;}
#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;}
.cboxIframe{width:100%; height:100%; display:block; border:0; padding:0; margin:0;}
#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;}
/*
User Style:
Change the following styles to modify the appearance of Colorbox. They are
ordered & tabbed in a way that represents the nesting of the generated HTML.
*/
#cboxOverlay{background:#fff; opacity: 0.9; filter: alpha(opacity = 90);}
#colorbox{outline:0;}
#cboxContent{margin-top:32px; overflow:visible; background:#000;}
.cboxIframe{background:#fff;}
#cboxError{padding:50px; border:1px solid #ccc;}
#cboxLoadedContent{background:#000; padding:1px;}
#cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;}
#cboxLoadingOverlay{background:#000;}
#cboxTitle{position:absolute; top:-22px; left:0; color:#000;}
#cboxCurrent{position:absolute; top:-22px; right:205px; text-indent:-9999px;}
/* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
#cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; text-indent:-9999px; width:20px; height:20px; position:absolute; top:-20px; background:url(images/controls.png) no-repeat 0 0;}
/* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
#cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;}
#cboxPrevious{background-position:0px 0px; right:44px;}
#cboxPrevious:hover{background-position:0px -25px;}
#cboxNext{background-position:-25px 0px; right:22px;}
#cboxNext:hover{background-position:-25px -25px;}
#cboxClose{background-position:-50px 0px; right:0;}
#cboxClose:hover{background-position:-50px -25px;}
.cboxSlideshow_on #cboxPrevious, .cboxSlideshow_off #cboxPrevious{right:66px;}
.cboxSlideshow_on #cboxSlideshow{background-position:-75px -25px; right:44px;}
.cboxSlideshow_on #cboxSlideshow:hover{background-position:-100px -25px;}
.cboxSlideshow_off #cboxSlideshow{background-position:-100px 0px; right:44px;}
.cboxSlideshow_off #cboxSlideshow:hover{background-position:-75px -25px;}

BIN
static/css/images/controls.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

BIN
static/css/images/loading.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,64 @@
/*! nice Validator 0.7.3
* (c) 2012-2014 Jony Zhang <zj86@live.cn>, MIT Licensed
* http://niceue.com/validator/
*/
.n-inline-block,.nice-validator input,.nice-validator select,.nice-validator textarea,.msg-wrap,.n-icon,.n-msg{display:inline-block;*display:inline;*zoom:1}
.msg-box{position:relative;*zoom:1}
.msg-wrap{position:relative;white-space:nowrap}
.msg-wrap,.n-icon,.n-msg{vertical-align:top}
.n-arrow{position:absolute;overflow:hidden;}
.n-arrow b,.n-arrow i{position:absolute;left:0;top:0;border:0;margin:0;padding:0;overflow:hidden;font-weight:400;font-style:normal;font-size:12px;font-family:serif;line-height:14px;_line-height:15px}
.n-arrow i{text-shadow:none}
.n-icon{width:16px;height:16px;overflow:hidden;background-repeat:no-repeat}
.n-msg{display:inline-block;line-height:15px;margin-left:2px;*margin-top:-1px;_margin-top:0;font-size:12px;font-family:simsun}
.n-error{color:#c33}
.n-ok{color:#390}
.n-tip,.n-loading{color:#808080}
.n-error .n-icon{background-position:0 0}
.n-ok .n-icon{background-position:-16px 0}
.n-tip .n-icon{background-position:-32px 0}
.n-loading .n-icon{background:url("images/loading.gif") 0 center no-repeat !important}
.n-top,.n-right,.n-bottom,.n-left{display:inline-block;line-height:0;vertical-align:top;outline:0}
.n-top .n-arrow,.n-bottom .n-arrow{height:6px;width:12px;left:8px}
.n-left .n-arrow,.n-right .n-arrow{width:6px;height:12px;top:6px}
.n-top{vertical-align:top;}
.n-top .msg-wrap{margin-bottom:6px}
.n-top .n-arrow{bottom:-6px;}
.n-top .n-arrow b{top:-6px}
.n-top .n-arrow i{top:-7px}
.n-bottom{vertical-align:bottom;}
.n-bottom .msg-wrap{margin-top:6px}
.n-bottom .n-arrow{top:-6px;}
.n-bottom .n-arrow b{top:-1px}
.n-bottom .n-arrow i{top:0}
.n-left .msg-wrap{right:100%;margin-right:6px}
.n-left .n-arrow{right:-6px;}
.n-left .n-arrow b{left:-6px}
.n-left .n-arrow i{left:-7px}
.n-right .msg-wrap{margin-left:6px}
.n-right .n-arrow{left:-6px;}
.n-right .n-arrow b{left:1px}
.n-right .n-arrow i{left:2px}
.n-default .n-left,.n-default .n-right{margin-top:5px}
.n-default .n-top .msg-wrap{bottom:100%}
.n-default .n-bottom .msg-wrap{top:100%}
.n-default .msg-wrap{position:absolute;z-index:1;}
.n-default .msg-wrap .n-icon{background-image:url("images/validator_default.png")}
.n-default .n-tip .n-icon{display:none}
.n-simple .msg-wrap{position:absolute;z-index:1;}
.n-simple .msg-wrap .n-icon{background-image:url("images/validator_simple.png")}
.n-simple .n-top .msg-wrap{bottom:100%}
.n-simple .n-bottom .msg-wrap{top:100%}
.n-simple .n-left,.n-simple .n-right{margin-top:5px}
.n-simple .n-bottom .msg-wrap{margin-top:3px}
.n-simple .n-tip .n-icon{display:none}
.n-yellow .msg-wrap{position:absolute;z-index:1;padding:4px 6px;font-size:12px;border:1px solid transparent;background-color:#fffcef;border-color:#ffbb76;color:#db7c22;box-shadow:0 1px 3px #ccc;border-radius:2px;}
.n-yellow .msg-wrap .n-arrow b{color:#ffbb76;text-shadow:0 0 2px #ccc}
.n-yellow .msg-wrap .n-arrow i{color:#fffcef}
.n-yellow .msg-wrap .n-icon{background-image:url("images/validator_simple.png")}
.n-yellow .n-top .msg-wrap{bottom:100%}
.n-yellow .n-bottom .msg-wrap{top:100%}
.n-yellow .n-tip,.n-yellow .n-ok,.n-yellow .n-loading{background-color:#f8fdff;border-color:#ddd;color:#333;box-shadow:0 1px 3px #ccc;}
.n-yellow .n-tip .n-arrow b,.n-yellow .n-ok .n-arrow b,.n-yellow .n-loading .n-arrow b{color:#ddd;text-shadow:0 0 2px #ccc}
.n-yellow .n-tip .n-arrow i,.n-yellow .n-ok .n-arrow i,.n-yellow .n-loading .n-arrow i{color:#f8fdff}
.n-yellow .n-tip .n-icon{display:none}

1090
static/js/jquery.colorbox.js Executable file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

File diff suppressed because one or more lines are too long

156
static/js/validator/zh_CN.js Executable file
View File

@ -0,0 +1,156 @@
/*********************************
* Themes, rules, and i18n support
* Locale: Chinese; 中文
*********************************/
(function(factory) {
if (typeof define === 'function') {
define(function(require, exports, module){
var $ = require('jquery');
$._VALIDATOR_URI = module.uri;
require('../src/jquery.validator')($);
factory($);
});
} else {
factory(jQuery);
}
}(function($) {
/* Global configuration
*/
$.validator.config({
//stopOnError: false,
//theme: 'yellow_right',
defaultMsg: "{0}格式不正确",
loadingMsg: "正在验证...",
// Custom rules
rules: {
digits: [/^\d+$/, "请输入数字"]
,letters: [/^[a-z]+$/i, "{0}只能输入字母"]
,tel: [/^(?:(?:0\d{2,3}[\- ]?[1-9]\d{6,7})|(?:[48]00[\- ]?[1-9]\d{6}))$/, "电话格式不正确"]
,mobile: [/^1[3-9]\d{9}$/, "手机号格式不正确"]
,email: [/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/i, "邮箱格式不正确"]
,qq: [/^[1-9]\d{4,}$/, "QQ号格式不正确"]
,date: [/^\d{4}-\d{1,2}-\d{1,2}$/, "请输入正确的日期,例:yyyy-mm-dd"]
,time: [/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/, "请输入正确的时间,例:14:30或14:30:00"]
,ID_card: [/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[A-Z])$/, "请输入正确的身份证号码"]
,url: [/^(https?|ftp):\/\/[^\s]+$/i, "网址格式不正确"]
,postcode: [/^[1-9]\d{5}$/, "邮政编码格式不正确"]
,chinese: [/^[\u0391-\uFFE5]+$/, "请输入中文"]
,username: [/^\w{3,12}$/, "请输入3-12位数字、字母、下划线"]
,password: [/^[0-9a-zA-Z]{6,16}$/, "密码由6-16位数字、字母组成"]
,accept: function (element, params){
if (!params) return true;
var ext = params[0];
return (ext === '*') ||
(new RegExp(".(?:" + (ext || "png|jpg|jpeg|gif") + ")$", "i")).test(element.value) ||
this.renderMsg("只接受{1}后缀", ext.replace('|', ','));
}
}
});
/* Default error messages
*/
$.validator.config({
messages: {
required: "{0}不能为空",
remote: "{0}已被使用",
integer: {
'*': "请输入整数",
'+': "请输入正整数",
'+0': "请输入正整数或0",
'-': "请输入负整数",
'-0': "请输入负整数或0"
},
match: {
eq: "{0}与{1}不一致",
neq: "{0}与{1}不能相同",
lt: "{0}必须小于{1}",
gt: "{0}必须大于{1}",
lte: "{0}必须小于或等于{1}",
gte: "{0}必须大于或等于{1}"
},
range: {
rg: "请输入{1}到{2}的数",
gte: "请输入大于或等于{1}的数",
lte: "请输入小于或等于{1}的数"
},
checked: {
eq: "请选择{1}项",
rg: "请选择{1}到{2}项",
gte: "请至少选择{1}项",
lte: "请最多选择{1}项"
},
length: {
eq: "请输入{1}个字符",
rg: "请输入{1}到{2}个字符",
gte: "请至少输入{1}个字符",
lte: "请最多输入{1}个字符",
eq_2: "",
rg_2: "",
gte_2: "",
lte_2: ""
}
}
});
/* Themes
*/
var TPL_ARROW = '<span class="n-arrow"><b>◆</b><i>◆</i></span>';
$.validator.setTheme({
'simple_right': {
formClass: 'n-simple',
msgClass: 'n-right'
},
'simple_bottom': {
formClass: 'n-simple',
msgClass: 'n-bottom'
},
'yellow_top': {
formClass: 'n-yellow',
msgClass: 'n-top',
msgArrow: TPL_ARROW
},
'yellow_right': {
formClass: 'n-yellow',
msgClass: 'n-right',
msgArrow: TPL_ARROW
},
'yellow_right_effect': {
formClass: 'n-yellow',
msgClass: 'n-right',
msgArrow: TPL_ARROW,
msgShow: function($msgbox, type){
var $el = $msgbox.children();
if ($el.is(':animated')) return;
if (type === 'error') {
$el.css({
left: '20px',
opacity: 0
}).delay(100).show().stop().animate({
left: '-4px',
opacity: 1
}, 150).animate({
left: '3px'
}, 80).animate({
left: 0
}, 80);
} else {
$el.css({
left: 0,
opacity: 1
}).fadeIn(200);
}
},
msgHide: function($msgbox, type){
var $el = $msgbox.children();
$el.stop().delay(100).show().animate({
left: '20px',
opacity: 0
}, 300, function(){
$msgbox.hide();
});
}
}
});
}));

View File

@ -10,6 +10,7 @@
<link rel="shortcut icon" href="/static/img/facio.ico" type="image/x-icon">
{% include 'link_css.html' %}
{% include 'script.html' %}
</head>
@ -26,7 +27,7 @@
</div>
</div>
{% include 'script.html' %}
<!--{% include 'script.html' %}-->
</body>
</html>

33
templates/css_js.html Normal file
View File

@ -0,0 +1,33 @@
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/font-awesome/css/font-awesome.css" rel="stylesheet">
<link href="/static/css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="/static/css/animate.css" rel="stylesheet">
<link href="/static/css/style.css" rel="stylesheet">
<link href="/static/css/colorbox.css" rel="stylesheet">
<!-- Mainly scripts -->
<script src="/static/js/jquery-2.1.1.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
<script src="/static/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/static/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!-- Peity -->
<script src="/static/js/plugins/peity/jquery.peity.min.js"></script>
<!-- Custom and plugin javascript -->
<script src="/static/js/inspinia.js"></script>
<script src="/static/js/plugins/pace/pace.min.js"></script>
<!-- iCheck -->
<script src="/static/js/plugins/iCheck/icheck.min.js"></script>
<!-- Peity -->
<script src="/static/js/demo/peity-demo.js"></script>
<!-- pop windows -->
<script src="/static/js/jquery.colorbox.js"></script>
<script>
$(document).ready(function(){
$(".iframe").colorbox({iframe:true, width:"90%", height:"90%"});
});
</script>

View File

@ -0,0 +1,80 @@
{% 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> 填写业务组基本信息 </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"> 业务组名 </label>
<div class="col-sm-8"><input type="text" value="{{ j_group }}" placeholder="网站" name="j_group" 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="{{ 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" type="submit"> 提交 </button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
$('#assetForm').validator({
timely: 2,
theme: "yellow_right_effect",
fields: {
"j_group": {
rule: "required",
tip: "输入业务组名",
ok: "",
msg: {required: "业务组名必须填写!"},
data: {'data-ok':"业务组名可以使用"}
}
},
valid: function(form) {
form.submit();
}
});
</script>
{% endblock %}

View File

@ -0,0 +1,65 @@
{% 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 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="">
<a target="_blank" href="/jasset/group_add" class="btn btn-sm btn-primary "> 添加 </a>
</div>
<table class="table table-striped table-bordered table-hover " id="editable" >
<thead>
<tr>
<th class="text-center"> ID </th>
<th class="text-center"> 机房名 </th>
<th class="text-center"> 备注 </th>
<th class="text-center"> 操作 </th>
</tr>
</thead>
<tbody>
{% for post in posts %}
<tr class="gradeX">
<td class="text-center"> {{ post.id }} </td>
<td class="text-center"> {{ post.name }} </td>
<td class="text-center"> {{ post.comment }} </td>
<td class="text-center">
<a href="/jasset/{{ post.ip }}/" class="iframe btn btn-xs btn-primary">详情</a>
<a href="/jasset/host_edit/{{ post.ip }}" class="btn btn-xs btn-info">编辑</a>
<a href="/jasset/group_del/{{ post.id }}" class="btn btn-xs btn-danger">删除</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -5,7 +5,13 @@
<div class="row">
<div class="col-lg-10">
<div class="ibox float-e-margins">
<div class="ibox-title">
<div class="text-center">
<span>请选择添加内容: </span>
<a href="#" class="btn btn-xs btn-primary" id="addhost">添加主机</a>
<a href="#" class="btn btn-xs btn-primary" id="addidc">添加IDC</a>
<a href="#" class="btn btn-xs btn-primary" id="addbis">添加业务组</a>
</div>
<div id="ibox-content" class="ibox-title">
<h5> 填写主机基本信息 </h5>
<div class="ibox-tools">
<a class="collapse-link">
@ -30,49 +36,51 @@
{% if emg %}
<div class="alert alert-warning text-center">{{ emg }}</div>
{% endif %}
<form method="post" class="form-horizontal">
{% 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"> IP地址 </label>
<div class="col-sm-8"><input type="text" value="{{ j_ip }}" placeholder="192.168.1.1" name="j_ip" class="form-control"></div>
<div class="col-sm-8"><input type="text" name="j_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"> 端口号 </label>
<div class="col-sm-8"><input type="text" value="{{ s_port }}" placeholder="22" name="j_port" class="form-control"></div>
<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"> 登录方式 </label>
<div class="col-sm-8">
<div class="radio i-checks"><label> <input type="radio" checked="" value="LDAP" name="j_type" onclick="show(this)"> <i> LDAP </i></label></div>
<div class="radio i-checks"><label> <input type="radio" value="SSH_KEY" name="j_type" onclick="show(this)"> <i> SSH_KEY </i></label></div>
<div class="radio i-checks"><label> <input type="radio" value="PASSWORD" name="j_type" onclick="show(this)"> <i> PASSWORD </i></label></div>
<div class="radio i-checks"><label> <input type="radio" value="MAP" name="j_type" onclick="show(this)"> <i> MAP </i></label></div>
<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="S" value="S" name="j_type" onclick="show(this)"> <i> SSH_KEY </i></label></div>
<div class="radio i-checks"><label> <input type="radio" id="P" value="P" name="j_type" onclick="show(this)"> <i> PASSWORD </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" value="{{ j_user }}" name="j_user" placeholder="lilei" class="form-control"></div>
<div class="col-sm-6"><input type="text" name="j_user" placeholder="lilei" class="form-control"></div>
</div>
<div class="hr-line-dashed"></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" value="{{ j_password }}" name="j_password" placeholder="Password" class="form-control"></div>
<div class="col-sm-6"><input type="password" name="j_password" placeholder="Password" class="form-control"></div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group"><label class="col-sm-2 col-sm-offset-1 control-label"> 超管用户名 </label>
<div class="col-sm-6"><input type="text" value="{{ j_root }}" name="j_root" placeholder="root" class="form-control"></div>
<div class="col-sm-6"><input type="text" name="j_root" placeholder="root" class="form-control"></div>
</div>
<div class="hr-line-dashed"></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" value="{{ j_passwd }}" name="j_passwd" placeholder="Password" class="form-control"></div>
<div class="col-sm-6"><input type="password" name="j_passwd" placeholder="Password" class="form-control"></div>
</div>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="j_idc" class="col-lg-2 control-label"> 所属IDC </label>
@ -98,8 +106,8 @@
<div class="hr-line-dashed"></div>
<div class="form-group"><label class="col-sm-2 control-label"> 是否激活 </label>
<div class="col-sm-8">
<div class="radio i-checks"><label> <input type="radio" checked="" value="active" name="j_active"> <i> 激活 </i></label></div>
<div class="radio i-checks"><label> <input type="radio" value="no_active" name="j_active"> <i> 禁用 </i></label></div>
<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>
</div>
@ -111,7 +119,7 @@
<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-white" type="submit"> 重置 </button>-->
<button class="btn btn-primary" type="submit"> 提交 </button>
</div>
</div>
@ -122,19 +130,74 @@
</div>
</div>
<script>
var showFlag={};
function show(o){
showFlag[o.name]=o.value;
if(showFlag.j_type=="MAP"){
if(showFlag.j_type=="M"){
document.getElementById("a1").style.display="";
}
else{
document.getElementById("a1").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_group": {
rule: "checked",
tip: "选择业务组",
ok: "",
msg: {checked: "至少选择一个组"}
},
"j_user": {
rule: "required(type_m)",
tip: "普通用户名",
ok: "",
msg: {required: "请填写用户名"}
},
"j_password": {
rule: "required(type_m);length[6~16]",
tip: "密码6-16位",
ok: "",
msg: {required: "6-16位"}
},
"j_root": {
rule: "required(type_m)",
tip: "超管用户名",
ok: "",
msg: {required: "请填写用户名"}
},
"j_passwd": {
rule: "required(type_m);length[6~16]",
tip: "密码6-16位",
ok: "",
msg: {required: "6-16位"}
}
},
valid: function(form) {
form.submit();
}
});
</script>

View File

@ -0,0 +1,215 @@
{% 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地址 </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"> 端口号 </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"> 登录方式 </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" id="{{ t }}" checked value="{{ t }}" name="j_type" onclick="show(this)"> <i> {{ type }} </i></label></div>
{% else %}
<div class="radio i-checks"><label> <input type="radio" id="{{ t }}" value="{{ t }}" name="j_type" onclick="show(this)"> <i> {{ type }} </i></label></div>
{% endifequal %}
{% endfor %}
</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" value="{{ post.username_common }}" name="j_user" placeholder="lilei" class="form-control"></div>
</div>
<div class="hr-line-dashed"></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" value="{{ post.password_common }}" name="j_password" placeholder="Password" class="form-control"></div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group"><label class="col-sm-2 col-sm-offset-1 control-label"> 超管用户名 </label>
<div class="col-sm-6"><input type="text" value="{{ post.username_super }}" name="j_root" placeholder="root" class="form-control"></div>
</div>
<div class="hr-line-dashed"></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" value="{{ post.password_super }}" name="j_passwd" placeholder="Password" class="form-control"></div>
</div>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="j_idc" class="col-lg-2 control-label"> 所属IDC </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 selected> {{ i }} </option>
{% else %}
<option> {{ i }} </option>
{% endifequal %}
{% endfor %}
</select>
</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-8">
{% for g in egroup %}
{% if g in e_group %}
<label class="checkbox-inline"><input type="checkbox" id="j_group" checked value="{{ g }}" name="j_group"> {{ g }} </label>
{% else %}
<label class="checkbox-inline"><input type="checkbox" id="j_group" value="{{ g }}" name="j_group"> {{ g }} </label>
{% endif %}
{% 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">
{% 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"> 提交 </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("a1").style.display="";
}
else{
document.getElementById("a1").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_group": {
rule: "checked",
tip: "选择业务组",
ok: "",
msg: {checked: "至少选择一个组"}
},
"j_user": {
rule: "required(type_m)",
tip: "普通用户名",
ok: "",
msg: {required: "请填写用户名"}
},
"j_password": {
rule: "required(type_m);length[6~16]",
tip: "密码6-16位",
ok: "",
msg: {required: "6-16位"}
},
"j_root": {
rule: "required(type_m)",
tip: "超管用户名",
ok: "",
msg: {required: "请填写用户名"}
},
"j_passwd": {
rule: "required(type_m);length[6~16]",
tip: "密码6-16位",
ok: "",
msg: {required: "6-16位"}
}
},
valid: function(form) {
form.submit();
}
});
</script>
{% endblock %}

View File

@ -1,10 +1,11 @@
{% 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="col-lg-12">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5> 主机详细信息列表 </h5>
@ -29,35 +30,43 @@
<div class="ibox-content">
<div class="">
<a onclick="fnClickAddRow();" href="javascript:void(0);" class="btn btn-primary "> 添加 </a>
<a target="_blank" href="/jasset/host_add" class="btn btn-sm btn-primary "> 添加 </a>
</div>
<table class="table table-striped table-bordered table-hover " id="editable" >
<thead>
<tr>
<th> IP地址 </th>
<th> 端口号 </th>
<th> 登录方式 </th>
<th> 所属IDC </th>
<th> 所属业务组 </th>
<th> 添加时间 </th>
<th> 备注 </th>
<th class="text-center"><input type="checkbox" class="i-checks" name=""></th>
<th class="text-center"> IP地址 </th>
<th class="text-center"> 端口号 </th>
<th class="text-center"> 登录方式 </th>
<th class="text-center"> 所属IDC </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 %}
<tr class="gradeX">
<td> {{ post.ip }} </td>
<td> {{ post.port }} </td>
<td> {{ post.login_type}} </td>
<td class="center"> {{ post.idc.name }} </td>
<td class="center">
{% for group in post.group.all %}
<td class="text-center"><input type="checkbox" class="i-checks" name=""></td>
<td class="text-center"> {{ post.ip }} </td>
<td class="text-center"> {{ post.port }} </td>
<td class="text-center"> {{ login_types|get_item:post.login_type }} </td>
<td class="text-center"> {{ post.idc.name }} </td>
<td class="text-center">
{% for group in post.bis_group.all %}
{{ group }}
{% endfor %}
</td>
<td class="center"> {{ post.date_added }} </td>
<td class="center"> {{ post.comment }} </td>
<td class="text-center"> {{ post.date_added }} </td>
<td class="text-center"> {{ post.comment }} </td>
<td class="text-center">
<a href="/jasset/{{ post.ip }}/" class="iframe btn btn-xs btn-primary">详情</a>
<a href="/jasset/host_edit/{{ post.ip }}" class="btn btn-xs btn-info">编辑</a>
<a href="/jasset/host_del/{{ post.ip }}" class="btn btn-xs btn-danger">删除</a>
</td>
</tr>
{% endfor %}
</tbody>
@ -85,4 +94,10 @@
</div>
</div>
<script>
$(document).ready(function(){
$(".iframe").colorbox({iframe:true, width:"70%", height:"70%"});
});
</script>
{% endblock %}

View File

@ -0,0 +1,79 @@
{% 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名 </label>
<div class="col-sm-8"><input type="text" value="{{ j_ip }}" 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="{{ s_port }}" 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

@ -0,0 +1,65 @@
{% 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 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="">
<a target="_blank" href="/jasset/idc_add" class="btn btn-sm btn-primary "> 添加 </a>
</div>
<table class="table table-striped table-bordered table-hover " id="editable" >
<thead>
<tr>
<th class="text-center"> ID </th>
<th class="text-center"> 机房名 </th>
<th class="text-center"> 备注 </th>
<th class="text-center"> 操作 </th>
</tr>
</thead>
<tbody>
{% for post in posts %}
<tr class="gradeX">
<td class="text-center"> {{ post.id }} </td>
<td class="text-center"> {{ post.name }} </td>
<td class="text-center"> {{ post.comment }} </td>
<td class="text-center">
<a href="/jasset/{{ post.ip }}/" class="iframe btn btn-xs btn-primary">详情</a>
<a href="/jasset/host_edit/{{ post.ip }}" class="btn btn-xs btn-info">编辑</a>
<a href="/jasset/idc_del/{{ post.id }}" class="btn btn-xs btn-danger">删除</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,60 @@
<html>
<head>
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/font-awesome/css/font-awesome.css" rel="stylesheet">
<link href="/static/css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="/static/css/animate.css" rel="stylesheet">
<link href="/static/css/style.css" rel="stylesheet">
<link href="/static/css/colorbox.css" rel="stylesheet">
<!-- Mainly scripts -->
<script src="/static/js/jquery-2.1.1.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
<script src="/static/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/static/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<style type="text/css">
body
{
background: #FFFFFF;
}
</style>
</head>
<body>
<div class="row">
<div class="contact-box">
<h2 class="text-center">{{ offset }}主机详情</h2>
<table class="table table-striped table-bordered table-hover " id="editable" >
<thead>
<tr>
<th> IP地址 </th>
<th> 端口号 </th>
<th> 登录方式 </th>
<th> 所属IDC </th>
<th> 所属业务组 </th>
<th> 添加时间 </th>
<th> 备注 </th>
</tr>
</thead>
<tbody>
<tr class="gradeX">
<td> <a class="iframe" href="/jasset/{{ post.ip }}/">{{ post.ip }}</a></td>
<td> {{ post.port }} </td>
<td> {{ post.get_login_type}} </td>
<td class="center"> {{ post.idc.name }} </td>
<td class="center">
{% for group in post.bis_group.all %}
{{ group }}
{% endfor %}
</td>
<td class="center"> {{ post.date_added }} </td>
<td class="center"> {{ post.comment }} </td>
</tr>
</tbody>
</table>
<a> 是否激活: {{ post.is_active }}</a>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,30 @@
<div id="result" class="tip-ok" style="display:none">提交成功</div>
<form id="signup_form" class="signup" autocomplete="off">
<fieldset>
<div class="form-item">
<div class="field-name">全名</div>
<div class="field-input">
<input type="text" name="user[name]" maxlength="20" autocomplete="off">
</div>
</div>
<div class="form-item">
<div class="field-name">电子邮件地址</div>
<div class="field-input">
<input type="text" name="user[email]" autocomplete="off">
</div>
</div>
<div class="form-item">
<div class="field-name">创建密码</div>
<div class="field-input">
<input type="password" name="user[user_password]">
</div>
</div>
<div class="form-item">
<div class="field-name">选择你的用户名</div>
<div class="field-input">
<input type="text" name="user[screen_name]" maxlength="15" autocomplete="off">
</div>
</div>
</fieldset>
<button id="btn-submit" class="btn-submit" type="submit">创建我的账号</button>
</form>

View File

@ -3,3 +3,5 @@
<link href="/static/css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="/static/css/animate.css" rel="stylesheet">
<link href="/static/css/style.css" rel="stylesheet">
<link href="/static/css/colorbox.css" rel="stylesheet">
<link href="/static/css/vaildator/jquery.validator.css" rel="stylesheet">

View File

@ -23,10 +23,12 @@
<li>
<a href="mailbox.html"><i class="fa fa-cube"></i> <span class="nav-label">资产管理</span><span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li><a href="/jasset/jlist/">查看资产</a></li>
<li><a href="/jasset/jadd/">添加资产</a></li>
<li><a href="/idc/showlist/">查看机房</a></li>
<li><a href="/idc/add/">添加机房</a></li>
<li><a href="/jasset/host_list/">查看资产</a></li>
<li><a href="/jasset/host_add/">添加资产</a></li>
<li><a href="/jasset/idc_list/">查看机房</a></li>
<li><a href="/jasset/idc_add/">添加机房</a></li>
<li><a href="/jasset/group_list/">查看业务组</a></li>
<li><a href="/jasset/group_add/">添加业务组</a></li>
</ul>
</li>
<li>

View File

@ -17,12 +17,19 @@
<!-- Peity -->
<script src="/static/js/demo/peity-demo.js"></script>
<script>
$(document).ready(function(){
$('.i-checks').iCheck({
checkboxClass: 'icheckbox_square-green',
radioClass: 'iradio_square-green',
});
});
<!--<script>-->
<!--$(document).ready(function(){-->
<!--$('.i-checks').iCheck({-->
<!--checkboxClass: 'icheckbox_square-green',-->
<!--radioClass: 'iradio_square-green',-->
<!--});-->
<!--});-->
</script>
<!--</script>-->
<!-- pop windows -->
<script src="/static/js/jquery.colorbox.js"></script>
<!-- validator js -->
<script src="/static/js/validator/jquery.validator.js"></script>
<script src="/static/js/validator/zh_CN.js"></script>