Remove unused form code
This commit is contained in:
parent
0bafa51bb9
commit
febc6f7890
@ -1,35 +0,0 @@
|
||||
from wtforms.fields.html5 import EmailField, TelField
|
||||
from wtforms.fields import StringField, TextAreaField
|
||||
from wtforms.validators import Email, Optional
|
||||
|
||||
from .forms import BaseForm
|
||||
from .validators import Name, PhoneNumber
|
||||
|
||||
from atst.utils.localization import translate
|
||||
|
||||
|
||||
class CCPOReviewForm(BaseForm):
|
||||
comment = TextAreaField(
|
||||
translate("forms.ccpo_review.comment_label"),
|
||||
description=translate("forms.ccpo_review.comment_description"),
|
||||
)
|
||||
fname_mao = StringField(
|
||||
translate("forms.ccpo_review.fname_mao_label"), validators=[Optional(), Name()]
|
||||
)
|
||||
lname_mao = StringField(
|
||||
translate("forms.ccpo_review.lname_mao_label"), validators=[Optional(), Name()]
|
||||
)
|
||||
email_mao = EmailField(
|
||||
translate("forms.ccpo_review.email_mao_label"), validators=[Optional(), Email()]
|
||||
)
|
||||
phone_mao = TelField(
|
||||
translate("forms.ccpo_review.phone_mao_label"),
|
||||
validators=[Optional(), PhoneNumber()],
|
||||
)
|
||||
phone_ext_mao = StringField(translate("forms.ccpo_review.phone_ext_mao_label"))
|
||||
fname_ccpo = StringField(
|
||||
translate("forms.ccpo_review.fname_ccpo_label"), validators=[Optional(), Name()]
|
||||
)
|
||||
lname_ccpo = StringField(
|
||||
translate("forms.ccpo_review.lname_ccpo_label"), validators=[Optional(), Name()]
|
||||
)
|
@ -1,5 +1,5 @@
|
||||
from atst.models import CSPRole
|
||||
from atst.utils.localization import translate, translate_duration
|
||||
from atst.utils.localization import translate
|
||||
|
||||
|
||||
SERVICE_BRANCHES = [
|
||||
@ -78,99 +78,6 @@ SERVICE_BRANCHES = [
|
||||
("Washington Headquarters Services", "Washington Headquarters Services"),
|
||||
]
|
||||
|
||||
ASSISTANCE_ORG_TYPES = [
|
||||
("In-house staff", "In-house staff"),
|
||||
("Contractor", "Contractor"),
|
||||
("Other DoD Organization", "Other DoD Organization"),
|
||||
("None", "None"),
|
||||
]
|
||||
|
||||
DATA_TRANSFER_AMOUNTS = [
|
||||
("", "Select an option"),
|
||||
("Less than 100GB", "Less than 100GB"),
|
||||
("100GB-500GB", "100GB-500GB"),
|
||||
("500GB-1TB", "500GB-1TB"),
|
||||
("1TB-50TB", "1TB-50TB"),
|
||||
("50TB-100TB", "50TB-100TB"),
|
||||
("100TB-500TB", "100TB-500TB"),
|
||||
("500TB-1PB", "500TB-1PB"),
|
||||
("1PB-5PB", "1PB-5PB"),
|
||||
("5PB-10PB", "5PB-10PB"),
|
||||
("Above 10PB", "Above 10PB"),
|
||||
]
|
||||
|
||||
COMPLETION_DATE_RANGES = [
|
||||
("", "Select an option"),
|
||||
("Less than 1 month", "Less than 1 month"),
|
||||
("1-3 months", "1-3 months"),
|
||||
("3-6 months", "3-6 months"),
|
||||
("Above 12 months", "Above 12 months"),
|
||||
]
|
||||
|
||||
ENVIRONMENT_ROLES = [
|
||||
(
|
||||
"developer",
|
||||
{
|
||||
"name": "Developer",
|
||||
"description": "Configures cloud-based IaaS and PaaS computing, networking, and storage services.",
|
||||
},
|
||||
),
|
||||
(
|
||||
"database_administrator",
|
||||
{
|
||||
"name": "Database Administrator",
|
||||
"description": "Configures cloud-based database services.",
|
||||
},
|
||||
),
|
||||
(
|
||||
"devops",
|
||||
{
|
||||
"name": "DevOps",
|
||||
"description": "Provisions, deprovisions, and deploys cloud-based IaaS and PaaS computing, networking, and storage services, including pre-configured machine images.",
|
||||
},
|
||||
),
|
||||
(
|
||||
"billing_administrator",
|
||||
{
|
||||
"name": "Billing Administrator",
|
||||
"description": "Views cloud resource usage, budget reports, and invoices; Tracks budgets, including spend reports, cost planning and applicationions, and sets limits based on cloud service usage.",
|
||||
},
|
||||
),
|
||||
(
|
||||
"security_administrator",
|
||||
{
|
||||
"name": "Security Administrator",
|
||||
"description": "Accesses information security and control tools of cloud resources which include viewing cloud resource usage logging, user roles and permissioning history.",
|
||||
},
|
||||
),
|
||||
(
|
||||
"financial_auditor",
|
||||
{
|
||||
"name": "Financial Auditor",
|
||||
"description": "Views cloud resource usage and budget reports.",
|
||||
},
|
||||
),
|
||||
(
|
||||
"",
|
||||
{"name": "No Access", "description": "User has no access to this environment."},
|
||||
),
|
||||
]
|
||||
|
||||
ENV_ROLE_MODAL_DESCRIPTION = {
|
||||
"header": "Assign Environment Role",
|
||||
"body": "An environment role determines the permissions a member of the portfolio assumes when using the JEDI Cloud.<br/><br/>A member may have different environment roles across different applications. A member can only have one assigned environment role in a given environment.",
|
||||
}
|
||||
|
||||
FUNDING_TYPES = [
|
||||
("", "- Select -"),
|
||||
("RDTE", "Research, Development, Testing & Evaluation (RDT&E)"),
|
||||
("OM", "Operations & Maintenance (O&M)"),
|
||||
("PROC", "Procurement (PROC)"),
|
||||
("OTHER", "Other"),
|
||||
]
|
||||
|
||||
TASK_ORDER_SOURCES = [("MANUAL", "Manual"), ("EDA", "EDA")]
|
||||
|
||||
APP_MIGRATION = [
|
||||
("on_premise", translate("forms.task_order.app_migration.on_premise")),
|
||||
("cloud", translate("forms.task_order.app_migration.cloud")),
|
||||
@ -204,19 +111,6 @@ TEAM_EXPERIENCE = [
|
||||
("built_many", translate("forms.task_order.team_experience.built_many")),
|
||||
]
|
||||
|
||||
PERIOD_OF_PERFORMANCE_LENGTH = [
|
||||
(str(x + 1), translate_duration(x + 1)) for x in range(24)
|
||||
]
|
||||
|
||||
REQUIRED_DISTRIBUTIONS = [
|
||||
("contractor", "Contractor"),
|
||||
("subcontractor", "Subcontractor"),
|
||||
("cognizant_so", "Cognizant Security Office for Prime and Subcontractor"),
|
||||
("overseas", "U.S. Activity Responsible for Overseas Security Administration"),
|
||||
("administrative_ko", "Administrative Contracting Officer"),
|
||||
("other", "Other as necessary"),
|
||||
]
|
||||
|
||||
ENV_ROLE_NO_ACCESS = "No Access"
|
||||
ENV_ROLES = [(role.value, role.value) for role in CSPRole] + [
|
||||
(ENV_ROLE_NO_ACCESS, "No access")
|
||||
|
@ -1,9 +0,0 @@
|
||||
from atst.utils.localization import translate
|
||||
|
||||
|
||||
class FormValidationError(Exception):
|
||||
|
||||
message = translate("forms.exceptions.message")
|
||||
|
||||
def __init__(self, form):
|
||||
self.form = form
|
@ -6,14 +6,3 @@ class SelectField(SelectField_):
|
||||
render_kw = kwargs.get("render_kw", {})
|
||||
kwargs["render_kw"] = {**render_kw, "required": False}
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
|
||||
class FormFieldWrapper(FormField):
|
||||
def has_changes(self):
|
||||
if not self.object_data:
|
||||
return False
|
||||
|
||||
for (attr, field) in self._fields.items():
|
||||
if attr in self.object_data and self.object_data[attr] != field.data:
|
||||
return True
|
||||
return False
|
||||
|
@ -1,14 +0,0 @@
|
||||
from wtforms.fields import TextAreaField
|
||||
from wtforms.validators import InputRequired
|
||||
|
||||
from .forms import BaseForm
|
||||
from atst.utils.localization import translate
|
||||
|
||||
|
||||
class InternalCommentForm(BaseForm):
|
||||
text = TextAreaField(
|
||||
translate("forms.internal_comment.text_label"),
|
||||
default="",
|
||||
description=translate("forms.internal_comment.text_description"),
|
||||
validators=[InputRequired()],
|
||||
)
|
@ -1,35 +0,0 @@
|
||||
from flask_wtf.file import FileAllowed
|
||||
|
||||
from wtforms.fields.html5 import DateField
|
||||
from wtforms.fields import StringField, TextAreaField, FileField, FieldList
|
||||
from wtforms.validators import Optional, Length
|
||||
|
||||
from .forms import BaseForm
|
||||
|
||||
from atst.utils.localization import translate
|
||||
|
||||
|
||||
class KOReviewForm(BaseForm):
|
||||
start_date = DateField(
|
||||
translate("forms.ko_review.start_date_label"), format="%m/%d/%Y"
|
||||
)
|
||||
end_date = DateField(translate("forms.ko_review.end_date_label"), format="%m/%d/%Y")
|
||||
pdf = FileField(
|
||||
translate("forms.ko_review.pdf_label"),
|
||||
description=translate("forms.ko_review.pdf_description"),
|
||||
validators=[
|
||||
FileAllowed(["pdf"], translate("forms.task_order.file_format_not_allowed"))
|
||||
],
|
||||
render_kw={"required": False, "accept": ".pdf,application/pdf"},
|
||||
)
|
||||
number = StringField(
|
||||
translate("forms.ko_review.to_number"), validators=[Length(min=10)]
|
||||
)
|
||||
loas = FieldList(
|
||||
StringField(translate("forms.ko_review.loa"), validators=[Optional()])
|
||||
)
|
||||
custom_clauses = TextAreaField(
|
||||
translate("forms.ko_review.custom_clauses_label"),
|
||||
description=translate("forms.ko_review.custom_clauses_description"),
|
||||
validators=[Optional()],
|
||||
)
|
@ -61,12 +61,6 @@ class MembersPermissionsForm(BaseForm):
|
||||
members_permissions = FieldList(FormField(PermissionsForm))
|
||||
|
||||
|
||||
class EditForm(PermissionsForm):
|
||||
# This form also accepts a field for each environment in each application
|
||||
# that the user is a member of
|
||||
pass
|
||||
|
||||
|
||||
class NewForm(BaseForm):
|
||||
user_data = FormField(BaseNewMemberForm)
|
||||
permission_sets = FormField(PermissionsForm)
|
||||
|
@ -35,11 +35,6 @@ class CLINForm(FlaskForm):
|
||||
loas = FieldList(StringField())
|
||||
|
||||
|
||||
class UnclassifiedCLINForm(CLINForm):
|
||||
# TODO: overwrite jedi_clin_type to only include the unclassified options
|
||||
pass
|
||||
|
||||
|
||||
class TaskOrderForm(BaseForm):
|
||||
number = StringField(
|
||||
label=translate("forms.task_order.number_description"), validators=[Required()]
|
||||
|
@ -1,41 +0,0 @@
|
||||
import pytest
|
||||
from wtforms import Form
|
||||
from wtforms.fields import StringField
|
||||
import pendulum
|
||||
from werkzeug.datastructures import ImmutableMultiDict
|
||||
|
||||
from atst.forms.fields import FormFieldWrapper
|
||||
|
||||
|
||||
class PersonForm(Form):
|
||||
first_name = StringField("first_name")
|
||||
|
||||
|
||||
class FormWithFormField(Form):
|
||||
person = FormFieldWrapper(PersonForm)
|
||||
|
||||
|
||||
class TestFormFieldWrapper:
|
||||
class Foo:
|
||||
person = {"first_name": "Luke"}
|
||||
|
||||
obj = Foo()
|
||||
|
||||
def test_form_data_does_not_match_object_data(self):
|
||||
form_data = ImmutableMultiDict({"person-first_name": "Han"})
|
||||
form = FormWithFormField(form_data, obj=self.obj)
|
||||
assert form.person.has_changes()
|
||||
|
||||
def test_when_no_form_data(self):
|
||||
form = FormWithFormField(None, obj=self.obj)
|
||||
assert not form.person.has_changes()
|
||||
|
||||
def test_when_no_obj_data(self):
|
||||
form_data = ImmutableMultiDict({"person-first_name": "Han"})
|
||||
form = FormWithFormField(form_data)
|
||||
assert not form.person.has_changes()
|
||||
|
||||
def test_when_form_data_matches_obj_dta(self):
|
||||
form_data = ImmutableMultiDict({"person-first_name": "Luke"})
|
||||
form = FormWithFormField(form_data, obj=self.obj)
|
||||
assert not form.person.has_changes()
|
Loading…
x
Reference in New Issue
Block a user