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
8bf9103f
Commit
8bf9103f
authored
Sep 08, 2015
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改资产管理
parent
4eb78e15
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
371 additions
and
568 deletions
+371
-568
AddUserAsset.py
docs/AddUserAsset.py
+7
-7
models.py
jasset/models.py
+4
-18
urls.py
jasset/urls.py
+18
-20
views.py
jasset/views.py
+0
-0
models.py
jperm/models.py
+3
-3
api.py
jumpserver/api.py
+3
-3
settings.py
jumpserver/settings.py
+2
-2
mytags.py
jumpserver/templatetags/mytags.py
+0
-0
urls.py
jumpserver/urls.py
+1
-1
views.py
juser/views.py
+6
-8
base.js
static/js/base.js
+11
-11
index.html
templates/index.html
+2
-2
asset_add.html
templates/jasset/asset_add.html
+0
-0
asset_detail.html
templates/jasset/asset_detail.html
+0
-0
asset_edit.html
templates/jasset/asset_edit.html
+165
-0
asset_list.html
templates/jasset/asset_list.html
+48
-43
group_add.html
templates/jasset/group_add.html
+30
-53
group_list.html
templates/jasset/group_list.html
+12
-20
host_edit.html
templates/jasset/host_edit.html
+0
-0
idc_add.html
templates/jasset/idc_add.html
+0
-80
idc_detail.html
templates/jasset/idc_detail.html
+0
-0
idc_edit.html
templates/jasset/idc_edit.html
+0
-110
idc_list.html
templates/jasset/idc_list.html
+0
-126
group_list.html
templates/juser/group_list.html
+1
-1
user_detail.html
templates/juser/user_detail.html
+28
-30
user_list.html
templates/juser/user_list.html
+20
-18
nav.html
templates/nav.html
+4
-6
nav_bar_header.html
templates/nav_bar_header.html
+5
-5
nav_li_profile.html
templates/nav_li_profile.html
+1
-1
No files found.
docs/AddUserAsset.py
View file @
8bf9103f
...
...
@@ -127,14 +127,14 @@ def test_add_log():
if
__name__
==
'__main__'
:
install
()
test_add_dept
()
test_add_group
()
test_add_user
()
test_add_idc
()
test_add_asset_group
()
#
install()
#
test_add_dept()
#
test_add_group()
#
test_add_user()
#
test_add_idc()
#
test_add_asset_group()
test_add_asset
()
test_add_log
()
#
test_add_log()
...
...
jasset/models.py
View file @
8bf9103f
...
...
@@ -3,15 +3,7 @@ from django.db import models
from
juser.models
import
User
,
UserGroup
class
IDC
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
40
,
unique
=
True
)
comment
=
models
.
CharField
(
max_length
=
80
,
blank
=
True
,
null
=
True
)
def
__unicode__
(
self
):
return
self
.
name
class
BisGroup
(
models
.
Model
):
class
AssetGroup
(
models
.
Model
):
GROUP_TYPE
=
(
(
'P'
,
'PRIVATE'
),
(
'A'
,
'ASSET'
),
...
...
@@ -67,17 +59,12 @@ class BisGroup(models.Model):
class
Asset
(
models
.
Model
):
LOGIN_TYPE_CHOICES
=
(
(
'L'
,
'LDAP'
),
(
'M'
,
'MAP'
),
)
ip
=
models
.
IPAddressField
(
unique
=
True
)
port
=
models
.
IntegerField
(
max_length
=
6
)
idc
=
models
.
ForeignKey
(
IDC
)
bis_group
=
models
.
ManyToManyField
(
BisGroup
)
login_type
=
models
.
CharField
(
max_length
=
1
,
choices
=
LOGIN_TYPE_CHOICES
,
default
=
'L'
)
group
=
models
.
ManyToManyField
(
AssetGroup
)
username
=
models
.
CharField
(
max_length
=
20
,
blank
=
True
,
null
=
True
)
password
=
models
.
CharField
(
max_length
=
80
,
blank
=
True
,
null
=
True
)
use_default_auth
=
models
.
BooleanField
(
default
=
True
)
date_added
=
models
.
DateTimeField
(
auto_now
=
True
,
default
=
datetime
.
datetime
.
now
(),
null
=
True
)
is_active
=
models
.
BooleanField
(
default
=
True
)
comment
=
models
.
CharField
(
max_length
=
100
,
blank
=
True
,
null
=
True
)
...
...
@@ -108,4 +95,4 @@ class AssetAlias(models.Model):
alias
=
models
.
CharField
(
max_length
=
100
,
blank
=
True
,
null
=
True
)
def
__unicode__
(
self
):
return
self
.
comment
\ No newline at end of file
return
self
.
alias
jasset/urls.py
View file @
8bf9103f
...
...
@@ -3,26 +3,23 @@ from django.conf.urls import patterns, include, url
from
jasset.views
import
*
urlpatterns
=
patterns
(
''
,
url
(
r'^host_add/$'
,
host_add
),
url
(
r"^host_add_multi/$"
,
host_add_batch
),
url
(
r'^host_list/$'
,
host_list
),
url
(
r'^search/$'
,
host_search
),
url
(
r"^host_detail/$"
,
host_detail
),
url
(
r"^dept_host_ajax/$"
,
dept_host_ajax
),
url
(
r"^show_all_ajax/$"
,
show_all_ajax
),
url
(
r'^idc_add/$'
,
idc_add
),
url
(
r'^idc_list/$'
,
idc_list
),
url
(
r'^idc_edit/$'
,
idc_edit
),
url
(
r'^idc_detail/$'
,
idc_detail
),
url
(
r'^idc_del/$'
,
idc_del
),
url
(
r'^asset_add/$'
,
asset_add
),
# url(r"^host_add_multi/$", host_add_batch),
url
(
r'^group_add/$'
,
group_add
),
url
(
r'^group_edit/$'
,
group_edit
),
url
(
r'^group_list/$'
,
group_list
),
url
(
r'^group_detail/$'
,
group_detail
),
url
(
r'^group_del_host/$'
,
group_del_host
),
url
(
r'^group_del/$'
,
group_del
),
url
(
r'^host_del/(\w+)/$'
,
host_del
),
url
(
r'^host_edit/$'
,
view_splitter
,
{
'su'
:
host_edit
,
'adm'
:
host_edit_adm
}),
url
(
r'^host_edit/batch/$'
,
host_edit_batch
),
url
(
r'^host_edit_common/batch/$'
,
host_edit_common_batch
),
url
(
r'^asset_list/$'
,
asset_list
),
url
(
r'^asset_del/$'
,
asset_del
),
url
(
r"^asset_detail/$"
,
asset_detail
),
url
(
r'^asset_edit/$'
,
asset_edit
),
# url(r'^search/$', host_search),
# url(r"^host_detail/$", host_detail),
# url(r"^dept_host_ajax/$", dept_host_ajax),
# url(r"^show_all_ajax/$", show_all_ajax),
# url(r'^group_edit/$', group_edit),
# url(r'^group_list/$', group_list),
# url(r'^group_detail/$', group_detail),
# url(r'^group_del_host/$', group_del_host),
# url(r'^group_del/$', group_del),
# url(r'^host_edit/batch/$', host_edit_batch),
# url(r'^host_edit_common/batch/$', host_edit_common_batch),
)
\ No newline at end of file
jasset/views.py
View file @
8bf9103f
This diff is collapsed.
Click to expand it.
jperm/models.py
View file @
8bf9103f
...
...
@@ -4,12 +4,12 @@ from uuidfield import UUIDField
from
django.db
import
models
from
juser.models
import
UserGroup
from
jasset.models
import
Asset
,
Bis
Group
from
jasset.models
import
Asset
,
Asset
Group
class
Perm
(
models
.
Model
):
user_group
=
models
.
ForeignKey
(
UserGroup
)
asset_group
=
models
.
ForeignKey
(
Bis
Group
)
asset_group
=
models
.
ForeignKey
(
Asset
Group
)
def
__unicode__
(
self
):
return
'
%
s_
%
s'
%
(
self
.
user_group
.
name
,
self
.
asset_group
.
name
)
...
...
@@ -27,7 +27,7 @@ class CmdGroup(models.Model):
class
SudoPerm
(
models
.
Model
):
user_group
=
models
.
ForeignKey
(
UserGroup
)
user_runas
=
models
.
CharField
(
max_length
=
100
)
asset_group
=
models
.
ManyToManyField
(
Bis
Group
)
asset_group
=
models
.
ManyToManyField
(
Asset
Group
)
cmd_group
=
models
.
ManyToManyField
(
CmdGroup
)
comment
=
models
.
CharField
(
max_length
=
30
,
null
=
True
,
blank
=
True
)
...
...
jumpserver/api.py
View file @
8bf9103f
...
...
@@ -17,7 +17,7 @@ from django.core.paginator import Paginator, EmptyPage, InvalidPage
from
django.http
import
HttpResponse
,
Http404
from
django.template
import
RequestContext
from
juser.models
import
User
,
UserGroup
from
jasset.models
import
Asset
,
BisGroup
,
IDC
from
jasset.models
import
Asset
,
AssetGroup
from
jlog.models
import
Log
from
jasset.models
import
AssetAlias
from
django.core.exceptions
import
ObjectDoesNotExist
,
MultipleObjectsReturned
...
...
@@ -177,6 +177,7 @@ def pages(post_objects, request):
else
:
show_end
=
0
# 所有对象, 分页器, 本页对象, 所有页码, 本页页码,是否显示第一页,是否显示最后一页
return
post_objects
,
paginator
,
page_objects
,
page_range
,
current_page
,
show_first
,
show_end
...
...
@@ -429,7 +430,7 @@ class PyCrypt(object):
"""
return
crypt
.
crypt
(
password
,
'$6$
%
s$'
%
salt
)
def
encrypt
(
self
,
passwd
=
None
):
def
encrypt
(
self
,
passwd
=
None
,
length
=
32
):
"""
encrypt gen password
对称加密之加密生成密码
...
...
@@ -438,7 +439,6 @@ class PyCrypt(object):
passwd
=
self
.
random_pass
()
cryptor
=
AES
.
new
(
self
.
key
,
self
.
mode
,
b
'8122ca7d906ad5e1'
)
length
=
64
try
:
count
=
len
(
passwd
)
except
TypeError
:
...
...
jumpserver/settings.py
View file @
8bf9103f
...
...
@@ -56,8 +56,8 @@ INSTALLED_APPS = (
'django.contrib.humanize'
,
'jumpserver'
,
'juser'
,
#
'jasset',
#
'jperm',
'jasset'
,
'jperm'
,
# 'jlog',
)
...
...
jumpserver/templatetags/mytags.py
View file @
8bf9103f
This diff is collapsed.
Click to expand it.
jumpserver/urls.py
View file @
8bf9103f
...
...
@@ -14,7 +14,7 @@ urlpatterns = patterns('',
(
r'^file/download/$'
,
'jumpserver.views.download'
),
(
r'^error/$'
,
'jumpserver.views.httperror'
),
(
r'^juser/'
,
include
(
'juser.urls'
)),
#
(r'^jasset/', include('jasset.urls')),
(
r'^jasset/'
,
include
(
'jasset.urls'
)),
# (r'^jlog/', include('jlog.urls')),
# (r'^jperm/', include('jperm.urls')),
(
r'^node_auth/'
,
'jumpserver.views.node_auth'
),
...
...
juser/views.py
View file @
8bf9103f
...
...
@@ -71,7 +71,7 @@ def group_list(request):
if
keyword
:
user_group_list
=
user_group_list
.
filter
(
Q
(
name__icontains
=
keyword
)
|
Q
(
comment__icontains
=
keyword
))
contacts
,
p
,
contact
s
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
user_group_list
,
request
)
user_group_list
,
p
,
user_group
s
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
user_group_list
,
request
)
return
my_render
(
'juser/group_list.html'
,
locals
(),
request
)
...
...
@@ -356,18 +356,18 @@ def user_list(request):
header_title
,
path1
,
path2
=
'查看用户'
,
'用户管理'
,
'用户列表'
keyword
=
request
.
GET
.
get
(
'keyword'
,
''
)
gid
=
request
.
GET
.
get
(
'gid'
,
''
)
contact_list
=
User
.
objects
.
all
()
.
order_by
(
'
name'
)
users_list
=
User
.
objects
.
all
()
.
order_by
(
'user
name'
)
if
gid
:
user_group
=
UserGroup
.
objects
.
filter
(
id
=
gid
)
if
user_group
:
user_group
=
user_group
[
0
]
contact
_list
=
user_group
.
user_set
.
all
()
users
_list
=
user_group
.
user_set
.
all
()
if
keyword
:
contact_list
=
contact_list
.
filter
(
Q
(
username__icontains
=
keyword
)
|
Q
(
name__icontains
=
keyword
))
.
order_by
(
'
name'
)
users_list
=
users_list
.
filter
(
Q
(
username__icontains
=
keyword
)
|
Q
(
name__icontains
=
keyword
))
.
order_by
(
'user
name'
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
contact
_list
,
request
)
users_list
,
p
,
users
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
users
_list
,
request
)
return
my_render
(
'juser/user_list.html'
,
locals
(),
request
)
...
...
@@ -568,8 +568,6 @@ def user_edit(request):
role
=
role_post
,
is_active
=
is_active
)
print
'#'
*
10
+
role_post
if
email_need
:
msg
=
u"""
Hi
%
s:
...
...
@@ -669,7 +667,7 @@ def change_info(request):
if
''
in
[
name
,
password
,
email
]:
error
=
'不能为空'
if
len
(
password
)
<
6
:
if
len
(
password
)
<
6
:
error
=
'密码须大于6位'
if
not
error
:
...
...
static/js/base.js
View file @
8bf9103f
...
...
@@ -70,17 +70,17 @@ function move(from, to, from_o, to_o) {
});
}
function
move_left
(
from
,
to
,
from_o
,
to_o
)
{
$
(
"#"
+
from
+
" option"
).
each
(
function
()
{
if
(
$
(
this
).
prop
(
"selected"
)
==
true
)
{
$
(
"#"
+
to
).
append
(
this
);
if
(
typeof
from_o
!==
'undefined'
){
$
(
"#"
+
to_o
).
append
(
$
(
"#"
+
from_o
+
" option[value='"
+
this
.
value
+
"']"
));
}
}
$
(
this
).
attr
(
"selected"
,
'true'
);
});
}
//
function move_left(from, to, from_o, to_o) {
//
$("#" + from + " option").each(function () {
//
if ($(this).prop("selected") == true) {
//
$("#" + to).append(this);
//
if( typeof from_o !== 'undefined'){
//
$("#"+to_o).append($("#"+from_o +" option[value='"+this.value+"']"));
//
}
//
}
//
$(this).attr("selected",'true');
//
});
//
}
//function move_all(from, to) {
// $("#" + from).children().each(function () {
...
...
templates/index.html
View file @
8bf9103f
...
...
@@ -114,8 +114,8 @@
<small
class=
"pull-right"
>
{{ perm.date_add|naturaltime }}
</small>
{% endifequal %}
<strong>
{{ perm.applyer }}
</strong>
<div>
申请 {{ perm.bisgroup|ast_to_list }} 主机组权限
</div>
<div>
申请 {{ perm.asset|ast_to_list }} 主机权限
</div>
{#
<div>
申请 {{ perm.bisgroup|ast_to_list }} 主机组权限
</div>
#}
{#
<div>
申请 {{ perm.asset|ast_to_list }} 主机权限
</div>
#}
<small
class=
"text-muted"
>
{{ perm.date_add }}
</small>
</div>
</div>
...
...
templates/jasset/
hos
t_add.html
→
templates/jasset/
asse
t_add.html
View file @
8bf9103f
This diff is collapsed.
Click to expand it.
templates/jasset/
hos
t_detail.html
→
templates/jasset/
asse
t_detail.html
View file @
8bf9103f
This diff is collapsed.
Click to expand it.
templates/jasset/asset_edit.html
0 → 100644
View file @
8bf9103f
{% extends 'base.html' %}
{% load mytags %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"row"
>
<div
class=
"col-lg-10"
>
<div
class=
"ibox float-e-margins"
>
<div
id=
"ibox-content"
class=
"ibox-title"
>
<h5>
修改资产基本信息
</h5>
<div
class=
"ibox-tools"
>
<a
class=
"collapse-link"
>
<i
class=
"fa fa-chevron-up"
></i>
</a>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
<div
class=
"ibox-content"
>
<div
class=
"panel-body"
>
<div
class=
"tab-content"
>
<div
id=
"tab-1"
class=
"ibox float-e-margins tab-pane active"
>
{% if error %}
<div
class=
"alert alert-warning text-center"
>
{{ error }}
</div>
{% endif %}
{% if msg %}
<div
class=
"alert alert-success text-center"
>
{{ msg }}
</div>
{% endif %}
<form
id=
"assetForm"
method=
"post"
class=
"form-horizontal"
>
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label"
>
IP地址
<span
class=
"red-fonts"
>
*
</span>
</label>
<div
class=
"col-sm-8"
><input
type=
"text"
name=
"ip"
value=
"{{ asset.ip }}"
class=
"form-control"
></div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
>
端口号
<span
class=
"red-fonts"
>
*
</span>
</label>
<div
class=
"col-sm-8"
>
<input
type=
"text"
value=
"{{ asset.port }}"
name=
"port"
class=
"form-control"
>
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<label
for=
"j_group"
class=
"col-sm-2 control-label"
>
使用默认管理账号
</label>
<div
class=
"col-sm-1"
>
<div
class=
"radio i-checks"
>
<label>
<input
type=
"checkbox"
{%
ifequal
asset
.
use_default_auth
1
%}
checked=
""
{%
endifequal
%}
value=
"1"
id=
"use_default_auth"
name=
"use_default_auth"
>
</label>
</div>
</div>
</div>
<div
class=
"form-group"
id=
"admin_account"
{%
ifequal
asset
.
use_default_auth
1
%}
style=
"display: none"
{%
endifequal
%}
>
<label
class=
"col-sm-2 control-label"
>
管理用户名
<span
class=
"red-fonts"
>
*
</span>
</label>
<div
class=
"col-sm-3"
>
<input
type=
"text"
{%
ifnotequal
asset
.
use_default_auth
1
%}
value=
"{{ asset.username }}"
{%
endifnotequal
%}
name=
"username"
class=
"form-control"
>
</div>
<label
class=
"col-sm-1 control-label"
>
密码
<span
class=
"red-fonts"
>
*
</span>
</label>
<div
class=
"col-sm-4"
>
<input
type=
"password"
{%
ifnotequal
asset
.
use_default_auth
1
%}
value=
"{{ asset.password }}"
{%
endifnotequal
%}
name=
"password"
class=
"form-control"
>
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<label
for=
"groups"
class=
"col-sm-2 control-label"
>
所属主机组
</label>
<div
class=
"col-sm-8"
>
<select
id=
"groups"
name=
"groups"
class=
"form-control m-b"
multiple
size=
"10"
>
{% for g in egroup %}
<option
type=
"checkbox"
value=
"{{ g.id }}"
>
{{ g.name }} {% if g.comment %} --- {{ g.comment }} {% endif %}
</option>
{% endfor %}
</select>
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label"
>
是否激活
<span
class=
"red-fonts"
>
*
</span>
</label>
<div
class=
"col-sm-8"
>
<div
class=
"radio i-checks"
>
{% ifequal asset.is_active 1 %}
<label>
<input
type=
"radio"
checked=
""
value=
"1"
name=
"is_active"
>
激活
</label>
<label>
<input
type=
"radio"
value=
"0"
name=
"is_active"
>
禁用
</label>
{% else %}
<label>
<input
type=
"radio"
value=
"1"
name=
"is_active"
>
激活
</label>
<label>
<input
type=
"radio"
checked=
""
value=
"0"
name=
"is_active"
>
禁用
</label>
{% endifequal %}
</div>
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label"
>
备注
</label>
<div
class=
"col-sm-8"
><input
type=
"text"
value=
"{{ asset.comment }}"
name=
"comment"
class=
"form-control"
></div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<div
class=
"col-sm-4 col-sm-offset-2"
>
<button
class=
"btn btn-white"
type=
"reset"
>
重置
</button>
<button
class=
"btn btn-primary"
type=
"submit"
>
提交
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block self_footer_js %}
<script>
$
(
'document'
).
ready
(
function
(){
$
(
'#use_default_auth'
).
click
(
function
(){
if
(
$
(
this
).
is
(
':checked'
)){
$
(
'#admin_account'
).
css
(
'display'
,
'none'
)
}
else
{
$
(
'#admin_account'
).
css
(
'display'
,
'block'
)
}
})
});
$
(
'#assetForm'
).
validator
({
timely
:
2
,
theme
:
"yellow_right_effect"
,
rules
:
{
check_ip
:
[
/^
(\d{1,2}
|1
\d\d
|2
[
0-4
]\d
|25
[
0-5
])(\.(\d{1,2}
|1
\d\d
|2
[
0-4
]\d
|25
[
0-5
])){3}
$/
,
'ip地址不正确'
],
check_port
:
[
/^
\d{1,5}
$/
,
'端口号不正确'
],
},
fields
:
{
"ip"
:
{
rule
:
"required;check_ip"
,
tip
:
"输入IP"
,
ok
:
""
,
msg
:
{
required
:
"必须填写!"
}
},
"port"
:
{
rule
:
"required;check_port"
,
tip
:
"输入端口号"
,
ok
:
""
,
msg
:
{
required
:
"必须填写!"
}
}
},
valid
:
function
(
form
)
{
form
.
submit
();
}
});
</script>
{% endblock %}
\ No newline at end of file
templates/jasset/
hos
t_list.html
→
templates/jasset/
asse
t_list.html
View file @
8bf9103f
...
...
@@ -16,12 +16,6 @@
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<ul
class=
"dropdown-menu dropdown-user"
>
<li><a
href=
"#"
>
未启用 1
</a>
</li>
<li><a
href=
"#"
>
未启用 2
</a>
</li>
</ul>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
...
...
@@ -30,14 +24,14 @@
<div
class=
"ibox-content"
>
<div>
<a
target=
"_blank"
href=
"/jasset/
host_add
"
class=
"btn btn-sm btn-primary "
>
添加
</a>
<a
target=
"_blank"
href=
"/jasset/
asset_add/
"
class=
"btn btn-sm btn-primary "
>
添加
</a>
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<div
class=
"input-group"
>
<input
type=
"text"
class=
"form-control input-sm"
id=
"search_input"
name=
"keyword"
placeholder=
"Search"
>
<input
type=
"text"
style=
"display: none"
>
<div
class=
"input-group-btn"
>
<button
id=
'search_btn'
type=
"button"
class=
"btn btn-sm btn-primary"
onclick=
"host_search()
"
>
Search
<button
type=
"submit"
class=
"btn btn-sm btn-primary
"
>
- 搜索 -
</button>
</div>
</div>
...
...
@@ -48,37 +42,35 @@
<table
class=
"table table-striped table-bordered table-hover "
id=
"editable"
name=
"editable"
>
<thead>
<tr>
<th
class=
"text-center"
><input
id=
"checkall"
type=
"checkbox"
class=
"i-checks"
name=
"checkall"
value=
"checkall"
data-editable=
'false'
onclick=
"check_all('contents_form')"
></th>
<th
class=
"text-center"
name=
"j_ip"
>
IP地址
</th>
<th
class=
"text-center"
>
<input
id=
"checkall"
type=
"checkbox"
class=
"i-checks"
name=
"checkall"
value=
"checkall"
data-editable=
'false'
onclick=
"check_all('contents_form')"
>
</th>
<th
class=
"text-center"
name=
"ip"
>
IP地址
</th>
<th
class=
"text-center"
>
端口号
</th>
<th
class=
"text-center"
name=
"j_type"
>
登录方式
</th>
<th
class=
"text-center"
name=
"j_idc"
>
所属IDC
</th>
<th
class=
"text-center"
>
所属部门
</th>
<th
class=
"text-center"
>
所属主机组
</th>
<th
class=
"text-center"
>
是否激活
</th>
<th
class=
"text-center"
name=
"j_comment"
>
备注
</th>
<th
class=
"text-center"
>
使用默认管理
</th>
<th
class=
"text-center"
>
激活
</th>
<th
class=
"text-center"
name=
"comment"
>
备注
</th>
<th
class=
"text-center"
>
操作
</th>
</tr>
</thead>
<tbody>
{% for
post in contac
ts.object_list %}
{% for
asset in asse
ts.object_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
name=
"j_id"
value=
"{{ post.id }}"
data-editable=
'false'
><input
name=
"id"
value=
"{{ post.id }}"
type=
"checkbox"
class=
"i-checks"
></td>
<td
class=
"text-center"
name=
"j_ip"
>
{{ post.ip }}
</td>
<td
class=
"text-center"
name=
"j_port"
>
{{ post.port }}
</td>
<td
class=
"text-center"
name=
"j_type"
>
{{ post.login_type|get_login_type }}
</td>
<td
class=
"text-center"
name=
"j_idc"
>
{{ post.idc.name }}
</td>
<td
class=
"text-center"
name=
"j_dept"
>
{{ post.dept.all | group_str2 }}
</td>
<!--<td class="text-center" id="j_dept_{{post.id}}" name="j_dept" onclick="show_all('dept', '{{post.id}}')">{{ post.dept.all | group_str2 }}</td>-->
<td
class=
"text-center"
name=
"j_group"
>
{{ post.bis_group.all | group_str2_all }}
</td>
<!--<td class="text-center" id="j_group_{{post.id}}" name="j_group" onclick="show_all('group', '{{post.id}}')">{{ post.bis_group.all | group_str2_all }}</td>-->
<td
class=
"text-center"
name=
"j_active"
>
{{ post.is_active|bool2str }}
</td>
<td
class=
"text-center"
name=
"j_comment"
>
{{ post.comment }}
</td>
<td
class=
"text-center"
name=
"id"
value=
"{{ asset.id }}"
data-editable=
'false'
>
<input
name=
"id"
value=
"{{ asset.id }}"
type=
"checkbox"
class=
"i-checks"
>
</td>
<td
class=
"text-center"
>
{{ asset.ip }}
</td>
<td
class=
"text-center"
>
{{ asset.port }}
</td>
<td
class=
"text-center"
>
{{ asset.port }}
</td>
<td
class=
"text-center"
>
{{ asset.use_default_auth|bool2str }}
</td>
<td
class=
"text-center"
>
{{ asset.is_active|bool2str }}
</td>
<td
class=
"text-center"
>
{{ asset.comment }}
</td>
<td
class=
"text-center"
data-editable=
'false'
>
<a
href=
"/jasset/
host_detail/?id={{ pos
t.id }}"
class=
"btn btn-xs btn-primary"
>
详情
</a>
<a
href=
"/jasset/
asset_detail/?id={{ asse
t.id }}"
class=
"btn btn-xs btn-primary"
>
详情
</a>
{% ifnotequal session_role_id 0 %}
<a
href=
"/jasset/
host_edit/?id={{ pos
t.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
href=
"/jasset/host_del/{{ post.id }}"
class=
"btn btn-xs btn-danger
"
>
删除
</a>
<a
href=
"/jasset/
asset_edit/?id={{ asse
t.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
value=
"/jasset/asset_del/?id={{ asset.id }}"
class=
"btn btn-xs btn-danger asset_del
"
>
删除
</a>
{% endifnotequal %}
</td>
</tr>
...
...
@@ -98,7 +90,9 @@
</div>
</div>
</div>
{% endblock %}
{% block self_footer_js %}
<script>
$
(
'table td'
).
on
(
'change'
,
function
(
env
,
id
){
var
url
=
"/jasset/show_all_ajax/?env="
+
env
+
"&id="
+
id
;
...
...
@@ -111,10 +105,21 @@
$
(
"#j_dept_"
+
id
).
html
(
data
);
}
});
})
})
;
$
(
document
).
ready
(
function
(){
$
(
'#editable'
).
editableTableWidget
({
editor
:
$
(
'<textarea>'
)});
$
(
'.asset_del'
).
click
(
function
(){
var
row
=
$
(
this
).
closest
(
'tr'
);
$
.
get
(
$
(
this
).
attr
(
'value'
),
{},
function
(
data
){
alert
(
data
);
row
.
remove
()
}
)
})
});
...
...
@@ -157,22 +162,22 @@
}
}
function
host_search
(){
$
.
ajax
({
type
:
"GET"
,
url
:
"/jasset/search/"
,
data
:
$
(
"#search_form"
).
serialize
(),
success
:
function
(
data
)
{
$
(
"#contents_form"
).
html
(
data
);
}
});
}
{
#
function
host_search
(){
#
}
{
#
$
.
ajax
({
#
}
{
#
type
:
"GET"
,
#
}
{
#
url
:
"/jasset/search/"
,
#
}
{
#
data
:
$
(
"#search_form"
).
serialize
(),
#
}
{
#
success
:
function
(
data
)
{
#
}
{
#
$
(
"#contents_form"
).
html
(
data
);
#
}
{
#
}
#
}
{
#
});
#
}
{
#
}
#
}
$
(
"#search_input"
).
keydown
(
function
(
e
){
if
(
e
.
keyCode
==
13
){
host_search
()
}
})
})
;
function
show_all
(
env
,
id
)
{
var
url
=
"/jasset/show_all_ajax/?env="
+
env
+
"&id="
+
id
;
...
...
templates/jasset/group_add.html
View file @
8bf9103f
...
...
@@ -22,7 +22,7 @@
<div
class=
"col-lg-10"
>
<div
class=
"ibox float-e-margins"
>
<div
id=
"ibox-content"
class=
"ibox-title"
>
<h5>
填写
主机
组基本信息
</h5>
<h5>
填写
资产
组基本信息
</h5>
<div
class=
"ibox-tools"
>
<a
class=
"collapse-link"
>
<i
class=
"fa fa-chevron-up"
></i>
...
...
@@ -30,64 +30,38 @@
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<ul
class=
"dropdown-menu dropdown-user"
>
<li><a
href=
"#"
>
未启用 1
</a>
</li>
<li><a
href=
"#"
>
未启用 2
</a>
</li>
</ul>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
<select
id=
"assets_total"
name=
"assets"
class=
"form-control m-b"
size=
"12"
multiple
style=
"display: none"
>
{% for asset in posts %
}
<option
value=
"{{ asset.id }}"
>
{{ asset.ip }}
</option>
{% endfor %
}
</select>
<select
id=
"asset_select_total"
name=
"j_hosts"
class=
"form-control m-b"
size=
"12"
multiple
style=
"display: none"
>
{% for asset in eposts %
}
<option
value=
"{{ asset.id }}"
>
{{ asset.ip }}
</option>
{% endfor %
}
</select>
{#
<select
id=
"assets_total"
name=
"assets"
class=
"form-control m-b"
size=
"12"
multiple
style=
"display: none"
>
#}
{# {% for asset in assets_all %}#
}
{#
<option
value=
"{{ asset.id }}"
>
{{ asset.ip }}
</option>
#}
{# {% endfor %}#
}
{#
</select>
#}
{##}
{#
<select
id=
"asset_select_total"
name=
"j_hosts"
class=
"form-control m-b"
size=
"12"
multiple
style=
"display: none"
>
#}
{# {% for asset in eposts %}#
}
{#
<option
value=
"{{ asset.id }}"
>
{{ asset.ip }}
</option>
#}
{# {% endfor %}#
}
{#
</select>
#}
<div
class=
"ibox-content"
>
{% if e
mg
%}
<div
class=
"alert alert-warning text-center"
>
{{ e
mg
}}
</div>
{% if e
rror
%}
<div
class=
"alert alert-warning text-center"
>
{{ e
rror
}}
</div>
{% endif %}
{% if
sm
g %}
<div
class=
"alert alert-success text-center"
>
{{
sm
g }}
</div>
{% if
ms
g %}
<div
class=
"alert alert-success text-center"
>
{{
ms
g }}
</div>
{% endif %}
<form
id=
"assetForm"
method=
"post"
class=
"form-horizontal"
>
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label"
>
主机组名
<span
class=
"red-fonts"
>
*
</span></label>
<div
class=
"col-sm-8"
name=
"group_id"
value=
"{{ post.id }}"
><input
type=
"text"
value=
"{{ group.name }}"
placeholder=
"网站"
name=
"j_group"
class=
"form-control"
></div>
</div>
{% ifequal session_role_id 2 %}
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<label
for=
"j_dept"
class=
"col-lg-2 control-label"
>
所属部门
<span
class=
"red-fonts"
>
*
</span></label>
<label
class=
"col-sm-2 control-label"
>
主机组名
<span
class=
"red-fonts"
>
*
</span></label>
<div
class=
"col-sm-8"
>
<select
id=
"j_dept"
name=
"j_dept"
class=
"form-control m-b"
onchange=
"change_dept(this.value)"
>
{% for d in edept %}
<option
value=
"{{ d.id }}"
>
{{ d.name }}
</option>
{% endfor %}
</select>
</div>
<input
type=
"text"
placeholder=
"Name"
name=
"name"
class=
"form-control"
>
</div>
{% endifequal %}
{% ifequal session_role_id 1 %}
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<label
for=
"j_dept"
class=
"col-lg-2 control-label"
>
所属部门
<span
class=
"red-fonts"
style=
""
>
*
</span></label>
<input
type=
"text"
name=
"j_dept"
value=
"{{ edept.id }}"
style=
"display: none"
>
<div
class=
"col-sm-8"
><input
type=
"text"
value=
"{{ edept.name }}"
class=
"form-control"
readonly=
"readonly"
></div>
</div>
{% endifequal %}
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
...
...
@@ -108,8 +82,8 @@
<div
class=
"col-sm-4"
>
<div>
<select
id=
"assets"
name=
"assets"
class=
"form-control m-b"
size=
"12"
multiple
>
{% for
post in posts
%}
<option
value=
"{{
post.id }}"
>
{{ pos
t.ip }}
</option>
{% for
asset in asset_all
%}
<option
value=
"{{
asset.id }}"
>
{{ asse
t.ip }}
</option>
{% endfor %}
</select>
</div>
...
...
@@ -118,27 +92,30 @@
<div
class=
"col-sm-1"
>
<div
class=
"btn-group"
style=
"margin-top: 60px;"
>
<button
type=
"button"
class=
"btn btn-white"
onclick=
"move('assets', 'asset_select', 'assets_total', 'asset_select_total' )"
><i
class=
"fa fa-chevron-right"
></i></button>
<button
type=
"button"
class=
"btn btn-white"
onclick=
"move
_left
('asset_select', 'assets', 'asset_select_total', 'assets_total')"
><i
class=
"fa fa-chevron-left"
></i>
</button>
<button
type=
"button"
class=
"btn btn-white"
onclick=
"move('asset_select', 'assets', 'asset_select_total', 'assets_total')"
><i
class=
"fa fa-chevron-left"
></i>
</button>
</div>
</div>
<div
class=
"col-sm-3"
>
<div>
<select
id=
"asset_select"
name=
"
j_hosts
"
class=
"form-control m-b"
size=
"12"
multiple
></select>
<select
id=
"asset_select"
name=
"
asset_select
"
class=
"form-control m-b"
size=
"12"
multiple
></select>
</div>
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label"
>
备注
</label>
<div
class=
"col-sm-8"
><input
type=
"text"
value=
"{{ j_comment }}"
placeholder=
包括web组所有主机
name=
"j_comment"
class=
"form-control"
></div>
<div
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-
5
"
>
<button
class=
"btn btn-white"
type=
"
submi
t"
>
重置
</button>
<button
class=
"btn btn-primary"
id=
"submit_button"
type=
"submit"
onclick=
"on_submit('groups_selected') "
>
提交
</button>
<div
class=
"col-sm-4 col-sm-offset-
2
"
>
<button
class=
"btn btn-white"
type=
"
rese
t"
>
重置
</button>
<button
class=
"btn btn-primary"
type=
"submit"
onclick=
"on_submit('groups_selected') "
>
提交
</button>
</div>
</div>
</form>
...
...
templates/jasset/group_list.html
View file @
8bf9103f
...
...
@@ -16,12 +16,6 @@
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<ul
class=
"dropdown-menu dropdown-user"
>
<li><a
href=
"#"
>
未启用 1
</a>
</li>
<li><a
href=
"#"
>
未启用 2
</a>
</li>
</ul>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
...
...
@@ -29,14 +23,14 @@
</div>
<div
class=
"ibox-content"
>
<div
class=
""
>
<a
target=
"_blank"
href=
"/jasset/group_add"
class=
"btn btn-sm btn-primary "
>
添加主机组
</a>
<a
target=
"_blank"
href=
"/jasset/group_add
/
"
class=
"btn btn-sm btn-primary "
>
添加主机组
</a>
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<div
class=
"input-group"
>
<input
type=
"text"
class=
"form-control input-sm"
id=
"search_input"
name=
"keyword"
placeholder=
"Search"
>
<input
type=
"text"
style=
"display: none"
>
<div
class=
"input-group-btn"
>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
Search
- 搜索 -
</button>
</div>
</div>
...
...
@@ -47,26 +41,24 @@
<table
class=
"table table-striped table-bordered table-hover "
id=
"editable"
>
<thead>
<tr>
<th
class=
"text-center"
><input
id=
"checkall"
type=
"checkbox"
class=
"i-checks"
name=
"checkall"
value=
"checkall"
data-editable=
'false'
onclick=
"check_all('contents_form')"
></th>
<th
class=
"text-center"
>
<input
id=
"checkall"
type=
"checkbox"
class=
"i-checks"
name=
"checkall"
value=
"checkall"
data-editable=
'false'
onclick=
"check_all('contents_form')"
>
</th>
<th
class=
"text-center"
>
主机组名
</th>
<th
class=
"text-center"
>
所属部门
</th>
<th
class=
"text-center"
>
主机数量
</th>
<th
class=
"text-center"
>
备注
</th>
<th
class=
"text-center"
>
操作
</th>
</tr>
</thead>
<tbody>
{% for
post in contact
s.object_list %}
{% for
asset_group in asset_group
s.object_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
name=
"j_id"
value=
"{{ post.id }}"
data-editable=
'false'
><input
name=
"id"
value=
"{{ post.id }}"
type=
"checkbox"
class=
"i-checks"
></td>
<td
class=
"text-center"
>
{{ post.name }}
</td>
<td
class=
"text-center"
>
{{ post.dept.name }}
</td>
{% ifequal session_role_id 2 %}
<td
class=
"text-center"
>
<a
href=
"/jasset/group_detail/?id={{ post.id }}"
>
{{ post.asset_set.count }}
</a>
</td>
{% else %}
<td
class=
"text-center"
>
<a
href=
"/jasset/group_detail/?id={{ post.id }}"
>
{{ post|get_group_count:dept }}
</a>
</td>
{% endifequal %}
<td
class=
"text-center"
>
{{ post.comment }}
</td>
<td
class=
"text-center"
name=
"id"
value=
"{{ asset_group.id }}"
data-editable=
'false'
>
<input
name=
"id"
value=
"{{ post.id }}"
type=
"checkbox"
class=
"i-checks"
>
</td>
<td
class=
"text-center"
>
{{ asset_group.name }}
</td>
<td
class=
"text-center"
>
<a
href=
"/jasset/group_detail/?id={{ post.id }}"
>
{{ asset_group.asset_set.count }}
</a>
</td>
<td
class=
"text-center"
>
{{ asset_group.comment }}
</td>
<td
class=
"text-center"
>
<a
href=
"/jasset/group_detail/?id={{ post.id }}"
class=
"btn btn-xs btn-info"
>
详情
</a>
<a
href=
"/jasset/group_edit/?id={{ post.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
...
...
templates/jasset/host_edit.html
deleted
100644 → 0
View file @
4eb78e15
This diff is collapsed.
Click to expand it.
templates/jasset/idc_add.html
deleted
100644 → 0
View file @
4eb78e15
{% extends 'base.html' %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"row"
>
<div
class=
"col-lg-10"
>
<div
class=
"ibox float-e-margins"
>
<div
id=
"ibox-content"
class=
"ibox-title"
>
<h5>
填写IDC基本信息
</h5>
<div
class=
"ibox-tools"
>
<a
class=
"collapse-link"
>
<i
class=
"fa fa-chevron-up"
></i>
</a>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<ul
class=
"dropdown-menu dropdown-user"
>
<li><a
href=
"#"
>
未启用 1
</a>
</li>
<li><a
href=
"#"
>
未启用 2
</a>
</li>
</ul>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
<div
class=
"ibox-content"
>
{% if emg %}
<div
class=
"alert alert-warning text-center"
>
{{ emg }}
</div>
{% endif %}
{% if smg %}
<div
class=
"alert alert-success text-center"
>
{{ smg }}
</div>
{% endif %}
<form
id=
"assetForm"
method=
"post"
class=
"form-horizontal"
>
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label"
>
IDC名
<span
class=
"red-fonts"
>
*
</span></label>
<div
class=
"col-sm-8"
><input
type=
"text"
value=
"{{ idc.name }}"
placeholder=
"北京联通"
name=
"j_idc"
class=
"form-control"
></div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label"
>
备注
</label>
<div
class=
"col-sm-8"
><input
type=
"text"
value=
"{{ idc.comment }}"
placeholder=
"核心联通机房"
name=
"j_comment"
class=
"form-control"
></div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<div
class=
"col-sm-4 col-sm-offset-5"
>
<button
class=
"btn btn-white"
type=
"submit"
>
重置
</button>
<button
class=
"btn btn-primary"
type=
"sumbit"
>
提交
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
$
(
'#assetForm'
).
validator
({
timely
:
2
,
theme
:
"yellow_right_effect"
,
fields
:
{
"j_idc"
:
{
rule
:
"required"
,
tip
:
"输入IDC名"
,
ok
:
""
,
msg
:
{
required
:
"IDC名必须填写!"
},
data
:
{
'data-ok'
:
"主机名可以使用"
,
'data-msg-required'
:
'主机名已正确'
}
}
},
valid
:
function
(
form
)
{
form
.
submit
();
}
});
</script>
{% endblock %}
\ No newline at end of file
templates/jasset/idc_detail.html
deleted
100644 → 0
View file @
4eb78e15
This diff is collapsed.
Click to expand it.
templates/jasset/idc_edit.html
deleted
100644 → 0
View file @
4eb78e15
{% extends 'base.html' %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"row"
>
<div
class=
"col-lg-10"
>
<div
class=
"ibox float-e-margins"
>
<div
id=
"ibox-content"
class=
"ibox-title"
>
<h5>
填写IDC基本信息
</h5>
<div
class=
"ibox-tools"
>
<a
class=
"collapse-link"
>
<i
class=
"fa fa-chevron-up"
></i>
</a>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<ul
class=
"dropdown-menu dropdown-user"
>
<li><a
href=
"#"
>
未启用 1
</a>
</li>
<li><a
href=
"#"
>
未启用 2
</a>
</li>
</ul>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
<div
class=
"ibox-content"
>
{% if emg %}
<div
class=
"alert alert-warning text-center"
>
{{ emg }}
</div>
{% endif %}
{% if smg %}
<div
class=
"alert alert-success text-center"
>
{{ smg }}
</div>
{% endif %}
<form
id=
"assetForm"
method=
"post"
class=
"form-horizontal"
>
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label"
>
IDC名
<span
class=
"red-fonts"
>
*
</span></label>
<div
class=
"col-sm-8"
>
<input
name=
"id"
type=
"text"
value=
"{{ idc.id }}"
style=
"display: none;"
>
<input
type=
"text"
value=
"{{ idc.name }}"
placeholder=
"北京联通"
name=
"j_idc"
class=
"form-control"
>
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label"
>
备注
</label>
<div
class=
"col-sm-8"
><input
type=
"text"
value=
"{{ idc.comment }}"
placeholder=
"核心联通机房"
name=
"j_comment"
class=
"form-control"
></div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<label
for=
"groups"
class=
"col-lg-2 control-label"
>
主机
</label>
<div
class=
"col-sm-3"
>
<select
id=
"groups"
name=
"idc_default"
size=
"12"
class=
"form-control m-b"
multiple
>
{% for post in posts %}
<option
value=
"{{ post.id }}"
>
{{ post.ip }}
</option>
{% endfor %}
</select>
</div>
<div
class=
"col-sm-1"
>
<div
class=
"btn-group"
style=
"margin-top: 50px;"
>
<button
type=
"button"
class=
"btn btn-white"
onclick=
"move('groups', 'groups_selected')"
><i
class=
"fa fa-chevron-right"
></i></button>
<button
type=
"button"
class=
"btn btn-white"
onclick=
"move_left('groups_selected', 'groups')"
><i
class=
"fa fa-chevron-left"
></i>
</button>
</div>
</div>
<div
class=
"col-sm-3"
>
<div>
<select
id=
"groups_selected"
name=
"j_hosts"
class=
"form-control m-b"
size=
"12"
multiple
>
{% for post in eposts %}
<option
value=
"{{ post.id }}"
>
{{ post.ip }}
</option>
{% endfor %}
</select>
</div>
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<div
class=
"col-sm-4 col-sm-offset-5"
>
<button
class=
"btn btn-white"
type=
"submit"
>
重置
</button>
<button
class=
"btn btn-primary"
type=
"sumbit"
>
提交
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
$
(
'#assetForm'
).
validator
({
timely
:
2
,
theme
:
"yellow_right_effect"
,
fields
:
{
"j_idc"
:
{
rule
:
"required"
,
tip
:
"输入IDC名"
,
ok
:
""
,
msg
:
{
required
:
"IDC名必须填写!"
},
data
:
{
'data-ok'
:
"主机名可以使用"
,
'data-msg-required'
:
'主机名已正确'
}
}
},
valid
:
function
(
form
)
{
form
.
submit
();
}
});
</script>
{% endblock %}
\ No newline at end of file
templates/jasset/idc_list.html
deleted
100644 → 0
View file @
4eb78e15
{% extends 'base.html' %}
{% load mytags %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"row"
>
<div
class=
"col-lg-10"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
IDC详细信息列表
</h5>
<div
class=
"ibox-tools"
>
<a
class=
"collapse-link"
>
<i
class=
"fa fa-chevron-up"
></i>
</a>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<ul
class=
"dropdown-menu dropdown-user"
>
<li><a
href=
"#"
>
未启用 1
</a>
</li>
<li><a
href=
"#"
>
未启用 2
</a>
</li>
</ul>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
<div
class=
"ibox-content"
>
<div
class=
""
>
{% ifequal session_role_id 2 %}
<a
target=
"_blank"
href=
"/jasset/idc_add"
class=
"btn btn-sm btn-primary "
>
添加IDC
</a>
{% endifequal %}
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<div
class=
"input-group"
>
<input
type=
"text"
class=
"form-control input-sm"
id=
"search_input"
name=
"keyword"
placeholder=
"Search"
>
<input
type=
"text"
style=
"display: none"
>
<div
class=
"input-group-btn"
>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
Search
</button>
</div>
</div>
</form>
</div>
<form
id=
"contents_form"
name=
"contents_form"
>
<table
class=
"table table-striped table-bordered table-hover "
id=
"editable"
>
<thead>
<tr>
{% ifequal session_role_id 2 %}
<th
class=
"text-center"
><input
id=
"checkall"
type=
"checkbox"
class=
"i-checks"
name=
"checkall"
value=
"checkall"
data-editable=
'false'
onclick=
"check_all('contents_form')"
></th>
{% endifequal %}
<th
class=
"text-center"
>
机房名
</th>
<th
class=
"text-center"
>
主机数量
</th>
<th
class=
"text-center"
>
备注
</th>
<th
class=
"text-center"
>
操作
</th>
</tr>
</thead>
<tbody>
{% for post in contacts.object_list %}
<tr
class=
"gradeX"
>
{% ifequal session_role_id 2 %}
<td
class=
"text-center"
name=
"j_id"
value=
"{{ post.id }}"
data-editable=
'false'
><input
name=
"id"
value=
"{{ post.id }}"
type=
"checkbox"
class=
"i-checks"
></td>
{% endifequal %}
<td
class=
"text-center"
>
{{ post.name }}
</td>
{% ifequal session_role_id 2 %}
<td
class=
"text-center"
>
<a
href=
"/jasset/idc_detail/?id={{ post.id }}"
>
{{ post.asset_set.count }}
</a>
</td>
{% else %}
<td
class=
"text-center"
>
<a
href=
"/jasset/idc_detail/?id={{ post.id }}"
>
{{ post|get_idc_count:dept }}
</a>
</td>
{% endifequal %}
<td
class=
"text-center"
>
{{ post.comment }}
</td>
<td
class=
"text-center"
>
<a
href=
"/jasset/idc_detail/?id={{ post.id }}"
class=
"iframe btn btn-xs btn-primary"
>
详情
</a>
{% ifequal session_role_id 2 %}
<a
href=
"/jasset/idc_edit/?id={{ post.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
href=
"/jasset/idc_del/?id={{ post.id }}"
class=
"btn btn-xs btn-danger"
>
删除
</a>
{% endifequal %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
{% ifequal session_role_id 2 %}
<input
type=
"button"
id=
"del_button"
class=
"btn btn-danger btn-sm"
name=
"del_button"
value=
"删除"
onclick=
"del('contents_form')"
/>
<!--<input type="button" id="alter_button" class="btn btn-warning btn-sm" name="alter_button" value="修改" onclick="alter('contents_form')" />-->
{% endifequal %}
</div>
{% include 'paginator.html' %}
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
function
del
(
form
)
{
var
checkboxes
=
document
.
getElementById
(
form
);
var
id_list
=
{};
var
j
=
0
;
for
(
var
i
=
0
;
i
<
checkboxes
.
elements
.
length
;
i
++
)
{
if
(
checkboxes
.
elements
[
i
].
type
==
"checkbox"
&&
checkboxes
.
elements
[
i
].
checked
==
true
&&
checkboxes
.
elements
[
i
].
value
!=
"checkall"
)
{
id_list
[
j
]
=
checkboxes
.
elements
[
i
].
value
;
j
++
;
}
}
if
(
confirm
(
"确定删除"
))
{
$
.
ajax
({
type
:
"POST"
,
url
:
"/jasset/idc_del/?id=multi"
,
data
:
{
"id_list"
:
id_list
,
"len_list"
:
j
},
success
:
function
(
data
)
{
window
.
open
(
"/jasset/idc_list/"
,
"_self"
);
}
});
}
}
</script>
{% endblock %}
\ No newline at end of file
templates/juser/group_list.html
View file @
8bf9103f
...
...
@@ -52,7 +52,7 @@
</tr>
</thead>
<tbody>
{% for group in
contact
s.object_list %}
{% for group in
user_group
s.object_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
<input
type=
"checkbox"
name=
"selected"
value=
"{{ group.id }}"
>
...
...
templates/juser/user_detail.html
View file @
8bf9103f
...
...
@@ -109,30 +109,30 @@
<small><i
class=
"fa fa-map-marker"
></i>
这里包含了用户所有的主机组和组下的主机.
</small>
</div>
<div
class=
"ibox-content inspinia-timeline"
>
{% for group in user|get_user_asset_group %
}
<div
class=
"timeline-item"
>
<div
class=
"row"
>
<div
class=
"col-xs-3 date"
>
<i
class=
"fa fa-repeat"
></i>
<b><a
href=
"/jperm/perm_list/?uid={{ user.id }}&agid={{ group.id }}"
>
{{ group.name }}
</a></b>
<br>
<small
class=
"text-navy"
>
共: {{ group | group_asset_list_count }}台
</small>
</div>
<div
class=
"col-xs-7 content no-top-border"
>
<p
class=
"m-b-xs"
><strong>
{{ group.comment }}
</strong></p>
<p>
{% for asset in group|group_asset_list %
}
{{ asset.ip }}
<br>
{% endfor %
}
</p>
<p></p>
</div>
</div>
</div>
{% endfor %
}
{% if not user|get_user_asset_group %
}
(无)
{% endif %
}
{# {% for group in user|get_user_asset_group %}#
}
{#
<div
class=
"timeline-item"
>
#}
{#
<div
class=
"row"
>
#}
{#
<div
class=
"col-xs-3 date"
>
#}
{#
<i
class=
"fa fa-repeat"
></i>
#}
{#
<b><a
href=
"/jperm/perm_list/?uid={{ user.id }}&agid={{ group.id }}"
>
{{ group.name }}
</a></b>
#}
{#
<br>
#}
{#
<small
class=
"text-navy"
>
共: {{ group | group_asset_list_count }}台
</small>
#}
{#
</div>
#}
{#
<div
class=
"col-xs-7 content no-top-border"
>
#}
{#
<p
class=
"m-b-xs"
><strong>
{{ group.comment }}
</strong></p>
#}
{#
<p>
#}
{# {% for asset in group|group_asset_list %}#
}
{# {{ asset.ip }}
<br>
#}
{# {% endfor %}#
}
{#
</p>
#}
{#
<p></p>
#}
{#
</div>
#}
{#
</div>
#}
{#
</div>
#}
{# {% endfor %}#
}
{# {% if not user|get_user_asset_group %}#
}
{# (无)#}
{# {% endif %}#
}
</div>
</div>
</div>
...
...
@@ -154,7 +154,8 @@
<img
alt=
"image"
class=
"img-circle"
src=
"/static/img/{{ session_role_id | to_avatar }}.png"
>
</a>
<div
class=
"media-body "
>
<small
class=
"pull-right"
>
{{ log.start_time|time_delta }}
</small>
{#
<small
class=
"pull-right"
>
{{ log.start_time|time_delta }}
</small>
#}
<small
class=
"pull-right"
>
{{ log.start_time }}
</small>
<strong>
{{ log.user }}
</strong>
登录了
<span
class=
"text-navy"
>
{{ log.host }}.
</span><br>
<small
class=
"text-muted"
>
{{ log.start_time|date:"Y-m-d H:i:s" }}
</small>
</div>
...
...
@@ -177,21 +178,18 @@
<img
alt=
"image"
class=
"img-circle"
src=
"/static/img/{{ session_role_id | to_avatar }}.png"
>
</a>
<div
class=
"media-body "
>
<small
class=
"pull-right"
>
{{ log.start_time|time_delta }}
</small>
<small
class=
"pull-right"
>
{{ log.start_time }}
</small>
{#
<small
class=
"pull-right"
>
{{ log.start_time|time_delta }}
</small>
#}
<strong>
{{ log.user }}
</strong>
登录了
<span
class=
"text-navy"
>
{{ log.host }}.
</span><br>
<small
class=
"text-muted"
>
{{ log.start_time|date:"Y-m-d H:i:s" }}
</small>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
templates/juser/user_list.html
View file @
8bf9103f
...
...
@@ -54,7 +54,7 @@
</tr>
</thead>
<tbody>
{% for user in
contact
s.object_list %}
{% for user in
user
s.object_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
<input
type=
"checkbox"
name=
"selected"
value=
"{{ user.id }}"
>
...
...
@@ -63,7 +63,7 @@
<td
class=
"text-center"
>
{{ user.name }}
</td>
<td
class=
"text-center"
title=
"{% for user_group in user.group.all %} {{ user_group.name }} {% endfor %}"
>
{{ user.group.all | group_str2 }}
</td>
<td
class=
"text-center"
>
{{ user.id | get_role }}
</td>
<td
class=
"text-center"
>
{{ user.is_active
|
bool2str }}
</td>
<td
class=
"text-center"
>
{{ user.is_active
|
bool2str }}
</td>
<td
class=
"text-center"
><a
href=
"/juser/down_key/?id={{ user.id }}"
>
下载
</a></td>
<td
class=
"text-center"
>
<a
href=
"../user_detail/?id={{ user.id }}"
class=
"btn btn-xs btn-primary"
>
详情
</a>
...
...
@@ -78,7 +78,7 @@
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
<div
class=
"dataTables_info"
id=
"editable_info"
role=
"status"
aria-live=
"polite"
>
Showing {{
contacts.start_index }} to {{ contact
s.end_index }} of {{ p.count }} entries
Showing {{
users.start_index }} to {{ user
s.end_index }} of {{ p.count }} entries
</div>
</div>
{% include 'paginator.html' %}
...
...
@@ -93,25 +93,27 @@
{% block self_head_css_js %}
<script>
$
(
document
).
ready
(
function
(){
$
(
".iframe"
).
on
(
'click'
,
function
()
{
var
url
=
$
(
this
).
attr
(
"value"
);
$
.
layer
({
type
:
2
,
title
:
'用户详情'
,
maxmin
:
true
,
shift
:
'top'
,
border
:
[
2
,
0.3
,
'#1AB394'
],
shade
:
[
0.5
,
'#000000'
],
shadeClose
:
true
,
area
:
[
'800px'
,
'600px'
],
iframe
:
{
src
:
url
}
})
});
{
#
$
(
".iframe"
).
on
(
'click'
,
function
()
{
#
}
{
#
var
url
=
$
(
this
).
attr
(
"value"
);
#
}
{
#
$
.
layer
({
#
}
{
#
type
:
2
,
#
}
{
#
title
:
'用户详情'
,
#
}
{
#
maxmin
:
true
,
#
}
{
#
shift
:
'top'
,
#
}
{
#
border
:
[
2
,
0.3
,
'#1AB394'
],
#
}
{
#
shade
:
[
0.5
,
'#000000'
],
#
}
{
#
shadeClose
:
true
,
#
}
{
#
area
:
[
'800px'
,
'600px'
],
#
}
{
#
iframe
:
{
src
:
url
}
#
}
{
#
})
#
}
{
#
});
#
}
var
check_array
=
[];
$
(
'#del_btn'
).
click
(
function
(){
if
(
confirm
(
"确定删除"
))
{
$
(
".gradeX input:checked"
).
each
(
function
()
{
check_array
.
push
(
$
(
this
).
attr
(
"value"
))
});
$
(
".gradeX input:checked"
).
each
(
function
()
{
check_array
.
push
(
$
(
this
).
attr
(
"value"
))
});
$
.
post
(
"/juser/user_del_ajax/"
,
{
ids
:
check_array
.
join
(
","
)},
function
(
data
){
...
...
templates/nav.html
View file @
8bf9103f
...
...
@@ -18,12 +18,10 @@
<li
id=
"jasset"
>
<a><i
class=
"fa fa-cube"
></i>
<span
class=
"nav-label"
>
资产管理
</span><span
class=
"fa arrow"
></span></a>
<ul
class=
"nav nav-second-level"
>
<li
class=
"host_add host_add_multi"
><a
href=
"/jasset/host_add/"
>
添加资产
</a></li>
<li
class=
"host_list host_detail host_edit"
><a
href=
"/jasset/host_list/"
>
查看资产
<span
class=
"label label-info pull-right"
>
{{ host_active_num }}/{{ host_total_num}}
</span></a></li>
<li
class=
"idc_add"
><a
href=
"/jasset/idc_add/"
>
添加IDC
</a></li>
<li
class=
"idc_list idc_detail idc_edit"
><a
href=
"/jasset/idc_list/"
>
查看IDC
</a></li>
<li
class=
"group_add"
><a
href=
"/jasset/group_add/"
>
添加主机组
</a></li>
<li
class=
"group_list group_detail group_edit"
><a
href=
"/jasset/group_list/"
>
查看主机组
</a></li>
<li
class=
"group_add"
><a
href=
"/jasset/group_add/"
>
添加资产组
</a></li>
<li
class=
"group_list group_detail group_edit"
><a
href=
"/jasset/group_list/"
>
查看资产组
</a></li>
<li
class=
"asset_add asset_add_multi"
><a
href=
"/jasset/asset_add/"
>
添加资产
</a></li>
<li
class=
"host_list host_detail host_edit"
><a
href=
"/jasset/asset_list/"
>
查看资产
<span
class=
"label label-info pull-right"
>
{{ host_active_num }}/{{ host_total_num}}
</span></a></li>
</ul>
</li>
<li
id=
"jperm"
>
...
...
templates/nav_bar_header.html
View file @
8bf9103f
...
...
@@ -26,11 +26,11 @@
<img
alt=
"image"
class=
"img-circle"
src=
"/static/img/a4.jpg"
>
</a>
<div
class=
"media-body"
>
<small
class=
"pull-right text-navy"
>
{{ apply.date_add|naturaltime }}
</small>
<strong>
{{ apply.applyer }}
</strong><br>
<small
class=
"text-muted"
>
主机组: {{ apply.bisgroup|ast_to_list }}
</small><br/>
<small
class=
"text-muted"
>
主机: {{ apply.asset|ast_to_list }}
</small><br/>
<small
class=
"text-muted"
>
申请时间: {{ apply.date_add|date:"Y-m-d H:i:s" }}
</small>
{#
<small
class=
"pull-right text-navy"
>
{{ apply.date_add|naturaltime }}
</small>
#}
{#
<strong>
{{ apply.applyer }}
</strong><br>
#}
{#
<small
class=
"text-muted"
>
主机组: {{ apply.bisgroup|ast_to_list }}
</small><br/>
#}
{#
<small
class=
"text-muted"
>
主机: {{ apply.asset|ast_to_list }}
</small><br/>
#}
{#
<small
class=
"text-muted"
>
申请时间: {{ apply.date_add|date:"Y-m-d H:i:s" }}
</small>
#}
</div>
</div>
</li>
...
...
templates/nav_li_profile.html
View file @
8bf9103f
...
...
@@ -10,7 +10,7 @@
<strong
class=
"font-bold"
>
{{ session_user_id | to_name}}
<span
style=
"color: #8095a8"
></span></strong>
</span>
<span
class=
"text-muted text-xs block"
>
{{ session_
role_id | to_role_nam
e }}
<b
class=
"caret"
></b>
{{ session_
user_id | get_rol
e }}
<b
class=
"caret"
></b>
</span>
</span>
</a>
...
...
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