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.
33 lines
942 B
33 lines
942 B
# ~*~ coding: utf-8 ~*~
|
|
#
|
|
|
|
from django import forms
|
|
from django.conf import settings
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from .models import Terminal
|
|
|
|
|
|
def get_all_command_storage():
|
|
# storage_choices = []
|
|
from common.models import Setting
|
|
Setting.refresh_all_settings()
|
|
for k, v in settings.TERMINAL_COMMAND_STORAGE.items():
|
|
yield (k, k)
|
|
|
|
|
|
class TerminalForm(forms.ModelForm):
|
|
command_storage = forms.ChoiceField(choices=get_all_command_storage(),
|
|
label=_("Command storage"))
|
|
|
|
class Meta:
|
|
model = Terminal
|
|
fields = ['name', 'remote_addr', 'ssh_port', 'http_port', 'comment', 'command_storage']
|
|
help_texts = {
|
|
'ssh_port': _("Coco ssh listen port"),
|
|
'http_port': _("Coco http/ws listen port"),
|
|
}
|
|
widgets = {
|
|
'name': forms.TextInput(attrs={'readonly': 'readonly'})
|
|
}
|