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
d926cbde
Commit
d926cbde
authored
Mar 14, 2015
by
guanghongwei
Browse files
Options
Browse Files
Download
Plain Diff
merge with wangyong
parents
d1f19a5c
ce6494ba
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
297 additions
and
177 deletions
+297
-177
connect.py
connect.py
+2
-0
AddUserAsset.py
docs/AddUserAsset.py
+1
-1
urls.py
jasset/urls.py
+1
-0
views.py
jasset/views.py
+62
-9
views.py
jlog/views.py
+16
-4
api.py
jumpserver/api.py
+12
-0
urls.py
jumpserver/urls.py
+1
-1
views.py
jumpserver/views.py
+2
-8
log_handler.py
log_handler.py
+13
-5
index.html
templates/index.html
+31
-103
group_detail.html
templates/jasset/group_detail.html
+7
-1
group_list.html
templates/jasset/group_list.html
+11
-0
host_edit.html
templates/jasset/host_edit.html
+15
-17
host_list.html
templates/jasset/host_list.html
+1
-1
host_search.html
templates/jasset/host_search.html
+40
-2
idc_add.html
templates/jasset/idc_add.html
+31
-2
idc_detail.html
templates/jasset/idc_detail.html
+1
-1
idc_list.html
templates/jasset/idc_list.html
+12
-0
log_online.html
templates/jlog/log_online.html
+1
-2
log_search.html
templates/jlog/log_search.html
+3
-20
paginator.html
templates/paginator.html
+34
-0
No files found.
connect.py
View file @
d926cbde
...
@@ -117,6 +117,7 @@ def log_record(username, host):
...
@@ -117,6 +117,7 @@ def log_record(username, host):
raise
ServerError
(
'Create logfile failed, Please modify
%
s permission.'
%
today_connect_log_dir
)
raise
ServerError
(
'Create logfile failed, Please modify
%
s permission.'
%
today_connect_log_dir
)
log
=
Log
(
user
=
username
,
host
=
host
,
log_path
=
log_file_path
,
start_time
=
datetime
.
now
(),
pid
=
pid
)
log
=
Log
(
user
=
username
,
host
=
host
,
log_path
=
log_file_path
,
start_time
=
datetime
.
now
(),
pid
=
pid
)
log_file
.
write
(
'Starttime is
%
s
\n
'
%
datetime
.
now
())
log
.
save
()
log
.
save
()
return
log_file
,
log
return
log_file
,
log
...
@@ -159,6 +160,7 @@ def posix_shell(chan, username, host):
...
@@ -159,6 +160,7 @@ def posix_shell(chan, username, host):
finally
:
finally
:
timestamp_end
=
time
.
time
()
timestamp_end
=
time
.
time
()
termios
.
tcsetattr
(
sys
.
stdin
,
termios
.
TCSADRAIN
,
old_tty
)
termios
.
tcsetattr
(
sys
.
stdin
,
termios
.
TCSADRAIN
,
old_tty
)
log_file
.
write
(
'Endtime is
%
s'
%
datetime
.
now
())
log_file
.
close
()
log_file
.
close
()
log
.
is_finished
=
True
log
.
is_finished
=
True
log
.
log_finished
=
False
log
.
log_finished
=
False
...
...
docs/AddUserAsset.py
View file @
d926cbde
...
@@ -114,7 +114,7 @@ if __name__ == '__main__':
...
@@ -114,7 +114,7 @@ if __name__ == '__main__':
test_add_idc
()
test_add_idc
()
test_add_asset_group
()
test_add_asset_group
()
test_add_asset
()
test_add_asset
()
#
test_add_log()
test_add_log
()
...
...
jasset/urls.py
View file @
d926cbde
...
@@ -11,6 +11,7 @@ urlpatterns = patterns('',
...
@@ -11,6 +11,7 @@ urlpatterns = patterns('',
url
(
r"^(\d+.\d+.\d+.\d+)/$"
,
jlist_ip
),
url
(
r"^(\d+.\d+.\d+.\d+)/$"
,
jlist_ip
),
url
(
r'^idc_add/$'
,
add_idc
),
url
(
r'^idc_add/$'
,
add_idc
),
url
(
r'^idc_list/$'
,
list_idc
),
url
(
r'^idc_list/$'
,
list_idc
),
url
(
r'^idc_edit/$'
,
edit_idc
),
url
(
r'^idc_detail/$'
,
detail_idc
),
url
(
r'^idc_detail/$'
,
detail_idc
),
url
(
r'^idc_del/(\w+)/$'
,
del_idc
),
url
(
r'^idc_del/(\w+)/$'
,
del_idc
),
url
(
r'^jgroup_add/$'
,
add_group
),
url
(
r'^jgroup_add/$'
,
add_group
),
...
...
jasset/views.py
View file @
d926cbde
...
@@ -22,7 +22,8 @@ def index(request):
...
@@ -22,7 +22,8 @@ def index(request):
def
f_add_host
(
ip
,
port
,
idc
,
jtype
,
group
,
active
,
comment
,
username
=
''
,
password
=
''
):
def
f_add_host
(
ip
,
port
,
idc
,
jtype
,
group
,
active
,
comment
,
username
=
''
,
password
=
''
):
groups
=
[]
groups
=
[]
idc
=
IDC
.
objects
.
get
(
name
=
idc
)
idc
=
IDC
.
objects
.
get
(
name
=
idc
)
if
type
==
'M'
:
if
jtype
==
'M'
:
print
username
,
password
a
=
Asset
(
ip
=
ip
,
port
=
port
,
a
=
Asset
(
ip
=
ip
,
port
=
port
,
login_type
=
jtype
,
idc
=
idc
,
login_type
=
jtype
,
idc
=
idc
,
is_active
=
int
(
active
),
is_active
=
int
(
active
),
...
@@ -135,7 +136,15 @@ def batch_host_edit(request):
...
@@ -135,7 +136,15 @@ def batch_host_edit(request):
j_active
=
request
.
POST
.
get
(
j_active
)
.
strip
()
j_active
=
request
.
POST
.
get
(
j_active
)
.
strip
()
j_comment
=
request
.
POST
.
get
(
j_comment
)
.
strip
()
j_comment
=
request
.
POST
.
get
(
j_comment
)
.
strip
()
jasset_host_edit
(
j_id
,
j_ip
,
j_idc
,
j_port
,
j_type
,
j_group
,
j_active
,
j_comment
)
if
j_type
==
'M'
:
j_user
=
"editable["
+
str
(
i
)
+
"][j_user]"
j_password
=
"editable["
+
str
(
i
)
+
"][j_password]"
j_user
=
request
.
POST
.
get
(
j_user
)
.
strip
()
password
=
request
.
POST
.
get
(
j_password
)
.
strip
()
j_password
=
cryptor
.
encrypt
(
password
)
jasset_host_edit
(
j_id
,
j_ip
,
j_idc
,
j_port
,
j_type
,
j_group
,
j_active
,
j_comment
,
j_user
,
j_password
)
else
:
jasset_host_edit
(
j_id
,
j_ip
,
j_idc
,
j_port
,
j_type
,
j_group
,
j_active
,
j_comment
)
return
render_to_response
(
'jasset/host_list.html'
)
return
render_to_response
(
'jasset/host_list.html'
)
...
@@ -143,8 +152,15 @@ def batch_host_edit(request):
...
@@ -143,8 +152,15 @@ def batch_host_edit(request):
def
list_host
(
request
):
def
list_host
(
request
):
header_title
,
path1
,
path2
=
u'查看主机'
,
u'资产管理'
,
u'查看主机'
header_title
,
path1
,
path2
=
u'查看主机'
,
u'资产管理'
,
u'查看主机'
login_types
=
{
'L'
:
'LDAP'
,
'S'
:
'SSH_KEY'
,
'P'
:
'PASSWORD'
,
'M'
:
'MAP'
}
login_types
=
{
'L'
:
'LDAP'
,
'S'
:
'SSH_KEY'
,
'P'
:
'PASSWORD'
,
'M'
:
'MAP'
}
posts
=
Asset
.
objects
.
all
()
.
order_by
(
'ip'
)
keyword
=
request
.
GET
.
get
(
'keyword'
,
''
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
posts
,
request
)
if
keyword
:
posts
=
Asset
.
objects
.
filter
(
Q
(
ip__contains
=
keyword
)
|
Q
(
idc__name__contains
=
keyword
)
|
Q
(
bis_group__name__contains
=
keyword
)
|
Q
(
comment__contains
=
keyword
))
.
distinct
()
.
order_by
(
'ip'
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
posts
,
request
)
else
:
posts
=
Asset
.
objects
.
all
()
.
order_by
(
'ip'
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
posts
,
request
)
return
render_to_response
(
'jasset/host_list.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
return
render_to_response
(
'jasset/host_list.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
...
@@ -192,8 +208,11 @@ def host_edit(request):
...
@@ -192,8 +208,11 @@ def host_edit(request):
a
=
Asset
.
objects
.
get
(
id
=
int
(
offset
))
a
=
Asset
.
objects
.
get
(
id
=
int
(
offset
))
if
j_type
==
'M'
:
if
j_type
==
'M'
:
if
post
.
password
==
request
.
POST
.
get
(
'j_password'
):
j_password
=
post
.
password
else
:
j_password
=
cryptor
.
encrypt
(
request
.
POST
.
get
(
'j_password'
))
j_user
=
request
.
POST
.
get
(
'j_user'
)
j_user
=
request
.
POST
.
get
(
'j_user'
)
j_password
=
cryptor
.
encrypt
(
request
.
POST
.
get
(
'j_password'
))
a
.
ip
=
j_ip
a
.
ip
=
j_ip
a
.
port
=
j_port
a
.
port
=
j_port
a
.
login_type
=
j_type
a
.
login_type
=
j_type
...
@@ -245,11 +264,43 @@ def add_idc(request):
...
@@ -245,11 +264,43 @@ def add_idc(request):
def
list_idc
(
request
):
def
list_idc
(
request
):
header_title
,
path1
,
path2
=
u'查看IDC'
,
u'资产管理'
,
u'查看IDC'
header_title
,
path1
,
path2
=
u'查看IDC'
,
u'资产管理'
,
u'查看IDC'
posts
=
IDC
.
objects
.
all
()
.
order_by
(
'id'
)
keyword
=
request
.
GET
.
get
(
'keyword'
,
''
)
if
keyword
:
posts
=
IDC
.
objects
.
filter
(
Q
(
name__contains
=
keyword
)
|
Q
(
comment__contains
=
keyword
))
else
:
posts
=
IDC
.
objects
.
all
()
.
order_by
(
'id'
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
posts
,
request
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
posts
,
request
)
return
render_to_response
(
'jasset/idc_list.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
return
render_to_response
(
'jasset/idc_list.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
def
edit_idc
(
request
):
header_title
,
path1
,
path2
=
u'编辑IDC'
,
u'资产管理'
,
u'编辑IDC'
edit
=
1
idc_id
=
request
.
GET
.
get
(
'id'
)
j_idc
=
IDC
.
objects
.
get
(
id
=
idc_id
)
default
=
IDC
.
objects
.
get
(
name
=
'默认'
)
.
asset_set
.
all
()
eposts
=
contact_list
=
Asset
.
objects
.
filter
(
idc
=
j_idc
)
.
order_by
(
'ip'
)
posts
=
[
g
for
g
in
default
if
g
not
in
eposts
]
if
request
.
method
==
'POST'
:
j_group
=
request
.
POST
.
get
(
'j_idc'
)
j_hosts
=
request
.
POST
.
getlist
(
'j_hosts'
)
j_comment
=
request
.
POST
.
get
(
'j_comment'
)
idc_default
=
request
.
POST
.
getlist
(
'idc_default'
)
for
host
in
j_hosts
:
g
=
Asset
.
objects
.
get
(
id
=
host
)
Asset
.
objects
.
filter
(
id
=
host
)
.
update
(
idc
=
j_idc
)
for
host
in
idc_default
:
g
=
Asset
.
objects
.
get
(
id
=
host
)
i
=
IDC
.
objects
.
get
(
name
=
'默认'
)
Asset
.
objects
.
filter
(
id
=
host
)
.
update
(
idc
=
i
)
return
HttpResponseRedirect
(
'/jasset/idc_detail/?id=
%
s'
%
idc_id
)
return
render_to_response
(
'jasset/idc_add.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
def
del_idc
(
request
,
offset
):
def
del_idc
(
request
,
offset
):
if
offset
==
'multi'
:
if
offset
==
'multi'
:
len_list
=
request
.
POST
.
get
(
"len_list"
)
len_list
=
request
.
POST
.
get
(
"len_list"
)
...
@@ -287,7 +338,11 @@ def add_group(request):
...
@@ -287,7 +338,11 @@ def add_group(request):
def
list_group
(
request
):
def
list_group
(
request
):
header_title
,
path1
,
path2
=
u'查看主机组'
,
u'资产管理'
,
u'查看主机组'
header_title
,
path1
,
path2
=
u'查看主机组'
,
u'资产管理'
,
u'查看主机组'
posts
=
BisGroup
.
objects
.
filter
(
type
=
'A'
)
.
order_by
(
'id'
)
keyword
=
request
.
GET
.
get
(
'keyword'
,
''
)
if
keyword
:
posts
=
BisGroup
.
objects
.
filter
(
Q
(
name__contains
=
keyword
)
|
Q
(
comment__contains
=
keyword
))
else
:
posts
=
BisGroup
.
objects
.
filter
(
type
=
'A'
)
.
order_by
(
'id'
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
posts
,
request
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
posts
,
request
)
return
render_to_response
(
'jasset/group_list.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
return
render_to_response
(
'jasset/group_list.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
...
@@ -374,8 +429,6 @@ def group_del(request, offset):
...
@@ -374,8 +429,6 @@ def group_del(request, offset):
return
HttpResponseRedirect
(
'/jasset/jgroup_list/'
)
return
HttpResponseRedirect
(
'/jasset/jgroup_list/'
)
def
host_search
(
request
):
def
host_search
(
request
):
keyword
=
request
.
GET
.
get
(
'keyword'
)
keyword
=
request
.
GET
.
get
(
'keyword'
)
login_types
=
{
'L'
:
'LDAP'
,
'S'
:
'SSH_KEY'
,
'P'
:
'PASSWORD'
,
'M'
:
'MAP'
}
login_types
=
{
'L'
:
'LDAP'
,
'S'
:
'SSH_KEY'
,
'P'
:
'PASSWORD'
,
'M'
:
'MAP'
}
...
...
jlog/views.py
View file @
d926cbde
...
@@ -18,18 +18,30 @@ CONF.read('%s/jumpserver.conf' % BASE_DIR)
...
@@ -18,18 +18,30 @@ CONF.read('%s/jumpserver.conf' % BASE_DIR)
def
log_list_online
(
request
):
def
log_list_online
(
request
):
header_title
,
path1
,
path2
=
u'查看日志'
,
u'查看日志'
,
u'在线用户'
header_title
,
path1
,
path2
=
u'查看日志'
,
u'查看日志'
,
u'在线用户'
keyword
=
request
.
GET
.
get
(
'keyword'
)
web_socket_host
=
CONF
.
get
(
'websocket'
,
'web_socket_host'
)
web_socket_host
=
CONF
.
get
(
'websocket'
,
'web_socket_host'
)
posts
=
Log
.
objects
.
filter
(
is_finished
=
0
)
.
order_by
(
'-start_time'
)
if
keyword
:
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
posts
,
request
)
posts
=
contact_list
=
Log
.
objects
.
filter
(
Q
(
user__contains
=
keyword
)
|
Q
(
host__contains
=
keyword
))
\
.
filter
(
is_finished
=
0
)
.
order_by
(
'-start_time'
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
posts
,
request
)
else
:
posts
=
Log
.
objects
.
filter
(
is_finished
=
0
)
.
order_by
(
'-start_time'
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
posts
,
request
)
return
render_to_response
(
'jlog/log_online.html'
,
locals
())
return
render_to_response
(
'jlog/log_online.html'
,
locals
())
def
log_list_offline
(
request
):
def
log_list_offline
(
request
):
header_title
,
path1
,
path2
=
u'查看日志'
,
u'查看日志'
,
u'历史记录'
header_title
,
path1
,
path2
=
u'查看日志'
,
u'查看日志'
,
u'历史记录'
keyword
=
request
.
GET
.
get
(
'keyword'
)
web_socket_host
=
CONF
.
get
(
'websocket'
,
'web_socket_host'
)
web_socket_host
=
CONF
.
get
(
'websocket'
,
'web_socket_host'
)
posts
=
Log
.
objects
.
filter
(
is_finished
=
1
)
.
order_by
(
'-start_time'
)
if
keyword
:
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
posts
,
request
)
posts
=
contact_list
=
Log
.
objects
.
filter
(
Q
(
user__contains
=
keyword
)
|
Q
(
host__contains
=
keyword
))
\
.
filter
(
is_finished
=
1
)
.
order_by
(
'-start_time'
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
posts
,
request
)
else
:
posts
=
Log
.
objects
.
filter
(
is_finished
=
1
)
.
order_by
(
'-start_time'
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
posts
,
request
)
return
render_to_response
(
'jlog/log_offline.html'
,
locals
())
return
render_to_response
(
'jlog/log_offline.html'
,
locals
())
...
...
jumpserver/api.py
View file @
d926cbde
#coding: utf-8
#coding: utf-8
from
django.http
import
HttpResponseRedirect
from
django.http
import
HttpResponseRedirect
import
json
from
django.http
import
HttpResponse
from
juser.models
import
User
,
UserGroup
from
juser.models
import
User
,
UserGroup
from
jasset.models
import
Asset
,
BisGroup
from
jasset.models
import
Asset
,
BisGroup
from
jlog.models
import
Log
def
user_perm_group_api
(
user
):
def
user_perm_group_api
(
user
):
...
@@ -85,3 +90,10 @@ def is_group_admin(request):
...
@@ -85,3 +90,10 @@ def is_group_admin(request):
return
True
return
True
else
:
else
:
return
False
return
False
def
api_user
(
request
):
hosts
=
Log
.
objects
.
filter
(
is_finished
=
0
)
.
count
()
users
=
Log
.
objects
.
filter
(
is_finished
=
0
)
.
values
(
'user'
)
.
distinct
()
.
count
()
ret
=
{
'users'
:
users
,
'hosts'
:
hosts
}
json_data
=
json
.
dumps
(
ret
)
return
HttpResponse
(
json_data
)
jumpserver/urls.py
View file @
d926cbde
...
@@ -6,7 +6,7 @@ urlpatterns = patterns('',
...
@@ -6,7 +6,7 @@ urlpatterns = patterns('',
# url(r'^$', 'jumpserver.views.home', name='home'),
# url(r'^$', 'jumpserver.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
# url(r'^blog/', include('blog.urls')),
(
r'^$'
,
'jumpserver.views.index'
),
(
r'^$'
,
'jumpserver.views.index'
),
(
r'^api/user/$'
,
'jumpserver.
views
.api_user'
),
(
r'^api/user/$'
,
'jumpserver.
api
.api_user'
),
(
r'^skin_config/$'
,
'jumpserver.views.skin_config'
),
(
r'^skin_config/$'
,
'jumpserver.views.skin_config'
),
(
r'^install/$'
,
'jumpserver.views.install'
),
(
r'^install/$'
,
'jumpserver.views.install'
),
(
r'^base/$'
,
'jumpserver.views.base'
),
(
r'^base/$'
,
'jumpserver.views.base'
),
...
...
jumpserver/views.py
View file @
d926cbde
...
@@ -46,7 +46,7 @@ def getDaysByNum(num):
...
@@ -46,7 +46,7 @@ def getDaysByNum(num):
for
i
in
range
(
0
,
num
):
for
i
in
range
(
0
,
num
):
today
=
today
-
oneday
today
=
today
-
oneday
li_date
.
append
(
today
)
li_date
.
append
(
today
)
li_str
.
append
(
str
(
today
)[
0
:
10
])
li_str
.
append
(
str
(
today
)[
5
:
10
])
li_date
.
reverse
()
li_date
.
reverse
()
li_str
.
reverse
()
li_str
.
reverse
()
t
=
(
li_date
,
li_str
)
t
=
(
li_date
,
li_str
)
...
@@ -102,12 +102,6 @@ def index(request):
...
@@ -102,12 +102,6 @@ def index(request):
return
render_to_response
(
'index.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
return
render_to_response
(
'index.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
def
api_user
(
request
):
users
=
Log
.
objects
.
filter
(
is_finished
=
0
)
.
count
()
ret
=
{
'users'
:
users
}
return
HttpResponse
(
json
.
dumps
(
ret
))
def
skin_config
(
request
):
def
skin_config
(
request
):
return
render_to_response
(
'skin_config.html'
)
return
render_to_response
(
'skin_config.html'
)
...
@@ -131,7 +125,7 @@ def page_list_return(total, current=1):
...
@@ -131,7 +125,7 @@ def page_list_return(total, current=1):
return
range
(
min_page
,
max_page
+
1
)
return
range
(
min_page
,
max_page
+
1
)
def
jasset_host_edit
(
j_id
,
j_ip
,
j_idc
,
j_port
,
j_type
,
j_group
,
j_active
,
j_comment
):
def
jasset_host_edit
(
j_id
,
j_ip
,
j_idc
,
j_port
,
j_type
,
j_group
,
j_active
,
j_comment
,
j_user
=
''
,
j_password
=
''
):
groups
=
[]
groups
=
[]
is_active
=
{
u'是'
:
'1'
,
u'否'
:
'2'
}
is_active
=
{
u'是'
:
'1'
,
u'否'
:
'2'
}
login_types
=
{
'LDAP'
:
'L'
,
'SSH_KEY'
:
'S'
,
'PASSWORD'
:
'P'
,
'MAP'
:
'M'
}
login_types
=
{
'LDAP'
:
'L'
,
'SSH_KEY'
:
'S'
,
'PASSWORD'
:
'P'
,
'MAP'
:
'M'
}
...
...
log_handler.py
View file @
d926cbde
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#coding: utf-8
#coding: utf-8
import
os
import
os
import
re
import
time
import
time
import
psutil
import
psutil
from
datetime
import
datetime
from
datetime
import
datetime
...
@@ -15,14 +16,21 @@ from jlog.models import Log
...
@@ -15,14 +16,21 @@ from jlog.models import Log
def
log_hanler
(
id
):
def
log_hanler
(
id
):
log
=
Log
.
objects
.
get
(
id
=
id
)
log
=
Log
.
objects
.
get
(
id
=
id
)
pattern
=
re
.
compile
(
r'\[.*@.*\][\$#].*'
)
if
log
:
if
log
:
filename
=
log
.
log_path
filename
=
log
.
log_path
if
os
.
path
.
isfile
(
filename
):
if
os
.
path
.
isfile
(
filename
):
ret1
=
os
.
system
(
'cat
%
s | grep "DateTime" >
%
s.his'
%
(
filename
,
filename
))
f_his
=
filename
+
'.his'
ret2
=
os
.
system
(
'cat
%
s | grep "
\
[.*@.*
\
][
\
$
\
#]" >>
%
s.his'
%
(
filename
,
filename
))
f1
=
open
(
filename
)
ret3
=
os
.
system
(
'cat
%
s | grep "EndTime" >>
%
s.his'
%
(
filename
,
filename
))
f2
=
open
(
f_his
,
'a'
)
if
(
ret1
+
ret2
+
ret3
)
==
0
:
lines
=
f1
.
readlines
()
print
'Handler
%
s ok.'
%
filename
for
line
in
lines
[
7
:]:
match
=
pattern
.
match
(
line
)
if
match
:
newline
=
re
.
sub
(
'
\
[[A-Z]'
,
''
,
line
)
f2
.
write
(
newline
)
f1
.
close
()
f2
.
close
()
log
.
log_finished
=
True
log
.
log_finished
=
True
log
.
save
()
log
.
save
()
...
...
templates/index.html
View file @
d926cbde
...
@@ -35,10 +35,10 @@
...
@@ -35,10 +35,10 @@
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<div
class=
"ibox-title"
>
<span
class=
"label label-primary pull-right"
>
Today
</span>
<span
class=
"label label-primary pull-right"
>
Today
</span>
<h5>
在线用户
</h5>
<h5>
实时
在线用户
</h5>
</div>
</div>
<div
class=
"ibox-content"
>
<div
class=
"ibox-content"
>
<h1
class=
"no-margins"
><a
href=
"/jlog/log_list/online/"
>
{{ online_user.count }}
</a></h1>
<h1
class=
"no-margins"
><a
href=
"/jlog/log_list/online/"
>
<span
id=
"online_users"
></span>
</a></h1>
<div
class=
"stat-percent font-bold text-navy"
>
44%
<i
class=
"fa fa-level-up"
></i></div>
<div
class=
"stat-percent font-bold text-navy"
>
44%
<i
class=
"fa fa-level-up"
></i></div>
<small>
Online user
</small>
<small>
Online user
</small>
</div>
</div>
...
@@ -52,18 +52,19 @@
...
@@ -52,18 +52,19 @@
<h5>
已连接服务器
</h5>
<h5>
已连接服务器
</h5>
</div>
</div>
<div
class=
"ibox-content"
>
<div
class=
"ibox-content"
>
<h1
class=
"no-margins"
><a
href=
"/jlog/log_list/online/"
>
{{ online_host.count }}
</a></h1>
<h1
class=
"no-margins"
><a
href=
"/jlog/log_list/online/"
>
<span
id=
"online_hosts"
></span>
</a></h1>
<div
class=
"stat-percent font-bold text-danger"
>
38%
<i
class=
"fa fa-level-down"
></i></div>
<div
class=
"stat-percent font-bold text-danger"
>
38%
<i
class=
"fa fa-level-down"
></i></div>
<small>
Connect host
</small>
<small>
Connect host
</small>
</div>
</div>
</div>
</div>
</div>
</div>
<div
id=
"top10"
style=
"width:100%;height:400px;"
></div>
<div
class=
"row"
>
<div
id=
"usertop10"
style=
"width:100%;height:400px;margin-top:170px"
></div>
<div
class=
"col-lg-6"
id=
"top10"
style=
"width:50%;height:400px;"
></div>
<br/>
<div
class=
"col-lg-6"
id=
"usertop10"
style=
"width:50%;height:400px;"
></div>
<div
id=
"hosttop10"
style=
"width:100%;height:400px;"
></div>
</div>
<br/>
<div
class=
"row"
>
<div
id=
"dynamic"
style=
"width:100%;height:400px;"
></div>
<div
class=
"col-lg-6"
id=
"hosttop10"
style=
"width:50%;height:400px; margin-top: 20px"
></div>
</div>
</div>
</div>
</div>
</div>
...
@@ -71,8 +72,11 @@
...
@@ -71,8 +72,11 @@
var
cate
=
{{
li_str
|
safe
}};
var
cate
=
{{
li_str
|
safe
}};
$
(
function
()
{
$
(
function
()
{
$
(
'#top10'
).
highcharts
({
$
(
'#top10'
).
highcharts
({
chart
:
{
type
:
'column'
},
title
:
{
title
:
{
text
:
'数据总览'
,
text
:
'
一周
数据总览'
,
x
:
-
20
//center
x
:
-
20
//center
},
},
subtitle
:
{
subtitle
:
{
...
@@ -101,12 +105,6 @@ $(function () {
...
@@ -101,12 +105,6 @@ $(function () {
tooltip
:
{
tooltip
:
{
valueSuffix
:
'次'
valueSuffix
:
'次'
},
},
legend
:
{
layout
:
'vertical'
,
align
:
'right'
,
verticalAlign
:
'middle'
,
borderWidth
:
0
},
navigation
:
{
navigation
:
{
buttonOptions
:
{
buttonOptions
:
{
align
:
'right'
align
:
'right'
...
@@ -149,12 +147,6 @@ $(function () {
...
@@ -149,12 +147,6 @@ $(function () {
tooltip
:
{
tooltip
:
{
valueSuffix
:
'次'
valueSuffix
:
'次'
},
},
legend
:
{
layout
:
'vertical'
,
align
:
'right'
,
verticalAlign
:
'middle'
,
borderWidth
:
0
},
series
:
[
series
:
[
{
%
for
k
,
v
in
user_dic
.
items
%
}
{
%
for
k
,
v
in
user_dic
.
items
%
}
{
{
...
@@ -192,12 +184,6 @@ $(function () {
...
@@ -192,12 +184,6 @@ $(function () {
tooltip
:
{
tooltip
:
{
valueSuffix
:
'次'
valueSuffix
:
'次'
},
},
legend
:
{
layout
:
'vertical'
,
align
:
'right'
,
verticalAlign
:
'middle'
,
borderWidth
:
0
},
series
:
[
series
:
[
{
%
for
k
,
v
in
host_dic
.
items
%
}
{
%
for
k
,
v
in
host_dic
.
items
%
}
{
{
...
@@ -208,85 +194,27 @@ $(function () {
...
@@ -208,85 +194,27 @@ $(function () {
]
]
});
});
function
magic_number
(
value
,
id
)
{
$
(
document
).
ready
(
function
()
{
var
num
=
$
(
"#"
+
id
);
Highcharts
.
setOptions
({
num
.
animate
({
count
:
value
},
{
global
:
{
duration
:
500
,
useUTC
:
false
step
:
function
()
{
num
.
text
(
String
(
parseInt
(
this
.
count
)));
}
}
});
});
};
var
chart
;
function
update
()
{
$
(
'#dynamic'
).
highcharts
({
$
.
getJSON
(
'api/user/'
,
function
(
data
)
{
chart
:
{
var
users
=
data
.
users
;
type
:
'spline'
,
var
hosts
=
data
.
hosts
;
animation
:
Highcharts
.
svg
,
// don't animate in old IE
magic_number
(
users
,
'online_users'
);
marginRight
:
10
,
magic_number
(
hosts
,
'online_hosts'
)
events
:
{
load
:
function
()
{
var
series
=
this
.
series
[
0
];
setInterval
(
function
()
{
jQuery
.
getJSON
(
'api/user/'
,
function
(
data
)
{
var
users
=
data
.
users
;
var
x
=
(
new
Date
()).
getTime
(),
// current time
y
=
users
;
console
.
log
(
users
)
series
.
addPoint
([
x
,
y
],
true
,
true
);
});
},
3000
);
}
}
},
title
:
{
text
:
'实时在线用户统计'
},
xAxis
:
{
type
:
'datetime'
,
tickPixelInterval
:
150
},
yAxis
:
{
min
:
0
,
title
:
{
text
:
'用户数量'
},
plotLines
:
[{
value
:
0
,
width
:
1
,
color
:
'#808080'
}]
},
tooltip
:
{
formatter
:
function
()
{
return
'<b>'
+
this
.
series
.
name
+
'</b><br/>'
+
Highcharts
.
dateFormat
(
'%Y-%m-%d %H:%M:%S'
,
this
.
x
)
+
'<br/>'
+
Highcharts
.
numberFormat
(
this
.
y
);
}
},
legend
:
{
enabled
:
false
},
exporting
:
{
enabled
:
false
},
series
:
[{
name
:
'实时在线用户数量'
,
data
:
(
function
()
{
// generate an array of random data
var
data
=
[],
time
=
(
new
Date
()).
getTime
(),
i
;
for
(
i
=
-
19
;
i
<=
0
;
i
++
)
{
data
.
push
({
x
:
time
+
i
*
1000
,
y
:
0
});
}
return
data
;
})()
}]
});
});
});
};
setInterval
(
update
,
5000
);
//5秒钟执行一次
update
();
});
});
</script>
</script>
...
...
templates/jasset/group_detail.html
View file @
d926cbde
...
@@ -57,7 +57,7 @@
...
@@ -57,7 +57,7 @@
<td
class=
"text-center"
name=
"j_port"
>
{{ post.port }}
</td>
<td
class=
"text-center"
name=
"j_port"
>
{{ post.port }}
</td>
<td
class=
"text-center"
name=
"j_type"
>
{{ login_types|get_item:post.login_type }}
</td>
<td
class=
"text-center"
name=
"j_type"
>
{{ login_types|get_item:post.login_type }}
</td>
<td
class=
"text-center"
name=
"j_idc"
>
{{ post.idc.name }}
</td>
<td
class=
"text-center"
name=
"j_idc"
>
{{ post.idc.name }}
</td>
<td
class=
"text-center"
name=
"j_group"
>
{
% for group in post.bis_group.all|filter_private %} {{ group }} {% endfor %
}
</td>
<td
class=
"text-center"
name=
"j_group"
>
{
{ post.bis_group.all | group_str2 }
}
</td>
<td
class=
"text-center"
name=
"j_active"
>
{{ post.is_active|bool2str }}
</td>
<td
class=
"text-center"
name=
"j_active"
>
{{ post.is_active|bool2str }}
</td>
<td
class=
"text-center"
>
{{ post.date_added|date:"Y-m-d H:i:s" }}
</td>
<td
class=
"text-center"
>
{{ 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"
name=
"j_comment"
>
{{ post.comment }}
</td>
...
@@ -88,6 +88,9 @@
...
@@ -88,6 +88,9 @@
<a
href=
"#"
>
Previous
</a>
<a
href=
"#"
>
Previous
</a>
</li>
</li>
{% endif %}
{% endif %}
{% ifequal show_first 1 %}
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?id={{ group_id }}&page=1"
title=
"第1页"
>
1...
</a></li>
{% endifequal %}
{% for page in page_range %}
{% for page in page_range %}
{% ifequal current_page page %}
{% ifequal current_page page %}
<li
class=
"paginate_button active"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?id={{ group_id }}&page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
<li
class=
"paginate_button active"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?id={{ group_id }}&page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
...
@@ -95,6 +98,9 @@
...
@@ -95,6 +98,9 @@
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?id={{ group_id }}&page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?id={{ group_id }}&page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% endifequal %}
{% endifequal %}
{% endfor %}
{% endfor %}
{% ifequal show_end 1 %}
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?id={{ group_id }}&page={{ p.num_pages }}"
title=
"第{{ page }}页"
>
...{{ p.num_pages }}
</a></li>
{% endifequal %}
{% if contacts.has_next %}
{% if contacts.has_next %}
<li
class=
"paginate_button next"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_next"
>
<li
class=
"paginate_button next"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_next"
>
<a
href=
"?id={{ group_id }}&page={{ contacts.next_page_number }}"
>
Next
</a>
<a
href=
"?id={{ group_id }}&page={{ contacts.next_page_number }}"
>
Next
</a>
...
...
templates/jasset/group_list.html
View file @
d926cbde
...
@@ -9,6 +9,17 @@
...
@@ -9,6 +9,17 @@
<div
class=
"ibox-content"
>
<div
class=
"ibox-content"
>
<div
class=
""
>
<div
class=
""
>
<a
target=
"_blank"
href=
"/jasset/jgroup_add"
class=
"btn btn-sm btn-primary "
>
添加主机组
</a>
<a
target=
"_blank"
href=
"/jasset/jgroup_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>
</form>
</div>
</div>
<form
id=
"contents_form"
name=
"contents_form"
>
<form
id=
"contents_form"
name=
"contents_form"
>
...
...
templates/jasset/host_edit.html
View file @
d926cbde
...
@@ -56,15 +56,25 @@
...
@@ -56,15 +56,25 @@
{% endfor %}
{% endfor %}
</div>
</div>
<div
name=
"a1"
id=
a1
style=
"display:none;"
>
{% ifequal post.login_type M %}
<div
class=
"form-group"
><label
class=
"col-sm-2 col-sm-offset-1 control-label"
>
普通用户名
</label>
<div
class=
"form-group"
><label
class=
"col-sm-2 col-sm-offset-1 control-label"
>
普通用户名
</label>
<div
class=
"col-sm-6"
><input
type=
"text"
name=
"j_user"
placeholder=
"lilei
"
class=
"form-control"
></div>
<div
class=
"col-sm-6"
><input
type=
"text"
name=
"j_user"
value=
"{{ post.username }}
"
class=
"form-control"
></div>
</div>
</div>
<div
class=
"form-group"
><label
class=
"col-sm-2 col-sm-offset-1 control-label"
>
普通用户密码
</label>
<div
class=
"form-group"
><label
class=
"col-sm-2 col-sm-offset-1 control-label"
>
普通用户密码
</label>
<div
class=
"col-sm-6"
><input
type=
"password"
name=
"j_password"
placeholder=
"Password
"
class=
"form-control"
></div>
<div
class=
"col-sm-6"
><input
type=
"password"
name=
"j_password"
value=
"{{ post.password }}
"
class=
"form-control"
></div>
</div>
</div>
</div>
{% else %}
<div
name=
"a1"
id=
a1
style=
"display:none;"
>
<div
class=
"form-group"
><label
class=
"col-sm-2 col-sm-offset-1 control-label"
>
普通用户名
</label>
<div
class=
"col-sm-6"
><input
type=
"text"
name=
"j_user"
placeholder=
"lilei"
class=
"form-control"
></div>
</div>
<div
class=
"form-group"
><label
class=
"col-sm-2 col-sm-offset-1 control-label"
>
普通用户密码
</label>
<div
class=
"col-sm-6"
><input
type=
"password"
name=
"j_password"
placeholder=
"Password"
class=
"form-control"
></div>
</div>
</div>
{% endifequal %}
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"hr-line-dashed"
></div>
...
@@ -177,19 +187,7 @@ $('#assetForm').validator({
...
@@ -177,19 +187,7 @@ $('#assetForm').validator({
msg
:
{
required
:
"请填写用户名"
}
msg
:
{
required
:
"请填写用户名"
}
},
},
"j_password"
:
{
"j_password"
:
{
rule
:
"required(type_m);length[6~16]"
,
rule
:
"required(type_m);length[6~100]"
,
tip
:
"密码6-16位"
,
ok
:
""
,
msg
:
{
required
:
"6-16位"
}
},
"j_root"
:
{
rule
:
"required(type_m)"
,
tip
:
"超管用户名"
,
ok
:
""
,
msg
:
{
required
:
"请填写用户名"
}
},
"j_passwd"
:
{
rule
:
"required(type_m);length[6~16]"
,
tip
:
"密码6-16位"
,
tip
:
"密码6-16位"
,
ok
:
""
,
ok
:
""
,
msg
:
{
required
:
"6-16位"
}
msg
:
{
required
:
"6-16位"
}
...
...
templates/jasset/host_list.html
View file @
d926cbde
...
@@ -68,7 +68,7 @@
...
@@ -68,7 +68,7 @@
<td
class=
"text-center"
name=
"j_port"
>
{{ post.port }}
</td>
<td
class=
"text-center"
name=
"j_port"
>
{{ post.port }}
</td>
<td
class=
"text-center"
name=
"j_type"
>
{{ login_types|get_item:post.login_type }}
</td>
<td
class=
"text-center"
name=
"j_type"
>
{{ login_types|get_item:post.login_type }}
</td>
<td
class=
"text-center"
name=
"j_idc"
>
{{ post.idc.name }}
</td>
<td
class=
"text-center"
name=
"j_idc"
>
{{ post.idc.name }}
</td>
<td
class=
"text-center"
name=
"j_group"
>
{{ post.bis_group.all | group_str2}}
</td>
<td
class=
"text-center"
name=
"j_group"
>
{{ post.bis_group.all | group_str2
}}
</td>
<td
class=
"text-center"
name=
"j_active"
>
{{ post.is_active|bool2str }}
</td>
<td
class=
"text-center"
name=
"j_active"
>
{{ post.is_active|bool2str }}
</td>
<td
class=
"text-center"
>
{{ post.date_added|date:"Y-m-d H:i:s" }}
</td>
<td
class=
"text-center"
>
{{ 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"
name=
"j_comment"
>
{{ post.comment }}
</td>
...
...
templates/jasset/host_search.html
View file @
d926cbde
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
<td
class=
"text-center"
name=
"j_port"
>
{{ post.port }}
</td>
<td
class=
"text-center"
name=
"j_port"
>
{{ post.port }}
</td>
<td
class=
"text-center"
name=
"j_type"
>
{{ login_types|get_item:post.login_type }}
</td>
<td
class=
"text-center"
name=
"j_type"
>
{{ login_types|get_item:post.login_type }}
</td>
<td
class=
"text-center"
name=
"j_idc"
>
{{ post.idc.name }}
</td>
<td
class=
"text-center"
name=
"j_idc"
>
{{ post.idc.name }}
</td>
<td
class=
"text-center"
name=
"j_group"
>
{
% for group in post.bis_group.all|filter_private %} {{ group }} {% endfor %
}
</td>
<td
class=
"text-center"
name=
"j_group"
>
{
{ post.bis_group.all | group_str2 }
}
</td>
<td
class=
"text-center"
name=
"j_active"
>
{{ post.is_active|bool2str }}
</td>
<td
class=
"text-center"
name=
"j_active"
>
{{ post.is_active|bool2str }}
</td>
<td
class=
"text-center"
>
{{ post.date_added|date:"Y-m-d H:i:s" }}
</td>
<td
class=
"text-center"
>
{{ 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"
name=
"j_comment"
>
{{ post.comment }}
</td>
...
@@ -40,7 +40,45 @@
...
@@ -40,7 +40,45 @@
<input
type=
"button"
id=
"del_button"
class=
"btn btn-danger btn-sm"
name=
"del_button"
value=
"删除"
onclick=
"del('contents_form')"
/>
<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')"
/>
<input
type=
"button"
id=
"alter_button"
class=
"btn btn-warning btn-sm"
name=
"alter_button"
value=
"修改"
onclick=
"alter('contents_form')"
/>
</div>
</div>
{% include 'paginator.html' %}
<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>
</div>
<script>
<script>
...
...
templates/jasset/idc_add.html
View file @
d926cbde
...
@@ -35,14 +35,43 @@
...
@@ -35,14 +35,43 @@
{% endif %}
{% endif %}
<form
id=
"assetForm"
method=
"post"
class=
"form-horizontal"
>
<form
id=
"assetForm"
method=
"post"
class=
"form-horizontal"
>
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label"
>
IDC名
</label>
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label"
>
IDC名
</label>
<div
class=
"col-sm-8"
><input
type=
"text"
value=
"{{ j_i
p
}}"
placeholder=
"北京联通"
name=
"j_idc"
class=
"form-control"
></div>
<div
class=
"col-sm-8"
><input
type=
"text"
value=
"{{ j_i
dc.name
}}"
placeholder=
"北京联通"
name=
"j_idc"
class=
"form-control"
></div>
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label"
>
备注
</label>
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label"
>
备注
</label>
<div
class=
"col-sm-8"
><input
type=
"text"
value=
"{{
s_por
t }}"
placeholder=
"核心联通机房"
name=
"j_comment"
class=
"form-control"
></div>
<div
class=
"col-sm-8"
><input
type=
"text"
value=
"{{
j_idc.commen
t }}"
placeholder=
"核心联通机房"
name=
"j_comment"
class=
"form-control"
></div>
</div>
</div>
{% if edit %}
<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>
{% endif %}
<div
class=
"hr-line-dashed"
></div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<div
class=
"col-sm-4 col-sm-offset-5"
>
<div
class=
"col-sm-4 col-sm-offset-5"
>
...
...
templates/jasset/idc_detail.html
View file @
d926cbde
...
@@ -57,7 +57,7 @@
...
@@ -57,7 +57,7 @@
<td
class=
"text-center"
name=
"j_port"
>
{{ post.port }}
</td>
<td
class=
"text-center"
name=
"j_port"
>
{{ post.port }}
</td>
<td
class=
"text-center"
name=
"j_type"
>
{{ login_types|get_item:post.login_type }}
</td>
<td
class=
"text-center"
name=
"j_type"
>
{{ login_types|get_item:post.login_type }}
</td>
<td
class=
"text-center"
name=
"j_idc"
>
{{ post.idc.name }}
</td>
<td
class=
"text-center"
name=
"j_idc"
>
{{ post.idc.name }}
</td>
<td
class=
"text-center"
name=
"j_group"
>
{
% for group in post.bis_group.all|filter_private %} {{ group }} {% endfor %
}
</td>
<td
class=
"text-center"
name=
"j_group"
>
{
{ post.bis_group.all | group_str2 }
}
</td>
<td
class=
"text-center"
name=
"j_active"
>
{{ post.is_active|bool2str }}
</td>
<td
class=
"text-center"
name=
"j_active"
>
{{ post.is_active|bool2str }}
</td>
<td
class=
"text-center"
>
{{ post.date_added|date:"Y-m-d H:i:s" }}
</td>
<td
class=
"text-center"
>
{{ 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"
name=
"j_comment"
>
{{ post.comment }}
</td>
...
...
templates/jasset/idc_list.html
View file @
d926cbde
...
@@ -9,6 +9,17 @@
...
@@ -9,6 +9,17 @@
<div
class=
"ibox-content"
>
<div
class=
"ibox-content"
>
<div
class=
""
>
<div
class=
""
>
<a
target=
"_blank"
href=
"/jasset/idc_add"
class=
"btn btn-sm btn-primary "
>
添加IDC
</a>
<a
target=
"_blank"
href=
"/jasset/idc_add"
class=
"btn btn-sm btn-primary "
>
添加IDC
</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>
</form>
</div>
</div>
<form
id=
"contents_form"
name=
"contents_form"
>
<form
id=
"contents_form"
name=
"contents_form"
>
...
@@ -31,6 +42,7 @@
...
@@ -31,6 +42,7 @@
<td
class=
"text-center"
>
{{ post.comment }}
</td>
<td
class=
"text-center"
>
{{ post.comment }}
</td>
<td
class=
"text-center"
>
<td
class=
"text-center"
>
<a
href=
"/jasset/idc_detail/?id={{ post.id }}"
class=
"iframe btn btn-xs btn-primary"
>
详情
</a>
<a
href=
"/jasset/idc_detail/?id={{ post.id }}"
class=
"iframe btn btn-xs btn-primary"
>
详情
</a>
<a
href=
"/jasset/idc_edit/?id={{ post.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
href=
"/jasset/idc_del/{{ post.id }}"
class=
"btn btn-xs btn-danger"
>
删除
</a>
<a
href=
"/jasset/idc_del/{{ post.id }}"
class=
"btn btn-xs btn-danger"
>
删除
</a>
</td>
</td>
</tr>
</tr>
...
...
templates/jlog/log_online.html
View file @
d926cbde
...
@@ -97,8 +97,7 @@
...
@@ -97,8 +97,7 @@
</tbody>
</tbody>
</table>
</table>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
<div
class=
"col-sm-6"
></div>
</div>
{% include 'paginator.html' %}
{% include 'paginator.html' %}
</div>
</div>
</div>
</div>
...
...
templates/jlog/log_search.html
View file @
d926cbde
...
@@ -23,25 +23,7 @@
...
@@ -23,25 +23,7 @@
</tbody>
</tbody>
</table>
</table>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-sm-6 col-sm-offset-6"
>
<div
class=
"col-sm-6 "
></div>
<div
class=
"dataTables_paginate paging_simple_numbers"
id=
"editable_paginate"
>
{% include 'paginator.html' %}
<ul
class=
"pagination"
style=
"margin-top: 0; float: right"
>
{% if contacts.has_previous %}
<li><a
href=
"?page={{ contacts.previous_page_number }}"
>
«
</a></li>
{% endif %}
{% for page in p.page_range %}
{% ifequal offset1 page %}
<li
class=
"active"
><a
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% else %}
<li><a
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% endifequal %}
{% endfor %}
{% if contacts.has_next %}
<li><a
href=
"?page={{ contacts.next_page_number }}"
>
»
</a></li>
{% endif %}
</ul>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
templates/paginator.html
View file @
d926cbde
<div
class=
"col-sm-6"
>
<div
class=
"col-sm-6"
>
<div
class=
"dataTables_paginate paging_simple_numbers"
id=
"editable_paginate"
>
<div
class=
"dataTables_paginate paging_simple_numbers"
id=
"editable_paginate"
>
<ul
class=
"pagination"
style=
"margin-top: 0; float: right"
>
<ul
class=
"pagination"
style=
"margin-top: 0; float: right"
>
{% if keyword %}
{% if contacts.has_previous %}
<li
class=
"paginate_button previous"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_previous"
>
<a
href=
"?keyword={{ keyword }}&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=
"?keyword={{ keyword }}&ppage=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=
"?keyword={{ keyword }}&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=
"?keyword={{ keyword }}&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 %}
{% else %}
{% if contacts.has_previous %}
{% if contacts.has_previous %}
<li
class=
"paginate_button previous"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_previous"
>
<li
class=
"paginate_button previous"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_previous"
>
<a
href=
"?page={{ contacts.previous_page_number }}"
>
Previous
</a>
<a
href=
"?page={{ contacts.previous_page_number }}"
>
Previous
</a>
...
@@ -33,6 +66,7 @@
...
@@ -33,6 +66,7 @@
<a
href=
"#"
>
Next
</a>
<a
href=
"#"
>
Next
</a>
</li>
</li>
{% endif %}
{% endif %}
{% endif %}
</ul>
</ul>
</div>
</div>
</div>
</div>
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