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
b0fab245
Commit
b0fab245
authored
Jan 26, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
[Merge] 合并标签功能
parents
0a2b6494
b2d6645f
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
763 additions
and
232 deletions
+763
-232
api.py
apps/assets/api.py
+16
-3
forms.py
apps/assets/forms.py
+73
-21
__init__.py
apps/assets/models/__init__.py
+1
-0
asset.py
apps/assets/models/asset.py
+2
-0
label.py
apps/assets/models/label.py
+37
-0
serializers.py
apps/assets/serializers.py
+32
-1
asset_create.html
apps/assets/templates/assets/asset_create.html
+45
-8
asset_detail.html
apps/assets/templates/assets/asset_detail.html
+27
-0
asset_list.html
apps/assets/templates/assets/asset_list.html
+22
-0
asset_update.html
apps/assets/templates/assets/asset_update.html
+37
-9
label_create_update.html
apps/assets/templates/assets/label_create_update.html
+32
-0
label_list.html
apps/assets/templates/assets/label_list.html
+69
-0
__init__.py
apps/assets/templatetags/__init__.py
+2
-0
asset_tags.py
apps/assets/templatetags/asset_tags.py
+8
-2
api_urls.py
apps/assets/urls/api_urls.py
+1
-0
views_urls.py
apps/assets/urls/views_urls.py
+3
-0
utils.py
apps/assets/utils.py
+26
-1
__init__.py
apps/assets/views/__init__.py
+1
-0
asset.py
apps/assets/views/asset.py
+9
-7
label.py
apps/assets/views/label.py
+70
-0
common_tags.py
apps/common/templatetags/common_tags.py
+5
-0
django.mo
apps/locale/zh/LC_MESSAGES/django.mo
+0
-0
django.po
apps/locale/zh/LC_MESSAGES/django.po
+219
-172
jumpserver.css
apps/static/css/jumpserver.css
+3
-2
jumpserver.js
apps/static/js/jumpserver.js
+17
-1
_nav.html
apps/templates/_nav.html
+4
-3
terminal_list.html
apps/terminal/templates/terminal/terminal_list.html
+1
-1
user_detail.html
apps/users/templates/users/user_detail.html
+1
-1
No files found.
apps/assets/api.py
View file @
b0fab245
...
@@ -17,25 +17,26 @@ from rest_framework import generics
...
@@ -17,25 +17,26 @@ from rest_framework import generics
from
rest_framework.response
import
Response
from
rest_framework.response
import
Response
from
rest_framework_bulk
import
BulkModelViewSet
from
rest_framework_bulk
import
BulkModelViewSet
from
rest_framework_bulk
import
ListBulkCreateUpdateDestroyAPIView
from
rest_framework_bulk
import
ListBulkCreateUpdateDestroyAPIView
from
rest_framework.pagination
import
LimitOffsetPagination
from
django.shortcuts
import
get_object_or_404
from
django.shortcuts
import
get_object_or_404
from
django.db.models
import
Q
,
Count
from
django.db.models
import
Q
,
Count
from
rest_framework.pagination
import
LimitOffsetPagination
from
common.mixins
import
CustomFilterMixin
from
common.mixins
import
CustomFilterMixin
from
common.utils
import
get_logger
from
common.utils
import
get_logger
from
.hands
import
IsSuperUser
,
IsValidUser
,
IsSuperUserOrAppUser
,
\
from
.hands
import
IsSuperUser
,
IsValidUser
,
IsSuperUserOrAppUser
,
\
get_user_granted_assets
get_user_granted_assets
from
.models
import
AssetGroup
,
Asset
,
Cluster
,
SystemUser
,
AdminUser
from
.models
import
AssetGroup
,
Asset
,
Cluster
,
SystemUser
,
AdminUser
,
Label
from
.
import
serializers
from
.
import
serializers
from
.tasks
import
update_asset_hardware_info_manual
,
test_admin_user_connectability_manual
,
\
from
.tasks
import
update_asset_hardware_info_manual
,
test_admin_user_connectability_manual
,
\
test_asset_connectability_manual
,
push_system_user_to_cluster_assets_manual
,
\
test_asset_connectability_manual
,
push_system_user_to_cluster_assets_manual
,
\
test_system_user_connectability_manual
test_system_user_connectability_manual
from
.utils
import
LabelFilter
logger
=
get_logger
(
__file__
)
logger
=
get_logger
(
__file__
)
class
AssetViewSet
(
CustomFilterMixin
,
BulkModelViewSet
):
class
AssetViewSet
(
CustomFilterMixin
,
LabelFilter
,
BulkModelViewSet
):
"""
"""
API endpoint that allows Asset to be viewed or edited.
API endpoint that allows Asset to be viewed or edited.
"""
"""
...
@@ -295,3 +296,15 @@ class SystemUserTestConnectiveApi(generics.RetrieveAPIView):
...
@@ -295,3 +296,15 @@ class SystemUserTestConnectiveApi(generics.RetrieveAPIView):
system_user
=
self
.
get_object
()
system_user
=
self
.
get_object
()
test_system_user_connectability_manual
.
delay
(
system_user
)
test_system_user_connectability_manual
.
delay
(
system_user
)
return
Response
({
"msg"
:
"Task created"
})
return
Response
({
"msg"
:
"Task created"
})
class
LabelViewSet
(
BulkModelViewSet
):
queryset
=
Label
.
objects
.
annotate
(
asset_count
=
Count
(
"assets"
))
permission_classes
=
(
IsSuperUser
,)
serializer_class
=
serializers
.
LabelSerializer
def
list
(
self
,
request
,
*
args
,
**
kwargs
):
if
request
.
query_params
.
get
(
"distinct"
):
self
.
serializer_class
=
serializers
.
LabelDistinctSerializer
self
.
queryset
=
self
.
queryset
.
values
(
"name"
)
.
distinct
()
return
super
()
.
list
(
request
,
*
args
,
**
kwargs
)
apps/assets/forms.py
View file @
b0fab245
...
@@ -2,28 +2,35 @@
...
@@ -2,28 +2,35 @@
from
django
import
forms
from
django
import
forms
from
django.utils.translation
import
gettext_lazy
as
_
from
django.utils.translation
import
gettext_lazy
as
_
from
.models
import
Cluster
,
Asset
,
AssetGroup
,
AdminUser
,
SystemUser
from
.models
import
Cluster
,
Asset
,
AssetGroup
,
AdminUser
,
SystemUser
,
Label
from
common.utils
import
validate_ssh_private_key
,
ssh_pubkey_gen
,
ssh_key_gen
,
get_logger
from
common.utils
import
validate_ssh_private_key
,
ssh_pubkey_gen
,
ssh_key_gen
,
get_logger
logger
=
get_logger
(
__file__
)
logger
=
get_logger
(
__file__
)
class
AssetCreateForm
(
forms
.
ModelForm
):
class
AssetCreateForm
(
forms
.
ModelForm
):
class
Meta
:
class
Meta
:
model
=
Asset
model
=
Asset
fields
=
[
fields
=
[
'hostname'
,
'ip'
,
'public_ip'
,
'port'
,
'type'
,
'comment'
,
'hostname'
,
'ip'
,
'public_ip'
,
'port'
,
'type'
,
'comment'
,
'cluster'
,
'groups'
,
'status'
,
'env'
,
'is_active'
,
'cluster'
,
'groups'
,
'status'
,
'env'
,
'is_active'
,
'admin_user'
'admin_user'
,
'labels'
]
]
widgets
=
{
widgets
=
{
'groups'
:
forms
.
SelectMultiple
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Select asset groups'
)}),
'groups'
:
forms
.
SelectMultiple
(
attrs
=
{
'cluster'
:
forms
.
Select
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Select cluster'
)}),
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Select asset groups'
)
'admin_user'
:
forms
.
Select
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Select admin user'
)}),
}),
'port'
:
forms
.
TextInput
()
'cluster'
:
forms
.
Select
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Select cluster'
)
}),
'admin_user'
:
forms
.
Select
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Select admin user'
)
}),
'labels'
:
forms
.
SelectMultiple
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Select labels'
)
}),
'port'
:
forms
.
TextInput
(),
}
}
help_texts
=
{
help_texts
=
{
'hostname'
:
'* required'
,
'hostname'
:
'* required'
,
...
@@ -40,6 +47,14 @@ class AssetCreateForm(forms.ModelForm):
...
@@ -40,6 +47,14 @@ class AssetCreateForm(forms.ModelForm):
raise
forms
.
ValidationError
(
_
(
"You need set a admin user if cluster not have"
))
raise
forms
.
ValidationError
(
_
(
"You need set a admin user if cluster not have"
))
return
self
.
cleaned_data
[
'admin_user'
]
return
self
.
cleaned_data
[
'admin_user'
]
def
is_valid
(
self
):
print
(
self
.
data
)
result
=
super
()
.
is_valid
()
if
not
result
:
print
(
self
.
errors
)
print
(
self
.
cleaned_data
)
return
result
class
AssetUpdateForm
(
forms
.
ModelForm
):
class
AssetUpdateForm
(
forms
.
ModelForm
):
class
Meta
:
class
Meta
:
...
@@ -47,11 +62,22 @@ class AssetUpdateForm(forms.ModelForm):
...
@@ -47,11 +62,22 @@ class AssetUpdateForm(forms.ModelForm):
fields
=
[
fields
=
[
'hostname'
,
'ip'
,
'port'
,
'groups'
,
"cluster"
,
'is_active'
,
'hostname'
,
'ip'
,
'port'
,
'groups'
,
"cluster"
,
'is_active'
,
'type'
,
'env'
,
'status'
,
'public_ip'
,
'remote_card_ip'
,
'cabinet_no'
,
'type'
,
'env'
,
'status'
,
'public_ip'
,
'remote_card_ip'
,
'cabinet_no'
,
'cabinet_pos'
,
'number'
,
'comment'
,
'admin_user'
,
'cabinet_pos'
,
'number'
,
'comment'
,
'admin_user'
,
'labels'
]
]
widgets
=
{
widgets
=
{
'groups'
:
forms
.
SelectMultiple
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Select asset groups'
)}),
'groups'
:
forms
.
SelectMultiple
(
attrs
=
{
'admin_user'
:
forms
.
Select
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
"Default using cluster admin user"
)})
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Select asset groups'
)
}),
'cluster'
:
forms
.
Select
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Select cluster'
)
}),
'admin_user'
:
forms
.
Select
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Select admin user'
)
}),
'labels'
:
forms
.
SelectMultiple
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Select labels'
)
}),
'port'
:
forms
.
TextInput
(),
}
}
help_texts
=
{
help_texts
=
{
'hostname'
:
'* required'
,
'hostname'
:
'* required'
,
...
@@ -68,13 +94,15 @@ class AssetUpdateForm(forms.ModelForm):
...
@@ -68,13 +94,15 @@ class AssetUpdateForm(forms.ModelForm):
raise
forms
.
ValidationError
(
_
(
"You need set a admin user if cluster not have"
))
raise
forms
.
ValidationError
(
_
(
"You need set a admin user if cluster not have"
))
return
self
.
cleaned_data
[
'admin_user'
]
return
self
.
cleaned_data
[
'admin_user'
]
def
is_valid
(
self
):
print
(
self
.
data
)
return
super
()
.
is_valid
()
class
AssetBulkUpdateForm
(
forms
.
ModelForm
):
class
AssetBulkUpdateForm
(
forms
.
ModelForm
):
assets
=
forms
.
ModelMultipleChoiceField
(
assets
=
forms
.
ModelMultipleChoiceField
(
required
=
True
,
required
=
True
,
help_text
=
'* required'
,
help_text
=
'* required'
,
label
=
_
(
'Select assets'
),
queryset
=
Asset
.
objects
.
all
(),
label
=
_
(
'Select assets'
),
queryset
=
Asset
.
objects
.
all
(),
widget
=
forms
.
SelectMultiple
(
widget
=
forms
.
SelectMultiple
(
attrs
=
{
attrs
=
{
'class'
:
'select2'
,
'class'
:
'select2'
,
...
@@ -83,10 +111,7 @@ class AssetBulkUpdateForm(forms.ModelForm):
...
@@ -83,10 +111,7 @@ class AssetBulkUpdateForm(forms.ModelForm):
)
)
)
)
port
=
forms
.
IntegerField
(
port
=
forms
.
IntegerField
(
label
=
_
(
'Port'
),
label
=
_
(
'Port'
),
required
=
False
,
min_value
=
1
,
max_value
=
65535
,
required
=
False
,
min_value
=
1
,
max_value
=
65535
,
)
)
class
Meta
:
class
Meta
:
...
@@ -96,7 +121,9 @@ class AssetBulkUpdateForm(forms.ModelForm):
...
@@ -96,7 +121,9 @@ class AssetBulkUpdateForm(forms.ModelForm):
'type'
,
'env'
,
'type'
,
'env'
,
]
]
widgets
=
{
widgets
=
{
'groups'
:
forms
.
SelectMultiple
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Select asset groups'
)}),
'groups'
:
forms
.
SelectMultiple
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Select asset groups'
)}
),
}
}
def
save
(
self
,
commit
=
True
):
def
save
(
self
,
commit
=
True
):
...
@@ -140,7 +167,7 @@ class AssetGroupForm(forms.ModelForm):
...
@@ -140,7 +167,7 @@ class AssetGroupForm(forms.ModelForm):
def
save
(
self
,
commit
=
True
):
def
save
(
self
,
commit
=
True
):
group
=
super
()
.
save
(
commit
=
commit
)
group
=
super
()
.
save
(
commit
=
commit
)
assets
=
self
.
cleaned_data
[
'assets'
]
assets
=
self
.
cleaned_data
[
'assets'
]
group
.
assets
.
set
(
assets
)
group
.
assets
.
set
(
assets
)
return
group
return
group
...
@@ -377,3 +404,28 @@ class SystemUserAuthForm(forms.Form):
...
@@ -377,3 +404,28 @@ class SystemUserAuthForm(forms.Form):
class
FileForm
(
forms
.
Form
):
class
FileForm
(
forms
.
Form
):
file
=
forms
.
FileField
()
file
=
forms
.
FileField
()
class
LabelForm
(
forms
.
ModelForm
):
assets
=
forms
.
ModelMultipleChoiceField
(
queryset
=
Asset
.
objects
.
all
(),
label
=
_
(
'Asset'
),
required
=
False
,
widget
=
forms
.
SelectMultiple
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Select assets'
)}
)
)
class
Meta
:
model
=
Label
fields
=
[
'name'
,
'value'
,
'assets'
]
def
__init__
(
self
,
*
args
,
**
kwargs
):
if
kwargs
.
get
(
'instance'
,
None
):
initial
=
kwargs
.
get
(
'initial'
,
{})
initial
[
'assets'
]
=
kwargs
[
'instance'
]
.
assets
.
all
()
super
()
.
__init__
(
*
args
,
**
kwargs
)
def
save
(
self
,
commit
=
True
):
label
=
super
()
.
save
(
commit
=
commit
)
assets
=
self
.
cleaned_data
[
'assets'
]
label
.
assets
.
set
(
assets
)
return
label
apps/assets/models/__init__.py
View file @
b0fab245
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
#
#
from
.user
import
AdminUser
,
SystemUser
from
.user
import
AdminUser
,
SystemUser
from
.label
import
Label
from
.cluster
import
*
from
.cluster
import
*
from
.group
import
*
from
.group
import
*
from
.asset
import
*
from
.asset
import
*
...
...
apps/assets/models/asset.py
View file @
b0fab245
...
@@ -88,6 +88,8 @@ class Asset(models.Model):
...
@@ -88,6 +88,8 @@ class Asset(models.Model):
os_arch
=
models
.
CharField
(
max_length
=
16
,
blank
=
True
,
null
=
True
,
verbose_name
=
_
(
'OS arch'
))
os_arch
=
models
.
CharField
(
max_length
=
16
,
blank
=
True
,
null
=
True
,
verbose_name
=
_
(
'OS arch'
))
hostname_raw
=
models
.
CharField
(
max_length
=
128
,
blank
=
True
,
null
=
True
,
verbose_name
=
_
(
'Hostname raw'
))
hostname_raw
=
models
.
CharField
(
max_length
=
128
,
blank
=
True
,
null
=
True
,
verbose_name
=
_
(
'Hostname raw'
))
labels
=
models
.
ManyToManyField
(
'assets.Label'
,
blank
=
True
,
related_name
=
'assets'
,
verbose_name
=
_
(
"Labels"
))
created_by
=
models
.
CharField
(
max_length
=
32
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Created by'
))
created_by
=
models
.
CharField
(
max_length
=
32
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Created by'
))
date_created
=
models
.
DateTimeField
(
auto_now_add
=
True
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Date created'
))
date_created
=
models
.
DateTimeField
(
auto_now_add
=
True
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Date created'
))
comment
=
models
.
TextField
(
max_length
=
128
,
default
=
''
,
blank
=
True
,
verbose_name
=
_
(
'Comment'
))
comment
=
models
.
TextField
(
max_length
=
128
,
default
=
''
,
blank
=
True
,
verbose_name
=
_
(
'Comment'
))
...
...
apps/assets/models/label.py
0 → 100644
View file @
b0fab245
# -*- coding: utf-8 -*-
#
import
uuid
from
django.db
import
models
from
django.utils.translation
import
ugettext_lazy
as
_
class
Label
(
models
.
Model
):
SYSTEM_CATEGORY
=
"S"
USER_CATEGORY
=
"U"
CATEGORY_CHOICES
=
(
(
"S"
,
_
(
"System"
)),
(
"U"
,
_
(
"User"
))
)
id
=
models
.
UUIDField
(
default
=
uuid
.
uuid4
,
primary_key
=
True
)
name
=
models
.
CharField
(
max_length
=
128
,
verbose_name
=
_
(
"Name"
))
value
=
models
.
CharField
(
max_length
=
128
,
verbose_name
=
_
(
"Value"
))
category
=
models
.
CharField
(
max_length
=
128
,
choices
=
CATEGORY_CHOICES
,
default
=
USER_CATEGORY
,
verbose_name
=
_
(
"Category"
))
is_active
=
models
.
BooleanField
(
default
=
True
,
verbose_name
=
_
(
"Is active"
))
comment
=
models
.
TextField
(
blank
=
True
,
null
=
True
,
verbose_name
=
_
(
"Comment"
))
date_created
=
models
.
DateTimeField
(
auto_now_add
=
True
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Date created'
)
)
@classmethod
def
get_queryset_group_by_name
(
cls
):
names
=
cls
.
objects
.
values_list
(
'name'
,
flat
=
True
)
for
name
in
names
:
yield
name
,
cls
.
objects
.
filter
(
name
=
name
)
def
__str__
(
self
):
return
"{}:{}"
.
format
(
self
.
name
,
self
.
value
)
class
Meta
:
db_table
=
"assets_label"
unique_together
=
(
'name'
,
'value'
)
apps/assets/serializers.py
View file @
b0fab245
...
@@ -4,7 +4,7 @@ from rest_framework import serializers
...
@@ -4,7 +4,7 @@ from rest_framework import serializers
from
rest_framework_bulk.serializers
import
BulkListSerializer
from
rest_framework_bulk.serializers
import
BulkListSerializer
from
common.mixins
import
BulkSerializerMixin
from
common.mixins
import
BulkSerializerMixin
from
.models
import
AssetGroup
,
Asset
,
Cluster
,
AdminUser
,
SystemUser
from
.models
import
AssetGroup
,
Asset
,
Cluster
,
AdminUser
,
SystemUser
,
Label
from
.const
import
ADMIN_USER_CONN_CACHE_KEY
,
SYSTEM_USER_CONN_CACHE_KEY
from
.const
import
ADMIN_USER_CONN_CACHE_KEY
,
SYSTEM_USER_CONN_CACHE_KEY
...
@@ -286,3 +286,34 @@ class MyAssetGroupGrantedSerializer(serializers.ModelSerializer):
...
@@ -286,3 +286,34 @@ class MyAssetGroupGrantedSerializer(serializers.ModelSerializer):
@staticmethod
@staticmethod
def
get_assets_amount
(
obj
):
def
get_assets_amount
(
obj
):
return
len
(
obj
.
assets_granted
)
return
len
(
obj
.
assets_granted
)
class
LabelSerializer
(
serializers
.
ModelSerializer
):
asset_count
=
serializers
.
SerializerMethodField
()
class
Meta
:
model
=
Label
fields
=
'__all__'
list_serializer_class
=
BulkListSerializer
@staticmethod
def
get_asset_count
(
obj
):
return
obj
.
asset_count
def
get_field_names
(
self
,
declared_fields
,
info
):
fields
=
super
()
.
get_field_names
(
declared_fields
,
info
)
fields
.
extend
([
'get_category_display'
])
return
fields
class
LabelDistinctSerializer
(
serializers
.
ModelSerializer
):
value
=
serializers
.
SerializerMethodField
()
class
Meta
:
model
=
Label
fields
=
(
"name"
,
"value"
)
@staticmethod
def
get_value
(
obj
):
labels
=
Label
.
objects
.
filter
(
name
=
obj
[
"name"
])
return
', '
.
join
([
label
.
value
for
label
in
labels
])
apps/assets/templates/assets/asset_create.html
View file @
b0fab245
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
{% load static %}
{% load static %}
{% load bootstrap3 %}
{% load bootstrap3 %}
{% load i18n %}
{% load i18n %}
{% load asset_tags %}
{% load common_tags %}
{% block form %}
{% block form %}
<form
action=
""
method=
"post"
class=
"form-horizontal"
>
<form
action=
""
method=
"post"
class=
"form-horizontal"
>
...
@@ -28,12 +30,37 @@
...
@@ -28,12 +30,37 @@
<h3>
{% trans 'Group' %}
</h3>
<h3>
{% trans 'Group' %}
</h3>
{% bootstrap_field form.groups layout="horizontal" %}
{% bootstrap_field form.groups layout="horizontal" %}
<div
class=
"hr-line-dashed"
></div>
<h3>
{% trans 'Labels' %}
</h3>
<div
class=
"form-group {% if form.errors.labels %} has-error {% endif %}"
>
<label
for=
"{{ form.labels.id_for_label }}"
class=
"col-md-2 control-label"
>
{% trans 'Label' %}
</label>
<div
class=
"col-md-9"
>
<select
name=
"labels"
class=
"select2 labels"
data-placeholder=
"{% trans 'Select labels' %}"
style=
"width: 100%"
multiple=
""
tabindex=
"4"
id=
"{{ form.labels.id_for_label }}"
>
{% for name, labels in form.labels.field.queryset|group_labels %}
<optgroup
label=
"{{ name }}"
>
{% for label in labels %}
{% if label in form.labels.initial %}
<option
value=
"{{ label.id }}"
selected
>
{{ label.value }}
</option>
{% else %}
<option
value=
"{{ label.id }}"
>
{{ label.value }}
</option>
{% endif %}
{% endfor %}
</optgroup>
{% endfor %}
</select>
{% if form.errors.labels %}
{% for e in form.errors.labels %}
<div
class=
"help-block"
>
{{ e }}
</div>
{% endfor %}
{% endif %}
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"hr-line-dashed"
></div>
<h3>
{% trans 'Other' %}
</h3>
<h3>
{% trans 'Other' %}
</h3>
{% bootstrap_field form.comment layout="horizontal" %}
{% bootstrap_field form.comment layout="horizontal" %}
{% bootstrap_field form.is_active layout="horizontal" %}
{% bootstrap_field form.is_active layout="horizontal" %}
<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-2"
>
<div
class=
"col-sm-4 col-sm-offset-2"
>
...
@@ -45,11 +72,20 @@
...
@@ -45,11 +72,20 @@
{% endblock %}
{% endblock %}
{% block custom_foot_js %}
{% block custom_foot_js %}
<script>
<script>
$
(
document
).
ready
(
function
()
{
function
format
(
item
)
{
$
(
'.select2'
).
select2
({
var
group
=
item
.
element
.
parentElement
.
label
;
allowClear
:
true
return
group
+
':'
+
item
.
text
;
});
}
})
</script>
$
(
document
).
ready
(
function
()
{
$
(
'.select2'
).
select2
({
allowClear
:
true
});
$
(
".labels"
).
select2
({
allowClear
:
true
,
templateSelection
:
format
});
})
</script>
{% endblock %}
{% endblock %}
\ No newline at end of file
apps/assets/templates/assets/asset_detail.html
View file @
b0fab245
...
@@ -244,6 +244,33 @@
...
@@ -244,6 +244,33 @@
</table>
</table>
</div>
</div>
</div>
</div>
<div
class=
"panel panel-warning"
>
<div
class=
"panel-heading"
>
<i
class=
"fa fa-info-circle"
></i>
{% trans 'Labels' %}
</div>
<div
class=
"panel-body"
>
{#
<table
class=
"table"
>
#}
{#
<tbody>
#}
{# {% for label in asset.labels.all %}#}
{#
<tr
{%
if
forloop
.
counter =
=
1
%}
class=
"no-borders-tr"
{%
endif
%}
>
#}
{#
<td>
{{ label.name }}
</td>
#}
{#
<td>
#}
{#
<span
class=
"pull-right"
>
#}
{# {{ label.value }}#}
{#
</span>
#}
{#
</td>
#}
{#
</tr>
#}
{# {% endfor %}#}
{#
</tbody>
#}
{#
</table>
#}
<ul
class=
"tag-list"
style=
"padding: 0"
>
{% for label in asset.labels.all %}
<li
><a
href=
""
><i
class=
"fa fa-tag"
></i>
{{ label.name }}:{{ label.value }}
</a></li>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
{% endif %}
</div>
</div>
</div>
</div>
...
...
apps/assets/templates/assets/asset_list.html
View file @
b0fab245
...
@@ -23,6 +23,14 @@
...
@@ -23,6 +23,14 @@
{% block table_container %}
{% block table_container %}
<div
class=
"uc pull-left m-r-5"
><a
href=
"{% url "
assets:asset-create
"
%}"
class=
"btn btn-sm btn-primary"
>
{% trans "Create asset" %}
</a></div>
<div
class=
"uc pull-left m-r-5"
><a
href=
"{% url "
assets:asset-create
"
%}"
class=
"btn btn-sm btn-primary"
>
{% trans "Create asset" %}
</a></div>
<div
class=
"btn-group"
style=
"float: right"
>
<button
data-toggle=
"dropdown"
class=
"btn btn-default btn-sm dropdown-toggle"
>
{% trans 'Label' %}
<span
class=
"caret"
></span></button>
<ul
class=
"dropdown-menu labels"
>
{% for label in labels %}
<li><a
style=
"font-weight: bolder"
>
{{ label.name }}:{{ label.value }}
</a></li>
{% endfor %}
</ul>
</div>
<table
class=
"table table-striped table-bordered table-hover "
id=
"asset_list_table"
>
<table
class=
"table table-striped table-bordered table-hover "
id=
"asset_list_table"
>
<thead>
<thead>
<tr>
<tr>
...
@@ -114,6 +122,20 @@ function initTable() {
...
@@ -114,6 +122,20 @@ function initTable() {
$
(
document
).
ready
(
function
(){
$
(
document
).
ready
(
function
(){
initTable
();
initTable
();
$
(
".select2"
).
select2
();
})
.
on
(
'click'
,
'.labels li'
,
function
()
{
var
val
=
$
(
this
).
text
();
{
#
var
origin_val
=
$
(
"#asset_list_table_filter input"
).
val
();
#
}
{
#
var
new_val
;
#
}
{
#
if
(
origin_val
===
""
)
{
#
}
{
#
new_val
=
val
;
#
}
{
#
}
else
{
#
}
{
#
new_val
=
origin_val
+
" "
+
val
;
#
}
{
#
}
#
}
$
(
"#asset_list_table_filter input"
).
val
(
val
);
{
#
$
(
'#asset_list_table'
).
DataTable
().
search
(
val
).
draw
();
#
}
jumpserver
.
table
.
search
(
val
).
draw
();
})
})
.
on
(
'click'
,
'.btn_export'
,
function
()
{
.
on
(
'click'
,
'.btn_export'
,
function
()
{
var
$data_table
=
$
(
'#asset_list_table'
).
DataTable
();
var
$data_table
=
$
(
'#asset_list_table'
).
DataTable
();
...
...
apps/assets/templates/assets/asset_update.html
View file @
b0fab245
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
{% load static %}
{% load static %}
{% load bootstrap3 %}
{% load bootstrap3 %}
{% load i18n %}
{% load i18n %}
{% load asset_tags %}
{% load common_tags %}
{% block custom_head_css_js_create %}
{% block custom_head_css_js_create %}
<link
href=
"{% static "
css
/
plugins
/
inputTags
.
css
"
%}"
rel=
"stylesheet"
>
<link
href=
"{% static "
css
/
plugins
/
inputTags
.
css
"
%}"
rel=
"stylesheet"
>
...
@@ -33,6 +35,27 @@
...
@@ -33,6 +35,27 @@
<h3>
{% trans 'Group' %}
</h3>
<h3>
{% trans 'Group' %}
</h3>
{% bootstrap_field form.groups layout="horizontal" %}
{% bootstrap_field form.groups layout="horizontal" %}
<div
class=
"hr-line-dashed"
></div>
<h3>
{% trans 'Labels' %}
</h3>
<div
class=
"form-group"
>
<label
for=
"{{ form.labels.id_for_label }}"
class=
"col-md-2 control-label"
>
{% trans 'Label' %}
</label>
<div
class=
"col-md-9"
>
<select
name=
"labels"
class=
"select2 labels"
data-placeholder=
"Select labels"
style=
"width: 100%"
multiple=
""
tabindex=
"4"
id=
"{{ form.labels.id_for_label }}"
>
{% for name, labels in form.labels.field.queryset|group_labels %}
<optgroup
label=
"{{ name }}"
>
{% for label in labels %}
{% if label in form.labels.initial %}
<option
value=
"{{ label.id }}"
selected
>
{{ label.value }}
</option>
{% else %}
<option
value=
"{{ label.id }}"
>
{{ label.value }}
</option>
{% endif %}
{% endfor %}
</optgroup>
{% endfor %}
</select>
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"hr-line-dashed"
></div>
<h3>
{% trans 'Configuration' %}
</h3>
<h3>
{% trans 'Configuration' %}
</h3>
{% bootstrap_field form.number layout="horizontal" %}
{% bootstrap_field form.number layout="horizontal" %}
...
@@ -62,14 +85,18 @@
...
@@ -62,14 +85,18 @@
{% block custom_foot_js %}
{% block custom_foot_js %}
<script>
<script>
$
(
document
).
ready
(
function
()
{
function
format
(
item
)
{
$
(
'.select2'
).
select2
({
var
group
=
item
.
element
.
parentElement
.
label
;
allowClear
:
true
return
group
+
':'
+
item
.
text
;
});
}
$
(
"#tags"
).
select2
({
$
(
document
).
ready
(
function
()
{
tags
:
true
,
$
(
'.select2'
).
select2
({
maximumSelectionLength
:
8
//最多能够选择的个数
allowClear
:
true
});
});
})
$
(
".labels"
).
select2
({
allowClear
:
true
,
templateSelection
:
format
});
})
</script>
</script>
{% endblock %}
{% endblock %}
\ No newline at end of file
apps/assets/templates/assets/label_create_update.html
0 → 100644
View file @
b0fab245
{% extends '_base_create_update.html' %}
{% load static %}
{% load bootstrap3 %}
{% load i18n %}
{% block form %}
<form
id=
"groupForm"
method=
"post"
class=
"form-horizontal"
>
{% csrf_token %}
{% bootstrap_field form.name layout="horizontal" %}
{% bootstrap_field form.value layout="horizontal" %}
{% bootstrap_field form.assets layout="horizontal" %}
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<div
class=
"col-sm-4 col-sm-offset-2"
>
<button
class=
"btn btn-default"
type=
"reset"
>
{% trans 'Reset' %}
</button>
<button
id=
"submit_button"
class=
"btn btn-primary"
type=
"submit"
>
{% trans 'Submit' %}
</button>
</div>
</div>
</form>
{% endblock %}
{% block custom_foot_js %}
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
$
(
'.select2'
).
select2
({
closeOnSelect
:
false
});
});
</script>
{% endblock %}
\ No newline at end of file
apps/assets/templates/assets/label_list.html
0 → 100644
View file @
b0fab245
{% extends '_base_list.html' %}
{% load i18n static %}
{% block table_search %}{% endblock %}
{% block table_container %}
<div
class=
"uc pull-left m-r-5"
>
<a
href=
"{% url 'assets:label-create' %}"
class=
"btn btn-sm btn-primary"
>
{% trans "Create label" %}
</a>
</div>
<table
class=
"table table-striped table-bordered table-hover "
id=
"label_list_table"
>
<thead>
<tr>
<th
class=
"text-center"
>
<input
type=
"checkbox"
id=
"check_all"
class=
"ipt_check_all"
>
</th>
<th
class=
"text-center"
>
{% trans 'Name' %}
</th>
<th
class=
"text-center"
>
{% trans 'Value' %}
</th>
<th
class=
"text-center"
>
{% trans 'Asset' %}
</th>
<th
class=
"text-center"
>
{% trans 'Action' %}
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
{% endblock %}
{% block content_bottom_left %}{% endblock %}
{% block custom_foot_js %}
<script>
function
initTable
()
{
var
options
=
{
ele
:
$
(
'#label_list_table'
),
columnDefs
:
[
{
targets
:
1
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
{
#
var
detail_btn
=
'<a href="{% url "assets:label-detail" pk=DEFAULT_PK %}">'
+
cellData
+
'</a>'
;
#
}
var
detail_btn
=
'<a>'
+
cellData
+
'</a>'
;
$
(
td
).
html
(
detail_btn
.
replace
(
'{{ DEFAULT_PK }}'
,
rowData
.
id
));
}},
{
targets
:
4
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
var
update_btn
=
'<a href="{% url "assets:label-update" pk=DEFAULT_PK %}" class="btn btn-xs btn-info">{% trans "Update" %}</a>'
.
replace
(
'{{ DEFAULT_PK }}'
,
cellData
);
var
del_btn
=
'<a class="btn btn-xs btn-danger m-l-xs btn_cluster_delete" data-uid="{{ DEFAULT_PK }}">{% trans "Delete" %}</a>'
.
replace
(
'{{ DEFAULT_PK }}'
,
cellData
);
$
(
td
).
html
(
update_btn
+
del_btn
)
}}],
ajax_url
:
'{% url "api-assets:label-list" %}?sort=name'
,
columns
:
[
{
data
:
"id"
},
{
data
:
"name"
},
{
data
:
"value"
},
{
data
:
"asset_count"
},
{
data
:
"id"
}
],
op_html
:
$
(
'#actions'
).
html
()
};
jumpserver
.
initDataTable
(
options
);
}
$
(
document
).
ready
(
function
(){
initTable
();
})
.
on
(
'click'
,
'.btn_cluster_delete'
,
function
()
{
var
$this
=
$
(
this
);
var
$data_table
=
$
(
'#cluster_list_table'
).
DataTable
();
var
name
=
$
(
this
).
closest
(
"tr"
).
find
(
":nth-child(2)"
).
children
(
'a'
).
html
();
var
uid
=
$this
.
data
(
'uid'
);
var
the_url
=
'{% url "api-assets:cluster-detail" pk=DEFAULT_PK %}'
.
replace
(
'{{ DEFAULT_PK }}'
,
uid
);
objectDelete
(
$this
,
name
,
the_url
);
setTimeout
(
function
()
{
$data_table
.
ajax
.
reload
();
},
3000
);
});
</script>
{% endblock %}
apps/assets/templatetags/__init__.py
0 → 100644
View file @
b0fab245
# -*- coding: utf-8 -*-
#
apps/assets/templatetags/asset_tags.py
View file @
b0fab245
from
collections
import
defaultdict
from
django
import
template
from
django
import
template
from
django.utils
import
timezone
from
django.conf
import
settings
register
=
template
.
Library
()
register
=
template
.
Library
()
@register.filter
def
group_labels
(
queryset
):
grouped
=
defaultdict
(
list
)
for
label
in
queryset
:
grouped
[
label
.
name
]
.
append
(
label
)
return
[(
name
,
labels
)
for
name
,
labels
in
grouped
.
items
()]
apps/assets/urls/api_urls.py
View file @
b0fab245
...
@@ -12,6 +12,7 @@ router.register(r'v1/assets', api.AssetViewSet, 'asset')
...
@@ -12,6 +12,7 @@ router.register(r'v1/assets', api.AssetViewSet, 'asset')
router
.
register
(
r'v1/clusters'
,
api
.
ClusterViewSet
,
'cluster'
)
router
.
register
(
r'v1/clusters'
,
api
.
ClusterViewSet
,
'cluster'
)
router
.
register
(
r'v1/admin-user'
,
api
.
AdminUserViewSet
,
'admin-user'
)
router
.
register
(
r'v1/admin-user'
,
api
.
AdminUserViewSet
,
'admin-user'
)
router
.
register
(
r'v1/system-user'
,
api
.
SystemUserViewSet
,
'system-user'
)
router
.
register
(
r'v1/system-user'
,
api
.
SystemUserViewSet
,
'system-user'
)
router
.
register
(
r'v1/labels'
,
api
.
LabelViewSet
,
'label'
)
urlpatterns
=
[
urlpatterns
=
[
url
(
r'^v1/assets-bulk/$'
,
api
.
AssetListUpdateApi
.
as_view
(),
name
=
'asset-bulk-update'
),
url
(
r'^v1/assets-bulk/$'
,
api
.
AssetListUpdateApi
.
as_view
(),
name
=
'asset-bulk-update'
),
...
...
apps/assets/urls/views_urls.py
View file @
b0fab245
...
@@ -53,5 +53,8 @@ urlpatterns = [
...
@@ -53,5 +53,8 @@ urlpatterns = [
# url(r'^system-user/(?P<pk>[0-9a-zA-Z\-]{36})/asset-group$', views.SystemUserAssetGroupView.as_view(),
# url(r'^system-user/(?P<pk>[0-9a-zA-Z\-]{36})/asset-group$', views.SystemUserAssetGroupView.as_view(),
# name='system-user-asset-group'),
# name='system-user-asset-group'),
url
(
r'^label/$'
,
views
.
LabelListView
.
as_view
(),
name
=
'label-list'
),
url
(
r'^label/create/$'
,
views
.
LabelCreateView
.
as_view
(),
name
=
'label-create'
),
url
(
r'^label/(?P<pk>[0-9a-zA-Z\-]{36})/update/$'
,
views
.
LabelUpdateView
.
as_view
(),
name
=
'label-update'
),
]
]
apps/assets/utils.py
View file @
b0fab245
# ~*~ coding: utf-8 ~*~
# ~*~ coding: utf-8 ~*~
#
#
from
collections
import
defaultdict
from
collections
import
defaultdict
from
functools
import
reduce
import
operator
from
django.db.models
import
Q
from
common.utils
import
get_object_or_none
from
common.utils
import
get_object_or_none
from
.models
import
Asset
,
SystemUser
from
.models
import
Asset
,
SystemUser
,
Label
def
get_assets_by_id_list
(
id_list
):
def
get_assets_by_id_list
(
id_list
):
...
@@ -27,3 +32,23 @@ def check_assets_have_system_user(assets, system_users):
...
@@ -27,3 +32,23 @@ def check_assets_have_system_user(assets, system_users):
if
asset
.
cluster
not
in
clusters
:
if
asset
.
cluster
not
in
clusters
:
errors
[
asset
]
.
append
(
system_user
)
errors
[
asset
]
.
append
(
system_user
)
return
errors
return
errors
class
LabelFilter
:
def
filter_queryset
(
self
,
queryset
):
query_keys
=
self
.
request
.
query_params
.
keys
()
all_label_keys
=
Label
.
objects
.
values_list
(
'name'
,
flat
=
True
)
valid_keys
=
set
(
all_label_keys
)
&
set
(
query_keys
)
labels_query
=
{}
for
key
in
valid_keys
:
labels_query
[
key
]
=
self
.
request
.
query_params
.
get
(
key
)
conditions
=
[]
for
k
,
v
in
labels_query
.
items
():
query
=
{
'labels__name'
:
k
,
'labels__value'
:
v
}
conditions
.
append
(
query
)
if
conditions
:
for
kwargs
in
conditions
:
queryset
=
queryset
.
filter
(
**
kwargs
)
return
queryset
apps/assets/views/__init__.py
View file @
b0fab245
...
@@ -4,4 +4,5 @@ from .group import *
...
@@ -4,4 +4,5 @@ from .group import *
from
.cluster
import
*
from
.cluster
import
*
from
.system_user
import
*
from
.system_user
import
*
from
.admin_user
import
*
from
.admin_user
import
*
from
.label
import
*
apps/assets/views/asset.py
View file @
b0fab245
...
@@ -27,7 +27,7 @@ from common.mixins import JSONResponseMixin
...
@@ -27,7 +27,7 @@ from common.mixins import JSONResponseMixin
from
common.utils
import
get_object_or_none
,
get_logger
,
is_uuid
from
common.utils
import
get_object_or_none
,
get_logger
,
is_uuid
from
common.const
import
create_success_msg
,
update_success_msg
from
common.const
import
create_success_msg
,
update_success_msg
from
..
import
forms
from
..
import
forms
from
..models
import
Asset
,
AssetGroup
,
AdminUser
,
Cluster
,
SystemUser
from
..models
import
Asset
,
AssetGroup
,
AdminUser
,
Cluster
,
SystemUser
,
Label
from
..hands
import
AdminUserRequiredMixin
from
..hands
import
AdminUserRequiredMixin
...
@@ -48,6 +48,7 @@ class AssetListView(AdminUserRequiredMixin, TemplateView):
...
@@ -48,6 +48,7 @@ class AssetListView(AdminUserRequiredMixin, TemplateView):
'app'
:
_
(
'Assets'
),
'app'
:
_
(
'Assets'
),
'action'
:
_
(
'Asset list'
),
'action'
:
_
(
'Asset list'
),
'system_users'
:
SystemUser
.
objects
.
all
(),
'system_users'
:
SystemUser
.
objects
.
all
(),
'labels'
:
Label
.
objects
.
all
()
.
order_by
(
'name'
),
}
}
kwargs
.
update
(
context
)
kwargs
.
update
(
context
)
return
super
()
.
get_context_data
(
**
kwargs
)
return
super
()
.
get_context_data
(
**
kwargs
)
...
@@ -72,12 +73,13 @@ class AssetCreateView(AdminUserRequiredMixin, SuccessMessageMixin, CreateView):
...
@@ -72,12 +73,13 @@ class AssetCreateView(AdminUserRequiredMixin, SuccessMessageMixin, CreateView):
template_name
=
'assets/asset_create.html'
template_name
=
'assets/asset_create.html'
success_url
=
reverse_lazy
(
'assets:asset-list'
)
success_url
=
reverse_lazy
(
'assets:asset-list'
)
def
form_valid
(
self
,
form
):
# def form_valid(self, form):
asset
=
form
.
save
()
# print("form valid")
asset
.
created_by
=
self
.
request
.
user
.
username
or
'Admin'
# asset = form.save()
asset
.
date_created
=
timezone
.
now
()
# asset.created_by = self.request.user.username or 'Admin'
asset
.
save
()
# asset.date_created = timezone.now()
return
super
()
.
form_valid
(
form
)
# asset.save()
# return super().form_valid(form)
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
context
=
{
...
...
apps/assets/views/label.py
0 → 100644
View file @
b0fab245
# -*- coding: utf-8 -*-
#
from
django.views.generic
import
TemplateView
,
CreateView
,
\
UpdateView
,
DeleteView
,
DetailView
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.urls
import
reverse_lazy
from
common.mixins
import
AdminUserRequiredMixin
from
common.const
import
create_success_msg
,
update_success_msg
from
..models
import
Label
from
..forms
import
LabelForm
__all__
=
(
"LabelListView"
,
"LabelCreateView"
,
"LabelUpdateView"
,
"LabelDetailView"
,
"LabelDeleteView"
,
)
class
LabelListView
(
AdminUserRequiredMixin
,
TemplateView
):
template_name
=
'assets/label_list.html'
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
_
(
'Assets'
),
'action'
:
_
(
'Label list'
),
}
kwargs
.
update
(
context
)
return
super
()
.
get_context_data
(
**
kwargs
)
class
LabelCreateView
(
AdminUserRequiredMixin
,
CreateView
):
model
=
Label
template_name
=
'assets/label_create_update.html'
form_class
=
LabelForm
success_url
=
reverse_lazy
(
'assets:label-list'
)
success_message
=
create_success_msg
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
_
(
'Assets'
),
'action'
:
_
(
'Create label'
),
}
kwargs
.
update
(
context
)
return
super
()
.
get_context_data
(
**
kwargs
)
class
LabelUpdateView
(
AdminUserRequiredMixin
,
UpdateView
):
model
=
Label
template_name
=
'assets/label_create_update.html'
form_class
=
LabelForm
success_url
=
reverse_lazy
(
'assets:label-list'
)
success_message
=
update_success_msg
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
_
(
'Assets'
),
'action'
:
_
(
'Update label'
),
}
kwargs
.
update
(
context
)
return
super
()
.
get_context_data
(
**
kwargs
)
class
LabelDetailView
(
AdminUserRequiredMixin
,
DetailView
):
pass
class
LabelDeleteView
(
AdminUserRequiredMixin
,
DeleteView
):
pass
apps/common/templatetags/common_tags.py
View file @
b0fab245
...
@@ -92,3 +92,8 @@ def is_bool_field(field):
...
@@ -92,3 +92,8 @@ def is_bool_field(field):
return
True
return
True
else
:
else
:
return
False
return
False
@register.filter
def
to_dict
(
data
):
return
dict
(
data
)
apps/locale/zh/LC_MESSAGES/django.mo
View file @
b0fab245
No preview for this file type
apps/locale/zh/LC_MESSAGES/django.po
View file @
b0fab245
...
@@ -8,7 +8,7 @@ msgid ""
...
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
msgstr ""
"Project-Id-Version: Jumpserver 0.3.3\n"
"Project-Id-Version: Jumpserver 0.3.3\n"
"Report-Msgid-Bugs-To: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-2
3 11:56
+0800\n"
"POT-Creation-Date: 2018-01-2
6 15:43
+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: ibuler <ibuler@qq.com>\n"
"Last-Translator: ibuler <ibuler@qq.com>\n"
"Language-Team: Jumpserver team<ibuler@qq.com>\n"
"Language-Team: Jumpserver team<ibuler@qq.com>\n"
...
@@ -17,42 +17,44 @@ msgstr ""
...
@@ -17,42 +17,44 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Content-Transfer-Encoding: 8bit\n"
#: assets/forms.py:2
3 assets/forms.py:53 assets/forms.py:99
perms/forms.py:37
#: assets/forms.py:2
2 assets/forms.py:69 assets/forms.py:125
perms/forms.py:37
#: perms/templates/perms/asset_permission_asset.html:116 users/forms.py:245
#: perms/templates/perms/asset_permission_asset.html:116 users/forms.py:245
msgid "Select asset groups"
msgid "Select asset groups"
msgstr "选择资产组"
msgstr "选择资产组"
#: assets/forms.py:24 assets/templates/assets/admin_user_detail.html:92
#: assets/forms.py:25 assets/forms.py:72
#: assets/templates/assets/admin_user_detail.html:92
msgid "Select cluster"
msgid "Select cluster"
msgstr "选择集群"
msgstr "选择集群"
#: assets/forms.py:25
#: assets/forms.py:2
8 assets/forms.py:7
5
msgid "Select admin user"
msgid "Select admin user"
msgstr "选择管理用户"
msgstr "选择管理用户"
#: assets/forms.py:33 assets/forms.py:61
#: assets/forms.py:31 assets/forms.py:78
msgid "Select labels"
msgstr "选择标签"
#: assets/forms.py:40 assets/forms.py:87
msgid "Host level admin user, If not set using cluster admin user default"
msgid "Host level admin user, If not set using cluster admin user default"
msgstr "主机级别管理用户,如果没有设置则默认使用集群级别管理用户"
msgstr "主机级别管理用户,如果没有设置则默认使用集群级别管理用户"
#: assets/forms.py:4
0 assets/forms.py:68
#: assets/forms.py:4
7 assets/forms.py:94
msgid "You need set a admin user if cluster not have"
msgid "You need set a admin user if cluster not have"
msgstr "集群没有管理用户,你需要为集群设置管理用户或设置一个主机级别的管理用户"
msgstr "集群没有管理用户,你需要为集群设置管理用户或设置一个主机级别的管理用户"
#: assets/forms.py:54
#: assets/forms.py:105 assets/forms.py:109 assets/forms.py:154
msgid "Default using cluster admin user"
#: assets/forms.py:413 assets/templates/assets/asset_group_detail.html:75
msgstr "默认使用管理用户"
#: perms/forms.py:34 perms/templates/perms/asset_permission_asset.html:88
#: users/forms.py:242
#: assets/forms.py:76 assets/forms.py:81 assets/forms.py:127
#: assets/templates/assets/asset_group_detail.html:75 perms/forms.py:34
#: perms/templates/perms/asset_permission_asset.html:88 users/forms.py:242
msgid "Select assets"
msgid "Select assets"
msgstr "选择资产"
msgstr "选择资产"
#: assets/forms.py:
86
assets/models/asset.py:55
#: assets/forms.py:
114
assets/models/asset.py:55
#: assets/templates/assets/admin_user_assets.html:61
#: assets/templates/assets/admin_user_assets.html:61
#: assets/templates/assets/asset_detail.html:69
#: assets/templates/assets/asset_detail.html:69
#: assets/templates/assets/asset_group_detail.html:52
#: assets/templates/assets/asset_group_detail.html:52
#: assets/templates/assets/asset_list.html:
32
#: assets/templates/assets/asset_list.html:
40
#: assets/templates/assets/cluster_assets.html:53
#: assets/templates/assets/cluster_assets.html:53
#: assets/templates/assets/system_user_asset.html:54
#: assets/templates/assets/system_user_asset.html:54
#: assets/templates/assets/user_asset_list.html:21
#: assets/templates/assets/user_asset_list.html:21
...
@@ -60,9 +62,10 @@ msgstr "选择资产"
...
@@ -60,9 +62,10 @@ msgstr "选择资产"
msgid "Port"
msgid "Port"
msgstr "端口"
msgstr "端口"
#: assets/forms.py:1
24 assets/models/asset.py:171
#: assets/forms.py:1
51 assets/forms.py:411 assets/models/asset.py:173
#: assets/templates/assets/admin_user_list.html:24
#: assets/templates/assets/admin_user_list.html:24
#: assets/templates/assets/asset_group_list.html:16
#: assets/templates/assets/asset_group_list.html:16
#: assets/templates/assets/label_list.html:16
#: assets/templates/assets/system_user_list.html:26 perms/models.py:17
#: assets/templates/assets/system_user_list.html:26 perms/models.py:17
#: perms/templates/perms/asset_permission_create_update.html:40
#: perms/templates/perms/asset_permission_create_update.html:40
#: perms/templates/perms/asset_permission_list.html:28 templates/_nav.html:22
#: perms/templates/perms/asset_permission_list.html:28 templates/_nav.html:22
...
@@ -76,28 +79,30 @@ msgstr "端口"
...
@@ -76,28 +79,30 @@ msgstr "端口"
msgid "Asset"
msgid "Asset"
msgstr "资产"
msgstr "资产"
#: assets/forms.py:1
61
perms/forms.py:40
#: assets/forms.py:1
88
perms/forms.py:40
#: perms/templates/perms/asset_permission_detail.html:144 users/forms.py:248
#: perms/templates/perms/asset_permission_detail.html:144 users/forms.py:248
msgid "Select system users"
msgid "Select system users"
msgstr "选择系统用户"
msgstr "选择系统用户"
#: assets/forms.py:1
63
#: assets/forms.py:1
90
#: assets/templates/assets/_asset_group_bulk_update_modal.html:22
#: assets/templates/assets/_asset_group_bulk_update_modal.html:22
#: assets/templates/assets/cluster_list.html:22
#: assets/templates/assets/cluster_list.html:22
msgid "System users"
msgid "System users"
msgstr "系统用户"
msgstr "系统用户"
#: assets/forms.py:1
65
#: assets/forms.py:1
92
msgid "Selected system users will be create at cluster assets"
msgid "Selected system users will be create at cluster assets"
msgstr "选择的系统用户将会在该集群资产上创建"
msgstr "选择的系统用户将会在该集群资产上创建"
#: assets/forms.py:
173 assets/forms.py:248 assets/forms.py:308
#: assets/forms.py:
200 assets/forms.py:275 assets/forms.py:335
#: assets/models/cluster.py:18 assets/models/group.py:20
#: assets/models/cluster.py:18 assets/models/group.py:20
#: assets/models/user.py:28 assets/templates/assets/admin_user_detail.html:56
#: assets/models/label.py:17 assets/models/user.py:28
#: assets/templates/assets/admin_user_detail.html:56
#: assets/templates/assets/admin_user_list.html:22
#: assets/templates/assets/admin_user_list.html:22
#: assets/templates/assets/asset_group_list.html:15
#: assets/templates/assets/asset_group_list.html:15
#: assets/templates/assets/cluster_detail.html:57
#: assets/templates/assets/cluster_detail.html:57
#: assets/templates/assets/cluster_list.html:19
#: assets/templates/assets/cluster_list.html:19
#: assets/templates/assets/label_list.html:14
#: assets/templates/assets/system_user_detail.html:58
#: assets/templates/assets/system_user_detail.html:58
#: assets/templates/assets/system_user_list.html:24 common/models.py:26
#: assets/templates/assets/system_user_list.html:24 common/models.py:26
#: common/templates/common/terminal_setting.html:62 ops/models.py:31
#: common/templates/common/terminal_setting.html:62 ops/models.py:31
...
@@ -110,7 +115,7 @@ msgstr "选择的系统用户将会在该集群资产上创建"
...
@@ -110,7 +115,7 @@ msgstr "选择的系统用户将会在该集群资产上创建"
#: terminal/models.py:141 terminal/templates/terminal/terminal_detail.html:43
#: terminal/models.py:141 terminal/templates/terminal/terminal_detail.html:43
#: terminal/templates/terminal/terminal_list.html:29 users/models/group.py:14
#: terminal/templates/terminal/terminal_list.html:29 users/models/group.py:14
#: users/models/user.py:35 users/templates/users/_select_user_modal.html:13
#: users/models/user.py:35 users/templates/users/_select_user_modal.html:13
#: users/templates/users/user_detail.html:6
2
#: users/templates/users/user_detail.html:6
3
#: users/templates/users/user_granted_asset.html:81
#: users/templates/users/user_granted_asset.html:81
#: users/templates/users/user_group_detail.html:55
#: users/templates/users/user_group_detail.html:55
#: users/templates/users/user_group_granted_asset.html:85
#: users/templates/users/user_group_granted_asset.html:85
...
@@ -121,15 +126,15 @@ msgstr "选择的系统用户将会在该集群资产上创建"
...
@@ -121,15 +126,15 @@ msgstr "选择的系统用户将会在该集群资产上创建"
msgid "Name"
msgid "Name"
msgstr "名称"
msgstr "名称"
#: assets/forms.py:
179
#: assets/forms.py:
206
msgid "Cluster level admin user"
msgid "Cluster level admin user"
msgstr "集群级别管理用户"
msgstr "集群级别管理用户"
#: assets/forms.py:2
00
#: assets/forms.py:2
27
msgid "Password or private key password"
msgid "Password or private key password"
msgstr "密码或秘钥密码"
msgstr "密码或秘钥密码"
#: assets/forms.py:2
01 assets/forms.py:262
assets/models/user.py:30
#: assets/forms.py:2
28 assets/forms.py:289
assets/models/user.py:30
#: common/forms.py:113 users/forms.py:16 users/forms.py:24
#: common/forms.py:113 users/forms.py:16 users/forms.py:24
#: users/templates/users/login.html:56
#: users/templates/users/login.html:56
#: users/templates/users/reset_password.html:52
#: users/templates/users/reset_password.html:52
...
@@ -140,19 +145,19 @@ msgstr "密码或秘钥密码"
...
@@ -140,19 +145,19 @@ msgstr "密码或秘钥密码"
msgid "Password"
msgid "Password"
msgstr "密码"
msgstr "密码"
#: assets/forms.py:2
04 assets/forms.py:264
users/models/user.py:45
#: assets/forms.py:2
31 assets/forms.py:291
users/models/user.py:45
msgid "Private key"
msgid "Private key"
msgstr "ssh私钥"
msgstr "ssh私钥"
#: assets/forms.py:2
29 assets/forms.py:290 assets/forms.py:354
#: assets/forms.py:2
56 assets/forms.py:317 assets/forms.py:381
msgid "Invalid private key"
msgid "Invalid private key"
msgstr "ssh密钥不合法"
msgstr "ssh密钥不合法"
#: assets/forms.py:2
40
#: assets/forms.py:2
67
msgid "Password and private key file must be input one"
msgid "Password and private key file must be input one"
msgstr "密码和私钥, 必须输入一个"
msgstr "密码和私钥, 必须输入一个"
#: assets/forms.py:2
49 assets/forms.py:309
assets/models/user.py:29
#: assets/forms.py:2
76 assets/forms.py:336
assets/models/user.py:29
#: assets/templates/assets/admin_user_detail.html:60
#: assets/templates/assets/admin_user_detail.html:60
#: assets/templates/assets/admin_user_list.html:23
#: assets/templates/assets/admin_user_list.html:23
#: assets/templates/assets/system_user_detail.html:62
#: assets/templates/assets/system_user_detail.html:62
...
@@ -162,29 +167,29 @@ msgstr "密码和私钥, 必须输入一个"
...
@@ -162,29 +167,29 @@ msgstr "密码和私钥, 必须输入一个"
#: users/templates/users/_select_user_modal.html:14
#: users/templates/users/_select_user_modal.html:14
#: users/templates/users/login.html:53
#: users/templates/users/login.html:53
#: users/templates/users/login_log_list.html:49
#: users/templates/users/login_log_list.html:49
#: users/templates/users/user_detail.html:6
6
#: users/templates/users/user_detail.html:6
7
#: users/templates/users/user_list.html:24
#: users/templates/users/user_list.html:24
#: users/templates/users/user_profile.html:47
#: users/templates/users/user_profile.html:47
msgid "Username"
msgid "Username"
msgstr "用户名"
msgstr "用户名"
#: assets/forms.py:
297 assets/forms.py:360
#: assets/forms.py:
324 assets/forms.py:387
msgid "Auth info required, private_key or password"
msgid "Auth info required, private_key or password"
msgstr "密钥和密码必须填写一个"
msgstr "密钥和密码必须填写一个"
#: assets/forms.py:3
13
#: assets/forms.py:3
40
msgid " Select clusters"
msgid " Select clusters"
msgstr "选择集群"
msgstr "选择集群"
#: assets/forms.py:3
20
#: assets/forms.py:3
47
msgid "If auto push checked, system user will be create at cluster assets"
msgid "If auto push checked, system user will be create at cluster assets"
msgstr "如果选择了自动推送,系统用户将会创建在集群资产上"
msgstr "如果选择了自动推送,系统用户将会创建在集群资产上"
#: assets/forms.py:3
21
#: assets/forms.py:3
48
msgid "Auto push system user to asset"
msgid "Auto push system user to asset"
msgstr "自动推送系统用户到资产"
msgstr "自动推送系统用户到资产"
#: assets/forms.py:3
22
#: assets/forms.py:3
49
msgid ""
msgid ""
"High level will be using login asset as default, if user was granted more "
"High level will be using login asset as default, if user was granted more "
"than 2 system user"
"than 2 system user"
...
@@ -237,7 +242,7 @@ msgstr "测试环境"
...
@@ -237,7 +242,7 @@ msgstr "测试环境"
#: assets/models/asset.py:53 assets/templates/assets/admin_user_assets.html:60
#: assets/models/asset.py:53 assets/templates/assets/admin_user_assets.html:60
#: assets/templates/assets/asset_detail.html:61
#: assets/templates/assets/asset_detail.html:61
#: assets/templates/assets/asset_group_detail.html:51
#: assets/templates/assets/asset_group_detail.html:51
#: assets/templates/assets/asset_list.html:3
1
#: assets/templates/assets/asset_list.html:3
9
#: assets/templates/assets/cluster_assets.html:52
#: assets/templates/assets/cluster_assets.html:52
#: assets/templates/assets/system_user_asset.html:53
#: assets/templates/assets/system_user_asset.html:53
#: assets/templates/assets/user_asset_list.html:20 common/forms.py:140
#: assets/templates/assets/user_asset_list.html:20 common/forms.py:140
...
@@ -251,7 +256,7 @@ msgstr "IP"
...
@@ -251,7 +256,7 @@ msgstr "IP"
#: assets/models/asset.py:54 assets/templates/assets/admin_user_assets.html:59
#: assets/models/asset.py:54 assets/templates/assets/admin_user_assets.html:59
#: assets/templates/assets/asset_detail.html:57
#: assets/templates/assets/asset_detail.html:57
#: assets/templates/assets/asset_group_detail.html:50
#: assets/templates/assets/asset_group_detail.html:50
#: assets/templates/assets/asset_list.html:3
0
#: assets/templates/assets/asset_list.html:3
8
#: assets/templates/assets/cluster_assets.html:51
#: assets/templates/assets/cluster_assets.html:51
#: assets/templates/assets/system_user_asset.html:52
#: assets/templates/assets/system_user_asset.html:52
#: assets/templates/assets/user_asset_list.html:19 common/forms.py:139
#: assets/templates/assets/user_asset_list.html:19 common/forms.py:139
...
@@ -262,17 +267,18 @@ msgid "Hostname"
...
@@ -262,17 +267,18 @@ msgid "Hostname"
msgstr "主机名"
msgstr "主机名"
#: assets/models/asset.py:56 assets/templates/assets/asset_detail.html:213
#: assets/models/asset.py:56 assets/templates/assets/asset_detail.html:213
#: assets/views/asset.py:2
18 assets/views/asset.py:258
#: assets/views/asset.py:2
20 assets/views/asset.py:260
msgid "Asset groups"
msgid "Asset groups"
msgstr "资产组"
msgstr "资产组"
#: assets/models/asset.py:57 assets/models/cluster.py:40
#: assets/models/asset.py:57 assets/models/cluster.py:40
#: assets/models/user.py:219 assets/templates/assets/asset_detail.html:85
#: assets/models/user.py:219 assets/templates/assets/asset_detail.html:85
#: assets/templates/assets/asset_list.html:
33
templates/_nav.html:24
#: assets/templates/assets/asset_list.html:
41
templates/_nav.html:24
msgid "Cluster"
msgid "Cluster"
msgstr "集群"
msgstr "集群"
#: assets/models/asset.py:58 assets/templates/assets/asset_detail.html:129
#: assets/models/asset.py:58 assets/models/label.py:20
#: assets/templates/assets/asset_detail.html:129
msgid "Is active"
msgid "Is active"
msgstr "激活"
msgstr "激活"
...
@@ -370,7 +376,15 @@ msgstr "系统架构"
...
@@ -370,7 +376,15 @@ msgstr "系统架构"
msgid "Hostname raw"
msgid "Hostname raw"
msgstr "主机名原始"
msgstr "主机名原始"
#: assets/models/asset.py:91 assets/models/cluster.py:28
#: assets/models/asset.py:91 assets/templates/assets/asset_create.html:34
#: assets/templates/assets/asset_create.html:36
#: assets/templates/assets/asset_detail.html:250
#: assets/templates/assets/asset_update.html:39
#: assets/templates/assets/asset_update.html:41
msgid "Labels"
msgstr "标签管理"
#: assets/models/asset.py:93 assets/models/cluster.py:28
#: assets/models/group.py:21 assets/models/user.py:36
#: assets/models/group.py:21 assets/models/user.py:36
#: assets/templates/assets/admin_user_detail.html:68
#: assets/templates/assets/admin_user_detail.html:68
#: assets/templates/assets/asset_detail.html:149
#: assets/templates/assets/asset_detail.html:149
...
@@ -378,12 +392,13 @@ msgstr "主机名原始"
...
@@ -378,12 +392,13 @@ msgstr "主机名原始"
#: assets/templates/assets/system_user_detail.html:96
#: assets/templates/assets/system_user_detail.html:96
#: ops/templates/ops/adhoc_detail.html:86 perms/models.py:22
#: ops/templates/ops/adhoc_detail.html:86 perms/models.py:22
#: perms/templates/perms/asset_permission_detail.html:94
#: perms/templates/perms/asset_permission_detail.html:94
#: users/models/user.py:50 users/templates/users/user_detail.html:9
8
#: users/models/user.py:50 users/templates/users/user_detail.html:9
9
msgid "Created by"
msgid "Created by"
msgstr "创建者"
msgstr "创建者"
#: assets/models/asset.py:92 assets/models/cluster.py:26
#: assets/models/asset.py:94 assets/models/cluster.py:26
#: assets/models/group.py:22 assets/templates/assets/admin_user_detail.html:64
#: assets/models/group.py:22 assets/models/label.py:23
#: assets/templates/assets/admin_user_detail.html:64
#: assets/templates/assets/cluster_detail.html:89
#: assets/templates/assets/cluster_detail.html:89
#: assets/templates/assets/system_user_detail.html:92
#: assets/templates/assets/system_user_detail.html:92
#: ops/templates/ops/adhoc_detail.html:90 ops/templates/ops/task_detail.html:60
#: ops/templates/ops/adhoc_detail.html:90 ops/templates/ops/task_detail.html:60
...
@@ -393,8 +408,8 @@ msgstr "创建者"
...
@@ -393,8 +408,8 @@ msgstr "创建者"
msgid "Date created"
msgid "Date created"
msgstr "创建日期"
msgstr "创建日期"
#: assets/models/asset.py:9
3
assets/models/cluster.py:29
#: assets/models/asset.py:9
5
assets/models/cluster.py:29
#: assets/models/group.py:23 assets/models/user.py:33
#: assets/models/group.py:23 assets/models/
label.py:21 assets/models/
user.py:33
#: assets/templates/assets/admin_user_detail.html:72
#: assets/templates/assets/admin_user_detail.html:72
#: assets/templates/assets/admin_user_list.html:28
#: assets/templates/assets/admin_user_list.html:28
#: assets/templates/assets/asset_detail.html:157
#: assets/templates/assets/asset_detail.html:157
...
@@ -405,7 +420,7 @@ msgstr "创建日期"
...
@@ -405,7 +420,7 @@ msgstr "创建日期"
#: ops/models.py:37 perms/models.py:24
#: ops/models.py:37 perms/models.py:24
#: perms/templates/perms/asset_permission_detail.html:98 terminal/models.py:25
#: perms/templates/perms/asset_permission_detail.html:98 terminal/models.py:25
#: terminal/templates/terminal/terminal_detail.html:63 users/models/group.py:15
#: terminal/templates/terminal/terminal_detail.html:63 users/models/group.py:15
#: users/models/user.py:47 users/templates/users/user_detail.html:11
0
#: users/models/user.py:47 users/templates/users/user_detail.html:11
1
#: users/templates/users/user_group_detail.html:67
#: users/templates/users/user_group_detail.html:67
#: users/templates/users/user_group_list.html:14
#: users/templates/users/user_group_list.html:14
#: users/templates/users/user_profile.html:118
#: users/templates/users/user_profile.html:118
...
@@ -421,7 +436,7 @@ msgid "Contact"
...
@@ -421,7 +436,7 @@ msgid "Contact"
msgstr "联系人"
msgstr "联系人"
#: assets/models/cluster.py:22 assets/templates/assets/cluster_detail.html:69
#: assets/models/cluster.py:22 assets/templates/assets/cluster_detail.html:69
#: users/models/user.py:41 users/templates/users/user_detail.html:7
5
#: users/models/user.py:41 users/templates/users/user_detail.html:7
6
msgid "Phone"
msgid "Phone"
msgstr "手机"
msgstr "手机"
...
@@ -445,7 +460,8 @@ msgstr "运营商"
...
@@ -445,7 +460,8 @@ msgstr "运营商"
msgid "Default"
msgid "Default"
msgstr "默认"
msgstr "默认"
#: assets/models/cluster.py:36 users/models/user.py:258
#: assets/models/cluster.py:36 assets/models/label.py:13
#: users/models/user.py:258
msgid "System"
msgid "System"
msgstr "系统"
msgstr "系统"
...
@@ -462,6 +478,28 @@ msgstr "资产组"
...
@@ -462,6 +478,28 @@ msgstr "资产组"
msgid "Default asset group"
msgid "Default asset group"
msgstr "默认资产组"
msgstr "默认资产组"
#: assets/models/label.py:14 perms/forms.py:18 perms/models.py:15
#: perms/templates/perms/asset_permission_create_update.html:36
#: perms/templates/perms/asset_permission_list.html:26 templates/_nav.html:12
#: terminal/backends/command/models.py:10 terminal/models.py:115
#: terminal/templates/terminal/command_list.html:32
#: terminal/templates/terminal/command_list.html:72
#: terminal/templates/terminal/session_list.html:33
#: terminal/templates/terminal/session_list.html:71 users/forms.py:190
#: users/models/user.py:30 users/templates/users/user_group_detail.html:78
#: users/views/user.py:337
msgid "User"
msgstr "用户"
#: assets/models/label.py:18 assets/templates/assets/label_list.html:15
#: common/models.py:27
msgid "Value"
msgstr "值"
#: assets/models/label.py:19
msgid "Category"
msgstr "分类"
#: assets/models/user.py:31
#: assets/models/user.py:31
msgid "SSH private key"
msgid "SSH private key"
msgstr "ssh密钥"
msgstr "ssh密钥"
...
@@ -575,11 +613,12 @@ msgstr "仅修改你需要更新的字段"
...
@@ -575,11 +613,12 @@ msgstr "仅修改你需要更新的字段"
#: assets/views/admin_user.py:29 assets/views/admin_user.py:47
#: assets/views/admin_user.py:29 assets/views/admin_user.py:47
#: assets/views/admin_user.py:63 assets/views/admin_user.py:79
#: assets/views/admin_user.py:63 assets/views/admin_user.py:79
#: assets/views/admin_user.py:106 assets/views/asset.py:48
#: assets/views/admin_user.py:106 assets/views/asset.py:48
#: assets/views/asset.py:6
1 assets/views/asset.py:84 assets/views/asset.py:144
#: assets/views/asset.py:6
2 assets/views/asset.py:86 assets/views/asset.py:146
#: assets/views/asset.py:16
1 assets/views/asset.py:185
#: assets/views/asset.py:16
3 assets/views/asset.py:187
#: assets/views/cluster.py:26 assets/views/cluster.py:80
#: assets/views/cluster.py:26 assets/views/cluster.py:80
#: assets/views/cluster.py:97 assets/views/group.py:34 assets/views/group.py:52
#: assets/views/cluster.py:97 assets/views/group.py:34 assets/views/group.py:52
#: assets/views/group.py:69 assets/views/group.py:87
#: assets/views/group.py:69 assets/views/group.py:87 assets/views/label.py:26
#: assets/views/label.py:42 assets/views/label.py:58
#: assets/views/system_user.py:28 assets/views/system_user.py:44
#: assets/views/system_user.py:28 assets/views/system_user.py:44
#: assets/views/system_user.py:60 assets/views/system_user.py:75
#: assets/views/system_user.py:60 assets/views/system_user.py:75
#: templates/_nav.html:19
#: templates/_nav.html:19
...
@@ -627,15 +666,15 @@ msgid "Create system user"
...
@@ -627,15 +666,15 @@ msgid "Create system user"
msgstr "创建系统用户"
msgstr "创建系统用户"
#: assets/templates/assets/_system_user.html:37
#: assets/templates/assets/_system_user.html:37
#: assets/templates/assets/asset_create.html:1
4
#: assets/templates/assets/asset_create.html:1
6
#: assets/templates/assets/asset_update.html:
19
#: assets/templates/assets/asset_update.html:
21
#: assets/templates/assets/cluster_create_update.html:35
#: assets/templates/assets/cluster_create_update.html:35
msgid "Basic"
msgid "Basic"
msgstr "基本"
msgstr "基本"
#: assets/templates/assets/_system_user.html:45
#: assets/templates/assets/_system_user.html:45
#: assets/templates/assets/asset_create.html:2
4
#: assets/templates/assets/asset_create.html:2
6
#: assets/templates/assets/asset_update.html:
29
#: assets/templates/assets/asset_update.html:
31
#: assets/templates/assets/system_user_update.html:7
#: assets/templates/assets/system_user_update.html:7
#: users/templates/users/user_create.html:9
#: users/templates/users/user_create.html:9
#: users/templates/users/user_update.html:6
#: users/templates/users/user_update.html:6
...
@@ -647,8 +686,8 @@ msgid "Auto generate key"
...
@@ -647,8 +686,8 @@ msgid "Auto generate key"
msgstr "自动生成秘钥"
msgstr "自动生成秘钥"
#: assets/templates/assets/_system_user.html:65
#: assets/templates/assets/_system_user.html:65
#: assets/templates/assets/asset_create.html:
32
#: assets/templates/assets/asset_create.html:
61
#: assets/templates/assets/asset_update.html:
47
#: assets/templates/assets/asset_update.html:
70
#: assets/templates/assets/cluster_create_update.html:46
#: assets/templates/assets/cluster_create_update.html:46
#: perms/templates/perms/asset_permission_create_update.html:45
#: perms/templates/perms/asset_permission_create_update.html:45
#: terminal/templates/terminal/terminal_update.html:41
#: terminal/templates/terminal/terminal_update.html:41
...
@@ -658,10 +697,11 @@ msgstr "其它"
...
@@ -658,10 +697,11 @@ msgstr "其它"
#: assets/templates/assets/_system_user.html:71
#: assets/templates/assets/_system_user.html:71
#: assets/templates/assets/admin_user_create_update.html:45
#: assets/templates/assets/admin_user_create_update.html:45
#: assets/templates/assets/asset_bulk_update.html:23
#: assets/templates/assets/asset_bulk_update.html:23
#: assets/templates/assets/asset_create.html:
40
#: assets/templates/assets/asset_create.html:
68
#: assets/templates/assets/asset_group_create.html:16
#: assets/templates/assets/asset_group_create.html:16
#: assets/templates/assets/asset_update.html:
55
#: assets/templates/assets/asset_update.html:
78
#: assets/templates/assets/cluster_create_update.html:54
#: assets/templates/assets/cluster_create_update.html:54
#: assets/templates/assets/label_create_update.html:16
#: common/templates/common/basic_setting.html:58
#: common/templates/common/basic_setting.html:58
#: common/templates/common/email_setting.html:59
#: common/templates/common/email_setting.html:59
#: common/templates/common/ldap_setting.html:59
#: common/templates/common/ldap_setting.html:59
...
@@ -681,11 +721,12 @@ msgstr "重置"
...
@@ -681,11 +721,12 @@ msgstr "重置"
#: assets/templates/assets/_system_user.html:72
#: assets/templates/assets/_system_user.html:72
#: assets/templates/assets/admin_user_create_update.html:46
#: assets/templates/assets/admin_user_create_update.html:46
#: assets/templates/assets/asset_bulk_update.html:24
#: assets/templates/assets/asset_bulk_update.html:24
#: assets/templates/assets/asset_create.html:
41
#: assets/templates/assets/asset_create.html:
69
#: assets/templates/assets/asset_group_create.html:17
#: assets/templates/assets/asset_group_create.html:17
#: assets/templates/assets/asset_list.html:
53
#: assets/templates/assets/asset_list.html:
61
#: assets/templates/assets/asset_update.html:
56
#: assets/templates/assets/asset_update.html:
79
#: assets/templates/assets/cluster_create_update.html:55
#: assets/templates/assets/cluster_create_update.html:55
#: assets/templates/assets/label_create_update.html:17
#: common/templates/common/basic_setting.html:59
#: common/templates/common/basic_setting.html:59
#: common/templates/common/email_setting.html:60
#: common/templates/common/email_setting.html:60
#: common/templates/common/ldap_setting.html:60
#: common/templates/common/ldap_setting.html:60
...
@@ -730,10 +771,11 @@ msgstr "资产列表"
...
@@ -730,10 +771,11 @@ msgstr "资产列表"
#: assets/templates/assets/asset_group_detail.html:18
#: assets/templates/assets/asset_group_detail.html:18
#: assets/templates/assets/asset_group_detail.html:177
#: assets/templates/assets/asset_group_detail.html:177
#: assets/templates/assets/asset_group_list.html:38
#: assets/templates/assets/asset_group_list.html:38
#: assets/templates/assets/asset_list.html:
98
#: assets/templates/assets/asset_list.html:
106
#: assets/templates/assets/cluster_assets.html:170
#: assets/templates/assets/cluster_assets.html:170
#: assets/templates/assets/cluster_detail.html:25
#: assets/templates/assets/cluster_detail.html:25
#: assets/templates/assets/cluster_list.html:43
#: assets/templates/assets/cluster_list.html:43
#: assets/templates/assets/label_list.html:38
#: assets/templates/assets/system_user_asset.html:25
#: assets/templates/assets/system_user_asset.html:25
#: assets/templates/assets/system_user_detail.html:26
#: assets/templates/assets/system_user_detail.html:26
#: assets/templates/assets/system_user_list.html:84
#: assets/templates/assets/system_user_list.html:84
...
@@ -754,16 +796,17 @@ msgstr "更新"
...
@@ -754,16 +796,17 @@ msgstr "更新"
#: assets/templates/assets/asset_detail.html:28
#: assets/templates/assets/asset_detail.html:28
#: assets/templates/assets/asset_group_detail.html:22
#: assets/templates/assets/asset_group_detail.html:22
#: assets/templates/assets/asset_group_list.html:39
#: assets/templates/assets/asset_group_list.html:39
#: assets/templates/assets/asset_list.html:
99
#: assets/templates/assets/asset_list.html:
107
#: assets/templates/assets/cluster_detail.html:29
#: assets/templates/assets/cluster_detail.html:29
#: assets/templates/assets/cluster_list.html:44
#: assets/templates/assets/cluster_list.html:44
#: assets/templates/assets/label_list.html:39
#: assets/templates/assets/system_user_detail.html:30
#: assets/templates/assets/system_user_detail.html:30
#: assets/templates/assets/system_user_list.html:85
#: assets/templates/assets/system_user_list.html:85
#: ops/templates/ops/task_list.html:71
#: ops/templates/ops/task_list.html:71
#: perms/templates/perms/asset_permission_detail.html:34
#: perms/templates/perms/asset_permission_detail.html:34
#: perms/templates/perms/asset_permission_list.html:74
#: perms/templates/perms/asset_permission_list.html:74
#: terminal/templates/terminal/terminal_list.html:73
#: terminal/templates/terminal/terminal_list.html:73
#: users/templates/users/user_detail.html:
29
#: users/templates/users/user_detail.html:
30
#: users/templates/users/user_group_detail.html:32
#: users/templates/users/user_group_detail.html:32
#: users/templates/users/user_group_list.html:41
#: users/templates/users/user_group_list.html:41
#: users/templates/users/user_list.html:80
#: users/templates/users/user_list.html:80
...
@@ -788,8 +831,8 @@ msgstr "类型"
...
@@ -788,8 +831,8 @@ msgstr "类型"
#: assets/templates/assets/admin_user_assets.html:63
#: assets/templates/assets/admin_user_assets.html:63
#: assets/templates/assets/admin_user_list.html:25
#: assets/templates/assets/admin_user_list.html:25
#: assets/templates/assets/asset_detail.html:
376
#: assets/templates/assets/asset_detail.html:
403
#: assets/templates/assets/asset_list.html:
36
#: assets/templates/assets/asset_list.html:
44
#: assets/templates/assets/system_user_asset.html:55
#: assets/templates/assets/system_user_asset.html:55
#: assets/templates/assets/system_user_list.html:27
#: assets/templates/assets/system_user_list.html:27
msgid "Reachable"
msgid "Reachable"
...
@@ -831,15 +874,15 @@ msgstr "使用集群管理用户"
...
@@ -831,15 +874,15 @@ msgstr "使用集群管理用户"
#: assets/templates/assets/admin_user_detail.html:101
#: assets/templates/assets/admin_user_detail.html:101
#: assets/templates/assets/asset_detail.html:230
#: assets/templates/assets/asset_detail.html:230
#: assets/templates/assets/asset_group_list.html:81
#: assets/templates/assets/asset_group_list.html:81
#: assets/templates/assets/asset_list.html:2
20
#: assets/templates/assets/asset_list.html:2
42
#: assets/templates/assets/cluster_assets.html:104
#: assets/templates/assets/cluster_assets.html:104
#: assets/templates/assets/cluster_list.html:89
#: assets/templates/assets/cluster_list.html:89
#: assets/templates/assets/system_user_detail.html:164
#: assets/templates/assets/system_user_detail.html:164
#: assets/templates/assets/system_user_list.html:134 templates/_modal.html:16
#: assets/templates/assets/system_user_list.html:134 templates/_modal.html:16
#: terminal/templates/terminal/session_detail.html:108
#: terminal/templates/terminal/session_detail.html:108
#: users/templates/users/user_detail.html:33
8
#: users/templates/users/user_detail.html:33
9
#: users/templates/users/user_detail.html:36
3
#: users/templates/users/user_detail.html:36
4
#: users/templates/users/user_detail.html:38
6
#: users/templates/users/user_detail.html:38
7
#: users/templates/users/user_group_create_update.html:32
#: users/templates/users/user_group_create_update.html:32
#: users/templates/users/user_group_list.html:82
#: users/templates/users/user_group_list.html:82
#: users/templates/users/user_list.html:196
#: users/templates/users/user_list.html:196
...
@@ -862,9 +905,10 @@ msgstr "比例"
...
@@ -862,9 +905,10 @@ msgstr "比例"
#: assets/templates/assets/admin_user_list.html:29
#: assets/templates/assets/admin_user_list.html:29
#: assets/templates/assets/asset_group_detail.html:55
#: assets/templates/assets/asset_group_detail.html:55
#: assets/templates/assets/asset_group_list.html:18
#: assets/templates/assets/asset_group_list.html:18
#: assets/templates/assets/asset_list.html:
37
#: assets/templates/assets/asset_list.html:
45
#: assets/templates/assets/cluster_assets.html:56
#: assets/templates/assets/cluster_assets.html:56
#: assets/templates/assets/cluster_list.html:23
#: assets/templates/assets/cluster_list.html:23
#: assets/templates/assets/label_list.html:17
#: assets/templates/assets/system_user_list.html:31
#: assets/templates/assets/system_user_list.html:31
#: ops/templates/ops/adhoc_history.html:59 ops/templates/ops/task_adhoc.html:61
#: ops/templates/ops/adhoc_history.html:59 ops/templates/ops/task_adhoc.html:61
#: ops/templates/ops/task_history.html:62 ops/templates/ops/task_list.html:41
#: ops/templates/ops/task_history.html:62 ops/templates/ops/task_list.html:41
...
@@ -876,12 +920,12 @@ msgstr "比例"
...
@@ -876,12 +920,12 @@ msgstr "比例"
msgid "Action"
msgid "Action"
msgstr "动作"
msgstr "动作"
#: assets/templates/assets/asset_create.html:
28
#: assets/templates/assets/asset_create.html:
30
#: assets/templates/assets/asset_update.html:3
3
#: assets/templates/assets/asset_update.html:3
5
msgid "Group"
msgid "Group"
msgstr "组"
msgstr "组"
#: assets/templates/assets/asset_detail.html:20 assets/views/asset.py:18
6
#: assets/templates/assets/asset_detail.html:20 assets/views/asset.py:18
8
#: assets/views/cluster.py:98
#: assets/views/cluster.py:98
msgid "Asset detail"
msgid "Asset detail"
msgstr "资产详情"
msgstr "资产详情"
...
@@ -899,26 +943,26 @@ msgid "Disk"
...
@@ -899,26 +943,26 @@ msgid "Disk"
msgstr "硬盘"
msgstr "硬盘"
#: assets/templates/assets/asset_detail.html:153
#: assets/templates/assets/asset_detail.html:153
#: users/templates/users/user_detail.html:10
2
#: users/templates/users/user_detail.html:10
3
#: users/templates/users/user_profile.html:88
#: users/templates/users/user_profile.html:88
msgid "Date joined"
msgid "Date joined"
msgstr "创建日期"
msgstr "创建日期"
#: assets/templates/assets/asset_detail.html:169
#: assets/templates/assets/asset_detail.html:169
#: terminal/templates/terminal/session_detail.html:81
#: terminal/templates/terminal/session_detail.html:81
#: users/templates/users/user_detail.html:12
1
#: users/templates/users/user_detail.html:12
2
#: users/templates/users/user_profile.html:130
#: users/templates/users/user_profile.html:130
msgid "Quick modify"
msgid "Quick modify"
msgstr "快速修改"
msgstr "快速修改"
#: assets/templates/assets/asset_detail.html:175
#: assets/templates/assets/asset_detail.html:175
#: assets/templates/assets/asset_list.html:
35
#: assets/templates/assets/asset_list.html:
43
#: assets/templates/assets/user_asset_list.html:25 perms/models.py:20
#: assets/templates/assets/user_asset_list.html:25 perms/models.py:20
#: perms/templates/perms/asset_permission_create_update.html:47
#: perms/templates/perms/asset_permission_create_update.html:47
#: perms/templates/perms/asset_permission_detail.html:116
#: perms/templates/perms/asset_permission_detail.html:116
#: terminal/templates/terminal/terminal_list.html:34
#: terminal/templates/terminal/terminal_list.html:34
#: users/templates/users/_select_user_modal.html:18
#: users/templates/users/_select_user_modal.html:18
#: users/templates/users/user_detail.html:12
7
#: users/templates/users/user_detail.html:12
8
#: users/templates/users/user_list.html:27
#: users/templates/users/user_list.html:27
#: users/templates/users/user_profile.html:63
#: users/templates/users/user_profile.html:63
msgid "Active"
msgid "Active"
...
@@ -936,8 +980,8 @@ msgstr "刷新"
...
@@ -936,8 +980,8 @@ msgstr "刷新"
msgid "Join asset groups"
msgid "Join asset groups"
msgstr "添加到资产组"
msgstr "添加到资产组"
#: assets/templates/assets/asset_detail.html:3
18
#: assets/templates/assets/asset_detail.html:3
45
#: users/templates/users/user_detail.html:27
2
#: users/templates/users/user_detail.html:27
3
msgid "Update successfully!"
msgid "Update successfully!"
msgstr "更新成功"
msgstr "更新成功"
...
@@ -974,11 +1018,11 @@ msgid "Create asset group"
...
@@ -974,11 +1018,11 @@ msgid "Create asset group"
msgstr "创建资产组"
msgstr "创建资产组"
#: assets/templates/assets/asset_group_list.html:76
#: assets/templates/assets/asset_group_list.html:76
#: assets/templates/assets/asset_list.html:2
15
#: assets/templates/assets/asset_list.html:2
37
#: assets/templates/assets/cluster_list.html:84
#: assets/templates/assets/cluster_list.html:84
#: assets/templates/assets/system_user_list.html:129
#: assets/templates/assets/system_user_list.html:129
#: users/templates/users/user_detail.html:33
3
#: users/templates/users/user_detail.html:33
4
#: users/templates/users/user_detail.html:35
8
#: users/templates/users/user_detail.html:35
9
#: users/templates/users/user_group_list.html:77
#: users/templates/users/user_group_list.html:77
#: users/templates/users/user_list.html:191
#: users/templates/users/user_list.html:191
msgid "Are you sure?"
msgid "Are you sure?"
...
@@ -1020,59 +1064,63 @@ msgstr "导入"
...
@@ -1020,59 +1064,63 @@ msgstr "导入"
msgid "Export"
msgid "Export"
msgstr "导出"
msgstr "导出"
#: assets/templates/assets/asset_list.html:25 assets/views/asset.py:8
5
#: assets/templates/assets/asset_list.html:25 assets/views/asset.py:8
7
msgid "Create asset"
msgid "Create asset"
msgstr "创建资产"
msgstr "创建资产"
#: assets/templates/assets/asset_list.html:34
#: assets/templates/assets/asset_list.html:27 templates/_nav.html:27
msgid "Label"
msgstr "标签"
#: assets/templates/assets/asset_list.html:42
#: assets/templates/assets/user_asset_list.html:24
#: assets/templates/assets/user_asset_list.html:24
msgid "Hardware"
msgid "Hardware"
msgstr "硬件"
msgstr "硬件"
#: assets/templates/assets/asset_list.html:
46
#: assets/templates/assets/asset_list.html:
54
#: users/templates/users/user_list.html:37
#: users/templates/users/user_list.html:37
msgid "Delete selected"
msgid "Delete selected"
msgstr "批量删除"
msgstr "批量删除"
#: assets/templates/assets/asset_list.html:
47
#: assets/templates/assets/asset_list.html:
55
#: users/templates/users/user_list.html:38
#: users/templates/users/user_list.html:38
msgid "Update selected"
msgid "Update selected"
msgstr "批量更新"
msgstr "批量更新"
#: assets/templates/assets/asset_list.html:
48
#: assets/templates/assets/asset_list.html:
56
#: users/templates/users/user_list.html:39
#: users/templates/users/user_list.html:39
msgid "Deactive selected"
msgid "Deactive selected"
msgstr "禁用所选"
msgstr "禁用所选"
#: assets/templates/assets/asset_list.html:
49
#: assets/templates/assets/asset_list.html:
57
#: users/templates/users/user_list.html:40
#: users/templates/users/user_list.html:40
msgid "Active selected"
msgid "Active selected"
msgstr "激活所选"
msgstr "激活所选"
#: assets/templates/assets/asset_list.html:2
16
#: assets/templates/assets/asset_list.html:2
38
msgid "This will delete the selected assets !!!"
msgid "This will delete the selected assets !!!"
msgstr "删除选择资产"
msgstr "删除选择资产"
# msgid "Deleted!"
# msgid "Deleted!"
# msgstr "删除"
# msgstr "删除"
#: assets/templates/assets/asset_list.html:2
24
#: assets/templates/assets/asset_list.html:2
46
msgid "Asset Deleted."
msgid "Asset Deleted."
msgstr "已被删除"
msgstr "已被删除"
#: assets/templates/assets/asset_list.html:2
25
#: assets/templates/assets/asset_list.html:2
47
#: assets/templates/assets/asset_list.html:2
30
#: assets/templates/assets/asset_list.html:2
52
msgid "Asset Delete"
msgid "Asset Delete"
msgstr "删除"
msgstr "删除"
#: assets/templates/assets/asset_list.html:2
29
#: assets/templates/assets/asset_list.html:2
51
msgid "Asset Deleting failed."
msgid "Asset Deleting failed."
msgstr "删除失败"
msgstr "删除失败"
#: assets/templates/assets/asset_update.html:
37
#: assets/templates/assets/asset_update.html:
60
msgid "Configuration"
msgid "Configuration"
msgstr "配置"
msgstr "配置"
#: assets/templates/assets/asset_update.html:
42
#: assets/templates/assets/asset_update.html:
65
msgid "Location"
msgid "Location"
msgstr "位置"
msgstr "位置"
...
@@ -1147,6 +1195,10 @@ msgstr "确认删除"
...
@@ -1147,6 +1195,10 @@ msgstr "确认删除"
msgid "Are you sure delete"
msgid "Are you sure delete"
msgstr "您确定删除吗?"
msgstr "您确定删除吗?"
#: assets/templates/assets/label_list.html:6 assets/views/label.py:43
msgid "Create label"
msgstr "创建标签"
#: assets/templates/assets/system_user_asset.html:33
#: assets/templates/assets/system_user_asset.html:33
msgid "Assets of "
msgid "Assets of "
msgstr "资产"
msgstr "资产"
...
@@ -1220,19 +1272,19 @@ msgstr "更新管理用户"
...
@@ -1220,19 +1272,19 @@ msgstr "更新管理用户"
msgid "Admin user detail"
msgid "Admin user detail"
msgstr "管理用户详情"
msgstr "管理用户详情"
#: assets/views/asset.py:49 assets/views/asset.py:6
2
#: assets/views/asset.py:49 assets/views/asset.py:6
3
msgid "Asset list"
msgid "Asset list"
msgstr "资产列表"
msgstr "资产列表"
#: assets/views/asset.py:14
5
#: assets/views/asset.py:14
7
msgid "Bulk update asset"
msgid "Bulk update asset"
msgstr "批量更新资产"
msgstr "批量更新资产"
#: assets/views/asset.py:16
2
#: assets/views/asset.py:16
4
msgid "Update asset"
msgid "Update asset"
msgstr "编辑资产"
msgstr "编辑资产"
#: assets/views/asset.py:
298
#: assets/views/asset.py:
300
msgid "already exists"
msgid "already exists"
msgstr "已经存在"
msgstr "已经存在"
...
@@ -1261,6 +1313,14 @@ msgstr "资产组列表"
...
@@ -1261,6 +1313,14 @@ msgstr "资产组列表"
msgid "Asset group detail"
msgid "Asset group detail"
msgstr "资产组详情"
msgstr "资产组详情"
#: assets/views/label.py:27
msgid "Label list"
msgstr "标签列表"
#: assets/views/label.py:59
msgid "Update label"
msgstr "编辑标签"
#: assets/views/system_user.py:29
#: assets/views/system_user.py:29
msgid "System user list"
msgid "System user list"
msgstr "系统用户列表"
msgstr "系统用户列表"
...
@@ -1296,14 +1356,12 @@ msgid "<b>%(name)s</b> was updated successfully"
...
@@ -1296,14 +1356,12 @@ msgid "<b>%(name)s</b> was updated successfully"
msgstr "<b>%(name)s</b> 更新成功"
msgstr "<b>%(name)s</b> 更新成功"
#: common/fields.py:25
#: common/fields.py:25
#, fuzzy
#| msgid "Not a valid ssh public key"
msgid "Not a valid json"
msgid "Not a valid json"
msgstr "
ssh密钥不合法
"
msgstr "
不是合法json
"
#: common/fields.py:27
#: common/fields.py:27
msgid "Not a string type"
msgid "Not a string type"
msgstr ""
msgstr "
不是字符类型
"
#: common/forms.py:70
#: common/forms.py:70
msgid "Current SITE URL"
msgid "Current SITE URL"
...
@@ -1416,10 +1474,6 @@ msgstr ""
...
@@ -1416,10 +1474,6 @@ msgstr ""
msgid "discard time"
msgid "discard time"
msgstr ""
msgstr ""
#: common/models.py:27
msgid "Value"
msgstr "值"
#: common/models.py:29
#: common/models.py:29
msgid "Enabled"
msgid "Enabled"
msgstr "启用"
msgstr "启用"
...
@@ -1459,7 +1513,7 @@ msgid "Test connection"
...
@@ -1459,7 +1513,7 @@ msgid "Test connection"
msgstr "测试连接"
msgstr "测试连接"
#: common/views.py:20 common/views.py:46 common/views.py:72 common/views.py:101
#: common/views.py:20 common/views.py:46 common/views.py:72 common/views.py:101
#: templates/_nav.html:6
9
#: templates/_nav.html:6
8
msgid "Settings"
msgid "Settings"
msgstr "系统设置"
msgstr "系统设置"
...
@@ -1735,19 +1789,6 @@ msgstr "执行历史"
...
@@ -1735,19 +1789,6 @@ msgstr "执行历史"
msgid "Select users"
msgid "Select users"
msgstr "选择用户"
msgstr "选择用户"
#: perms/forms.py:18 perms/models.py:15
#: perms/templates/perms/asset_permission_create_update.html:36
#: perms/templates/perms/asset_permission_list.html:26 templates/_nav.html:12
#: terminal/backends/command/models.py:10 terminal/models.py:115
#: terminal/templates/terminal/command_list.html:32
#: terminal/templates/terminal/command_list.html:72
#: terminal/templates/terminal/session_list.html:33
#: terminal/templates/terminal/session_list.html:71 users/forms.py:190
#: users/models/user.py:30 users/templates/users/user_group_detail.html:78
#: users/views/user.py:337
msgid "User"
msgstr "用户"
#: perms/forms.py:31 perms/templates/perms/asset_permission_user.html:116
#: perms/forms.py:31 perms/templates/perms/asset_permission_user.html:116
msgid "Select user groups"
msgid "Select user groups"
msgstr "选择用户组"
msgstr "选择用户组"
...
@@ -1772,13 +1813,13 @@ msgstr "资产 {}(组 {}) 所在集群 {} 不包含系统用户 [{}] 请检查\n
...
@@ -1772,13 +1813,13 @@ msgstr "资产 {}(组 {}) 所在集群 {} 不包含系统用户 [{}] 请检查\n
#: perms/models.py:16 perms/templates/perms/asset_permission_list.html:27
#: perms/models.py:16 perms/templates/perms/asset_permission_list.html:27
#: templates/_nav.html:13 users/models/user.py:37
#: templates/_nav.html:13 users/models/user.py:37
#: users/templates/users/_select_user_modal.html:16
#: users/templates/users/_select_user_modal.html:16
#: users/templates/users/user_detail.html:17
8
#: users/templates/users/user_detail.html:17
9
#: users/templates/users/user_list.html:26
#: users/templates/users/user_list.html:26
msgid "User group"
msgid "User group"
msgstr "用户组"
msgstr "用户组"
#: perms/models.py:21 perms/templates/perms/asset_permission_detail.html:86
#: perms/models.py:21 perms/templates/perms/asset_permission_detail.html:86
#: users/models/user.py:49 users/templates/users/user_detail.html:9
4
#: users/models/user.py:49 users/templates/users/user_detail.html:9
5
#: users/templates/users/user_profile.html:96
#: users/templates/users/user_profile.html:96
msgid "Date expired"
msgid "Date expired"
msgstr "失效日期"
msgstr "失效日期"
...
@@ -1804,7 +1845,7 @@ msgid "Add asset group to this permission"
...
@@ -1804,7 +1845,7 @@ msgid "Add asset group to this permission"
msgstr "添加资产组"
msgstr "添加资产组"
#: perms/templates/perms/asset_permission_asset.html:125
#: perms/templates/perms/asset_permission_asset.html:125
#: users/templates/users/user_detail.html:19
5
#: users/templates/users/user_detail.html:19
6
msgid "Join"
msgid "Join"
msgstr "加入"
msgstr "加入"
...
@@ -1859,7 +1900,7 @@ msgid "Add user group to asset permission"
...
@@ -1859,7 +1900,7 @@ msgid "Add user group to asset permission"
msgstr "添加用户组"
msgstr "添加用户组"
#: perms/views.py:28 perms/views.py:44 perms/views.py:60 perms/views.py:74
#: perms/views.py:28 perms/views.py:44 perms/views.py:60 perms/views.py:74
#: perms/views.py:111 perms/views.py:141 templates/_nav.html:3
0
#: perms/views.py:111 perms/views.py:141 templates/_nav.html:3
1
msgid "Perms"
msgid "Perms"
msgstr "权限管理"
msgstr "权限管理"
...
@@ -1964,20 +2005,27 @@ msgstr "用户管理"
...
@@ -1964,20 +2005,27 @@ msgstr "用户管理"
msgid "Login logs"
msgid "Login logs"
msgstr "登录日志"
msgstr "登录日志"
#: templates/_nav.html:3
3
#: templates/_nav.html:3
4
msgid "Asset permission"
msgid "Asset permission"
msgstr "资产授权"
msgstr "资产授权"
#: templates/_nav.html:
39
#: templates/_nav.html:
40
msgid "
Job Center
"
msgid "
Sessions
"
msgstr "
作业中心
"
msgstr "
会话
"
#: templates/_nav.html:42
#: templates/_nav.html:43
msgid "Task"
msgid "Session online"
msgstr "任务"
msgstr "在线会话"
#: templates/_nav.html:44
msgid "Session offline"
msgstr "离线会话"
#: templates/_nav.html:45
msgid "Commands"
msgstr "命令记录"
#: templates/_nav.html:47 templates/_nav.html:50
#: templates/_nav.html:46 terminal/templates/terminal/session_list.html:75
#: terminal/templates/terminal/session_list.html:75
#: terminal/views/command.py:47 terminal/views/session.py:75
#: terminal/views/command.py:47 terminal/views/session.py:75
#: terminal/views/session.py:92 terminal/views/session.py:114
#: terminal/views/session.py:92 terminal/views/session.py:114
#: terminal/views/terminal.py:31 terminal/views/terminal.py:46
#: terminal/views/terminal.py:31 terminal/views/terminal.py:46
...
@@ -1986,20 +2034,12 @@ msgid "Terminal"
...
@@ -1986,20 +2034,12 @@ msgid "Terminal"
msgstr "终端管理"
msgstr "终端管理"
#: templates/_nav.html:51
#: templates/_nav.html:51
msgid "Session online"
msgid "Job Center"
msgstr "在线会话"
msgstr "作业中心"
#: templates/_nav.html:52
msgid "Session offline"
msgstr "离线会话"
#: templates/_nav.html:53 terminal/models.py:122
#: templates/_nav.html:54
#: terminal/templates/terminal/command_list.html:55
msgid "Task"
#: terminal/templates/terminal/command_list.html:71
msgstr "任务"
#: terminal/templates/terminal/session_detail.html:48
#: terminal/templates/terminal/session_list.html:76
msgid "Command"
msgstr "命令"
#: templates/_nav_user.html:4
#: templates/_nav_user.html:4
msgid "My assets"
msgid "My assets"
...
@@ -2031,6 +2071,7 @@ msgstr "输出"
...
@@ -2031,6 +2071,7 @@ msgstr "输出"
#: terminal/backends/command/models.py:15
#: terminal/backends/command/models.py:15
#: terminal/templates/terminal/command_list.html:75
#: terminal/templates/terminal/command_list.html:75
#: terminal/templates/terminal/terminal_list.html:33
msgid "Session"
msgid "Session"
msgstr "会话"
msgstr "会话"
...
@@ -2091,6 +2132,13 @@ msgstr "远端地址"
...
@@ -2091,6 +2132,13 @@ msgstr "远端地址"
msgid "Replay"
msgid "Replay"
msgstr "回放"
msgstr "回放"
#: terminal/models.py:122 terminal/templates/terminal/command_list.html:55
#: terminal/templates/terminal/command_list.html:71
#: terminal/templates/terminal/session_detail.html:48
#: terminal/templates/terminal/session_list.html:76
msgid "Command"
msgstr "命令"
#: terminal/models.py:125
#: terminal/models.py:125
msgid "Date end"
msgid "Date end"
msgstr "结束日期"
msgstr "结束日期"
...
@@ -2169,10 +2217,6 @@ msgstr "HTTP端口"
...
@@ -2169,10 +2217,6 @@ msgstr "HTTP端口"
msgid "Addr"
msgid "Addr"
msgstr "地址"
msgstr "地址"
#: terminal/templates/terminal/terminal_list.html:33
msgid "Sessions"
msgstr "会话"
#: terminal/templates/terminal/terminal_list.html:76
#: terminal/templates/terminal/terminal_list.html:76
msgid "Accept"
msgid "Accept"
msgstr "接受"
msgstr "接受"
...
@@ -2269,7 +2313,7 @@ msgstr ""
...
@@ -2269,7 +2313,7 @@ msgstr ""
msgid "Invalid token or cache refreshed."
msgid "Invalid token or cache refreshed."
msgstr ""
msgstr ""
#: users/forms.py:43 users/templates/users/user_detail.html:18
6
#: users/forms.py:43 users/templates/users/user_detail.html:18
7
msgid "Join user groups"
msgid "Join user groups"
msgstr "添加到用户组"
msgstr "添加到用户组"
...
@@ -2345,13 +2389,13 @@ msgstr "管理员"
...
@@ -2345,13 +2389,13 @@ msgstr "管理员"
msgid "Application"
msgid "Application"
msgstr "应用程序"
msgstr "应用程序"
#: users/models/user.py:36 users/templates/users/user_detail.html:7
0
#: users/models/user.py:36 users/templates/users/user_detail.html:7
1
#: users/templates/users/user_profile.html:59
#: users/templates/users/user_profile.html:59
msgid "Email"
msgid "Email"
msgstr "邮件"
msgstr "邮件"
#: users/models/user.py:38 users/templates/users/_select_user_modal.html:15
#: users/models/user.py:38 users/templates/users/_select_user_modal.html:15
#: users/templates/users/user_detail.html:8
6
#: users/templates/users/user_detail.html:8
7
#: users/templates/users/user_list.html:25
#: users/templates/users/user_list.html:25
#: users/templates/users/user_profile.html:55
#: users/templates/users/user_profile.html:55
msgid "Role"
msgid "Role"
...
@@ -2361,7 +2405,7 @@ msgstr "角色"
...
@@ -2361,7 +2405,7 @@ msgstr "角色"
msgid "Avatar"
msgid "Avatar"
msgstr "头像"
msgstr "头像"
#: users/models/user.py:40 users/templates/users/user_detail.html:8
1
#: users/models/user.py:40 users/templates/users/user_detail.html:8
2
msgid "Wechat"
msgid "Wechat"
msgstr "微信"
msgstr "微信"
...
@@ -2464,7 +2508,7 @@ msgid "City"
...
@@ -2464,7 +2508,7 @@ msgid "City"
msgstr "城市"
msgstr "城市"
#: users/templates/users/reset_password.html:45
#: users/templates/users/reset_password.html:45
#: users/templates/users/user_detail.html:32
4
#: users/templates/users/user_detail.html:32
5
#: users/templates/users/user_profile.html:136 users/utils.py:68
#: users/templates/users/user_profile.html:136 users/utils.py:68
msgid "Reset password"
msgid "Reset password"
msgstr "重置密码"
msgstr "重置密码"
...
@@ -2495,54 +2539,54 @@ msgstr "用户详情"
...
@@ -2495,54 +2539,54 @@ msgstr "用户详情"
msgid "Asset granted"
msgid "Asset granted"
msgstr "授权的资产"
msgstr "授权的资产"
#: users/templates/users/user_detail.html:10
6
#: users/templates/users/user_detail.html:10
7
#: users/templates/users/user_profile.html:92
#: users/templates/users/user_profile.html:92
msgid "Last login"
msgid "Last login"
msgstr "最后登录"
msgstr "最后登录"
#: users/templates/users/user_detail.html:15
6
#: users/templates/users/user_detail.html:15
7
msgid "Send reset password mail"
msgid "Send reset password mail"
msgstr "发送重置密码邮件"
msgstr "发送重置密码邮件"
#: users/templates/users/user_detail.html:1
59
#: users/templates/users/user_detail.html:1
60
#: users/templates/users/user_detail.html:16
7
#: users/templates/users/user_detail.html:16
8
msgid "Send"
msgid "Send"
msgstr "发送"
msgstr "发送"
#: users/templates/users/user_detail.html:16
4
#: users/templates/users/user_detail.html:16
5
msgid "Send reset ssh key mail"
msgid "Send reset ssh key mail"
msgstr "发送重置密钥邮件"
msgstr "发送重置密钥邮件"
#: users/templates/users/user_detail.html:32
3
#: users/templates/users/user_detail.html:32
4
msgid "An e-mail has been sent to the user\\'s mailbox."
msgid "An e-mail has been sent to the user\\'s mailbox."
msgstr "已发送邮件到用户邮箱"
msgstr "已发送邮件到用户邮箱"
#: users/templates/users/user_detail.html:33
4
#: users/templates/users/user_detail.html:33
5
msgid "This will reset the user password and send a reset mail"
msgid "This will reset the user password and send a reset mail"
msgstr "将失效用户当前密码,并发送重设密码邮件到用户邮箱"
msgstr "将失效用户当前密码,并发送重设密码邮件到用户邮箱"
#: users/templates/users/user_detail.html:34
8
#: users/templates/users/user_detail.html:34
9
msgid ""
msgid ""
"The reset-ssh-public-key E-mail has been sent successfully. Please inform "
"The reset-ssh-public-key E-mail has been sent successfully. Please inform "
"the user to update his new ssh public key."
"the user to update his new ssh public key."
msgstr "重设秘钥邮件将会发送到用户邮箱"
msgstr "重设秘钥邮件将会发送到用户邮箱"
#: users/templates/users/user_detail.html:3
49
#: users/templates/users/user_detail.html:3
50
#: users/templates/users/user_profile.html:144
#: users/templates/users/user_profile.html:144
msgid "Reset SSH public key"
msgid "Reset SSH public key"
msgstr "重置SSH密钥"
msgstr "重置SSH密钥"
#: users/templates/users/user_detail.html:3
59
#: users/templates/users/user_detail.html:3
60
msgid "This will reset the user public key and send a reset mail"
msgid "This will reset the user public key and send a reset mail"
msgstr "将会失效用户当前秘钥,并发送重置邮件到用户邮箱"
msgstr "将会失效用户当前秘钥,并发送重置邮件到用户邮箱"
#: users/templates/users/user_detail.html:37
6
#: users/templates/users/user_detail.html:37
7
#: users/templates/users/user_profile.html:170
#: users/templates/users/user_profile.html:170
msgid "Successfully updated the SSH public key."
msgid "Successfully updated the SSH public key."
msgstr "更新ssh密钥成功"
msgstr "更新ssh密钥成功"
#: users/templates/users/user_detail.html:37
7
#: users/templates/users/user_detail.html:37
8
#: users/templates/users/user_detail.html:38
1
#: users/templates/users/user_detail.html:38
2
#: users/templates/users/user_profile.html:171
#: users/templates/users/user_profile.html:171
#: users/templates/users/user_profile.html:176
#: users/templates/users/user_profile.html:176
msgid "User SSH public key update"
msgid "User SSH public key update"
...
@@ -2856,6 +2900,9 @@ msgstr "密码更新"
...
@@ -2856,6 +2900,9 @@ msgstr "密码更新"
msgid "Public key update"
msgid "Public key update"
msgstr "秘钥更新"
msgstr "秘钥更新"
#~ msgid "Default using cluster admin user"
#~ msgstr "默认使用管理用户"
#~ msgid "Add command storage"
#~ msgid "Add command storage"
#~ msgstr "添加命令存储"
#~ msgstr "添加命令存储"
...
...
apps/static/css/jumpserver.css
View file @
b0fab245
...
@@ -338,4 +338,6 @@ div.dataTables_wrapper div.dataTables_filter {
...
@@ -338,4 +338,6 @@ div.dataTables_wrapper div.dataTables_filter {
.nav.nav-tabs
li
.active
a
{
.nav.nav-tabs
li
.active
a
{
border
:
none
;
border
:
none
;
}
}
\ No newline at end of file
apps/static/js/jumpserver.js
View file @
b0fab245
...
@@ -383,7 +383,22 @@ jumpserver.initServerSideDataTable = function (options) {
...
@@ -383,7 +383,22 @@ jumpserver.initServerSideDataTable = function (options) {
}
}
if
(
data
.
search
!==
null
)
{
if
(
data
.
search
!==
null
)
{
var
search_val
=
data
.
search
.
value
;
var
search_val
=
data
.
search
.
value
;
data
.
search
=
search_val
;
var
search_list
=
search_val
.
split
(
" "
);
var
search_attr
=
{};
var
search_raw
=
[];
search_list
.
map
(
function
(
val
,
index
)
{
var
kv
=
val
.
split
(
":"
);
if
(
kv
.
length
===
2
)
{
search_attr
[
kv
[
0
]]
=
kv
[
1
]
}
else
{
search_raw
.
push
(
kv
)
}
});
data
.
search
=
search_raw
.
join
(
""
);
$
.
each
(
search_attr
,
function
(
k
,
v
)
{
data
[
k
]
=
v
})
}
}
if
(
data
.
order
!==
null
&&
data
.
order
.
length
===
1
)
{
if
(
data
.
order
!==
null
&&
data
.
order
.
length
===
1
)
{
var
col
=
data
.
order
[
0
].
column
;
var
col
=
data
.
order
[
0
].
column
;
...
@@ -446,6 +461,7 @@ jumpserver.initServerSideDataTable = function (options) {
...
@@ -446,6 +461,7 @@ jumpserver.initServerSideDataTable = function (options) {
}
}
});
});
jumpserver
.
table
=
table
;
return
table
;
return
table
;
};
};
...
...
apps/templates/_nav.html
View file @
b0fab245
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
<li
id=
"cluster"
><a
href=
"{% url 'assets:cluster-list' %}"
>
{% trans 'Cluster' %}
</a></li>
<li
id=
"cluster"
><a
href=
"{% url 'assets:cluster-list' %}"
>
{% trans 'Cluster' %}
</a></li>
<li
id=
"admin-user"
><a
href=
"{% url 'assets:admin-user-list' %}"
>
{% trans 'Admin user' %}
</a></li>
<li
id=
"admin-user"
><a
href=
"{% url 'assets:admin-user-list' %}"
>
{% trans 'Admin user' %}
</a></li>
<li
id=
"system-user"
><a
href=
"{% url 'assets:system-user-list' %}"
>
{% trans 'System user' %}
</a></li>
<li
id=
"system-user"
><a
href=
"{% url 'assets:system-user-list' %}"
>
{% trans 'System user' %}
</a></li>
<li
id=
"label"
><a
href=
"{% url 'assets:label-list' %}"
>
{% trans 'Labels' %}
</a></li>
</ul>
</ul>
</li>
</li>
<li
id=
"perms"
>
<li
id=
"perms"
>
...
@@ -36,13 +37,13 @@
...
@@ -36,13 +37,13 @@
</li>
</li>
<li
id=
"terminal"
>
<li
id=
"terminal"
>
<a>
<a>
<i
class=
"fa fa-rocket"
></i>
<span
class=
"nav-label"
>
{% trans '
Terminal
' %}
</span><span
class=
"fa arrow"
></span>
<i
class=
"fa fa-rocket"
></i>
<span
class=
"nav-label"
>
{% trans '
Sessions
' %}
</span><span
class=
"fa arrow"
></span>
</a>
</a>
<ul
class=
"nav nav-second-level"
>
<ul
class=
"nav nav-second-level"
>
<li
id=
"terminal"
><a
href=
"{% url 'terminal:terminal-list' %}"
>
{% trans 'Terminal' %}
</a></li>
<li
id=
"session-online"
><a
href=
"{% url 'terminal:session-online-list' %}"
>
{% trans 'Session online' %}
</a></li>
<li
id=
"session-online"
><a
href=
"{% url 'terminal:session-online-list' %}"
>
{% trans 'Session online' %}
</a></li>
<li
id=
"session-offline"
><a
href=
"{% url 'terminal:session-offline-list' %}"
>
{% trans 'Session offline' %}
</a></li>
<li
id=
"session-offline"
><a
href=
"{% url 'terminal:session-offline-list' %}"
>
{% trans 'Session offline' %}
</a></li>
<li
id=
"command"
><a
href=
"{% url 'terminal:command-list' %}"
>
{% trans 'Command' %}
</a></li>
<li
id=
"command"
><a
href=
"{% url 'terminal:command-list' %}"
>
{% trans 'Commands' %}
</a></li>
<li
id=
"terminal"
><a
href=
"{% url 'terminal:terminal-list' %}"
>
{% trans 'Terminal' %}
</a></li>
</ul>
</ul>
</li>
</li>
<li
id=
"ops"
>
<li
id=
"ops"
>
...
...
apps/terminal/templates/terminal/terminal_list.html
View file @
b0fab245
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
<th
class=
"text-center"
>
{% trans 'Addr' %}
</th>
<th
class=
"text-center"
>
{% trans 'Addr' %}
</th>
<th
class=
"text-center"
>
{% trans 'SSH port' %}
</th>
<th
class=
"text-center"
>
{% trans 'SSH port' %}
</th>
<th
class=
"text-center"
>
{% trans 'Http port' %}
</th>
<th
class=
"text-center"
>
{% trans 'Http port' %}
</th>
<th
class=
"text-center"
>
{% trans 'Session
s
' %}
</th>
<th
class=
"text-center"
>
{% trans 'Session' %}
</th>
<th
class=
"text-center"
>
{% trans 'Active' %}
</th>
<th
class=
"text-center"
>
{% trans 'Active' %}
</th>
<th
class=
"text-center"
>
{% trans 'Alive' %}
</th>
<th
class=
"text-center"
>
{% trans 'Alive' %}
</th>
<th
class=
"text-center"
>
{% trans 'Action' %}
</th>
<th
class=
"text-center"
>
{% trans 'Action' %}
</th>
...
...
apps/users/templates/users/user_detail.html
View file @
b0fab245
...
@@ -129,7 +129,7 @@
...
@@ -129,7 +129,7 @@
<td><span
class=
"pull-right"
>
<td><span
class=
"pull-right"
>
<div
class=
"switch"
>
<div
class=
"switch"
>
<div
class=
"onoffswitch"
>
<div
class=
"onoffswitch"
>
<input
type=
"checkbox"
{%
if
user_object
.
is_active
%}
checked
{%
endif
%}
{%
if
request
.
user =
=
user_object
%}
disabled
=
"disabled"
{%
endif
%}
class=
"onoffswitch-checkbox disabled
"
id=
"is_active"
>
<input
type=
"checkbox"
{%
if
user_object
.
is_active
%}
checked
{%
endif
%}
{%
if
request
.
user =
=
user_object
%}
disabled
{%
endif
%}
class=
"onoffswitch-checkbox
"
id=
"is_active"
>
<label
class=
"onoffswitch-label"
for=
"is_active"
>
<label
class=
"onoffswitch-label"
for=
"is_active"
>
<span
class=
"onoffswitch-inner"
></span>
<span
class=
"onoffswitch-inner"
></span>
<span
class=
"onoffswitch-switch"
></span>
<span
class=
"onoffswitch-switch"
></span>
...
...
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