Add lists of other option choices

This commit is contained in:
Andrew Croce 2018-08-20 14:07:46 -04:00
parent c9bc36bef3
commit b3e82b3707
4 changed files with 43 additions and 39 deletions

View File

@ -46,3 +46,32 @@ SERVICE_BRANCHES = [
("US Transportation Command (USTRANSCOM)", "US Transportation Command (USTRANSCOM)"), ("US Transportation Command (USTRANSCOM)", "US Transportation Command (USTRANSCOM)"),
("Washington Headquarters Services", "Washington Headquarters Services"), ("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"),
]

View File

@ -4,7 +4,7 @@ from wtforms.validators import Optional, Required
from .fields import DateField, SelectField from .fields import DateField, SelectField
from .forms import ValidatedForm from .forms import ValidatedForm
from .data import SERVICE_BRANCHES from .data import SERVICE_BRANCHES, ASSISTANCE_ORG_TYPES, DATA_TRANSFER_AMOUNTS, COMPLETION_DATE_RANGES
from atst.domain.requests import Requests from atst.domain.requests import Requests
@ -76,12 +76,7 @@ class RequestForm(ValidatedForm):
organization_providing_assistance = RadioField( # this needs to be updated to use checkboxes instead of radio organization_providing_assistance = RadioField( # this needs to be updated to use checkboxes instead of radio
description="If you are receiving migration assistance, what is the type of organization providing assistance?", description="If you are receiving migration assistance, what is the type of organization providing assistance?",
choices=[ choices=ASSISTANCE_ORG_TYPES,
("In-house staff", "In-house staff"),
("Contractor", "Contractor"),
("Other DoD Organization", "Other DoD Organization"),
("None", "None"),
],
default="", default="",
) )
@ -93,30 +88,12 @@ class RequestForm(ValidatedForm):
data_transfers = SelectField( data_transfers = SelectField(
description="How much data is being transferred to the cloud?", description="How much data is being transferred to the cloud?",
choices=[ choices=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"),
],
) )
expected_completion_date = SelectField( expected_completion_date = SelectField(
description="When do you expect to complete your migration to the JEDI Cloud?", description="When do you expect to complete your migration to the JEDI Cloud?",
choices=[ choices=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"),
],
) )
cloud_native = RadioField( cloud_native = RadioField(

View File

@ -6,7 +6,7 @@ from atst.routes.requests.jedi_request_flow import JEDIRequestFlow
from atst.models.permissions import Permissions from atst.models.permissions import Permissions
from atst.models.request_status_event import RequestStatus from atst.models.request_status_event import RequestStatus
from atst.domain.exceptions import UnauthorizedError from atst.domain.exceptions import UnauthorizedError
from atst.forms.data import SERVICE_BRANCHES from atst.forms.data import SERVICE_BRANCHES, ASSISTANCE_ORG_TYPES, DATA_TRANSFER_AMOUNTS, COMPLETION_DATE_RANGES
@requests_bp.route("/requests/new/<int:screen>", methods=["GET"]) @requests_bp.route("/requests/new/<int:screen>", methods=["GET"])
@ -22,9 +22,11 @@ def requests_form_new(screen):
next_screen=screen + 1, next_screen=screen + 1,
can_submit=jedi_flow.can_submit, can_submit=jedi_flow.can_submit,
service_branches=SERVICE_BRANCHES, service_branches=SERVICE_BRANCHES,
assistance_org_types=ASSISTANCE_ORG_TYPES,
data_transfer_amounts=DATA_TRANSFER_AMOUNTS,
completion_date_ranges=COMPLETION_DATE_RANGES,
) )
@requests_bp.route( @requests_bp.route(
"/requests/new/<int:screen>", methods=["GET"], defaults={"request_id": None} "/requests/new/<int:screen>", methods=["GET"], defaults={"request_id": None}
) )
@ -47,6 +49,9 @@ def requests_form_update(screen=1, request_id=None):
jedi_request=jedi_flow.request, jedi_request=jedi_flow.request,
can_submit=jedi_flow.can_submit, can_submit=jedi_flow.can_submit,
service_branches=SERVICE_BRANCHES, service_branches=SERVICE_BRANCHES,
assistance_org_types=ASSISTANCE_ORG_TYPES,
data_transfer_amounts=DATA_TRANSFER_AMOUNTS,
completion_date_ranges=COMPLETION_DATE_RANGES,
) )

View File

@ -8,13 +8,6 @@
{% from "components/text_input.html" import TextInput %} {% from "components/text_input.html" import TextInput %}
{% from "components/icon.html" import Icon %} {% from "components/icon.html" import Icon %}
{% set organization_providing_assistance_choices = {
"in_house_staff": "In-house staff",
"contractor": "Contractor",
"other_dod_organization": "Other DoD organization",
"none": "None"
} %}
{% block subtitle %} {% block subtitle %}
<h2>Review &amp; Submit</h2> <h2>Review &amp; Submit</h2>
{% endblock %} {% endblock %}
@ -95,7 +88,7 @@
<dt>Organization Providing Assistance</dt> <dt>Organization Providing Assistance</dt>
<dd> <dd>
{% if data['details_of_use']['organization_providing_assistance'] %} {% if data['details_of_use']['organization_providing_assistance'] %}
{{ organization_providing_assistance_choices[data['details_of_use']['organization_providing_assistance']] }} {{ data['details_of_use']['organization_providing_assistance'] | getOptionLabel(assistance_org_types) }}
{% else %} {% else %}
{{ RequiredLabel() }} {{ RequiredLabel() }}
{% endif %} {% endif %}
@ -112,7 +105,7 @@
<dt>Data Transfers</dt> <dt>Data Transfers</dt>
<dd> <dd>
{% if data['details_of_use']['data_transfers'] %} {% if data['details_of_use']['data_transfers'] %}
{{ data['details_of_use']['data_transfers'] | upper | replace("_"," ")}} {{ data['details_of_use']['data_transfers'] | getOptionLabel(data_transfer_amounts) }}
{% else %} {% else %}
{{ RequiredLabel() }} {{ RequiredLabel() }}
{% endif %} {% endif %}
@ -123,7 +116,7 @@
<dt>Expected Completion Date</dt> <dt>Expected Completion Date</dt>
<dd> <dd>
{% if data['details_of_use']['expected_completion_date'] %} {% if data['details_of_use']['expected_completion_date'] %}
{{ data['details_of_use']['expected_completion_date'] | replace("_"," ")}} {{ data['details_of_use']['expected_completion_date'] | getOptionLabel(completion_date_ranges) }}
{% else %} {% else %}
{{ RequiredLabel() }} {{ RequiredLabel() }}
{% endif %} {% endif %}