Merge pull request #10931 from jumpserver/pr@dev@perf_change_platform

perf: 修改 Platform 约束
pull/10942/head
老广 2023-07-07 19:48:15 +08:00 committed by GitHub
commit 100b1553b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 4 deletions

View File

@ -69,10 +69,15 @@ class BaseType(TextChoices):
choices = protocol.get('choices', [])
if choices == '__self__':
choices = [tp]
protocols = [
{'name': name, **settings.get(name, {})}
for name in choices
]
protocols = []
for name in choices:
protocol = {'name': name, **settings.get(name, {})}
setting = protocol.pop('setting', {})
setting_values = {k: v.get('default', None) for k, v in setting.items()}
protocol['setting'] = setting_values
protocols.append(protocol)
if protocols:
protocols[0]['default'] = True
return protocols