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
7863a685
Commit
7863a685
authored
Jan 19, 2015
by
halcyon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产管理页面基本完成,尚有部分小bug
parent
1925cf40
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
141 additions
and
132 deletions
+141
-132
urls.py
jasset/urls.py
+13
-7
views.py
jasset/views.py
+0
-0
mytags.py
jumpserver/templatetags/mytags.py
+4
-0
views.py
juser/views.py
+0
-1
group_add.html
templates/jasset/group_add.html
+21
-47
group_list.html
templates/jasset/group_list.html
+13
-7
host_add.html
templates/jasset/host_add.html
+0
-0
host_edit.html
templates/jasset/host_edit.html
+0
-0
host_list.html
templates/jasset/host_list.html
+25
-16
idc_add.html
templates/jasset/idc_add.html
+21
-47
idc_list.html
templates/jasset/idc_list.html
+13
-7
test.html
templates/jasset/test.html
+31
-0
No files found.
jasset/urls.py
View file @
7863a685
...
...
@@ -4,11 +4,16 @@ from jasset.views import *
urlpatterns
=
patterns
(
''
,
url
(
r'^$'
,
index
),
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'group_add/$'
,
jadd_group
),
url
(
r'group_list/$'
,
jlist_group
),
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
),
)
\ No newline at end of file
jasset/views.py
View file @
7863a685
This diff is collapsed.
Click to expand it.
jumpserver/templatetags/mytags.py
View file @
7863a685
...
...
@@ -15,3 +15,7 @@ def stamp2str(value):
@register.filter
(
name
=
'int2str'
)
def
int2str
(
value
):
return
str
(
value
)
@register.filter
(
name
=
'get_item'
)
def
get_item
(
dictionary
,
key
):
return
dictionary
.
get
(
key
)
juser/views.py
View file @
7863a685
...
...
@@ -158,7 +158,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
)
...
...
templates/jasset/
jadd_group
.html
→
templates/jasset/
group_add
.html
View file @
7863a685
...
...
@@ -30,14 +30,17 @@
{% 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"
>
业务组名
</label>
<div
class=
"col-sm-8"
><input
type=
"text"
value=
"{{ j_
i
p }}"
placeholder=
"网站"
name=
"j_group"
class=
"form-control"
></div>
<div
class=
"col-sm-8"
><input
type=
"text"
value=
"{{ j_
grou
p }}"
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=
"{{
s_por
t }}"
placeholder=
包括web组所有主机
name=
"j_comment"
class=
"form-control"
></div>
<div
class=
"col-sm-8"
><input
type=
"text"
value=
"{{
j_commen
t }}"
placeholder=
包括web组所有主机
name=
"j_comment"
class=
"form-control"
></div>
</div>
<div
class=
"hr-line-dashed"
></div>
...
...
@@ -54,52 +57,23 @@
</div>
</div>
<!-- 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>
<!-- Peity -->
<script
src=
"static/js/demo/peity-demo.js"
></script>
<script>
var
showFlag
=
{};
function
show
(
o
){
showFlag
[
o
.
name
]
=
o
.
value
;
if
(
showFlag
.
j_type
==
"MAP"
){
document
.
getElementById
(
"a1"
).
style
.
display
=
""
;
$
(
'#assetForm'
).
validator
({
timely
:
2
,
theme
:
"yellow_right_effect"
,
fields
:
{
"j_group"
:
{
rule
:
"required"
,
tip
:
"输入业务组名"
,
ok
:
""
,
msg
:
{
required
:
"业务组名必须填写!"
},
data
:
{
'data-ok'
:
"业务组名可以使用"
}
}
else
{
document
.
getElementById
(
"a1"
).
style
.
display
=
"none"
;
}};
$
(
document
).
ready
(
function
(){
// Local script for demo purpose only
$
(
'#lightVersion'
).
click
(
function
(
event
)
{
event
.
preventDefault
()
$
(
'#ibox-content'
).
removeClass
(
'ibox-content'
);
$
(
'#vertical-timeline'
).
removeClass
(
'dark-timeline'
);
$
(
'#vertical-timeline'
).
addClass
(
'light-timeline'
);
});
$
(
'#darkVersion'
).
click
(
function
(
event
)
{
event
.
preventDefault
()
$
(
'#ibox-content'
).
addClass
(
'ibox-content'
);
$
(
'#vertical-timeline'
).
removeClass
(
'light-timeline'
);
$
(
'#vertical-timeline'
).
addClass
(
'dark-timeline'
);
});
$
(
'#leftVersion'
).
click
(
function
(
event
)
{
event
.
preventDefault
()
$
(
'#vertical-timeline'
).
toggleClass
(
'center-orientation'
);
});
});
},
valid
:
function
(
form
)
{
form
.
submit
();
}
});
</script>
...
...
templates/jasset/
jlist_idc
.html
→
templates/jasset/
group_list
.html
View file @
7863a685
...
...
@@ -29,23 +29,29 @@
<div
class=
"ibox-content"
>
<div
class=
""
>
<a
onclick=
"fnClickAddRow();"
href=
"javascript:void(0);"
class=
"btn
btn-primary "
>
添加
</a>
<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>
ID
</th>
<th>
机房名
</th>
<th>
备注
</th>
<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>
{{ post.id }}
</td>
<td>
{{ post.name }}
</td>
<td>
{{ post.comment }}
</td>
<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>
...
...
templates/jasset/
j
add.html
→
templates/jasset/
host_
add.html
View file @
7863a685
This diff is collapsed.
Click to expand it.
templates/jasset/host_edit.html
0 → 100644
View file @
7863a685
This diff is collapsed.
Click to expand it.
templates/jasset/
j
list.html
→
templates/jasset/
host_
list.html
View file @
7863a685
{% 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-1
0
"
>
<div
class=
"col-lg-1
2
"
>
<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>
<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"
>
<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>
...
...
templates/jasset/
jadd_idc
.html
→
templates/jasset/
idc_add
.html
View file @
7863a685
...
...
@@ -30,7 +30,10 @@
{% 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"
>
IDC名
</label>
<div
class=
"col-sm-8"
><input
type=
"text"
value=
"{{ j_ip }}"
placeholder=
"北京联通"
name=
"j_idc"
class=
"form-control"
></div>
</div>
...
...
@@ -44,7 +47,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"
type=
"su
bm
it"
>
提交
</button>
<button
class=
"btn btn-primary"
type=
"su
mb
it"
>
提交
</button>
</div>
</div>
</form>
...
...
@@ -54,53 +57,23 @@
</div>
</div>
<!-- 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>
<!-- Peity -->
<script
src=
"static/js/demo/peity-demo.js"
></script>
<script>
var
showFlag
=
{};
function
show
(
o
){
showFlag
[
o
.
name
]
=
o
.
value
;
if
(
showFlag
.
j_type
==
"MAP"
){
document
.
getElementById
(
"a1"
).
style
.
display
=
""
;
$
(
'#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'
:
'主机名已正确'
}
}
else
{
document
.
getElementById
(
"a1"
).
style
.
display
=
"none"
;
}};
$
(
document
).
ready
(
function
(){
// Local script for demo purpose only
$
(
'#lightVersion'
).
click
(
function
(
event
)
{
event
.
preventDefault
()
$
(
'#ibox-content'
).
removeClass
(
'ibox-content'
);
$
(
'#vertical-timeline'
).
removeClass
(
'dark-timeline'
);
$
(
'#vertical-timeline'
).
addClass
(
'light-timeline'
);
});
$
(
'#darkVersion'
).
click
(
function
(
event
)
{
event
.
preventDefault
()
$
(
'#ibox-content'
).
addClass
(
'ibox-content'
);
$
(
'#vertical-timeline'
).
removeClass
(
'light-timeline'
);
$
(
'#vertical-timeline'
).
addClass
(
'dark-timeline'
);
});
$
(
'#leftVersion'
).
click
(
function
(
event
)
{
event
.
preventDefault
()
$
(
'#vertical-timeline'
).
toggleClass
(
'center-orientation'
);
});
});
},
valid
:
function
(
form
)
{
form
.
submit
();
}
});
</script>
{% endblock %}
\ No newline at end of file
templates/jasset/
jlist_group
.html
→
templates/jasset/
idc_list
.html
View file @
7863a685
...
...
@@ -29,23 +29,29 @@
<div
class=
"ibox-content"
>
<div
class=
""
>
<a
onclick=
"fnClickAddRow();"
href=
"javascript:void(0);"
class=
"btn
btn-primary "
>
添加
</a>
<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>
ID
</th>
<th>
机房名
</th>
<th>
备注
</th>
<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>
{{ post.id }}
</td>
<td>
{{ post.name }}
</td>
<td>
{{ post.comment }}
</td>
<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>
...
...
templates/jasset/test.html
0 → 100644
View file @
7863a685
<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>
\ No newline at end of file
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