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
05ecd749
Commit
05ecd749
authored
Aug 10, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 不可以更改root节点名称
parent
6b86b8b4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
1 deletion
+15
-1
node.py
apps/assets/api/node.py
+12
-0
asset_list.html
apps/assets/templates/assets/asset_list.html
+3
-1
django.mo
apps/i18n/zh/LC_MESSAGES/django.mo
+0
-0
django.po
apps/i18n/zh/LC_MESSAGES/django.po
+0
-0
No files found.
apps/assets/api/node.py
View file @
05ecd749
...
...
@@ -48,6 +48,18 @@ class NodeViewSet(viewsets.ModelViewSet):
serializer
.
validated_data
[
"key"
]
=
child_key
serializer
.
save
()
def
update
(
self
,
request
,
*
args
,
**
kwargs
):
node
=
self
.
get_object
()
if
node
.
is_root
():
node_value
=
node
.
value
post_value
=
request
.
data
.
get
(
'value'
)
if
node_value
!=
post_value
:
return
Response
(
{
"msg"
:
_
(
"You cant update the root node name"
)},
status
=
400
)
return
super
()
.
update
(
request
,
*
args
,
**
kwargs
)
class
NodeChildrenApi
(
mixins
.
ListModelMixin
,
generics
.
CreateAPIView
):
queryset
=
Node
.
objects
.
all
()
...
...
apps/assets/templates/assets/asset_list.html
View file @
05ecd749
...
...
@@ -288,7 +288,9 @@ function onRename(event, treeId, treeNode, isCancel){
APIUpdateAttr
({
url
:
url
,
body
:
JSON
.
stringify
(
data
),
method
:
"PATCH"
method
:
"PATCH"
,
success_message
:
"{% trans 'Rename success' %}"
,
fail_message
:
"{% trans 'Rename failed, do not change the root node name' %}"
})
}
...
...
apps/i18n/zh/LC_MESSAGES/django.mo
View file @
05ecd749
No preview for this file type
apps/i18n/zh/LC_MESSAGES/django.po
View file @
05ecd749
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment