Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
6c70d5bf
Commit
6c70d5bf
authored
Feb 01, 2015
by
halcyon
Browse files
Options
Browse Files
Download
Plain Diff
批量添加删除功能实现,修改资产添加修改等
parents
05603327
7adbf52a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
514 additions
and
131 deletions
+514
-131
urls.py
jasset/urls.py
+4
-1
views.py
jasset/views.py
+0
-0
urls.py
jlog/urls.py
+1
-1
views.py
jlog/views.py
+7
-5
mytags.py
jumpserver/templatetags/mytags.py
+11
-0
views.py
jumpserver/views.py
+14
-9
base.html
templates/base.html
+2
-2
foot_script.html
templates/foot_script.html
+2
-56
head_script.html
templates/head_script.html
+54
-0
group_detail.html
templates/jasset/group_detail.html
+152
-0
group_list.html
templates/jasset/group_list.html
+3
-2
host_add.html
templates/jasset/host_add.html
+0
-0
host_add_multi.html
templates/jasset/host_add_multi.html
+68
-0
host_edit.html
templates/jasset/host_edit.html
+15
-25
host_list.html
templates/jasset/host_list.html
+26
-27
idc_detail.html
templates/jasset/idc_detail.html
+151
-0
idc_list.html
templates/jasset/idc_list.html
+3
-2
log_list.html
templates/jlog/log_list.html
+0
-0
nav.html
templates/nav.html
+1
-1
No files found.
jasset/urls.py
View file @
6c70d5bf
...
...
@@ -5,15 +5,18 @@ from jasset.views import *
urlpatterns
=
patterns
(
''
,
url
(
r'^$'
,
index
),
url
(
r'^host_add/$'
,
jadd_host
),
url
(
r'^host_add_multi/$'
,
jadd_host_multi
),
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_detail/(\d+)$'
,
idc_detail
),
url
(
r'^idc_del/(\d+)/$'
,
idc_del
),
url
(
r'^group_add/$'
,
jadd_group
),
url
(
r'^group_list/$'
,
jlist_group
),
url
(
r'^group_detail/(\d)/$'
,
group_detail
),
url
(
r'^group_del/(\d+)/$'
,
group_del
),
url
(
r'^host_del/(\
d
+)/$'
,
host_del
),
url
(
r'^host_del/(\
w
+)/$'
,
host_del
),
url
(
r'^host_edit/(\d+)$'
,
host_edit
),
url
(
r'^host_edit/batch/$'
,
batch_host_edit
),
url
(
r'^test/$'
,
test
),
...
...
jasset/views.py
View file @
6c70d5bf
This diff is collapsed.
Click to expand it.
jlog/urls.py
View file @
6c70d5bf
...
...
@@ -4,6 +4,6 @@ from jlog.views import *
urlpatterns
=
patterns
(
''
,
url
(
r'^$'
,
jlog_list
),
url
(
r'^log_list/$'
,
jlog_list
),
url
(
r'^log_list/
(\w+)/
$'
,
jlog_list
),
url
(
r'^log_kill/(\d+)'
,
jlog_kill
),
)
jlog/views.py
View file @
6c70d5bf
...
...
@@ -13,12 +13,14 @@ from jlog.models import Log
CONF
=
ConfigParser
.
ConfigParser
()
CONF
.
read
(
'
%
s/jumpserver.conf'
%
BASE_DIR
)
def
jlog_list
(
request
):
def
jlog_list
(
request
,
offset
=
'online'
):
header_title
,
path1
,
path2
=
u'查看日志 | Log List.'
,
u'查看日志'
,
u'日志列表'
web_socket_host
=
CONF
.
get
(
'websocket'
,
'web_socket_host'
)
online
=
Log
.
objects
.
filter
(
is_finished
=
0
)
offline
=
Log
.
objects
.
filter
(
is_finished
=
1
)
web_socket_host
=
CONF
.
get
(
'websocket'
,
'web_socket_host'
)
return
render_to_response
(
'jlog/log_list.html'
,
locals
())
return
render_to_response
(
'jlog/log_list.html'
,
locals
())
def
jlog_kill
(
request
,
offset
):
...
...
@@ -26,4 +28,4 @@ def jlog_kill(request, offset):
if
pid
:
os
.
kill
(
int
(
pid
),
9
)
Log
.
objects
.
filter
(
pid
=
pid
)
.
update
(
is_finished
=
1
,
end_time
=
datetime
.
now
())
return
render_to_response
(
'jlog/log_list.html'
,
locals
())
\ No newline at end of file
return
HttpResponseRedirect
(
'jlog/log_list.html'
,
locals
())
\ No newline at end of file
jumpserver/templatetags/mytags.py
View file @
6c70d5bf
...
...
@@ -5,6 +5,7 @@ from django import template
from
django.db.models
import
Q
from
juser.models
import
User
,
UserGroup
from
jperm.views
import
perm_user_asset
from
jasset.models
import
BisGroup
register
=
template
.
Library
()
...
...
@@ -75,6 +76,15 @@ def group_type_to_str(type_name):
}
return
group_types
.
get
(
type_name
)
@register.filter
(
name
=
'perm_asset_count'
)
def
perm_asset_count
(
user_id
):
return
len
(
perm_user_asset
(
user_id
))
@register.filter
(
name
=
'filter_private'
)
def
filter_private
(
group
):
agroup
=
[]
p
=
BisGroup
.
objects
.
get
(
name
=
'ALL'
)
[
agroup
.
append
(
g
)
for
g
in
group
if
g
!=
p
]
return
agroup
\ No newline at end of file
jumpserver/views.py
View file @
6c70d5bf
...
...
@@ -30,17 +30,23 @@ def jasset_group_add(name, comment, type):
BisGroup
.
objects
.
create
(
name
=
name
,
comment
=
comment
,
type
=
type
)
smg
=
u'业务组
%
s添加成功'
%
name
def
jasset_host_edit
(
j_ip
,
j_idc
,
j_port
,
j_type
,
j_group
,
j_active
,
j_comment
):
def
jasset_host_edit
(
j_id
,
j_ip
,
j_idc
,
j_port
,
j_type
,
j_group
,
j_active
,
j_comment
):
print
'ok'
groups
=
[]
is_active
=
{
u'是'
:
'1'
,
u'否'
:
'2'
}
login_types
=
{
'LDAP'
:
'L'
,
'SSH_KEY'
:
'S'
,
'PASSWORD'
:
'P'
,
'MAP'
:
'M'
}
for
group
in
j_group
:
for
group
in
j_group
[
0
]
.
split
():
print
group
.
strip
()
c
=
BisGroup
.
objects
.
get
(
name
=
group
.
strip
())
groups
.
append
(
c
)
j_type
=
login_types
[
j_type
]
print
j_type
j_idc
=
IDC
.
objects
.
get
(
name
=
j_idc
)
a
=
Asset
.
objects
.
get
(
ip
=
str
(
j_ip
))
print
j_idc
print
a
=
Asset
.
objects
.
get
(
id
=
j_id
)
print
'123'
if
j_type
==
'M'
:
a
.
ip
=
j_ip
a
.
port
=
j_port
...
...
@@ -48,10 +54,8 @@ def jasset_host_edit(j_ip, j_idc, j_port, j_type, j_group, j_active, j_comment):
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
a
.
username
=
j_user
a
.
password
=
j_password
else
:
a
.
ip
=
j_ip
a
.
port
=
j_port
...
...
@@ -59,11 +63,11 @@ def jasset_host_edit(j_ip, j_idc, j_port, j_type, j_group, j_active, j_comment):
a
.
login_type
=
j_type
a
.
is_active
=
is_active
[
j_active
]
a
.
comment
=
j_comment
a
.
save
()
a
.
bis_group
=
groups
a
.
save
()
def
login
(
request
):
"""登录界面"""
if
request
.
session
.
get
(
'username'
):
...
...
@@ -95,3 +99,4 @@ def login(request):
def
logout
(
request
):
request
.
session
.
delete
()
return
HttpResponseRedirect
(
'/login/'
)
templates/base.html
View file @
6c70d5bf
...
...
@@ -10,6 +10,7 @@
<link
rel=
"shortcut icon"
href=
"/static/img/facio.ico"
type=
"image/x-icon"
>
{% include 'link_css.html' %}
{% include 'head_script.html' %}
</head>
...
...
@@ -27,7 +28,6 @@
</div>
</div>
{#
<!--{% include 'script.html' %}-->
#}
</body>
{% include 'script.html' %}
{% include '
foot_
script.html' %}
</html>
templates/script.html
→
templates/
foot_
script.html
View file @
6c70d5bf
<!-- 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>
<script
src=
"/static/js/bootstrap-dialog.js"
></script>
<script
src=
"/static/js/mindmup-editabletable.js"
></script>
<script
src=
"/static/js/base.js"
></script>
<!-- Custom and plugin javascript -->
<script
src=
"/static/js/inspinia.js"
></script>
<script
src=
"/static/js/plugins/pace/pace.min.js"
></script>
<!-- iCheck box -->
<script
src=
"/static/js/plugins/iCheck/icheck.min.js"
></script>
{#
<script
src=
"/static/js/plugins/iCheck/icheck.min.js"
></script>
#}
<!-- Peity -->
<script
src=
"/static/js/plugins/peity/jquery.peity.min.js"
></script>
...
...
@@ -20,58 +18,6 @@
<!-- 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'
});
});
function
selectAll
(){
var
checklist
=
document
.
getElementsByName
(
"selected"
);
if
(
document
.
getElementById
(
"select_all"
).
checked
)
{
for
(
var
i
=
0
;
i
<
checklist
.
length
;
i
++
)
{
checklist
[
i
].
checked
=
1
;
}
}
else
{
for
(
var
j
=
0
;
j
<
checklist
.
length
;
j
++
)
{
checklist
[
j
].
checked
=
0
;
}
}
}
function
move
(
from
,
to
)
{
$
(
"#"
+
from
+
" option"
).
each
(
function
(){
if
(
$
(
this
).
prop
(
"selected"
)
==
true
)
{
$
(
"#"
+
to
).
append
(
this
);
}
});
}
function
move_all
(
from
,
to
){
$
(
"#"
+
from
).
children
().
each
(
function
(){
$
(
"#"
+
to
).
append
(
this
);
});
}
</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>
<!-- active menu -->
<script>
var
str
=
document
.
location
.
pathname
.
split
(
"/"
)[
1
];
...
...
templates/head_script.html
0 → 100644
View file @
6c70d5bf
<script
src=
"/static/js/jquery-2.1.1.js"
></script>
<script
src=
"/static/js/bootstrap.min.js"
></script>
<script
src=
"/static/js/base.js"
></script>
<!--<script>-->
<!--$(document).ready(function(){-->
<!--$('.i-checks').iCheck({-->
<!--checkboxClass: 'icheckbox_square-green',-->
<!--radioClass: 'iradio_square-green'-->
<!--});-->
<!--});-->
<!--function selectAll(){-->
<!--var checklist = document.getElementsByName ("selected");-->
<!--if(document.getElementById("select_all").checked)-->
<!--{-->
<!--for(var i=0;i<checklist.length;i++)-->
<!--{-->
<!--checklist[i].checked = 1;-->
<!--}-->
<!--}else{-->
<!--for(var j=0;j<checklist.length;j++)-->
<!--{-->
<!--checklist[j].checked = 0;-->
<!--}-->
<!--}-->
<!--}-->
<!--function move(from, to) {-->
<!--$("#"+from+" option").each(function(){-->
<!--if ( $(this).prop("selected") == true ) {-->
<!--$("#"+to).append(this);-->
<!--}-->
<!--});-->
<!--}-->
<!--function move_all(from, to){-->
<!--$("#"+from).children().each(function(){-->
<!--$("#"+to).append(this);-->
<!--});-->
<!--}-->
</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>
templates/jasset/group_detail.html
0 → 100644
View file @
6c70d5bf
{% 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>
主机组
<span
class=
"text-info"
>
{{ group_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"
>
<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"
name=
"j_idc"
>
所属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"
>
{{ login_types|get_item:post.login_type }}
</td>
<td
class=
"text-center"
name=
"j_idc"
>
{{ post.idc.name }}
</td>
<td
class=
"text-center"
name=
"j_group"
>
{% for group in post.bis_group.all %} {{ group }} {% endfor %}
</td>
<td
class=
"text-center"
name=
"j_active"
>
{{ post.is_active|bool2str }}
</td>
<td
class=
"text-center"
>
{{ post.date_added|date:"Y-m-d H:i:s" }}
</td>
<td
class=
"text-center"
name=
"j_comment"
>
{{ post.comment }}
</td>
<td
class=
"text-center"
data-editable=
'false'
>
<a
href=
"/jasset/{{ post.ip }}/"
class=
"iframe btn btn-xs btn-primary"
>
详情
</a>
<a
href=
"/jasset/host_edit/{{ post.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
href=
"/jasset/host_del/{{ post.id }}"
class=
"btn btn-xs btn-danger"
>
删除
</a>
</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 contacts.has_previous %}
<li><a
href=
"?page={{ contacts.previous_page_number }}"
>
«
</a></li>
{% endif %}
{% for page in p.page_range %}
{% ifequal offset1 page %}
<li
class=
"active"
><a
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% else %}
<li><a
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% endifequal %}
{% endfor %}
{% if contacts.has_next %}
<li><a
href=
"?page={{ contacts.next_page_number }}"
>
»
</a></li>
{% endif %}
</ul>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
$
(
document
).
ready
(
function
(){
$
(
".iframe"
).
colorbox
({
iframe
:
true
,
width
:
"70%"
,
height
:
"70%"
});
$
(
'#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
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/host_del/"
,
data
:
{
"id_list"
:
id_list
,
"len_list"
:
j
},
success
:
function
(
data
)
{
window
.
open
(
"/jasset/host_list/"
,
"_self"
);
}
});
}
}
</script>
{% endblock %}
\ No newline at end of file
templates/jasset/group_list.html
View file @
6c70d5bf
...
...
@@ -22,6 +22,7 @@
<tr>
<th
class=
"text-center"
>
ID
</th>
<th
class=
"text-center"
>
主机组名
</th>
<th
class=
"text-center"
>
主机数量
</th>
<th
class=
"text-center"
>
备注
</th>
<th
class=
"text-center"
>
操作
</th>
</tr>
...
...
@@ -31,10 +32,10 @@
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
{{ post.id }}
</td>
<td
class=
"text-center"
>
{{ post.name }}
</td>
<td
class=
"text-center"
>
<a
href=
"/jasset/group_detail/{{ post.id }}"
>
{{ post.asset_set.count }}
</a>
</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_detail/{{ post.id }}"
class=
"btn btn-xs btn-info"
>
详情
</a>
<a
href=
"/jasset/group_del/{{ post.id }}"
class=
"btn btn-xs btn-danger"
>
删除
</a>
</td>
</tr>
...
...
templates/jasset/host_add.html
View file @
6c70d5bf
This diff is collapsed.
Click to expand it.
templates/jasset/host_add_multi.html
0 → 100644
View file @
6c70d5bf
{% 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"
>
<div
class=
"panel blank-panel"
>
<div
class=
"panel-options"
>
<ul
class=
"nav nav-tabs"
>
<li><a
href=
"/jasset/host_add/"
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
单台添加
</a></li>
<li
class=
"active"
><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
id=
"tab-2"
class=
"ibox float-e-margins tab-pane active"
>
{% if emg %}
<div
class=
"alert alert-warning text-center"
>
{{ emg }}
</div>
{% endif %}
{% if smg %}
<div
class=
"alert alert-success text-center"
>
{{ smg }}
</div>
{% endif %}
<h4>
按照文本框内主机信息格式填写, 多台主机回车换行
</h4>
<form
id=
"assetMulti"
method=
"post"
class=
"form-horizontal"
>
<div><textarea
id=
"j_multi"
name=
"j_multi"
type=
"text"
placeholder=
"192.168.1.1 22 LDAP 北京联通 [网站,数据库] admin 1 网站服务器"
class=
"form-control"
style=
"width:700px;height:500px"
></textarea></div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<div
class=
"col-sm-4 col-sm-offset-4"
>
<button
class=
"btn btn-white"
type=
"submit"
>
重置
</button>
<button
class=
"btn btn-primary"
type=
"submit"
>
提交
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
\ No newline at end of file
templates/jasset/host_edit.html
View file @
6c70d5bf
...
...
@@ -35,17 +35,17 @@
<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=
"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"
>
端口号
</label>
<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"
>
登录方式
</label>
<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 %}
...
...
@@ -61,27 +61,15 @@
<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"
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"
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"
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>
<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 %}
...
...
@@ -97,20 +85,22 @@
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<label
for=
"j_group"
class=
"col-
sm-2 control-label"
>
所属业务组
</label>
<label
for=
"j_group"
class=
"col-
lg-2 control-label"
>
所属主机组
<span
class=
"red-fonts"
>
*
</span>
</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 %}
<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.name }}"
selected
>
{{ g.name }} --- {{ g.comment }}
</option>
{% else %}
<option
type=
"checkbox"
value=
"{{ g.name }}"
>
{{ g.name }} --- {{ g.comment }}
</option>
{% endif %}
{% endfor %}
</select>
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label"
>
是否激活
</label>
<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 %}
...
...
templates/jasset/host_list.html
View file @
6c70d5bf
...
...
@@ -52,12 +52,12 @@
<tbody>
{% for post in contacts.object_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
data-editable=
'false'
><input
name=
"id"
value=
"{{ post.id }}"
type=
"checkbox"
class=
"i-checks"
></td>
<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"
>
{{ login_types|get_item:post.login_type }}
</td>
<td
class=
"text-center"
name=
"j_idc"
>
{{ post.idc.name }}
</td>
<td
class=
"text-center"
name=
"j_group"
>
{% for group in post.bis_group.all %} {{ group }} {% endfor %}
</td>
<td
class=
"text-center"
name=
"j_group"
>
{% for group in post.bis_group.all
|filter_private
%} {{ group }} {% endfor %}
</td>
<td
class=
"text-center"
name=
"j_active"
>
{{ post.is_active|bool2str }}
</td>
<td
class=
"text-center"
>
{{ post.date_added|date:"Y-m-d H:i:s" }}
</td>
<td
class=
"text-center"
name=
"j_comment"
>
{{ post.comment }}
</td>
...
...
@@ -112,40 +112,40 @@
function
alter
(
form
)
{
selectData
=
GetTableDataBox
();
if
(
selectData
[
1
]
!=
0
){
if
(
selectData
[
1
]
!=
0
)
{
$
.
ajax
({
type
:
"post"
,
url
:
"/jasset/host_edit/batch/"
,
data
:
{
"editable"
:
selectData
[
0
],
"len_table"
:
selectData
[
1
]},
success
:
function
(
data
)
{
data
:
{
"editable"
:
selectData
[
0
],
"len_table"
:
selectData
[
1
]},
success
:
function
(
data
)
{
alert
(
"修改成功"
);
window
.
open
(
"/jasset/host_list/"
,
"_self"
);
window
.
open
(
"/jasset/host_list/"
,
"_self"
);
}
});
}
}
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/host_del/"
,
data
:
{
"id_list"
:
id_list
,
"len_list"
:
j
},
success
:
function
(
data
)
{
window
.
open
(
"/jasset/host_list/"
,
"_self"
);
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/host_del/multi/"
,
data
:
{
"id_list"
:
id_list
,
"len_list"
:
j
},
success
:
function
(
data
)
{
window
.
open
(
"/jasset/host_list/"
,
"_self"
);
}
});
}
}
}
}
</script>
{% endblock %}
\ No newline at end of file
templates/jasset/idc_detail.html
0 → 100644
View file @
6c70d5bf
{% 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"
>
<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"
name=
"j_idc"
>
所属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"
>
{{ login_types|get_item:post.login_type }}
</td>
<td
class=
"text-center"
name=
"j_idc"
>
{{ post.idc.name }}
</td>
<td
class=
"text-center"
name=
"j_group"
>
{% for group in post.bis_group.all %} {{ group }} {% endfor %}
</td>
<td
class=
"text-center"
name=
"j_active"
>
{{ post.is_active|bool2str }}
</td>
<td
class=
"text-center"
>
{{ post.date_added|date:"Y-m-d H:i:s" }}
</td>
<td
class=
"text-center"
name=
"j_comment"
>
{{ post.comment }}
</td>
<td
class=
"text-center"
data-editable=
'false'
>
<a
href=
"/jasset/{{ post.ip }}/"
class=
"iframe btn btn-xs btn-primary"
>
详情
</a>
<a
href=
"/jasset/host_del/{{ post.id }}"
class=
"btn btn-xs btn-danger"
>
删除
</a>
</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 contacts.has_previous %}
<li><a
href=
"?page={{ contacts.previous_page_number }}"
>
«
</a></li>
{% endif %}
{% for page in p.page_range %}
{% ifequal offset1 page %}
<li
class=
"active"
><a
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% else %}
<li><a
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% endifequal %}
{% endfor %}
{% if contacts.has_next %}
<li><a
href=
"?page={{ contacts.next_page_number }}"
>
»
</a></li>
{% endif %}
</ul>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
$
(
document
).
ready
(
function
(){
$
(
".iframe"
).
colorbox
({
iframe
:
true
,
width
:
"70%"
,
height
:
"70%"
});
$
(
'#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
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/host_del/"
,
data
:
{
"id_list"
:
id_list
,
"len_list"
:
j
},
success
:
function
(
data
)
{
window
.
open
(
"/jasset/host_list/"
,
"_self"
);
}
});
}
}
}
</script>
{% endblock %}
\ No newline at end of file
templates/jasset/idc_list.html
View file @
6c70d5bf
...
...
@@ -22,6 +22,7 @@
<tr>
<th
class=
"text-center"
>
ID
</th>
<th
class=
"text-center"
>
机房名
</th>
<th
class=
"text-center"
>
主机数量
</th>
<th
class=
"text-center"
>
备注
</th>
<th
class=
"text-center"
>
操作
</th>
</tr>
...
...
@@ -31,10 +32,10 @@
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
{{ post.id }}
</td>
<td
class=
"text-center"
>
{{ post.name }}
</td>
<td
class=
"text-center"
>
<a
href=
"/jasset/idc_detail/{{ post.id }}"
>
{{ post.asset_set.count }}
</a>
</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_detail/{{ post.id }}"
class=
"iframe btn btn-xs btn-primary"
>
详情
</a>
<a
href=
"/jasset/idc_del/{{ post.id }}"
class=
"btn btn-xs btn-danger"
>
删除
</a>
</td>
</tr>
...
...
templates/jlog/log_list.html
View file @
6c70d5bf
This diff is collapsed.
Click to expand it.
templates/nav.html
View file @
6c70d5bf
...
...
@@ -39,7 +39,7 @@
<li
id=
"jlog"
>
<a
href=
"#"
><i
class=
"fa fa-files-o"
></i>
<span
class=
"nav-label"
>
日志审计
</span><span
class=
"fa arrow"
></span></a>
<ul
class=
"nav nav-second-level"
>
<li
id=
"log_list"
><a
href=
"/jlog/
log_list/
"
>
查看日志
</a></li>
<li
id=
"log_list"
><a
href=
"/jlog/"
>
查看日志
</a></li>
<li
id=
"log_detail"
><a
href=
"/jlog/log_detail/"
>
日志分析
</a></li>
</ul>
</li>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment