-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs #79. Added form for TeraTestType
- Loading branch information
Showing
3 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from opentera.forms.TeraForm import * | ||
from flask_babel import gettext | ||
from modules.DatabaseModule.DBManagerTeraUserAccess import DBManagerTeraUserAccess | ||
|
||
|
||
class TeraTestTypeForm: | ||
|
||
@staticmethod | ||
def get_test_type_form(user_access: DBManagerTeraUserAccess): | ||
form = TeraForm("session_type") | ||
|
||
# Building lists | ||
services = user_access.get_accessible_services() | ||
services_list = [] | ||
for service in services: | ||
services_list.append(TeraFormValue(value_id=service.id_service, value=service.service_name)) | ||
|
||
# Sections | ||
section = TeraFormSection("informations", gettext("Information")) | ||
form.add_section(section) | ||
|
||
# Items | ||
section.add_item(TeraFormItem("id_test_type", gettext("Test Type ID"), "hidden", True)) | ||
section.add_item(TeraFormItem("id_service", gettext("Service"), "array", item_required=False, | ||
item_values=services_list) | ||
) | ||
section.add_item(TeraFormItem("test_type_uuid", gettext("UUID"), "hidden", True)) | ||
section.add_item(TeraFormItem("test_type_name", gettext("Name"), "text", True)) | ||
section.add_item(TeraFormItem("test_type_description", gettext("Description"), "longtext", False)) | ||
section.add_item(TeraFormItem("test_type_key", gettext("Unique Key"), "text", False)) | ||
section.add_item(TeraFormItem("test_type_has_json_format", gettext("Expose JSON structure"), "boolean", False)) | ||
section.add_item(TeraFormItem("test_type_has_web_format", gettext("Expose Web interface"), "boolean", False)) | ||
section.add_item(TeraFormItem("test_type_has_web_editor", gettext("Expose Web editor"), "boolean", False)) | ||
|
||
return form.to_dict() |