Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gjl2004yn
jumpserver
提交
bb8852d5
J
jumpserver
项目概览
gjl2004yn
/
jumpserver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jumpserver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bb8852d5
编写于
9月 15, 2016
作者:
baltery
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Modify some style
上级
037d9323
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
1131 addition
and
340 deletion
+1131
-340
apps/assets/templates/assets/idc_create_update.html
apps/assets/templates/assets/idc_create_update.html
+0
-0
apps/assets/templates/assets/idc_list.html
apps/assets/templates/assets/idc_list.html
+1
-1
apps/assets/views.py
apps/assets/views.py
+21
-17
apps/locale/zh/LC_MESSAGES/django.mo
apps/locale/zh/LC_MESSAGES/django.mo
+0
-0
apps/locale/zh/LC_MESSAGES/django.po
apps/locale/zh/LC_MESSAGES/django.po
+1034
-240
apps/perms/views.py
apps/perms/views.py
+6
-5
apps/static/js/jumpserver.js
apps/static/js/jumpserver.js
+52
-18
apps/templates/_foot_js.html
apps/templates/_foot_js.html
+17
-58
apps/templates/base.html
apps/templates/base.html
+0
-1
未找到文件。
apps/assets/templates/assets/idc_create.html
→
apps/assets/templates/assets/idc_create
_update
.html
浏览文件 @
bb8852d5
文件已移动
apps/assets/templates/assets/idc_list.html
浏览文件 @
bb8852d5
...
...
@@ -28,7 +28,7 @@
<td
class=
"text-center"
>
{{ idc.address }}
</td>
<td
class=
"text-center"
>
<a
href=
"{% url 'assets:idc-update' pk=idc.id %}"
class=
"btn btn-xs btn-info"
>
{% trans 'Update' %}
</a>
<a
onclick=
"obj
_del(this,'{{ idc.name }}',
'{% url 'assets:idc-delete' idc.id %}')"
class=
"btn btn-xs btn-danger del"
>
{% trans 'Delete' %}
</a>
<a
onclick=
"obj
ectDelete(this, '{{ idc.name }}',
'{% url 'assets:idc-delete' idc.id %}')"
class=
"btn btn-xs btn-danger del"
>
{% trans 'Delete' %}
</a>
</td>
</tr>
{% endfor %}
...
...
apps/assets/views.py
浏览文件 @
bb8852d5
...
...
@@ -173,7 +173,7 @@ class IDCListView(AdminUserRequiredMixin, ListView):
class
IDCCreateView
(
AdminUserRequiredMixin
,
CreateView
):
model
=
IDC
form_class
=
IDCForm
template_name
=
'assets/idc_create.html'
template_name
=
'assets/idc_create
_update
.html'
success_url
=
reverse_lazy
(
'assets:idc-list'
)
def
get_context_data
(
self
,
**
kwargs
):
...
...
@@ -188,24 +188,26 @@ class IDCCreateView(AdminUserRequiredMixin, CreateView):
class
IDCUpdateView
(
AdminUserRequiredMixin
,
UpdateView
):
model
=
IDC
form_class
=
IDCForm
template_name
=
'assets/idc_create.html'
context_object_name
=
'
IDC
'
template_name
=
'assets/idc_create
_update
.html'
context_object_name
=
'
idc
'
success_url
=
reverse_lazy
(
'assets:idc-list'
)
def
form_valid
(
self
,
form
):
IDC
=
form
.
save
(
commit
=
False
)
IDC
.
save
()
idc
=
form
.
save
(
commit
=
False
)
idc
.
save
()
return
super
(
IDCUpdateView
,
self
).
form_valid
(
form
)
class
IDCDetailView
(
AdminUserRequiredMixin
,
DetailView
):
pass
class
IDCDeleteView
(
AdminUserRequiredMixin
,
DeleteView
):
model
=
IDC
template_name
=
'assets/delete_confirm.html'
success_url
=
reverse_lazy
(
'assets:idc-list'
)
class
AdminUserListView
(
AdminUserRequiredMixin
,
ListView
):
model
=
AdminUser
paginate_by
=
settings
.
CONFIG
.
DISPLAY_PER_PAGE
...
...
@@ -241,7 +243,6 @@ class AdminUserCreateView(AdminUserRequiredMixin, SuccessMessageMixin, CreateVie
form_class
=
AdminUserForm
template_name
=
'assets/admin_user_create_update.html'
success_url
=
reverse_lazy
(
'assets:admin-user-list'
)
success_message
=
_
(
'Create admin user <a href="%s">%s</a> successfully.'
)
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
...
...
@@ -252,17 +253,18 @@ class AdminUserCreateView(AdminUserRequiredMixin, SuccessMessageMixin, CreateVie
return
super
(
AdminUserCreateView
,
self
).
get_context_data
(
**
kwargs
)
def
get_success_message
(
self
,
cleaned_data
):
return
self
.
success_message
%
(
reverse_lazy
(
'assets:admin-user-detail'
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
}),
self
.
object
.
name
,
)
success_message
=
_
(
'Create admin user <a href="%s">%s</a> successfully.'
%
(
reverse_lazy
(
'assets:admin-user-detail'
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
}),
self
.
object
.
name
,
))
return
success_message
class
AdminUserUpdateView
(
AdminUserRequiredMixin
,
UpdateView
):
model
=
AdminUser
form_class
=
AdminUserForm
template_name
=
'assets/admin_user_create_update.html'
success_message
=
_
(
'Update admin user <a href="%s">%s</a> successfully.'
)
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
...
...
@@ -340,7 +342,6 @@ class SystemUserCreateView(AdminUserRequiredMixin, SuccessMessageMixin, CreateVi
form_class
=
SystemUserForm
template_name
=
'assets/system_user_create_update.html'
success_url
=
reverse_lazy
(
'assets:system-user-list'
)
success_message
=
_
(
'Create system user <a href="%s">%s</a> successfully.'
)
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
...
...
@@ -351,10 +352,13 @@ class SystemUserCreateView(AdminUserRequiredMixin, SuccessMessageMixin, CreateVi
return
super
(
SystemUserCreateView
,
self
).
get_context_data
(
**
kwargs
)
def
get_success_message
(
self
,
cleaned_data
):
return
self
.
success_message
%
(
reverse_lazy
(
'assets:system-user-detail'
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
}),
self
.
object
.
name
,
)
success_message
=
_
(
'Create system user <a href="%s">%s</a> successfully.'
%
(
reverse_lazy
(
'assets:system-user-detail'
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
}),
self
.
object
.
name
,
))
return
self
.
success_message
class
SystemUserUpdateView
(
AdminUserRequiredMixin
,
UpdateView
):
...
...
apps/locale/zh/LC_MESSAGES/django.mo
浏览文件 @
bb8852d5
无法预览此类型文件
apps/locale/zh/LC_MESSAGES/django.po
浏览文件 @
bb8852d5
此差异已折叠。
点击以展开。
apps/perms/views.py
浏览文件 @
bb8852d5
...
...
@@ -60,7 +60,6 @@ class AssetPermissionCreateView(AdminUserRequiredMixin, SuccessMessageMixin, Cre
form_class
=
AssetPermissionForm
template_name
=
'perms/asset_permission_create_update.html'
success_url
=
reverse_lazy
(
'perms:asset-permission-list'
)
success_message
=
_
(
'Create asset permission <a href="%s"> %s </a> successfully.'
)
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
...
...
@@ -71,10 +70,12 @@ class AssetPermissionCreateView(AdminUserRequiredMixin, SuccessMessageMixin, Cre
return
super
(
AssetPermissionCreateView
,
self
).
get_context_data
(
**
kwargs
)
def
get_success_message
(
self
,
cleaned_data
):
return
self
.
success_message
%
(
reverse_lazy
(
'perms:asset-permission-detail'
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
}),
self
.
object
.
name
,
)
success_message
=
_
(
'Create asset permission <a href="%s"> %s </a> successfully.'
%
(
reverse_lazy
(
'perms:asset-permission-detail'
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
}),
self
.
object
.
name
,
))
return
success_message
class
AssetPermissionUpdateView
(
AdminUserRequiredMixin
,
UpdateView
):
...
...
apps/static/js/jumpserver.js
浏览文件 @
bb8852d5
...
...
@@ -124,33 +124,66 @@ function move_left(from, to, from_o, to_o) {
function
selectAll
(){
//
选择该页面所有option
//
Select all check box
$
(
'
option
'
).
each
(
function
(){
$
(
this
).
attr
(
'
selected
'
,
true
);
});
}
//
//function move_all(from, to){
// $("#"+from).children().each(function(){
// $("#"+to).append(this);
// });
//}
// function getIDall() {
// var check_array = [];
// $(".gradeX input:checked").each(function () {
// var id = $(this).attr("value");
// check_array.push(id);
// });
// return check_array.join(",");
// }
function
getCookie
(
name
)
{
var
cookieValue
=
null
;
if
(
document
.
cookie
&&
document
.
cookie
!==
''
)
{
var
cookies
=
document
.
cookie
.
split
(
'
;
'
);
for
(
var
i
=
0
;
i
<
cookies
.
length
;
i
++
)
{
var
cookie
=
jQuery
.
trim
(
cookies
[
i
]);
// Does this cookie string begin with the name we want?
if
(
cookie
.
substring
(
0
,
name
.
length
+
1
)
===
(
name
+
'
=
'
))
{
cookieValue
=
decodeURIComponent
(
cookie
.
substring
(
name
.
length
+
1
));
break
;
}
}
}
return
cookieValue
;
}
//function commit_select(form_array){
// $('#{0} option'.format(form_array)).each(function(){
// $(this).prop('selected', true)
// })
//}
function
csrfSafeMethod
(
method
)
{
// these HTTP methods do not require CSRF protection
return
(
/^
(
GET|HEAD|OPTIONS|TRACE
)
$/
.
test
(
method
));
}
function
getIDall
()
{
var
check_array
=
[];
$
(
"
.gradeX input:checked
"
).
each
(
function
()
{
var
id
=
$
(
this
).
attr
(
"
value
"
);
check_array
.
push
(
id
);
function
setAjaxCSRFToken
()
{
var
csrftoken
=
getCookie
(
'
csrftoken
'
);
var
sessionid
=
getCookie
(
'
sessionid
'
);
$
.
ajaxSetup
({
beforeSend
:
function
(
xhr
,
settings
)
{
if
(
!
csrfSafeMethod
(
settings
.
type
)
&&
!
this
.
crossDomain
)
{
xhr
.
setRequestHeader
(
"
X-CSRFToken
"
,
csrftoken
);
}
}
});
return
check_array
.
join
(
"
,
"
);
}
function
activeNav
()
{
var
url_array
=
document
.
location
.
pathname
.
split
(
"
/
"
);
var
app
=
url_array
[
1
];
var
resource
=
url_array
[
2
];
if
(
app
==
''
){
$
(
'
#index
'
).
addClass
(
'
active
'
)
}
else
{
$
(
"
#
"
+
app
).
addClass
(
'
active
'
);
$
(
'
#
'
+
app
+
'
#
'
+
resource
).
addClass
(
'
active
'
);
}
}
function
APIUpdateAttr
(
props
)
{
...
...
@@ -158,6 +191,7 @@ function APIUpdateAttr(props) {
props
=
props
||
{};
success_message
=
props
.
success_message
||
'
Update Successfully!
'
;
fail_message
=
props
.
fail_message
||
'
Error occurred while updating.
'
;
$
.
ajax
({
url
:
props
.
url
,
type
:
props
.
method
||
"
PATCH
"
,
...
...
apps/templates/_foot_js.html
浏览文件 @
bb8852d5
...
...
@@ -6,62 +6,23 @@
<!-- Custom and plugin javascript -->
<script
src=
"{% static "
js
/
plugins
/
toastr
/
toastr.min.js
"
%}"
></script>
<script
src=
"{% static "
js
/
inspinia.js
"
%}"
></script>
<script
src=
"{% static "
js
/
jumpserver.js
"
%}"
></script>
<script>
// active menu
var
url_array
=
document
.
location
.
pathname
.
split
(
"
/
"
);
app
=
url_array
[
1
];
resource
=
url_array
[
2
];
if
(
app
==
''
){
$
(
'
#index
'
).
addClass
(
'
active
'
)
}
else
{
$
(
"
#
"
+
app
).
addClass
(
'
active
'
);
$
(
'
#
'
+
app
+
'
#
'
+
resource
).
addClass
(
'
active
'
);
}
// ajax set cookie
function
getCookie
(
name
)
{
var
cookieValue
=
null
;
if
(
document
.
cookie
&&
document
.
cookie
!==
''
)
{
var
cookies
=
document
.
cookie
.
split
(
'
;
'
);
for
(
var
i
=
0
;
i
<
cookies
.
length
;
i
++
)
{
var
cookie
=
jQuery
.
trim
(
cookies
[
i
]);
// Does this cookie string begin with the name we want?
if
(
cookie
.
substring
(
0
,
name
.
length
+
1
)
===
(
name
+
'
=
'
))
{
cookieValue
=
decodeURIComponent
(
cookie
.
substring
(
name
.
length
+
1
));
break
;
}
}
}
return
cookieValue
;
}
var
csrftoken
=
getCookie
(
'
csrftoken
'
);
var
sessionid
=
getCookie
(
'
sessionid
'
);
function
csrfSafeMethod
(
method
)
{
// these HTTP methods do not require CSRF protection
return
(
/^
(
GET|HEAD|OPTIONS|TRACE
)
$/
.
test
(
method
));
}
$
.
ajaxSetup
({
beforeSend
:
function
(
xhr
,
settings
)
{
if
(
!
csrfSafeMethod
(
settings
.
type
)
&&
!
this
.
crossDomain
)
{
xhr
.
setRequestHeader
(
"
X-CSRFToken
"
,
csrftoken
);
}
}
});
// textarea rows
$
(
'
textarea
'
).
attr
(
'
rows
'
,
5
)
activeNav
();
$
(
document
).
ready
(
function
(){
setAjaxCSRFToken
();
// Set textarea rows five
$
(
'
textarea
'
).
attr
(
'
rows
'
,
5
);
});
//Sweet Alert for Delete
function
obj_del
(
obj
,
name
,
url
){
// Sweet Alert for Delete
// Todo: Change name to objectDelete(obj, name, url)
function
objectDelete
(
obj
,
name
,
url
){
swal
({
title
:
"
{% trans 'Are you sure delete ??' %}
"
,
//text: "You will not be able to recover this imaginary file!",
text
:
"
【
"
+
name
+
"
】
"
,
title
:
"
{% trans 'Are you sure delete ?' %}
"
,
text
:
"
【
"
+
name
+
"
】
"
,
type
:
"
warning
"
,
showCancelButton
:
true
,
cancelButtonText
:
"
{% trans 'Cancel' %}
"
,
...
...
@@ -73,16 +34,14 @@ function obj_del(obj,name,url){
type
:
"
post
"
,
url
:
url
,
data
:
{
// idc_id : idc_id
},
dataType
:
"
text
"
,
success
:
function
(
data
)
{
swal
(
"
{% trans 'Deleted!' %}
"
,
"
【
"
+
name
+
"
】
"
+
"
{% trans 'has been deleted.' %}
"
,
"
success
"
);
$
(
obj
).
parent
().
parent
().
remove
();
},
dataType
:
"
text
"
});
swal
(
"
{% trans 'Deleted!' %}
"
,
"
【
"
+
name
+
"
】
"
+
"
{% trans 'has been deleted.' %}
"
,
"
success
"
);
$
(
obj
).
parent
().
parent
().
remove
();
}
})
});
}
</script>
<script
src=
"{% static "
js
/
jumpserver.js
"
%}"
></script>
apps/templates/base.html
浏览文件 @
bb8852d5
...
...
@@ -12,7 +12,6 @@
{% include '_head_css_js.html' %}
{% block custom_head_css_js %} {% endblock %}
<link
href=
"{% static "
css
/
jumpserver.css
"
%}"
rel=
"stylesheet"
>
<script
src=
"{% static "
js
/
jumpserver.js
"
%}"
></script>
</head>
<body>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录