mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-19 18:34:28 +00:00
perf: 关闭SFTP后,luna界面不显示相应选项 (#10186)
* perf: 关闭SFTP后,luna界面不显示相应选项 * perf: 修改默认值 * perf: 增加资产协议冗余字段,减少关联查询 * perf: 修改 * perf: 优化 * perf: 精简 * perf: 删掉空格 * perf: 修改继承类
This commit is contained in:
@@ -94,6 +94,20 @@ class Protocol(models.Model):
|
||||
def __str__(self):
|
||||
return '{}/{}'.format(self.name, self.port)
|
||||
|
||||
@lazyproperty
|
||||
def asset_platform_protocol(self):
|
||||
protocols = self.asset.platform.protocols.values('name', 'public', 'setting')
|
||||
protocols = list(filter(lambda p: p['name'] == self.name, protocols))
|
||||
return protocols[0] if len(protocols) > 0 else {}
|
||||
|
||||
@property
|
||||
def setting(self):
|
||||
return self.asset_platform_protocol.get('setting', {})
|
||||
|
||||
@property
|
||||
def public(self):
|
||||
return self.asset_platform_protocol.get('public', True)
|
||||
|
||||
|
||||
class Asset(NodesRelationMixin, AbsConnectivity, JMSOrgBaseModel):
|
||||
Category = const.Category
|
||||
|
Reference in New Issue
Block a user