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.
40 lines
1.0 KiB
40 lines
1.0 KiB
5 years ago
|
# coding: utf-8
|
||
8 years ago
|
#
|
||
|
|
||
5 years ago
|
__all__ = ['TerminalForm']
|
||
|
|
||
8 years ago
|
from django import forms
|
||
7 years ago
|
from django.utils.translation import ugettext_lazy as _
|
||
8 years ago
|
|
||
5 years ago
|
from ..models import Terminal, ReplayStorage, CommandStorage
|
||
8 years ago
|
|
||
|
|
||
7 years ago
|
def get_all_command_storage():
|
||
5 years ago
|
for c in CommandStorage.objects.all():
|
||
|
yield (c.name, c.name)
|
||
7 years ago
|
|
||
|
|
||
7 years ago
|
def get_all_replay_storage():
|
||
5 years ago
|
for r in ReplayStorage.objects.all():
|
||
|
yield (r.name, r.name)
|
||
7 years ago
|
|
||
|
|
||
8 years ago
|
class TerminalForm(forms.ModelForm):
|
||
7 years ago
|
command_storage = forms.ChoiceField(
|
||
6 years ago
|
choices=get_all_command_storage,
|
||
7 years ago
|
label=_("Command storage"),
|
||
|
help_text=_("Command can store in server db or ES, default to server, more see docs"),
|
||
7 years ago
|
)
|
||
|
replay_storage = forms.ChoiceField(
|
||
6 years ago
|
choices=get_all_replay_storage,
|
||
7 years ago
|
label=_("Replay storage"),
|
||
|
help_text=_("Replay file can store in server disk, AWS S3, Aliyun OSS, default to server, more see docs"),
|
||
7 years ago
|
)
|
||
7 years ago
|
|
||
8 years ago
|
class Meta:
|
||
|
model = Terminal
|
||
7 years ago
|
fields = [
|
||
7 years ago
|
'name', 'remote_addr', 'comment',
|
||
7 years ago
|
'command_storage', 'replay_storage',
|
||
|
]
|