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
b4c13069
Commit
b4c13069
authored
Nov 19, 2015
by
halcyon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
batch asset alert
parent
f9b1d305
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
60 additions
and
782 deletions
+60
-782
views.py
jasset/views.py
+48
-0
cmdb_excel_2015_11_19_22_05.xlsx
static/files/excels/cmdb_excel_2015_11_19_22_05.xlsx
+0
-0
asset_add_bak.html
templates/jasset/asset_add_bak.html
+0
-167
asset_edit_batch.html
templates/jasset/asset_edit_batch.html
+8
-22
asset_list.html
templates/jasset/asset_list.html
+3
-3
host_add_multi.html
templates/jasset/host_add_multi.html
+0
-69
host_list_common.html
templates/jasset/host_list_common.html
+0
-173
host_list_nop.html
templates/jasset/host_list_nop.html
+0
-178
host_search.html
templates/jasset/host_search.html
+0
-169
nav.html
templates/nav.html
+1
-1
No files found.
jasset/views.py
View file @
b4c13069
...
...
@@ -306,6 +306,54 @@ def asset_list(request):
def
asset_edit_batch
(
request
):
af
=
AssetForm
()
asset_group_all
=
AssetGroup
.
objects
.
all
()
if
request
.
method
==
'POST'
:
env
=
request
.
POST
.
get
(
'env'
,
''
)
idc_id
=
request
.
POST
.
get
(
'idc'
,
''
)
port
=
request
.
POST
.
get
(
'port'
,
''
)
use_default_auth
=
request
.
POST
.
get
(
'use_default_auth'
,
''
)
username
=
request
.
POST
.
get
(
'username'
,
''
)
password
=
request
.
POST
.
get
(
'password'
,
''
)
group
=
request
.
POST
.
getlist
(
'group'
,
[])
cabinet
=
request
.
POST
.
get
(
'cabinet'
,
''
)
comment
=
request
.
POST
.
get
(
'comment'
,
''
)
asset_id_all
=
unicode
(
request
.
GET
.
get
(
'asset_id_all'
,
''
))
asset_id_all
=
asset_id_all
.
split
(
','
)
for
asset_id
in
asset_id_all
:
asset
=
get_object
(
Asset
,
id
=
asset_id
)
if
asset
:
if
env
:
asset
.
env
=
env
if
idc_id
:
idc
=
get_object
(
IDC
,
id
=
idc_id
)
if
idc
:
asset
.
idc
=
idc
if
port
:
asset
.
port
=
port
if
use_default_auth
:
if
use_default_auth
==
'default'
:
asset
.
use_default_auth
=
1
asset
.
username
=
''
asset
.
password
=
''
elif
use_default_auth
==
'user_passwd'
:
asset
.
use_default_auth
=
0
asset
.
username
=
username
password_encode
=
CRYPTOR
.
encrypt
(
password
)
asset
.
password
=
password_encode
if
group
:
group_instance
=
[]
for
group_id
in
group
:
g
=
get_object
(
AssetGroup
,
id
=
group_id
)
if
g
:
group_instance
.
append
(
g
)
asset
.
group
=
group_instance
if
cabinet
:
asset
.
cabinet
=
cabinet
if
comment
:
asset
.
comment
=
comment
asset
.
save
()
return
HttpResponse
(
'ok'
)
return
my_render
(
'jasset/asset_edit_batch.html'
,
locals
(),
request
)
...
...
static/files/excels/cmdb_excel_2015_11_19_22_05.xlsx
0 → 100644
View file @
b4c13069
File added
templates/jasset/asset_add_bak.html
deleted
100644 → 0
View file @
f9b1d305
{% 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 blank-panel"
>
<div
class=
"panel-options"
>
<ul
class=
"nav nav-tabs"
>
<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 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"
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=
"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-2"
>
<div
class=
"radio i-checks"
>
<label>
<input
type=
"checkbox"
checked=
""
value=
"1"
id=
"use_default_auth"
name=
"use_default_auth"
><span>
使用默认
</span>
</label>
</div>
</div>
</div>
<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>
<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>
<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 asset_group in asset_group_all %}
<option
type=
"checkbox"
value=
"{{ asset_group.id }}"
>
{{ asset_group.name }} {% if asset_group.comment %} --- {{ asset_group.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"
>
<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=
"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 %}
\ No newline at end of file
templates/jasset/asset_edit_batch.html
View file @
b4c13069
...
...
@@ -49,33 +49,31 @@
{{ af.port|bootstrap_horizontal }}
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
"j_group"
class=
"col-sm-2 control-label"
>
管理账号
</label>
<div
class=
"col-sm-2"
>
<div
class=
"radio i-checks"
>
<label>
<input
type=
"radio"
checked=
""
value=
"
no_action"
name=
"use_default_
auth"
><span>
不修改
</span>
<input
type=
"radio"
checked=
""
value=
"
"
id=
"no"
name=
"use_default_auth"
class=
"
auth"
><span>
不修改
</span>
</label>
</div>
<div
class=
"radio i-checks"
>
<label>
<input
type=
"radio"
name=
"use_default_auth
"
><span>
使用默认
</span>
<input
type=
"radio"
id=
"default"
name=
"use_default_auth"
class=
"auth"
value=
"default
"
><span>
使用默认
</span>
</label>
</div>
<div
class=
"radio i-checks"
>
<label>
<input
type=
"radio"
id=
"
id_use_default_auth"
name=
"use_default_auth
"
><span>
用户名密码
</span>
<input
type=
"radio"
id=
"
pass"
name=
"use_default_auth"
class=
"auth"
value=
"user_passwd
"
><span>
用户名密码
</span>
</label>
</div>
</div>
</div>
<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>
<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"
>
...
...
@@ -101,7 +99,7 @@
</div>
<div
class=
"col-sm-3"
>
<div>
<select
id=
"groups_selected"
name=
"
project
"
class=
"form-control m-b"
size=
"10"
multiple
>
<select
id=
"groups_selected"
name=
"
group
"
class=
"form-control m-b"
size=
"10"
multiple
>
</select>
</div>
</div>
...
...
@@ -117,7 +115,7 @@
<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=
"host_edit"
>
提交
</button>
<button
class=
"btn btn-primary"
>
提交
</button>
</div>
</div>
</form>
...
...
@@ -128,20 +126,8 @@
</div>
<script>
$
(
document
).
ready
(
function
()
{
$
(
'#host_edit'
).
click
(
function
()
{
var
args
=
{};
var
match
=
null
;
var
uuid
=
decodeURIComponent
(
location
.
search
.
substring
(
1
));
var
reg
=
/
(?:([^
&
]
+
)
=
([^
&
]
+
))
/g
;
while
((
match
=
reg
.
exec
(
uuid
))
!==
null
){
args
[
match
[
1
]]
=
match
[
2
];
}
var
ids
=
args
[
'uuid'
];
$
(
'#uuid'
).
val
(
ids
)
});
$
(
'#id_use_default_auth'
).
click
(
function
(){
if
(
$
(
this
).
is
(
':checked'
)){
$
(
'.auth'
).
click
(
function
(){
if
(
$
(
this
).
attr
(
'id'
)
==
'pass'
){
$
(
'#admin_account'
).
css
(
'display'
,
'block'
)
}
else
{
...
...
templates/jasset/asset_list.html
View file @
b4c13069
...
...
@@ -184,12 +184,12 @@
});
$
(
".iframe"
).
on
(
'click'
,
function
(){
var
ids
=
getIDall
();
if
(
ids
==
''
){
var
asset_id_all
=
getIDall
();
if
(
asset_id_all
==
''
){
alert
(
"请至少选择一行!"
);
return
false
;
}
var
url
=
$
(
this
).
attr
(
"value"
)
+
'?
id='
+
ids
;
var
url
=
$
(
this
).
attr
(
"value"
)
+
'?
asset_id_all='
+
asset_id_all
;
index
=
$
.
layer
({
type
:
2
,
title
:
'JumpServer - 批量修改主机'
,
...
...
templates/jasset/host_add_multi.html
deleted
100644 → 0
View file @
f9b1d305
{% 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 %}
<p>
请严格按照文本框内主机信息格式填写, 多台主机回车换行, 具体格式如下:
</p>
<p
class=
"text-info"
>
IP地址 端口号 登录方式 IDC名 所属主机组 所属部门 激活/禁用 备注
</p>
<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 北京联通 [网站,数据库] 运维部 激活 网站服务器"
class=
"form-control"
style=
"width:700px;height:500px"
>
192.168.1.1 22 LDAP 北京联通 ['网站','数据库'] ['运维部','测试部'] 激活 网站服务器
</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_list_common.html
deleted
100644 → 0
View file @
f9b1d305
{% 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>
主机详细信息列表
</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>
<span>
点击别名栏修改主机别名, 可在跳板机上使用别名直接登录.
</span>
<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>
</div>
</div>
</form>
</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"
>
别名
</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"
data-editable=
'false'
name=
"j_ip"
>
{{ post.ip }}
</td>
<td
class=
"text-center"
data-editable=
'false'
name=
"j_port"
>
{{ post.port }}
</td>
<td
class=
"text-center"
data-editable=
'false'
name=
"j_type"
>
{{ post.login_type|get_login_type }}
</td>
<td
class=
"text-center"
data-editable=
'false'
name=
"j_idc"
>
{{ post.idc.name }}
</td>
<td
class=
"text-center"
data-editable=
'false'
name=
"j_dept"
>
{{ post.dept.all | group_str2 }}
</td>
<td
class=
"text-center"
data-editable=
'false'
name=
"j_group"
>
{{ post.bis_group.all | group_str2_all }}
</td>
<td
class=
"text-center"
name=
"j_alias"
>
{{ post|get_user_alias:user_id }}
</td>
<td
class=
"text-center"
data-editable=
'false'
name=
"j_comment"
>
{{ post.comment }}
</td>
<td
class=
"text-center"
data-editable=
'false'
>
<a
href=
"/jasset/host_detail/?id={{ post.id }}"
class=
"iframe btn btn-xs btn-primary"
>
详情
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
<input
type=
"button"
id=
"alter_button"
class=
"btn btn-warning btn-sm"
name=
"alter_button"
value=
"修改"
onclick=
"alter('contents_form')"
/>
</div>
{% include 'paginator.html' %}
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
$
(
document
).
ready
(
function
(){
$
(
'#editable'
).
editableTableWidget
();
});
$
(
".iframe"
).
on
(
'click'
,
function
(){
var
url
=
$
(
this
).
attr
(
"value"
);
$
.
layer
({
type
:
2
,
title
:
'JumpServer主机详情'
,
maxmin
:
true
,
shift
:
'top'
,
border
:
[
2
,
0.3
,
'#1AB394'
],
shade
:
[
0.5
,
'#000000'
],
shadeClose
:
true
,
area
:
[
'800px'
,
'600px'
],
iframe
:
{
src
:
url
}
});
});
function
alter
(
form
)
{
selectData
=
GetTableDataBox
();
if
(
selectData
[
1
]
!=
0
)
{
$
.
ajax
({
type
:
"post"
,
url
:
"/jasset/host_edit_common/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/multi/"
,
data
:
{
"id_list"
:
id_list
,
"len_list"
:
j
},
success
:
function
(
data
)
{
window
.
open
(
"/jasset/host_list/"
,
"_self"
);
}
});
}
}
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
()
}
})
</script>
{% endblock %}
\ No newline at end of file
templates/jasset/host_list_nop.html
deleted
100644 → 0
View file @
f9b1d305
{% 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>
主机详细信息列表
</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>
<a
target=
"_blank"
href=
"/jasset/host_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>-->
<!--</div>-->
<!--</div>-->
<!--</form>-->
</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"
>
是否激活
</th>
<th
class=
"text-center"
name=
"j_comment"
>
备注
</th>
<th
class=
"text-center"
>
操作
</th>
</tr>
</thead>
<tbody>
{% for post in posts %}
<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
value=
"/jasset/{{ post.ip }}/"
class=
"iframe 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>
<!--{% include 'paginator.html' %}-->
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
$
(
document
).
ready
(
function
(){
$
(
'#editable'
).
editableTableWidget
();
});
$
(
".iframe"
).
on
(
'click'
,
function
(){
var
url
=
$
(
this
).
attr
(
"value"
);
$
.
layer
({
type
:
2
,
title
:
'JumpServer主机详情'
,
maxmin
:
true
,
shift
:
'top'
,
border
:
[
2
,
0.3
,
'#1AB394'
],
shade
:
[
0.5
,
'#000000'
],
shadeClose
:
true
,
area
:
[
'800px'
,
'600px'
],
iframe
:
{
src
:
url
}
});
});
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/multi/"
,
data
:
{
"id_list"
:
id_list
,
"len_list"
:
j
},
success
:
function
(
data
)
{
window
.
open
(
"/jasset/host_list/"
,
"_self"
);
}
});
}
}
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
()
}
})
</script>
{% endblock %}
\ No newline at end of file
templates/jasset/host_search.html
deleted
100644 → 0
View file @
f9b1d305
{% load mytags %}
<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>
{% ifnotequal session_role_id 0 %}
<th
class=
"text-center"
>
是否激活
</th>
{% else %}
<th
class=
"text-center"
>
别名
</th>
{% endifnotequal %}
<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_group"
>
{{ post.bis_group.all | group_str2 }}
</td>
{% ifnotequal session_role_id 0 %}
<td
class=
"text-center"
name=
"j_alias"
>
{{ post.is_active|bool2str }}
</td>
{% else %}
<td
class=
"text-center"
name=
"j_active"
>
{{ post|get_user_alias:user_id }}
</td>
{% endifnotequal %}
<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
value=
"/jasset/{{ post.ip }}/"
class=
"iframe 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 contacts.has_previous %}
<li
class=
"paginate_button previous"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_previous"
>
<a
href=
"?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=
"?page=1"
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 }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% else %}
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?keyword={{ keyword }}&page={{ page }}"
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 }}"
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 }}"
>
Next
</a>
</li>
{% else %}
<li
class=
"paginate_button next disabled"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_next"
>
<a
href=
"#"
>
Next
</a>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
<script>
$
(
document
).
ready
(
function
(){
$
(
'#editable'
).
editableTableWidget
();
});
$
(
".iframe"
).
on
(
'click'
,
function
(){
var
url
=
$
(
this
).
attr
(
"value"
);
$
.
layer
({
type
:
2
,
title
:
'JumpServer主机详情'
,
maxmin
:
true
,
shift
:
'top'
,
border
:
[
2
,
0.3
,
'#1AB394'
],
shade
:
[
0.5
,
'#000000'
],
shadeClose
:
true
,
area
:
[
'800px'
,
'600px'
],
iframe
:
{
src
:
url
}
});
});
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/multi/"
,
data
:
{
"id_list"
:
id_list
,
"len_list"
:
j
},
success
:
function
(
data
)
{
window
.
open
(
"/jasset/host_list/"
,
"_self"
);
}
});
}
}
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
()
}
})
</script>
templates/nav.html
View file @
b4c13069
...
...
@@ -20,7 +20,7 @@
<ul
class=
"nav nav-second-level"
>
<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=
"asset_add asset_add_
batch
"
><a
href=
"/jasset/asset_add/"
>
添加资产
</a></li>
<li
class=
"asset_list asset_detail asset_edit"
><a
href=
"/jasset/asset_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/"
>
添加机房
</a></li>
<li
class=
"idc_list idc_detail idc_edit"
><a
href=
"/jasset/idc_list/"
>
查看机房
</a></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