jumpserver/apps/terminal/models/virtualapp/provider.py

30 lines
928 B
Python
Raw Normal View History

from django.db import models
from django.utils.translation import gettext_lazy as _
from common.db.models import JMSBaseModel
__all__ = ['AppProvider', ]
class AppProvider(JMSBaseModel):
name = models.CharField(max_length=128, verbose_name=_('Name'), unique=True)
hostname = models.CharField(max_length=128, verbose_name=_('Hostname'))
terminal = models.OneToOneField(
'terminal.Terminal', on_delete=models.CASCADE, null=True, blank=True,
related_name='app_provider', verbose_name=_('Terminal')
)
apps = models.ManyToManyField(
2023-12-08 08:06:17 +00:00
'VirtualApp', verbose_name=_('Virtual app'),
through='VirtualAppPublication', through_fields=('provider', 'app'),
)
class Meta:
ordering = ('-date_created',)
2024-06-26 08:41:37 +00:00
verbose_name = _('App Provider')
@property
def load(self):
if not self.terminal:
return 'offline'
return self.terminal.load