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
8acbcb2e
Commit
8acbcb2e
authored
Sep 07, 2016
by
xiaokong1937@gmail.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of code.simcu.com:jumpserver/jumpserver
parents
04151b99
4db352f5
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
744 additions
and
190 deletions
+744
-190
forms.py
apps/assets/forms.py
+24
-2
hands.py
apps/assets/hands.py
+14
-0
models.py
apps/assets/models.py
+66
-19
asset_group_create.html
apps/assets/templates/assets/asset_group_create.html
+1
-13
asset_group_detail.html
apps/assets/templates/assets/asset_group_detail.html
+232
-0
asset_group_list.html
apps/assets/templates/assets/asset_group_list.html
+1
-1
delete_confirm.html
apps/assets/templates/assets/delete_confirm.html
+16
-0
idc_create.html
apps/assets/templates/assets/idc_create.html
+62
-0
idc_list.html
apps/assets/templates/assets/idc_list.html
+35
-0
urls.py
apps/assets/urls.py
+6
-1
views.py
apps/assets/views.py
+99
-5
django.po
apps/locale/zh/LC_MESSAGES/django.po
+168
-126
jumpserver.css
apps/static/css/jumpserver.css
+1
-0
_list_base.html
apps/templates/_list_base.html
+0
-1
_nav.html
apps/templates/_nav.html
+1
-1
_pagination.html
apps/templates/_pagination.html
+0
-5
hands.py
apps/users/hands.py
+14
-0
_user.html
apps/users/templates/users/_user.html
+1
-1
user_detail.html
apps/users/templates/users/user_detail.html
+1
-14
user_group_create.html
apps/users/templates/users/user_group_create.html
+1
-1
urls.py
apps/users/urls.py
+1
-0
No files found.
apps/assets/forms.py
View file @
8acbcb2e
...
...
@@ -45,14 +45,36 @@ class AssetGroupForm(forms.ModelForm):
fields
=
[
"name"
,
"comment"
]
help_texts
=
{
'name'
:
'* required'
,
}
class
IDCForm
(
forms
.
ModelForm
):
assets
=
forms
.
ModelMultipleChoiceField
(
queryset
=
Asset
.
objects
.
all
(),
label
=
_
(
'Asset'
),
required
=
False
,
widget
=
forms
.
SelectMultiple
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Select assets'
)})
)
def
__init__
(
self
,
*
args
,
**
kwargs
):
if
kwargs
.
get
(
'instance'
):
initial
=
kwargs
.
get
(
'initial'
,
{})
initial
[
'assets'
]
=
kwargs
[
'instance'
]
.
assets
.
all
()
super
(
IDCForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
def
_save_m2m
(
self
):
super
(
IDCForm
,
self
)
.
_save_m2m
()
assets
=
self
.
cleaned_data
[
'assets'
]
self
.
instance
.
assets
.
clear
()
self
.
instance
.
assets
.
add
(
*
tuple
(
assets
))
class
IdcForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
IDC
fields
=
[
'name'
,
"bandwidth"
,
"operator"
,
'contact'
,
'phone'
,
'address'
,
'network'
,
'comment'
]
widgets
=
{
'name'
:
forms
.
TextInput
(
attrs
=
{
'placeholder'
:
'Name'
}),
'name'
:
forms
.
TextInput
(
attrs
=
{
'placeholder'
:
_
(
'Name'
)
}),
'network'
:
forms
.
Textarea
(
attrs
=
{
'placeholder'
:
'192.168.1.0/24
\n
192.168.2.0/24'
})
}
apps/assets/hands.py
0 → 100644
View file @
8acbcb2e
"""
jumpserver.__app__.hands.py
~~~~~~~~~~~~~~~~~
This app depends other apps api, function .. should be import or write mack here.
Other module of this app shouldn't connect with other app.
:copyright: (c) 2014-2016 by Jumpserver Team.
:license: GPL v2, see LICENSE for more details.
"""
apps/assets/models.py
View file @
8acbcb2e
...
...
@@ -2,19 +2,10 @@
from
__future__
import
unicode_literals
,
absolute_import
from
django.db
import
models
import
logging
from
django.utils.translation
import
ugettext_lazy
as
_
class
AssetGroup
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
64
,
unique
=
True
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Name'
))
created_by
=
models
.
CharField
(
max_length
=
32
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Created by'
))
comment
=
models
.
TextField
(
blank
=
True
,
verbose_name
=
_
(
'Comment'
))
def
__unicode__
(
self
):
return
self
.
name
class
Meta
:
db_table
=
'asset_group'
logger
=
logging
.
getLogger
(
__name__
)
class
IDC
(
models
.
Model
):
...
...
@@ -24,7 +15,7 @@ class IDC(models.Model):
phone
=
models
.
CharField
(
max_length
=
32
,
blank
=
True
,
verbose_name
=
_
(
'Phone'
))
address
=
models
.
CharField
(
max_length
=
128
,
blank
=
True
,
verbose_name
=
_
(
"Address"
))
network
=
models
.
TextField
(
blank
=
True
,
verbose_name
=
_
(
'Network'
))
date_created
=
models
.
DateField
(
auto_now
=
True
,
null
=
True
,
verbose_name
=
_
(
'Date added'
))
date_created
=
models
.
Date
Time
Field
(
auto_now
=
True
,
null
=
True
,
verbose_name
=
_
(
'Date added'
))
operator
=
models
.
CharField
(
max_length
=
32
,
blank
=
True
,
verbose_name
=
_
(
'Operator'
))
created_by
=
models
.
CharField
(
max_length
=
32
,
blank
=
True
,
verbose_name
=
_
(
'Created by'
))
comment
=
models
.
TextField
(
blank
=
True
,
verbose_name
=
_
(
'Comment'
))
...
...
@@ -47,7 +38,7 @@ class AssetExtend(models.Model):
return
self
.
name
class
Meta
:
db_table
=
'assetextend'
db_table
=
'asset
_
extend'
class
AdminUser
(
models
.
Model
):
...
...
@@ -65,10 +56,10 @@ class AdminUser(models.Model):
return
self
.
name
class
Meta
:
db_table
=
'adminuser'
db_table
=
'admin
_
user'
class
SysUser
(
models
.
Model
):
class
Sys
tem
User
(
models
.
Model
):
PROTOCOL_CHOICES
=
(
(
'ssh'
,
'ssh'
),
(
'telnet'
,
'telnet'
),
...
...
@@ -94,7 +85,44 @@ class SysUser(models.Model):
return
self
.
name
class
Meta
:
db_table
=
'sysuser'
db_table
=
'system_user'
class
AssetGroup
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
64
,
unique
=
True
,
verbose_name
=
_
(
'Name'
))
system_users
=
models
.
ManyToManyField
(
SystemUser
,
related_name
=
'asset_groups'
,
blank
=
True
)
created_by
=
models
.
CharField
(
max_length
=
32
,
blank
=
True
,
verbose_name
=
_
(
'Created by'
))
date_created
=
models
.
DateTimeField
(
auto_now
=
True
,
null
=
True
,
verbose_name
=
_
(
'Date added'
))
comment
=
models
.
TextField
(
blank
=
True
,
verbose_name
=
_
(
'Comment'
))
def
__unicode__
(
self
):
return
self
.
name
class
Meta
:
db_table
=
'asset_group'
@classmethod
def
initial
(
cls
):
asset_group
=
cls
(
name
=
_
(
'Default'
),
commont
=
_
(
'Default asset group'
))
asset_group
.
save
()
@classmethod
def
generate_fake
(
cls
,
count
=
100
):
from
random
import
seed
import
forgery_py
from
django.db
import
IntegrityError
seed
()
for
i
in
range
(
count
):
group
=
cls
(
name
=
forgery_py
.
name
.
full_name
(),
comment
=
forgery_py
.
lorem_ipsum
.
sentence
(),
created_by
=
'Fake'
)
try
:
group
.
save
()
logger
.
debug
(
'Generate fake asset group:
%
s'
%
group
.
name
)
except
IntegrityError
:
print
(
'Error continue'
)
continue
class
Asset
(
models
.
Model
):
...
...
@@ -106,9 +134,9 @@ class Asset(models.Model):
groups
=
models
.
ManyToManyField
(
AssetGroup
,
related_name
=
'assets'
,
verbose_name
=
_
(
'Asset groups'
))
username
=
models
.
CharField
(
max_length
=
16
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Admin user'
))
password
=
models
.
CharField
(
max_length
=
256
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
"Admin password"
))
admin_user
=
models
.
ForeignKey
(
AdminUser
,
null
=
True
,
blank
=
True
,
on_delete
=
models
.
SET_NULL
,
verbose_name
=
_
(
"Admin user"
))
sys
_user
=
models
.
ManyToManyField
(
SysUser
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
"System User"
))
idc
=
models
.
ForeignKey
(
IDC
,
null
=
True
,
blank
=
True
,
on_delete
=
models
.
SET_NULL
,
verbose_name
=
_
(
'IDC'
))
admin_user
=
models
.
ForeignKey
(
AdminUser
,
null
=
True
,
on_delete
=
models
.
SET_NULL
,
verbose_name
=
_
(
"Admin user"
))
sys
tem_user
=
models
.
ManyToManyField
(
SystemUser
,
blank
=
True
,
verbose_name
=
_
(
"System User"
))
idc
=
models
.
ForeignKey
(
IDC
,
null
=
True
,
related_name
=
'assets'
,
on_delete
=
models
.
SET_NULL
,
verbose_name
=
_
(
'IDC'
))
mac_addr
=
models
.
CharField
(
max_length
=
20
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
"Mac address"
))
brand
=
models
.
CharField
(
max_length
=
64
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Brand'
))
cpu
=
models
.
CharField
(
max_length
=
64
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'CPU'
))
...
...
@@ -137,6 +165,25 @@ class Asset(models.Model):
db_table
=
'asset'
index_together
=
(
'ip'
,
'port'
)
@classmethod
def
generate_fake
(
cls
,
count
=
100
):
from
random
import
seed
import
forgery_py
from
django.db
import
IntegrityError
seed
()
for
i
in
range
(
count
):
asset
=
cls
(
ip
=
'
%
s.
%
s.
%
s.
%
s'
%
tuple
([
forgery_py
.
forgery
.
basic
.
text
(
length
=
3
,
digits
=
True
)
for
i
in
range
(
0
,
4
)]),
port
=
22
,
created_by
=
'Fake'
)
try
:
asset
.
save
()
logger
.
debug
(
'Generate fake asset :
%
s'
%
asset
.
ip
)
except
IntegrityError
:
print
(
'Error continue'
)
continue
class
Label
(
models
.
Model
):
key
=
models
.
CharField
(
max_length
=
64
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'KEY'
))
...
...
apps/assets/templates/assets/asset_group_create.html
View file @
8acbcb2e
...
...
@@ -27,22 +27,10 @@
</div>
</div>
<div
class=
"ibox-content"
>
<form
method=
"post"
id=
"userForm"
class=
"form-horizontal"
action=
""
>
<form
method=
"post"
class=
"form-horizontal"
action=
""
>
{% csrf_token %}
{{ form.name|bootstrap_horizontal }}
{{ form.assets|bootstrap_horizontal }}
{#
<div
class=
"form-group"
>
#}
{#
<label
for=
"users"
class=
"col-sm-2 control-label"
>
{% trans 'Asset' %}
</label>
#}
{#
<div
class=
"col-sm-9"
>
#}
{#
<select
name=
"assets"
id=
"assets"
data-placeholder=
"{% trans 'Select asset' %}"
class=
"select2 form-control m-b"
multiple
tabindex=
"2"
>
#}
{# {% for asset in assets %}#}
{#
<option
value=
"{{ asset.id }}"
>
{{ asset.ip }}:{{ asset.port }}
</option>
#}
{# {% endfor %}#}
{#
</select>
#}
{#
</div>
#}
{#
</div>
#}
{{ form.comment|bootstrap_horizontal }}
<div
class=
"form-group"
>
...
...
apps/assets/templates/assets/asset_group_detail.html
0 → 100644
View file @
8acbcb2e
{% 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 'Asset group perm' %}
</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>
{{ asset_group.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>
{{ asset_group.name }}
</b></td>
</tr>
<tr>
<td>
{% trans 'Date created' %}:
</td>
<td><b>
{{ asset_group.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>
{{ asset_group.comment }}
</b></td>
</tr>
</tbody>
</table>
</div>
</div>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<span>
{% trans 'Asset list of ' %}
<b>
{{ asset_group.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 'Associate asset user(system/admin)' %}
</div>
<div
class=
"panel-body"
>
<table
class=
"table"
>
<tbody>
<tr
class=
"no-borders-tr"
>
<td
width=
"50%"
>
{% trans 'repush system user' %}:
</td>
<td>
<span
style=
"float: right"
>
<button
class=
"btn btn-danger btn-xs"
type=
"button"
><i
class=
"fa fa-refresh"
></i></button>
</span>
</td>
</tr>
<form>
<tr
class=
"no-borders-tr"
>
<td
colspan=
"2"
>
<select
data-placeholder=
"{% trans 'Select system user' %}"
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-primary btn-sm"
>
{% trans 'Associate' %}
</button>
</td>
</tr>
</form>
{% for group in user.groups.all %}
<tr>
<td
><b>
{{ group.name }}
</b></td>
<td>
<button
class=
"btn btn-danger btn-xs"
type=
"button"
style=
"float: right;"
><i
class=
"fa fa-minus"
></i></button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div
class=
"panel panel-info"
>
<div
class=
"panel-heading"
>
<i
class=
"fa fa-info-circle"
></i>
{% trans 'Add asset to this group' %}
</div>
<div
class=
"panel-body"
>
<table
class=
"table"
>
<tbody>
<form>
<tr
class=
"no-borders-tr"
>
<td
colspan=
"2"
>
<select
data-placeholder=
"{% trans 'Select asset user' %}"
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 'Add' %}
</button>
</td>
</tr>
</form>
{% for group in user.groups.all %}
<tr>
<td
><b>
{{ group.name }}
</b></td>
<td>
<button
class=
"btn btn-danger btn-xs"
type=
"button"
style=
"float: right;"
><i
class=
"fa fa-minus"
></i></button>
</td>
</tr>
{% endfor %}
</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
apps/assets/templates/assets/asset_group_list.html
View file @
8acbcb2e
...
...
@@ -27,7 +27,7 @@
</a>
</td>
<td
class=
"text-center"
>
{{ asset_group.assets.count }}
</td>
<td
class=
"text-center"
>
{{ asset_group.comment }}
</td>
<td
class=
"text-center"
>
{{ asset_group.comment
|truncatewords:8
}}
</td>
<td
class=
"text-center"
>
<a
href=
"{% url 'assets:asset-group-update' pk=asset_group.id %}"
class=
"btn btn-xs btn-info"
>
{% trans 'Update' %}
</a>
<a
href=
"{% url 'assets:asset-group-delete' pk=asset_group.id %}"
class=
"btn btn-xs btn-danger del"
>
{% trans 'Delete' %}
</a>
...
...
apps/assets/templates/assets/delete_confirm.html
0 → 100644
View file @
8acbcb2e
{% load i18n %}
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
{% trans 'Confirm delete' %}
</title>
</head>
<body>
<form
action=
""
method=
"post"
>
{% csrf_token %}
<p>
Are you sure you want to delete "{{ object.name }}"?
</p>
<input
type=
"submit"
value=
"Confirm"
/>
</form>
</body>
</html>
\ No newline at end of file
apps/assets/templates/assets/idc_create.html
0 → 100644
View file @
8acbcb2e
{% extends 'base.html' %}
{% load i18n %}
{% load static %}
{% load bootstrap %}
{% 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=
"ibox-title"
>
<h5>
{% trans 'Create 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>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
<div
class=
"ibox-content"
>
<form
method=
"post"
class=
"form-horizontal"
action=
""
>
{% csrf_token %}
{{ form.name|bootstrap_horizontal }}
{{ form.assets|bootstrap_horizontal }}
{{ form.bandwidth|bootstrap_horizontal }}
{{ form.operator|bootstrap_horizontal }}
{{ form.contact|bootstrap_horizontal }}
{{ form.phone|bootstrap_horizontal }}
{{ form.address|bootstrap_horizontal }}
{{ form.network|bootstrap_horizontal }}
{{ form.comment|bootstrap_horizontal }}
<div
class=
"form-group"
>
<div
class=
"col-sm-4 col-sm-offset-2"
>
<button
class=
"btn btn-white"
type=
"reset"
>
{% trans 'Reset' %}
</button>
<button
id=
"submit_button"
class=
"btn btn-primary"
type=
"submit"
>
{% trans 'Submit' %}
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block custom_foot_js %}
<script>
$
(
document
).
ready
(
function
()
{
$
(
'.select2'
).
select2
();
})
</script>
{% endblock %}
\ No newline at end of file
apps/assets/templates/assets/idc_list.html
0 → 100644
View file @
8acbcb2e
{% extends '_list_base.html' %}
{% load i18n %}
{% load common_tags %}
{% block content_left_head %}
<a
href=
"{% url 'assets:idc-create' %}"
class=
"btn btn-sm btn-primary "
>
{% trans "Create IDC" %}
</a>
{% endblock %}
{% block table_head %}
<th
class=
"text-center"
>
{% trans 'ID' %}
</th>
<th
class=
"text-center"
><a
href=
"{% url 'assets:idc-list' %}?sort=name"
>
{% trans 'Name' %}
</a></th>
<th
class=
"text-center"
>
{% trans 'Asset num' %}
</th>
<th
class=
"text-center"
>
{% trans 'Bandwidth' %}
</th>
<th
class=
"text-center"
>
{% trans 'Contact' %}
</th>
<th
class=
"text-center"
>
{% trans 'Phone' %}
</th>
<th
class=
"text-center"
>
{% trans 'Address' %}
</th>
<th
class=
"text-center"
></th>
{% endblock %}
{% block table_body %}
{% for idc in idc_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
{{ idc.id }}
</td>
<td
class=
"text-center"
>
{{ idc.name }}
</td>
<td
class=
"text-center"
>
{{ idc.assets.count }}
</td>
<td
class=
"text-center"
>
{{ idc.bandwidth }}
</td>
<td
class=
"text-center"
>
{{ idc.contact }}
</td>
<td
class=
"text-center"
>
{{ idc.phone }}
</td>
<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
href=
"{% url 'assets:idc-delete' pk=idc.id %}"
class=
"btn btn-xs btn-danger del"
>
{% trans 'Delete' %}
</a>
</td>
</tr>
{% endfor %}
{% endblock %}
apps/assets/urls.py
View file @
8acbcb2e
...
...
@@ -16,12 +16,17 @@ urlpatterns = [
url
(
r'^asset$'
,
views
.
AssetListView
.
as_view
(),
name
=
'asset-list'
),
url
(
r'^asset/create$'
,
views
.
AssetCreateView
.
as_view
(),
name
=
'asset-create'
),
url
(
r'^asset/(?P<pk>[0-9]+)$'
,
views
.
AssetDetailView
.
as_view
(),
name
=
'asset-detail'
),
url
(
r'^asset/(?P<pk>[0-9]+)
$
/update'
,
views
.
AssetUpdateView
.
as_view
(),
name
=
'asset-update'
),
url
(
r'^asset/(?P<pk>[0-9]+)/update'
,
views
.
AssetUpdateView
.
as_view
(),
name
=
'asset-update'
),
url
(
r'^asset/(?P<pk>[0-9]+)/delete$'
,
views
.
AssetDeleteView
.
as_view
(),
name
=
'asset-delete'
),
url
(
r'^asset-group$'
,
views
.
AssetGroupListView
.
as_view
(),
name
=
'asset-group-list'
),
url
(
r'^asset-group/create$'
,
views
.
AssetGroupCreateView
.
as_view
(),
name
=
'asset-group-create'
),
url
(
r'^asset-group/(?P<pk>[0-9]+)$'
,
views
.
AssetGroupDetailView
.
as_view
(),
name
=
'asset-group-detail'
),
url
(
r'^asset-group/(?P<pk>[0-9]+)/update$'
,
views
.
AssetGroupUpdateView
.
as_view
(),
name
=
'asset-group-update'
),
url
(
r'^asset-group/(?P<pk>[0-9]+)/delete$'
,
views
.
AssetGroupDeleteView
.
as_view
(),
name
=
'asset-group-delete'
),
url
(
r'^idc$'
,
views
.
IDCListView
.
as_view
(),
name
=
'idc-list'
),
url
(
r'^idc/create$'
,
views
.
IDCCreateView
.
as_view
(),
name
=
'idc-create'
),
url
(
r'^idc/(?P<pk>[0-9]+)$'
,
views
.
IDCDetailView
.
as_view
(),
name
=
'idc-detail'
),
url
(
r'^idc/(?P<pk>[0-9]+)/update'
,
views
.
IDCUpdateView
.
as_view
(),
name
=
'idc-update'
),
url
(
r'^idc/(?P<pk>[0-9]+)/delete$'
,
views
.
IDCDeleteView
.
as_view
(),
name
=
'idc-delete'
),
# url(r'^api/v1.0/', include(router.urls)),
]
apps/assets/views.py
View file @
8acbcb2e
...
...
@@ -6,13 +6,15 @@ from django.shortcuts import get_object_or_404
from
django.views.generic
import
TemplateView
,
ListView
from
django.urls
import
reverse_lazy
from
django.views.generic.edit
import
CreateView
,
DeleteView
,
FormView
,
UpdateView
from
django.conf
import
settings
from
django.db.models
import
Q
from
django.views.generic
import
TemplateView
,
ListView
from
django.views.generic.edit
import
CreateView
,
DeleteView
,
FormView
,
UpdateView
from
django.urls
import
reverse_lazy
from
django.views.generic.detail
import
DetailView
from
django.views.generic.detail
import
DetailView
,
SingleObjectMixin
from
.models
import
Asset
,
AssetGroup
,
IDC
,
AssetExtend
from
.forms
import
AssetForm
,
AssetGroupForm
from
.forms
import
AssetForm
,
AssetGroupForm
,
IDCForm
from
.utils
import
AdminUserRequiredMixin
...
...
@@ -54,6 +56,8 @@ class AssetGroupCreateView(CreateView):
template_name
=
'assets/asset_group_create.html'
success_url
=
reverse_lazy
(
'assets:asset-group-list'
)
# Todo: Asset group create template select assets so hard, need be resolve next
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
_
(
'Assets'
),
...
...
@@ -70,20 +74,52 @@ class AssetGroupCreateView(CreateView):
class
AssetGroupListView
(
ListView
):
model
=
AssetGroup
paginate_by
=
settings
.
CONFIG
.
DISPLAY_PER_PAGE
context_object_name
=
'asset_group_list'
template_name
=
'assets/asset_group_list.html'
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
_
(
'Assets'
),
'action'
:
_
(
'Asset group list'
)
'action'
:
_
(
'Asset group list'
),
'keyword'
:
self
.
request
.
GET
.
get
(
'keyword'
,
''
)
}
kwargs
.
update
(
context
)
return
super
(
AssetGroupListView
,
self
)
.
get_context_data
(
**
kwargs
)
def
get_queryset
(
self
):
self
.
queryset
=
super
(
AssetGroupListView
,
self
)
.
get_queryset
()
self
.
keyword
=
keyword
=
self
.
request
.
GET
.
get
(
'keyword'
,
''
)
self
.
sort
=
sort
=
self
.
request
.
GET
.
get
(
'sort'
,
'-date_created'
)
class
AssetGroupDetailView
(
DetailView
):
pass
if
keyword
:
self
.
queryset
=
self
.
queryset
.
filter
(
Q
(
name__icontains
=
keyword
)
|
Q
(
comment__icontains
=
keyword
))
if
sort
:
self
.
queryset
=
self
.
queryset
.
order_by
(
sort
)
return
self
.
queryset
class
AssetGroupDetailView
(
SingleObjectMixin
,
ListView
):
template_name
=
'assets/asset_group_detail.html'
paginate_by
=
settings
.
CONFIG
.
DISPLAY_PER_PAGE
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
self
.
object
=
self
.
get_object
(
queryset
=
AssetGroup
.
objects
.
all
())
return
super
(
AssetGroupDetailView
,
self
)
.
get
(
request
,
*
args
,
**
kwargs
)
def
get_queryset
(
self
):
return
self
.
object
.
assets
.
all
()
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
_
(
'Assets'
),
'action'
:
_
(
'Asset group detail'
),
'asset_group'
:
self
.
object
,
}
kwargs
.
update
(
context
)
return
super
(
AssetGroupDetailView
,
self
)
.
get_context_data
(
**
kwargs
)
class
AssetGroupUpdateView
(
UpdateView
):
...
...
@@ -103,4 +139,62 @@ class AssetGroupUpdateView(UpdateView):
class
AssetGroupDeleteView
(
DeleteView
):
template_name
=
'assets/delete_confirm.html'
model
=
AssetGroup
success_url
=
reverse_lazy
(
'assets:asset-group-list'
)
class
IDCListView
(
ListView
):
model
=
IDC
paginate_by
=
settings
.
CONFIG
.
DISPLAY_PER_PAGE
context_object_name
=
'idc_list'
template_name
=
'assets/idc_list.html'
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
_
(
'Assets'
),
'action'
:
_
(
'IDC list'
),
'keyword'
:
self
.
request
.
GET
.
get
(
'keyword'
,
''
)
}
kwargs
.
update
(
context
)
return
super
(
IDCListView
,
self
)
.
get_context_data
(
**
kwargs
)
def
get_queryset
(
self
):
self
.
queryset
=
super
(
IDCListView
,
self
)
.
get_queryset
()
self
.
keyword
=
keyword
=
self
.
request
.
GET
.
get
(
'keyword'
,
''
)
self
.
sort
=
sort
=
self
.
request
.
GET
.
get
(
'sort'
,
'-date_created'
)
if
keyword
:
self
.
queryset
=
self
.
queryset
.
filter
(
Q
(
name__icontains
=
keyword
)
|
Q
(
comment__icontains
=
keyword
))
if
sort
:
self
.
queryset
=
self
.
queryset
.
order_by
(
sort
)
return
self
.
queryset
class
IDCCreateView
(
CreateView
):
model
=
IDC
form_class
=
IDCForm
template_name
=
'assets/idc_create.html'
success_url
=
reverse_lazy
(
'assets:idc-list'
)
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
'assets'
,
'action'
:
'Create IDC'
}
kwargs
.
update
(
context
)
return
super
(
IDCCreateView
,
self
)
.
get_context_data
(
**
kwargs
)
class
IDCUpdateView
(
UpdateView
):
pass
class
IDCDetailView
(
DetailView
):
pass
class
IDCDeleteView
(
DeleteView
):
pass
apps/locale/zh/LC_MESSAGES/django.po
View file @
8acbcb2e
...
...
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Jumpserver 0.3.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-09-06 1
5:08
+0800\n"
"POT-Creation-Date: 2016-09-06 1
9:12
+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: ibuler <ibuler@qq.com>\n"
"Language-Team: Jumpserver team<ibuler@qq.com>\n"
...
...
@@ -21,7 +21,7 @@ msgstr ""
msgid "Select asset groups"
msgstr "添加到资产组"
#: assets/forms.py:25 assets/models.py:1
44
templates/_nav.html:21
#: assets/forms.py:25 assets/models.py:1
71
templates/_nav.html:21
msgid "Asset"
msgstr "资产"
...
...
@@ -29,67 +29,79 @@ msgstr "资产"
msgid "Select assets"
msgstr "选择资产"
#: assets/models.py:
9 assets/models.py:21 assets/models.py:54
#: assets/models.py:
76 assets/templates/assets/asset_group_list.html:12
#:
users/models.py:60 users/models.py:107
#: users/templates/users/user_detail.html:69
#: assets/models.py:
12 assets/models.py:48 assets/models.py:81
#: assets/models.py:
103 assets/templates/assets/asset_group_detail.html:63
#:
assets/templates/assets/asset_group_list.html:12 users/models.py:60
#: users/
models.py:107 users/
templates/users/user_detail.html:69
#: users/templates/users/user_list.html:12
msgid "Name"
msgstr "名称"
#: assets/models.py:1
0 assets/models.py:29 assets/models.py:42
#: assets/models.py:
61 assets/models.py:90 assets/models.py:125
#: assets/models.py:1
45
users/models.py:122
#: assets/models.py:1
3 assets/models.py:56 assets/models.py:69
#: assets/models.py:
88 assets/models.py:117 assets/models.py:152
#: assets/models.py:1
72
users/models.py:122
#: users/templates/users/user_detail.html:101
msgid "Created by"
msgstr "创建者"
#: assets/models.py:11 assets/models.py:30 assets/models.py:44
#: assets/models.py:62 assets/models.py:91 assets/models.py:128
#: assets/models.py:147 assets/templates/assets/asset_group_list.html:14
#: users/models.py:61 users/models.py:118
#: users/templates/users/user_detail.html:113
#: assets/models.py:14 assets/models.py:54 assets/models.py:154
msgid "Date added"
msgstr "加入日期"
#: assets/models.py:15 assets/models.py:57 assets/models.py:71
#: assets/models.py:89 assets/models.py:118 assets/models.py:155
#: assets/models.py:174 assets/templates/assets/asset_group_detail.html:75
#: assets/templates/assets/asset_group_list.html:14 users/models.py:61
#: users/models.py:118 users/templates/users/user_detail.html:113
msgid "Comment"
msgstr "备注"
#: assets/models.py:22
#: assets/models.py:25
#, fuzzy
#| msgid "As default"
msgid "Default"
msgstr "默认使用"
#: assets/models.py:25
#, fuzzy
#| msgid "Create asset group"
msgid "Default asset group"
msgstr "创建资产组"
#: assets/models.py:49
msgid "Bandwidth"
msgstr "带宽"
#: assets/models.py:
23
#: assets/models.py:
50
msgid "Contact"
msgstr "联系人"
#: assets/models.py:
24
users/models.py:113
#: assets/models.py:
51
users/models.py:113
#: users/templates/users/user_detail.html:82
msgid "Phone"
msgstr "手机"
#: assets/models.py:
25
#: assets/models.py:
52
msgid "Address"
msgstr "地址"
#: assets/models.py:
26
#: assets/models.py:
53
msgid "Network"
msgstr "网络"
#: assets/models.py:27 assets/models.py:127
msgid "Date added"
msgstr "加入日期"
#: assets/models.py:28
#: assets/models.py:55
msgid "Operator"
msgstr "运营商"
#: assets/models.py:
40 assets/models.py:142
#: assets/models.py:
67 assets/models.py:169
msgid "KEY"
msgstr "KEY"
#: assets/models.py:
41 assets/models.py:143
#: assets/models.py:
68 assets/models.py:170
msgid "VALUE"
msgstr "VALUE"
#: assets/models.py:
55 assets/models.py:77
users/forms.py:13
#: assets/models.py:
82 assets/models.py:104
users/forms.py:13
#: users/models.py:106 users/templates/users/login.html:53
#: users/templates/users/user_detail.html:73
#: users/templates/users/user_list.html:13
...
...
@@ -97,7 +109,7 @@ msgstr "VALUE"
msgid "Username"
msgstr "用户名"
#: assets/models.py:
56 assets/models.py:78
users/forms.py:15
#: assets/models.py:
83 assets/models.py:105
users/forms.py:15
#: users/templates/users/login.html:56
#: users/templates/users/reset_password.html:52
#: users/templates/users/user_create.html:8
...
...
@@ -107,149 +119,151 @@ msgstr "用户名"
msgid "Password"
msgstr "密码"
#: assets/models.py:
57 assets/models.py:80
#: assets/models.py:
84 assets/models.py:107
msgid "SSH private key"
msgstr "ssh密钥"
#: assets/models.py:
58 assets/models.py:82
#: assets/models.py:
85 assets/models.py:109
msgid "As default"
msgstr "默认使用"
#: assets/models.py:
59 assets/models.py:84
#: assets/models.py:
86 assets/models.py:111
msgid "Auto update pass/key"
msgstr "自动更新密码/密钥"
#: assets/models.py:
79
#: assets/models.py:
106
msgid "Protocol"
msgstr "协议"
#: assets/models.py:
81
#: assets/models.py:
108
msgid "SSH public key"
msgstr "ssh公钥"
#: assets/models.py:
83
#: assets/models.py:
110
msgid "Auto push"
msgstr "自动推送"
#: assets/models.py:
85
#: assets/models.py:
112
msgid "Sudo"
msgstr "Sudo"
#: assets/models.py:
86
#: assets/models.py:
113
msgid "Shell"
msgstr "Shell"
#: assets/models.py:
87
templates/_header_bar.html:41 templates/_nav.html:4
#: assets/models.py:
114
templates/_header_bar.html:41 templates/_nav.html:4
msgid "Home"
msgstr "仪表盘"
#: assets/models.py:
88
#: assets/models.py:
115
msgid "Uid"
msgstr "Uid"
#: assets/models.py:1
01
#: assets/models.py:1
28
msgid "IP"
msgstr "IP"
#: assets/models.py:1
02
#: assets/models.py:1
29
msgid "Other IP"
msgstr "其它IP"
#: assets/models.py:1
03
#: assets/models.py:1
30
msgid "Remote card IP"
msgstr "远控卡IP"
#: assets/models.py:1
04
#: assets/models.py:1
31
msgid "Hostname"
msgstr "用户名"
#: assets/models.py:1
05
#: assets/models.py:1
32
msgid "Port"
msgstr "端口"
#: assets/models.py:1
06
#: assets/models.py:1
33
msgid "Asset groups"
msgstr "用户组"
#: assets/models.py:1
07 assets/models.py:109
templates/_nav.html:24
#: assets/models.py:1
34 assets/models.py:136
templates/_nav.html:24
msgid "Admin user"
msgstr "管理用户"
#: assets/models.py:1
08
#: assets/models.py:1
35
msgid "Admin password"
msgstr "管理员密码"
#: assets/models.py:1
10
#: assets/models.py:1
37
msgid "System User"
msgstr "系统用户"
#: assets/models.py:1
11
templates/_nav.html:23
#: assets/models.py:1
38
templates/_nav.html:23
msgid "IDC"
msgstr "机房"
#: assets/models.py:1
12
#: assets/models.py:1
39
msgid "Mac address"
msgstr "Mac地址"
#: assets/models.py:1
13
#: assets/models.py:1
40
msgid "Brand"
msgstr "品牌"
#: assets/models.py:1
14
#: assets/models.py:1
41
msgid "CPU"
msgstr "CPU"
#: assets/models.py:1
15
#: assets/models.py:1
42
msgid "Memory"
msgstr "内存"
#: assets/models.py:1
16
#: assets/models.py:1
43
msgid "Disk"
msgstr "硬盘"
#: assets/models.py:1
17
#: assets/models.py:1
44
msgid "OS"
msgstr "操作系统"
#: assets/models.py:1
18
#: assets/models.py:1
45
msgid "Cabinet number"
msgstr "机柜编号"
#: assets/models.py:1
19
#: assets/models.py:1
46
msgid "Cabinet position"
msgstr "机柜层号"
#: assets/models.py:1
20
#: assets/models.py:1
47
msgid "Asset number"
msgstr "资产编号"
#: assets/models.py:1
21
#: assets/models.py:1
48
msgid "Asset status"
msgstr "资产状态"
#: assets/models.py:1
22
#: assets/models.py:1
49
msgid "Asset type"
msgstr "系统类型"
#: assets/models.py:1
23
#: assets/models.py:1
50
msgid "Asset environment"
msgstr "资产环境"
#: assets/models.py:1
24
#: assets/models.py:1
51
msgid "Serial number"
msgstr "序列号"
#: assets/models.py:1
26
#: assets/models.py:1
53
msgid "Is active"
msgstr "是否激活"
#: assets/templates/assets/asset_group_create.html:16
#: assets/templates/assets/asset_group_list.html:5 assets/views.py:6
0
#: assets/views.py:
98
#: assets/templates/assets/asset_group_list.html:5 assets/views.py:6
2
#: assets/views.py:
117
msgid "Create asset group"
msgstr "创建资产组"
#: assets/templates/assets/asset_group_create.html:50
#: assets/templates/assets/asset_group_detail.html:124
#: assets/templates/assets/asset_group_detail.html:132
#: users/templates/users/_user.html:70
#: users/templates/users/user_detail.html:162
#: users/templates/users/user_detail.html:170
...
...
@@ -264,6 +278,65 @@ msgstr "重置"
msgid "Submit"
msgstr "提交"
#: assets/templates/assets/asset_group_detail.html:18
msgid "Detail"
msgstr ""
#: assets/templates/assets/asset_group_detail.html:20
#, fuzzy
#| msgid "Asset group list"
msgid "Asset group assets"
msgstr "资产组列表"
#: assets/templates/assets/asset_group_detail.html:28
#: templates/_header_bar.html:8 users/templates/users/user_detail.html:29
msgid "Search"
msgstr "搜索"
#: assets/templates/assets/asset_group_detail.html:67
#, fuzzy
#| msgid "Date added"
msgid "Date create"
msgstr "加入日期"
#: assets/templates/assets/asset_group_detail.html:71
#, fuzzy
#| msgid "Created by"
msgid "Create by"
msgstr "创建者"
#: assets/templates/assets/asset_group_detail.html:86
#: users/templates/users/user_detail.html:124
msgid "Quick modify"
msgstr "快速修改"
#: assets/templates/assets/asset_group_detail.html:121
#: users/templates/users/reset_password.html:45
#: users/templates/users/user_detail.html:159 users/utils.py:98
msgid "Reset password"
msgstr "重置密码"
#: assets/templates/assets/asset_group_detail.html:129
#: users/templates/users/user_detail.html:167
msgid "Reset ssh key"
msgstr "重置密钥"
#: assets/templates/assets/asset_group_detail.html:143 templates/_nav.html:13
#: users/models.py:109 users/templates/users/user_detail.html:181
#: users/templates/users/user_list.html:15
msgid "User group"
msgstr "用户组"
#: assets/templates/assets/asset_group_detail.html:151 users/forms.py:34
#: users/forms.py:54 users/templates/users/user_detail.html:189
msgid "Join user groups"
msgstr "添加到用户组"
#: assets/templates/assets/asset_group_detail.html:160
#: users/templates/users/user_detail.html:198
msgid "Join"
msgstr "加入"
#: assets/templates/assets/asset_group_list.html:13
#: users/templates/users/user_list.html:16
msgid "Asset num"
...
...
@@ -303,19 +376,20 @@ msgstr "批量导出"
msgid "Create asset"
msgstr "创建资产"
#: assets/views.py:59 assets/views.py:78 assets/views.py:97
#: assets/templates/assets/delete_confirm.html:6
#: users/templates/users/user_delete_confirm.html:6
msgid "Confirm delete"
msgstr "确认删除"
#: assets/views.py:61 assets/views.py:81 assets/views.py:116
#: templates/_nav.html:18
msgid "Assets"
msgstr "资产管理"
#: assets/views.py:
79
#: assets/views.py:
82
msgid "Asset group list"
msgstr "资产组列表"
#: templates/_header_bar.html:8 users/templates/users/user_detail.html:29
msgid "Search"
msgstr "搜索"
#: templates/_header_bar.html:14
msgid "Welcome to use Jumpserver system"
msgstr "欢迎使用Jumpserver开源跳板机系统"
...
...
@@ -333,8 +407,8 @@ msgstr "注销登录"
msgid "Login"
msgstr "登录"
#: templates/_nav.html:9 users/views.py:
50 users/views.py:63 users/views.py:103
#: users/views.py:1
20 users/views.py:145 users/views.py:158
#: templates/_nav.html:9 users/views.py:
92 users/views.py:105
#: users/views.py:1
45 users/views.py:162 users/views.py:187 users/views.py:200
msgid "Users"
msgstr "用户管理"
...
...
@@ -342,12 +416,6 @@ msgstr "用户管理"
msgid "User"
msgstr "用户"
#: templates/_nav.html:13 users/models.py:109
#: users/templates/users/user_detail.html:181
#: users/templates/users/user_list.html:15
msgid "User group"
msgstr "用户组"
#: templates/_nav.html:22
msgid "Asset group"
msgstr "资产组"
...
...
@@ -408,11 +476,6 @@ msgstr ""
msgid "Captcha"
msgstr "验证码"
#: users/forms.py:34 users/forms.py:54
#: users/templates/users/user_detail.html:189
msgid "Join user groups"
msgstr "添加到用户组"
#: users/models.py:102 users/models.py:225
msgid "Administrator"
msgstr "管理员"
...
...
@@ -459,7 +522,7 @@ msgid "System"
msgstr "系统"
#: users/templates/users/_user.html:17 users/templates/users/user_list.html:5
#: users/views.py:
63
#: users/views.py:
105
msgid "Create user"
msgstr "创建用户"
...
...
@@ -484,11 +547,6 @@ msgstr "输入您的邮箱, 将会发一封重置短信邮件到您的邮箱中"
msgid "Captcha invalid"
msgstr "验证码错误"
#: users/templates/users/reset_password.html:45
#: users/templates/users/user_detail.html:159 users/utils.py:98
msgid "Reset password"
msgstr "重置密码"
#: users/templates/users/reset_password.html:55
msgid "Password again"
msgstr "再次输入密码"
...
...
@@ -501,11 +559,7 @@ msgstr "设置"
msgid "Reset link will be generated and sent to the user. "
msgstr "生成重置密码连接,通过邮件发送给用户"
#: users/templates/users/user_delete_confirm.html:6
msgid "Confirm delete"
msgstr "确认删除"
#: users/templates/users/user_detail.html:18 users/views.py:120
#: users/templates/users/user_detail.html:18 users/views.py:162
msgid "User detail"
msgstr "用户详情"
...
...
@@ -525,19 +579,7 @@ msgstr "创建日期"
msgid "Last login"
msgstr "最后登录"
#: users/templates/users/user_detail.html:124
msgid "Quick modify"
msgstr "快速修改"
#: users/templates/users/user_detail.html:167
msgid "Reset ssh key"
msgstr "重置密钥"
#: users/templates/users/user_detail.html:198
msgid "Join"
msgstr "加入"
#: users/templates/users/user_group_create.html:16 users/views.py:158
#: users/templates/users/user_group_create.html:16 users/views.py:200
msgid "Create user group"
msgstr "创建用户组"
...
...
@@ -546,18 +588,10 @@ msgstr "创建用户组"
msgid "Active"
msgstr "激活"
#: users/templates/users/user_update.html:3 users/views.py:1
03
#: users/templates/users/user_update.html:3 users/views.py:1
45
msgid "Update user"
msgstr "编辑用户"
#: users/urls.py:23
msgid "Logout success"
msgstr "退出登录成功"
#: users/urls.py:24
msgid "Logout success, return login page"
msgstr "退出登录成功,返回到登录页面"
#: users/utils.py:47
msgid "Begin to generate ssh private key ..."
msgstr "开始生成ssh密钥"
...
...
@@ -659,45 +693,53 @@ msgstr ""
" </br>\n"
" "
#: users/views.py:50
#: users/views.py:62
msgid "Logout success"
msgstr "退出登录成功"
#: users/views.py:63
msgid "Logout success, return login page"
msgstr "退出登录成功,返回到登录页面"
#: users/views.py:92
msgid "User list"
msgstr "用户列表"
#: users/views.py:
59
#: users/views.py:
101
#, python-format
msgid "Create user <a href=\"%s\">%s</a> success."
msgstr "创建用户 <a href=\"%s\">%s</a> 成功"
#: users/views.py:1
45
#: users/views.py:1
87
msgid "User group list"
msgstr "用户组列表"
#: users/views.py:
190
#: users/views.py:
232
msgid "Email address invalid, input again"
msgstr "邮箱地址错误,重新输入"
#: users/views.py:2
01
#: users/views.py:2
43
msgid "Send reset password message"
msgstr "发送重置密码邮件"
#: users/views.py:2
02
#: users/views.py:2
44
msgid "Send reset password mail success, login your mail box and follow it "
msgstr ""
"发送重置邮件成功, 请登录邮箱查看, 按照提示操作 (如果没收到,请等待3-5分钟)"
#: users/views.py:2
14
#: users/views.py:2
56
msgid "Reset password success"
msgstr "重置密码成功"
#: users/views.py:2
15
#: users/views.py:2
57
msgid "Reset password success, return to login page"
msgstr "重置密码成功,返回到登录页面"
#: users/views.py:2
31 users/views.py:244
#: users/views.py:2
73 users/views.py:286
msgid "Token invalid or expired"
msgstr "Token错误或失效"
#: users/views.py:2
40
#: users/views.py:2
82
msgid "Password not same"
msgstr "密码不一致"
...
...
apps/static/css/jumpserver.css
View file @
8acbcb2e
...
...
@@ -38,6 +38,7 @@ th a {
color
:
white
;
}
.select2-selection--single
,
.select2-selection--multiple
{
border
:
1px
solid
#e5e6e7
!important
;
cursor
:
text
!important
;
...
...
apps/templates/_list_base.html
View file @
8acbcb2e
...
...
@@ -22,7 +22,6 @@
<div
class=
"ibox-content"
>
<div
class=
""
>
{# left button add #}
{% block content_left_head %} {% endblock %}
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<div
class=
"input-group"
>
...
...
apps/templates/_nav.html
View file @
8acbcb2e
...
...
@@ -20,7 +20,7 @@
<ul
class=
"nav nav-second-level"
>
<li
id=
"asset"
><a
href=
"{% url 'assets:asset-list' %}"
>
{% trans 'Asset' %}
</a></li>
<li
id=
"asset-group"
><a
href=
"{% url 'assets:asset-group-list' %}"
>
{% trans 'Asset group' %}
</a></li>
<li
id=
"idc"
><a
href=
""
>
{% trans 'IDC' %}
</a></li>
<li
id=
"idc"
><a
href=
"
{% url 'assets:idc-list' %}
"
>
{% trans 'IDC' %}
</a></li>
<li
id=
"admin-user"
><a
href=
""
>
{% trans 'Admin user' %}
</a></li>
<li
id=
"system-user"
><a
href=
""
>
{% trans 'System user' %}
</a></li>
<li
id=
""
><a
href=
""
>
{% trans 'Label' %}
</a></li>
...
...
apps/templates/_pagination.html
View file @
8acbcb2e
...
...
@@ -34,11 +34,6 @@
</div>
{% endif %}
<script>
{
#
function
sleep
(
n
)
{
//n表示的毫秒数#}
{
#
var
start
=
new
Date
().
getTime
();
#
}
{
#
while
(
true
)
if
(
new
Date
().
getTime
()
-
start
>
n
)
break
;
#
}
{
#
}
#
}
$
(
document
).
ready
(
function
()
{
$
(
'.page'
).
click
(
function
()
{
var
searchStr
=
location
.
search
;
...
...
apps/users/hands.py
0 → 100644
View file @
8acbcb2e
"""
jumpserver.__app__.hands.py
~~~~~~~~~~~~~~~~~
This app depends other apps api, function .. should be import or write mack here.
Other module of this app shouldn't connect with other app.
:copyright: (c) 2014-2016 by Jumpserver Team.
:license: GPL v2, see LICENSE for more details.
"""
apps/users/templates/users/_user.html
View file @
8acbcb2e
...
...
@@ -28,7 +28,7 @@
</div>
</div>
<div
class=
"ibox-content"
>
<form
method=
"post"
id=
"userForm"
class=
"form-horizontal"
action=
""
enctype=
"multipart/form-data"
>
<form
method=
"post"
class=
"form-horizontal"
action=
""
enctype=
"multipart/form-data"
>
{% csrf_token %}
<h3>
{% trans 'Account' %}
</h3>
{% block username %} {% endblock %}
...
...
apps/users/templates/users/user_detail.html
View file @
8acbcb2e
...
...
@@ -19,19 +19,6 @@
</li>
<li><a
href=
""
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
{% trans 'User assets' %}
</a></li>
<li><a
href=
""
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
{% trans 'User log' %}
</a></li>
<div
class=
""
style=
"float: right"
>
<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=
"keyword"
name=
"keyword"
value=
"{{ keyword }}"
placeholder=
"Search"
>
<div
class=
"input-group-btn"
>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
{% trans 'Search' %}
</button>
</div>
</div>
</form>
</div>
</ul>
</div>
<div
class=
"tab-content"
>
...
...
@@ -118,7 +105,7 @@
</div>
</div>
</div>
<div
class=
"col-sm-5"
style=
"padding-left: 0
px;
"
>
<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 modify' %}
...
...
apps/users/templates/users/user_group_create.html
View file @
8acbcb2e
...
...
@@ -27,7 +27,7 @@
</div>
</div>
<div
class=
"ibox-content"
>
<form
method=
"post"
id=
"userForm"
class=
"form-horizontal"
action=
""
>
<form
method=
"post"
class=
"form-horizontal"
action=
""
>
{% csrf_token %}
{{ form.name|bootstrap_horizontal }}
...
...
apps/users/urls.py
View file @
8acbcb2e
...
...
@@ -16,6 +16,7 @@ urlpatterns = [
name
=
'reset-password-success'
),
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]+)/assets-perm$'
,
views
.
UserDetailView
.
as_view
(),
name
=
'user-detail'
),
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]+)/delete$'
,
views
.
UserDeleteView
.
as_view
(),
name
=
'user-delete'
),
...
...
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