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
73f0199d
Commit
73f0199d
authored
Oct 21, 2016
by
江世峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asset:add assets_bulk
parent
4e1f9c97
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
6 deletions
+19
-6
api.py
apps/assets/api.py
+7
-2
asset_list.html
apps/assets/templates/assets/asset_list.html
+0
-0
asset_tags_list.html
apps/assets/templates/assets/asset_tags_list.html
+1
-1
urls.py
apps/assets/urls.py
+2
-0
views.py
apps/assets/views.py
+8
-2
jumpserver.css
apps/static/css/jumpserver.css
+1
-1
No files found.
apps/assets/api.py
View file @
73f0199d
...
...
@@ -3,8 +3,9 @@
from
rest_framework
import
serializers
from
rest_framework
import
viewsets
,
serializers
,
generics
from
.models
import
AssetGroup
,
Asset
,
IDC
,
AssetExtend
from
common.mixins
import
BulkDeleteApiMixin
from
rest_framework_bulk
import
BulkListSerializer
,
BulkSerializerMixin
,
ListBulkCreateUpdateDestroyAPIView
from
.serializers
import
*
class
AssetGroupSerializer
(
serializers
.
ModelSerializer
):
class
Meta
:
model
=
AssetGroup
...
...
@@ -51,3 +52,6 @@ class IDCViewSet(viewsets.ReadOnlyModelViewSet):
queryset
=
IDC
.
objects
.
all
()
serializer_class
=
IDCSerializer
class
AssetListUpdateApi
(
BulkDeleteApiMixin
,
ListBulkCreateUpdateDestroyAPIView
):
queryset
=
Asset
.
objects
.
all
()
serializer_class
=
AssetBulkUpdateSerializer
\ No newline at end of file
apps/assets/templates/assets/asset_list.html
View file @
73f0199d
This diff is collapsed.
Click to expand it.
apps/assets/templates/assets/asset_tags_list.html
View file @
73f0199d
...
...
@@ -2,7 +2,7 @@
{% load i18n %}
{% load common_tags %}
{% block content_left_head %}
<a
href=
"{% url 'assets:asset-tag-create' %}"
class=
"btn btn-sm btn-primary "
>
{% trans "Create tag" %}
</a>
<a
href=
"{% url 'assets:asset-tag-create' %}"
class=
"btn btn-sm btn-primary "
>
{% trans "Create tag" %}
</a>
{% endblock %}
{% block table_head %}
...
...
apps/assets/urls.py
View file @
73f0199d
...
...
@@ -21,6 +21,7 @@ urlpatterns = [
url
(
r'^asset/(?P<pk>[0-9]+)/update'
,
views
.
AssetUpdateView
.
as_view
(),
name
=
'asset-update'
),
url
(
r'^asset/(?P<pk>[0-9]+)/delete$'
,
views
.
AssetDeleteView
.
as_view
(),
name
=
'asset-delete'
),
url
(
r'^asset-modal$'
,
views
.
AssetModalListView
.
as_view
(),
name
=
'asset-modal-list'
),
url
(
r'^asset-modal-update$'
,
views
.
AssetModalCreateView
.
as_view
(),
name
=
'asset-modal-update'
),
# Resource asset group url
url
(
r'^asset-group$'
,
views
.
AssetGroupListView
.
as_view
(),
name
=
'asset-group-list'
),
...
...
@@ -65,6 +66,7 @@ urlpatterns = [
urlpatterns
+=
[
#json
url
(
r'^v1/assets/$'
,
api
.
AssetViewSet
.
as_view
({
'get'
:
'list'
}),
name
=
'assets-list-api'
),
url
(
r'^v1/assets_bulk/$'
,
api
.
AssetListUpdateApi
.
as_view
(),
name
=
'asset-bulk-update-api'
),
url
(
r'^v1/idc/$'
,
api
.
IDCViewSet
.
as_view
({
'get'
:
'list'
}),
name
=
'idc-list-json'
),
]
...
...
apps/assets/views.py
View file @
73f0199d
...
...
@@ -46,6 +46,8 @@ class AssetListView(AdminUserRequiredMixin, ListView):
return
super
(
AssetListView
,
self
)
.
get_context_data
(
**
kwargs
)
class
AssetCreateView
(
AdminUserRequiredMixin
,
CreateAssetTagsMiXin
,
CreateView
):
model
=
Asset
tag_type
=
'asset'
...
...
@@ -73,8 +75,12 @@ class AssetCreateView(AdminUserRequiredMixin,CreateAssetTagsMiXin,CreateView):
return
super
(
AssetCreateView
,
self
)
.
get_context_data
(
**
kwargs
)
class
AssetModalCreateView
(
AdminUserRequiredMixin
,
CreateAssetTagsMiXin
,
CreateView
):
model
=
Asset
# tag_type = 'asset'
form_class
=
AssetCreateForm
template_name
=
'assets/asset_modal_update.html'
success_url
=
reverse_lazy
(
'assets:asset-list'
)
class
AssetUpdateView
(
AdminUserRequiredMixin
,
UpdateAssetTagsMiXin
,
UpdateView
):
model
=
Asset
...
...
apps/static/css/jumpserver.css
View file @
73f0199d
...
...
@@ -204,7 +204,7 @@ table.dataTable tbody td.selected td i.text-navy
padding-top
:
15px
;
margin-bottom
:
15px
;
display
:
block
;
/*background: #ccc;*/
background
:
#f4f4f4
;
padding-left
:
10px
;
}
.mar
{
...
...
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