mirror of https://github.com/jumpserver/jumpserver
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
928 B
30 lines
928 B
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(
|
|
'VirtualApp', verbose_name=_('Virtual app'),
|
|
through='VirtualAppPublication', through_fields=('provider', 'app'),
|
|
)
|
|
|
|
class Meta:
|
|
ordering = ('-date_created',)
|
|
verbose_name = _('App Provider')
|
|
|
|
@property
|
|
def load(self):
|
|
if not self.terminal:
|
|
return 'offline'
|
|
return self.terminal.load
|