mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-05 17:30:30 +00:00
perf: 优化Migration,删掉原来的 content type (#7835)
Co-authored-by: ibuler <ibuler@qq.com> Co-authored-by: Jiangjie.Bai <32935519+BaiJiangJie@users.noreply.github.com>
This commit is contained in:
@@ -123,28 +123,30 @@ xpack_nodes = [
|
||||
|
||||
|
||||
def _sort_action(node):
|
||||
value = 0
|
||||
if node.isParent:
|
||||
return ['zz', 0]
|
||||
|
||||
if 'view' in node.title:
|
||||
value += 2
|
||||
elif 'add' in node.title:
|
||||
value += 4
|
||||
elif 'change' in node.title:
|
||||
value += 6
|
||||
elif 'delete' in node.title:
|
||||
value += 8
|
||||
else:
|
||||
value += 10
|
||||
return value
|
||||
action_resource = node.title.split('.')[-1]
|
||||
action, resource = action_resource.split('_', 2)
|
||||
action_value_mapper = {
|
||||
'view': 2,
|
||||
'add': 4,
|
||||
'change': 6,
|
||||
'delete': 8
|
||||
}
|
||||
v = action_value_mapper.get(action, 10)
|
||||
return [resource, v]
|
||||
|
||||
|
||||
def sort_nodes(node):
|
||||
value = 0
|
||||
value = []
|
||||
|
||||
if node.isParent:
|
||||
value += 50
|
||||
value.append(50)
|
||||
else:
|
||||
value += _sort_action(node)
|
||||
value.append(0)
|
||||
|
||||
value.extend(_sort_action(node))
|
||||
return value
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user