Merge pull request #189 from dod-ccpo/dod_branch_labels

Option labels
This commit is contained in:
andrewdds 2018-08-20 15:11:45 -04:00 committed by GitHub
commit 63b498d9db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 59 additions and 51 deletions

View File

@ -26,9 +26,14 @@ def readableInteger(value):
return "{:,}".format(numberValue)
def getOptionLabel(value, options):
return next(tup[1] for tup in options if tup[0] == value)
def register_filters(app):
app.jinja_env.filters['iconSvg'] = iconSvg
app.jinja_env.filters['dollars'] = dollars
app.jinja_env.filters['usPhone'] = usPhone
app.jinja_env.filters['readableInteger'] = readableInteger
app.jinja_env.filters['getOptionLabel'] = getOptionLabel

View File

@ -46,3 +46,32 @@ SERVICE_BRANCHES = [
("US Transportation Command (USTRANSCOM)", "US Transportation Command (USTRANSCOM)"),
("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 .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
@ -76,12 +76,7 @@ class RequestForm(ValidatedForm):
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?",
choices=[
("In-house staff", "In-house staff"),
("Contractor", "Contractor"),
("Other DoD Organization", "Other DoD Organization"),
("None", "None"),
],
choices=ASSISTANCE_ORG_TYPES,
default="",
)
@ -93,31 +88,13 @@ class RequestForm(ValidatedForm):
data_transfers = SelectField(
description="How much data is being transferred to the cloud?",
choices=[
("", "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"),
],
choices=DATA_TRANSFER_AMOUNTS,
validators=[Required()],
)
expected_completion_date = SelectField(
description="When do you expect to complete your migration to the JEDI Cloud?",
choices=[
("", "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"),
],
choices=COMPLETION_DATE_RANGES,
validators=[Required()],
)

View File

@ -6,6 +6,7 @@ from atst.routes.requests.jedi_request_flow import JEDIRequestFlow
from atst.models.permissions import Permissions
from atst.models.request_status_event import RequestStatus
from atst.domain.exceptions import UnauthorizedError
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"])
@ -20,9 +21,12 @@ def requests_form_new(screen):
current=screen,
next_screen=screen + 1,
can_submit=jedi_flow.can_submit,
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/new/<int:screen>", methods=["GET"], defaults={"request_id": None}
)
@ -44,6 +48,10 @@ def requests_form_update(screen=1, request_id=None):
request_id=request_id,
jedi_request=jedi_flow.request,
can_submit=jedi_flow.can_submit,
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,23 +8,6 @@
{% from "components/text_input.html" import TextInput %}
{% from "components/icon.html" import Icon %}
{% set dod_component_choices = {
"null": "Select an option",
"us_air_force": "US Air Force",
"us_army": "US Army",
"us_navy": "US Navy",
"us_marine_corps": "US Marine Corps",
"joint_chiefs_of_staff": "Joint Chiefs of Staff"
} %}
{% set organization_providing_assistance_choices = {
"in_house_staff": "In-house staff",
"contractor": "Contractor",
"other_dod_organization": "Other DoD organization",
"none": "None"
} %}
{% block subtitle %}
<h2>Review &amp; Submit</h2>
{% endblock %}
@ -59,7 +42,7 @@
<dt>DoD Component</dt>
<dd>
{% if data['details_of_use']['dod_component'] %}
{{ dod_component_choices[data['details_of_use']['dod_component']] }}
{{ data['details_of_use']['dod_component'] | getOptionLabel(service_branches) }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
@ -105,7 +88,7 @@
<dt>Organization Providing Assistance</dt>
<dd>
{% 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 %}
{{ RequiredLabel() }}
{% endif %}
@ -122,7 +105,7 @@
<dt>Data Transfers</dt>
<dd>
{% 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 %}
{{ RequiredLabel() }}
{% endif %}
@ -133,7 +116,7 @@
<dt>Expected Completion Date</dt>
<dd>
{% 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 %}
{{ RequiredLabel() }}
{% endif %}
@ -251,7 +234,13 @@
<div>
<dt>Service Branch or Agency</dt>
<dd>{{ data['information_about_you']['service_branch'] or RequiredLabel() }}</dd>
<dd>
{% if data['information_about_you']['service_branch'] %}
{{ data['information_about_you']['service_branch'] | getOptionLabel(service_branches) }}
{% else %}
{{ RequiredLabel() }}
{% endif %}
</dd>
</div>
<div>