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.
26 lines
896 B
26 lines
896 B
from __future__ import unicode_literals
|
|
|
|
from django.db import models
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
from common.db.models import JMSBaseModel
|
|
from terminal.const import TaskNameType as SessionTaskChoices
|
|
from .terminal import Terminal
|
|
|
|
|
|
class Task(JMSBaseModel):
|
|
|
|
name = models.CharField(max_length=128, choices=SessionTaskChoices.choices, verbose_name=_("Name"))
|
|
args = models.CharField(max_length=1024, verbose_name=_("Args"))
|
|
kwargs = models.JSONField(default=dict, verbose_name=_("Kwargs"))
|
|
terminal = models.ForeignKey(Terminal, null=True, on_delete=models.SET_NULL)
|
|
is_finished = models.BooleanField(default=False)
|
|
date_finished = models.DateTimeField(null=True)
|
|
|
|
class Meta:
|
|
db_table = "terminal_task"
|
|
verbose_name = _("Task")
|
|
|
|
def __str__(self):
|
|
return str(dict(SessionTaskChoices.choices).get(self.name))
|