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
bb8852d5
Commit
bb8852d5
authored
Sep 15, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify some style
parent
037d9323
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
97 additions
and
100 deletions
+97
-100
idc_create_update.html
apps/assets/templates/assets/idc_create_update.html
+0
-0
idc_list.html
apps/assets/templates/assets/idc_list.html
+1
-1
views.py
apps/assets/views.py
+21
-17
django.mo
apps/locale/zh/LC_MESSAGES/django.mo
+0
-0
django.po
apps/locale/zh/LC_MESSAGES/django.po
+0
-0
views.py
apps/perms/views.py
+6
-5
jumpserver.js
apps/static/js/jumpserver.js
+52
-18
_foot_js.html
apps/templates/_foot_js.html
+17
-58
base.html
apps/templates/base.html
+0
-1
No files found.
apps/assets/templates/assets/idc_create.html
→
apps/assets/templates/assets/idc_create
_update
.html
View file @
bb8852d5
File moved
apps/assets/templates/assets/idc_list.html
View file @
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
View file @
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
View file @
bb8852d5
No preview for this file type
apps/locale/zh/LC_MESSAGES/django.po
View file @
bb8852d5
This diff is collapsed.
Click to expand it.
apps/perms/views.py
View file @
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
View file @
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
View file @
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
View file @
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>
...
...
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