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
58d22b72
Commit
58d22b72
authored
Jan 29, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Feature] Label 删除修改
parent
6d552f46
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
5 deletions
+8
-5
label_list.html
apps/assets/templates/assets/label_list.html
+4
-4
views_urls.py
apps/assets/urls/views_urls.py
+1
-0
label.py
apps/assets/views/label.py
+3
-1
No files found.
apps/assets/templates/assets/label_list.html
View file @
58d22b72
...
@@ -36,7 +36,7 @@ function initTable() {
...
@@ -36,7 +36,7 @@ function initTable() {
{
targets
:
4
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
{
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
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
);
var
del_btn
=
'<a class="btn btn-xs btn-danger m-l-xs btn
-
delete" data-uid="{{ DEFAULT_PK }}">{% trans "Delete" %}</a>'
.
replace
(
'{{ DEFAULT_PK }}'
,
cellData
);
$
(
td
).
html
(
update_btn
+
del_btn
)
$
(
td
).
html
(
update_btn
+
del_btn
)
}}],
}}],
ajax_url
:
'{% url "api-assets:label-list" %}?sort=name'
,
ajax_url
:
'{% url "api-assets:label-list" %}?sort=name'
,
...
@@ -51,12 +51,12 @@ function initTable() {
...
@@ -51,12 +51,12 @@ function initTable() {
$
(
document
).
ready
(
function
(){
$
(
document
).
ready
(
function
(){
initTable
();
initTable
();
})
})
.
on
(
'click'
,
'.btn
_cluster_
delete'
,
function
()
{
.
on
(
'click'
,
'.btn
-
delete'
,
function
()
{
var
$this
=
$
(
this
);
var
$this
=
$
(
this
);
var
$data_table
=
$
(
'#
cluster
_list_table'
).
DataTable
();
var
$data_table
=
$
(
'#
label
_list_table'
).
DataTable
();
var
name
=
$
(
this
).
closest
(
"tr"
).
find
(
":nth-child(2)"
).
children
(
'a'
).
html
();
var
name
=
$
(
this
).
closest
(
"tr"
).
find
(
":nth-child(2)"
).
children
(
'a'
).
html
();
var
uid
=
$this
.
data
(
'uid'
);
var
uid
=
$this
.
data
(
'uid'
);
var
the_url
=
'{% url "api-assets:
cluster
-detail" pk=DEFAULT_PK %}'
.
replace
(
'{{ DEFAULT_PK }}'
,
uid
);
var
the_url
=
'{% url "api-assets:
label
-detail" pk=DEFAULT_PK %}'
.
replace
(
'{{ DEFAULT_PK }}'
,
uid
);
objectDelete
(
$this
,
name
,
the_url
);
objectDelete
(
$this
,
name
,
the_url
);
setTimeout
(
function
()
{
setTimeout
(
function
()
{
$data_table
.
ajax
.
reload
();
$data_table
.
ajax
.
reload
();
...
...
apps/assets/urls/views_urls.py
View file @
58d22b72
...
@@ -56,5 +56,6 @@ urlpatterns = [
...
@@ -56,5 +56,6 @@ urlpatterns = [
url
(
r'^label/$'
,
views
.
LabelListView
.
as_view
(),
name
=
'label-list'
),
url
(
r'^label/$'
,
views
.
LabelListView
.
as_view
(),
name
=
'label-list'
),
url
(
r'^label/create/$'
,
views
.
LabelCreateView
.
as_view
(),
name
=
'label-create'
),
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'
),
url
(
r'^label/(?P<pk>[0-9a-zA-Z\-]{36})/update/$'
,
views
.
LabelUpdateView
.
as_view
(),
name
=
'label-update'
),
url
(
r'^label/(?P<pk>[0-9a-zA-Z\-]{36})/delete/$'
,
views
.
LabelDeleteView
.
as_view
(),
name
=
'label-delete'
),
]
]
apps/assets/views/label.py
View file @
58d22b72
...
@@ -67,4 +67,6 @@ class LabelDetailView(AdminUserRequiredMixin, DetailView):
...
@@ -67,4 +67,6 @@ class LabelDetailView(AdminUserRequiredMixin, DetailView):
class
LabelDeleteView
(
AdminUserRequiredMixin
,
DeleteView
):
class
LabelDeleteView
(
AdminUserRequiredMixin
,
DeleteView
):
pass
model
=
Label
template_name
=
'delete_confirm.html'
success_url
=
reverse_lazy
(
'assets:label-list'
)
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