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
239dd056
Commit
239dd056
authored
8 years ago
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish admin user view
parent
ff30435e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
283 additions
and
29 deletions
+283
-29
admin_user_create_update.html
apps/assets/templates/assets/admin_user_create_update.html
+0
-0
admin_user_detail.html
apps/assets/templates/assets/admin_user_detail.html
+221
-0
admin_user_list.html
apps/assets/templates/assets/admin_user_list.html
+1
-1
asset_group_detail.html
apps/assets/templates/assets/asset_group_detail.html
+19
-19
views.py
apps/assets/views.py
+40
-6
user_detail.html
apps/users/templates/users/user_detail.html
+2
-2
urls.py
apps/users/urls.py
+0
-1
No files found.
apps/assets/templates/assets/admin_user_create.html
→
apps/assets/templates/assets/admin_user_create
_update
.html
View file @
239dd056
File moved
This diff is collapsed.
Click to expand it.
apps/assets/templates/assets/admin_user_detail.html
0 → 100644
View file @
239dd056
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load static %}
{% load i18n %}
{% block custom_head_css_js %}
<link
href=
"{% static "
css
/
plugins
/
select2
/
select2
.
min
.
css
"
%}"
rel=
"stylesheet"
>
<script
src=
"{% static "
js
/
plugins
/
select2
/
select2
.
full
.
min
.
js
"
%}"
></script>
{% endblock %}
{% block content %}
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"panel-options"
>
<ul
class=
"nav nav-tabs"
>
<li
class=
"active"
><a
href=
""
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Detail' %}
</a>
</li>
<li><a
href=
""
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
{% trans 'Associate assets' %}
</a></li>
</ul>
</div>
<div
class=
"tab-content"
>
<div
class=
"col-sm-7"
style=
"padding-left: 0;"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<span
class=
"label"
><b>
{{ admin_user.name }}
</b></span>
<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=
"#"
></a>
</li>
<li><a
href=
"#"
></a>
</li>
</ul>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
<div
class=
"ibox-content"
>
<table
class=
"table"
>
<tbody>
<tr
class=
"no-borders-tr"
>
<td>
{% trans 'Name' %}:
</td>
<td><b>
{{ admin_user.name }}
</b></td>
</tr>
<tr>
<td>
{% trans 'Username' %}:
</td>
<td><b>
{{ admin_user.username }}
</b></td>
</tr>
<tr>
<td>
{% trans 'Date created' %}:
</td>
<td><b>
{{ admin_user.date_created }}
</b></td>
</tr>
<tr>
<td>
{% trans 'Created by' %}:
</td>
<td><b>
{{ asset_group.created_by }}
</b></td>
</tr>
<tr>
<td>
{% trans 'Comment' %}:
</td>
<td><b>
{{ admin_user.comment }}
</b></td>
</tr>
</tbody>
</table>
</div>
</div>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<span
style=
"float: left"
>
{% trans 'Asset list of ' %}
<b>
{{ admin_user.name }}
</b></span>
<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=
"#"
></a>
</li>
<li><a
href=
"#"
></a>
</li>
</ul>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
<div
class=
"ibox-content"
>
<table
class=
"table table-hover"
>
<thead>
<tr>
<th>
{% trans 'Hostname' %}
</th>
<th>
{% trans 'IP' %}
</th>
<th>
{% trans 'Port' %}
</th>
<th>
{% trans 'Alive' %}
</th>
</tr>
</thead>
<tbody>
{% for asset in page_obj %}
<tr>
<td>
{{ asset.hostname }}
</td>
<td>
{{ asset.ip }}
</td>
<td>
{{ asset.port }}
</td>
<td>
Alive
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div
class=
"row"
>
{% include '_pagination.html' %}
</div>
</div>
</div>
</div>
<div
class=
"col-sm-5"
style=
"padding-left: 0;padding-right: 0"
>
<div
class=
"panel panel-primary"
>
<div
class=
"panel-heading"
>
<i
class=
"fa fa-info-circle"
></i>
{% trans 'Quick update' %}
</div>
<div
class=
"panel-body"
>
<table
class=
"table"
>
<tbody>
<tr
class=
"no-borders-tr"
>
<td
width=
"50%"
>
{% trans 'Get install script' %}:
</td>
<td>
<span
style=
"float: right"
>
<button
type=
"button"
class=
"btn btn-primary btn-xs"
style=
"width: 54px"
>
{% trans 'Get' %}
</button>
</span>
</td>
</tr>
<tr>
<td
width=
"50%"
>
{% trans 'Retest asset connectivity' %}:
</td>
<td>
<span
style=
"float: right"
>
<button
type=
"button"
class=
"btn btn-primary btn-xs"
style=
"width: 54px"
>
{% trans 'Start' %}
</button>
</span>
</td>
</tr>
<tr>
<td
width=
"50%"
>
{% trans 'Reset private key' %}:
</td>
<td>
<span
style=
"float: right"
>
<button
type=
"button"
class=
"btn btn-primary btn-xs"
style=
"width: 54px"
>
{% trans 'Reset' %}
</button>
</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div
class=
"panel panel-info"
>
<div
class=
"panel-heading"
>
<i
class=
"fa fa-info-circle"
></i>
{% trans 'Replace asset admin user with this' %}
</div>
<div
class=
"panel-body"
>
<table
class=
"table"
>
<tbody>
<form>
<tr
class=
"no-borders-tr"
>
<td
colspan=
"2"
>
<select
data-placeholder=
"{% trans 'Select asset' %}"
class=
"select2"
style=
"width: 100%"
multiple=
""
tabindex=
"4"
>
{% for group in groups %}
<option
value=
"{{ group.id }}"
>
{{ group.name }}
</option>
{% endfor %}
</select>
</td>
</tr>
<tr
class=
"no-borders-tr"
>
<td
colspan=
"2"
>
<button
type=
"button"
class=
"btn btn-info btn-sm"
>
{% trans 'Replace' %}
</button>
</td>
</tr>
</form>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block custom_foot_js %}
<script>
{
#
function
switch_user_status
(
obj
)
{
#
}
{
#
var
status
=
$
(
obj
).
prop
(
'checked'
);
#
}
{
##
}
{
#
$
.
ajax
({
#
}
{
#
url
:
"{% url 'users:user-active-api' pk=user.id %}"
,
#
}
{
#
type
:
"PUT"
,
#
}
{
#
data
:
{
#
}
{
#
'is_active'
:
status
#
}
{
#
},
#
}
{
#
success
:
function
(
data
,
status
)
{
#
}
{
#
console
.
log
(
data
)
#
}
{
#
},
#
}
{
#
error
:
function
()
{
#
}
{
#
console
.
log
(
'error'
)
#
}
{
#
}
#
}
{
#
})
#
}
{
#
}
#
}
$
(
document
).
ready
(
function
()
{
$
(
'.select2'
).
select2
();
});
</script>
{% endblock %}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
apps/assets/templates/assets/admin_user_list.html
View file @
239dd056
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
<tr
class=
"gradeX"
>
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
{{ admin_user.id }}
</td>
<td
class=
"text-center"
>
{{ admin_user.id }}
</td>
<td>
<td>
<a
href=
"{% url '
users:user-detail' pk=
user.id %}"
>
<a
href=
"{% url '
assets:admin-user-detail' pk=admin_
user.id %}"
>
{{ admin_user.name }}
{{ admin_user.name }}
</a>
</a>
</td>
</td>
...
...
This diff is collapsed.
Click to expand it.
apps/assets/templates/assets/asset_group_detail.html
View file @
239dd056
...
@@ -69,7 +69,7 @@
...
@@ -69,7 +69,7 @@
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<div
class=
"ibox-title"
>
<span>
{% trans 'Asset list of ' %}
<b>
{{ asset_group.name }}
</b></span>
<span
style=
"float: left"
></span
>
{% trans 'Asset list of ' %}
<b>
{{ asset_group.name }}
</b></span>
<div
class=
"ibox-tools"
>
<div
class=
"ibox-tools"
>
<a
class=
"collapse-link"
>
<a
class=
"collapse-link"
>
<i
class=
"fa fa-chevron-up"
></i>
<i
class=
"fa fa-chevron-up"
></i>
...
@@ -118,7 +118,7 @@
...
@@ -118,7 +118,7 @@
<div
class=
"col-sm-5"
style=
"padding-left: 0;padding-right: 0"
>
<div
class=
"col-sm-5"
style=
"padding-left: 0;padding-right: 0"
>
<div
class=
"panel panel-primary"
>
<div
class=
"panel panel-primary"
>
<div
class=
"panel-heading"
>
<div
class=
"panel-heading"
>
<i
class=
"fa fa-info-circle"
></i>
{% trans 'Associate
asset user(system/admin)
' %}
<i
class=
"fa fa-info-circle"
></i>
{% trans 'Associate
system user
' %}
</div>
</div>
<div
class=
"panel-body"
>
<div
class=
"panel-body"
>
<table
class=
"table"
>
<table
class=
"table"
>
...
@@ -207,23 +207,23 @@
...
@@ -207,23 +207,23 @@
{% endblock %}
{% endblock %}
{% block custom_foot_js %}
{% block custom_foot_js %}
<script>
<script>
function
switch_user_status
(
obj
)
{
{
#
function
switch_user_status
(
obj
)
{
#
}
var
status
=
$
(
obj
).
prop
(
'checked'
);
{
#
var
status
=
$
(
obj
).
prop
(
'checked'
);
#
}
{
##
}
$
.
ajax
({
{
#
$
.
ajax
({
#
}
url
:
"{% url 'users:user-active-api' pk=user.id %}"
,
{
#
url
:
"{% url 'users:user-active-api' pk=user.id %}"
,
#
}
type
:
"PUT"
,
{
#
type
:
"PUT"
,
#
}
data
:
{
{
#
data
:
{
#
}
'is_active'
:
status
{
#
'is_active'
:
status
#
}
},
{
#
},
#
}
success
:
function
(
data
,
status
)
{
{
#
success
:
function
(
data
,
status
)
{
#
}
console
.
log
(
data
)
{
#
console
.
log
(
data
)
#
}
},
{
#
},
#
}
error
:
function
()
{
{
#
error
:
function
()
{
#
}
console
.
log
(
'error'
)
{
#
console
.
log
(
'error'
)
#
}
}
{
#
}
#
}
})
{
#
})
#
}
}
{
#
}
#
}
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
$
(
'.select2'
).
select2
();
$
(
'.select2'
).
select2
();
})
})
...
...
This diff is collapsed.
Click to expand it.
apps/assets/views.py
View file @
239dd056
...
@@ -213,7 +213,7 @@ class AdminUserListView(AdminUserRequiredMixin, ListView):
...
@@ -213,7 +213,7 @@ class AdminUserListView(AdminUserRequiredMixin, ListView):
return
super
(
AdminUserListView
,
self
)
.
get_context_data
(
**
kwargs
)
return
super
(
AdminUserListView
,
self
)
.
get_context_data
(
**
kwargs
)
def
get_queryset
(
self
):
def
get_queryset
(
self
):
# Todo: Default
group
by lose asset connection num
# Todo: Default
order
by lose asset connection num
self
.
queryset
=
super
(
AdminUserListView
,
self
)
.
get_queryset
()
self
.
queryset
=
super
(
AdminUserListView
,
self
)
.
get_queryset
()
self
.
keyword
=
keyword
=
self
.
request
.
GET
.
get
(
'keyword'
,
''
)
self
.
keyword
=
keyword
=
self
.
request
.
GET
.
get
(
'keyword'
,
''
)
self
.
sort
=
sort
=
self
.
request
.
GET
.
get
(
'sort'
,
'-date_created'
)
self
.
sort
=
sort
=
self
.
request
.
GET
.
get
(
'sort'
,
'-date_created'
)
...
@@ -230,7 +230,7 @@ class AdminUserListView(AdminUserRequiredMixin, ListView):
...
@@ -230,7 +230,7 @@ class AdminUserListView(AdminUserRequiredMixin, ListView):
class
AdminUserCreateView
(
AdminUserRequiredMixin
,
SuccessMessageMixin
,
CreateView
):
class
AdminUserCreateView
(
AdminUserRequiredMixin
,
SuccessMessageMixin
,
CreateView
):
model
=
AdminUser
model
=
AdminUser
form_class
=
AdminUserForm
form_class
=
AdminUserForm
template_name
=
'assets/admin_user_create.html'
template_name
=
'assets/admin_user_create
_update
.html'
success_url
=
reverse_lazy
(
'assets:admin-user-list'
)
success_url
=
reverse_lazy
(
'assets:admin-user-list'
)
success_message
=
_
(
'Create admin user <a href="
%
s">
%
s</a> successfully.'
)
success_message
=
_
(
'Create admin user <a href="
%
s">
%
s</a> successfully.'
)
...
@@ -250,12 +250,46 @@ class AdminUserCreateView(AdminUserRequiredMixin, SuccessMessageMixin, CreateVie
...
@@ -250,12 +250,46 @@ class AdminUserCreateView(AdminUserRequiredMixin, SuccessMessageMixin, CreateVie
class
AdminUserUpdateView
(
AdminUserRequiredMixin
,
UpdateView
):
class
AdminUserUpdateView
(
AdminUserRequiredMixin
,
UpdateView
):
pass
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
=
{
'app'
:
'assets'
,
'action'
:
'Update admin user'
}
kwargs
.
update
(
context
)
return
super
(
AdminUserUpdateView
,
self
)
.
get_context_data
(
**
kwargs
)
class
AdminUserDetailView
(
AdminUserRequiredMixin
,
DetailView
):
def
get_success_url
(
self
):
pass
success_url
=
reverse_lazy
(
'assets:admin-user-detail'
,
pk
=
self
.
object
.
pk
)
return
success_url
class
AdminUserDetailView
(
AdminUserRequiredMixin
,
SingleObjectMixin
,
ListView
):
paginate_by
=
settings
.
CONFIG
.
DISPLAY_PER_PAGE
template_name
=
'assets/admin_user_detail.html'
context_object_name
=
'admin_user'
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
self
.
object
=
self
.
get_object
(
queryset
=
AdminUser
.
objects
.
all
())
return
super
(
AdminUserDetailView
,
self
)
.
get
(
request
,
*
args
,
**
kwargs
)
def
get_queryset
(
self
):
return
self
.
object
.
assets
.
all
()
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
'assets'
,
'action'
:
'Admin user detail'
}
kwargs
.
update
(
context
)
return
super
(
AdminUserDetailView
,
self
)
.
get_context_data
(
**
kwargs
)
class
AdminUserDeleteView
(
AdminUserRequiredMixin
,
DeleteView
):
class
AdminUserDeleteView
(
AdminUserRequiredMixin
,
DeleteView
):
pass
model
=
AdminUser
template_name
=
'assets/delete_confirm.html'
success_url
=
'assets:admin-user-list'
This diff is collapsed.
Click to expand it.
apps/users/templates/users/user_detail.html
View file @
239dd056
...
@@ -108,7 +108,7 @@
...
@@ -108,7 +108,7 @@
<div
class=
"col-sm-5"
style=
"padding-left: 0;padding-right: 0"
>
<div
class=
"col-sm-5"
style=
"padding-left: 0;padding-right: 0"
>
<div
class=
"panel panel-primary"
>
<div
class=
"panel panel-primary"
>
<div
class=
"panel-heading"
>
<div
class=
"panel-heading"
>
<i
class=
"fa fa-info-circle"
></i>
{% trans 'Quick
modify
' %}
<i
class=
"fa fa-info-circle"
></i>
{% trans 'Quick
update
' %}
</div>
</div>
<div
class=
"panel-body"
>
<div
class=
"panel-body"
>
<table
class=
"table"
>
<table
class=
"table"
>
...
@@ -191,7 +191,7 @@
...
@@ -191,7 +191,7 @@
<tr>
<tr>
<td
><b
class=
"bdg_user_group"
data-gid=
{{
group
.
id
}}
>
{{ group.name }}
</b></td>
<td
><b
class=
"bdg_user_group"
data-gid=
{{
group
.
id
}}
>
{{ group.name }}
</b></td>
<td>
<td>
<button
class=
"btn btn-danger btn-
sm
btn_delete_user_group"
type=
"button"
style=
"float: right;"
><i
class=
"fa fa-minus"
></i></button>
<button
class=
"btn btn-danger btn-
xs
btn_delete_user_group"
type=
"button"
style=
"float: right;"
><i
class=
"fa fa-minus"
></i></button>
</td>
</td>
</tr>
</tr>
{% endfor %}
{% endfor %}
...
...
This diff is collapsed.
Click to expand it.
apps/users/urls.py
View file @
239dd056
...
@@ -16,7 +16,6 @@ urlpatterns = [
...
@@ -16,7 +16,6 @@ urlpatterns = [
name
=
'reset-password-success'
),
name
=
'reset-password-success'
),
url
(
r'^user$'
,
views
.
UserListView
.
as_view
(),
name
=
'user-list'
),
url
(
r'^user$'
,
views
.
UserListView
.
as_view
(),
name
=
'user-list'
),
url
(
r'^user/(?P<pk>[0-9]+)$'
,
views
.
UserDetailView
.
as_view
(),
name
=
'user-detail'
),
url
(
r'^user/(?P<pk>[0-9]+)$'
,
views
.
UserDetailView
.
as_view
(),
name
=
'user-detail'
),
url
(
r'^user/(?P<pk>[0-9]+)/assets-perm$'
,
views
.
UserDetailView
.
as_view
(),
name
=
'user-detail'
),
url
(
r'^user/create$'
,
views
.
UserCreateView
.
as_view
(),
name
=
'user-create'
),
url
(
r'^user/create$'
,
views
.
UserCreateView
.
as_view
(),
name
=
'user-create'
),
url
(
r'^user/(?P<pk>[0-9]+)/update$'
,
views
.
UserUpdateView
.
as_view
(),
name
=
'user-update'
),
url
(
r'^user/(?P<pk>[0-9]+)/update$'
,
views
.
UserUpdateView
.
as_view
(),
name
=
'user-update'
),
url
(
r'^user/(?P<pk>[0-9]+)/delete$'
,
views
.
UserDeleteView
.
as_view
(),
name
=
'user-delete'
),
url
(
r'^user/(?P<pk>[0-9]+)/delete$'
,
views
.
UserDeleteView
.
as_view
(),
name
=
'user-delete'
),
...
...
This diff is collapsed.
Click to expand it.
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