From becfbed10a1024ce66345c58c6447f00cf2b30f4 Mon Sep 17 00:00:00 2001 From: Patrick Smith Date: Thu, 27 Sep 2018 17:38:24 -0400 Subject: [PATCH 1/5] Email addresses are case-insensitive --- js/lib/input_validations.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/lib/input_validations.js b/js/lib/input_validations.js index 80b36f9a..c14b958d 100644 --- a/js/lib/input_validations.js +++ b/js/lib/input_validations.js @@ -29,7 +29,7 @@ export default { }, email: { mask: emailMask, - match: /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/, + match: /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/i, unmask: [], validationError: 'Please enter a valid e-mail address' }, From 7d7afebede6527343ee568f8e70d00ced33a9201 Mon Sep 17 00:00:00 2001 From: Patrick Smith Date: Thu, 27 Sep 2018 17:51:32 -0400 Subject: [PATCH 2/5] Update modal content for approval/acceptance --- .../routes/requests/financial_verification.py | 4 +-- atst/routes/requests/requests_form.py | 2 +- .../pending_ccpo_acceptance_alert.html | 4 +-- .../pending_ccpo_approval_modal.html | 36 ++----------------- templates/requests/details.html | 9 +---- tests/routes/test_request_submit.py | 2 +- 6 files changed, 8 insertions(+), 49 deletions(-) diff --git a/atst/routes/requests/financial_verification.py b/atst/routes/requests/financial_verification.py index eeb4dd52..d43d75b6 100644 --- a/atst/routes/requests/financial_verification.py +++ b/atst/routes/requests/financial_verification.py @@ -71,9 +71,7 @@ def update_financial_verification(request_id): ) else: return redirect( - url_for( - "requests.requests_index", modal="pendingFinancialVerification" - ) + url_for("requests.requests_index", modal="pendingCCPOApproval") ) else: diff --git a/atst/routes/requests/requests_form.py b/atst/routes/requests/requests_form.py index d8e79d46..431b4828 100644 --- a/atst/routes/requests/requests_form.py +++ b/atst/routes/requests/requests_form.py @@ -121,7 +121,7 @@ def requests_submit(request_id=None): if request.status == RequestStatus.PENDING_FINANCIAL_VERIFICATION: modal = "pendingFinancialVerification" else: - modal = "pendingCCPOApproval" + modal = "pendingCCPOAcceptance" return redirect(url_for("requests.requests_index", modal=modal)) diff --git a/templates/fragments/pending_ccpo_acceptance_alert.html b/templates/fragments/pending_ccpo_acceptance_alert.html index 2e2343f5..44ec3a58 100644 --- a/templates/fragments/pending_ccpo_acceptance_alert.html +++ b/templates/fragments/pending_ccpo_acceptance_alert.html @@ -1,11 +1,11 @@ {% from "components/icon.html" import Icon %}

- We will review and respond to your request in 3 business days. You’ll be notified via email or phone. + The CCPO will review and respond to your request in 3 business days. You’ll be notified via email or phone. Please note if your request is for over $1M of JEDI cloud resources it will require a manual review by the CCPO.

- While your request is being reviewed, your next step is to create a Task Order associated with JEDI Cloud. Please contact a Contracting Officer (KO), Contracting Officer Representative (COR), or a Financial Manager to help with this step. + While your request is being reviewed, your next step is to create a Task Order (TO) associated with the JEDI Cloud. Please contact a Contracting Officer (KO), Contracting Officer Representative (COR), or a Financial Manager to help with this step.

diff --git a/templates/fragments/pending_ccpo_approval_modal.html b/templates/fragments/pending_ccpo_approval_modal.html index a605012e..958194d3 100644 --- a/templates/fragments/pending_ccpo_approval_modal.html +++ b/templates/fragments/pending_ccpo_approval_modal.html @@ -1,40 +1,8 @@ -{% from "components/icon.html" import Icon %} - -

- Request submitted. Approval pending. -

-

- We will review and respond to your request in 3 business days. You’ll be notified via email or phone. + The CCPO will review and respond to your Financial Verification submission in 3 business days. You will be notified via email or phone.

-

- Your request is being reviewed because: -

    -
  • - Your request includes over $1 million for cloud resources -
  • -
  • - We may need more information about your request -
  • -
-

- -

- Next Steps -

- While your request is being reviewed, your next step is to create a Task Order associated with JEDI Cloud. Please contact a Contracting Officer (KO), Contracting Officer Representative (COR), or a Financial Manager to help with this step. + Once the financial verification is approved you will be invited to create your JEDI Workspace and set-up your projects. Click here for more details.

- -

- Once the Task Order has been created, you will be asked to provide details about the task order in the Financial Verification step. -

- - diff --git a/templates/requests/details.html b/templates/requests/details.html index 59411fe1..a1199ffd 100644 --- a/templates/requests/details.html +++ b/templates/requests/details.html @@ -8,17 +8,10 @@ {% if request.is_pending_ccpo_acceptance %} {{ Alert('Request submitted. Approval pending.', fragment="fragments/pending_ccpo_acceptance_alert.html") }} {% elif request.is_pending_ccpo_approval %} - - {% call Alert('Pending CCPO Approval') %} -

The CCPO will review and respond to your Financial Verification submission in 3 business days. You will be notified via email or phone.

-

Once the financial verification is approved you will be invited to create your JEDI Workspace and set-up your projects. Click here for more details.

- {% endcall %} - + {{ Alert('Request submitted. Approval pending.', fragment="fragments/pending_ccpo_approval_modal.html") }} {% elif requires_fv_action %} - {% include 'requests/review_menu.html' %} {{ Alert('Pending Financial Verification', fragment="fragments/pending_financial_verification.html") }} - {% endif %}
diff --git a/tests/routes/test_request_submit.py b/tests/routes/test_request_submit.py index 74799915..f5f9c1d8 100644 --- a/tests/routes/test_request_submit.py +++ b/tests/routes/test_request_submit.py @@ -21,7 +21,7 @@ def test_submit_reviewed_request(monkeypatch, client, user_session): follow_redirects=False, ) assert "/requests" in response.headers["Location"] - assert "modal=pendingCCPOApproval" in response.headers["Location"] + assert "modal=pendingCCPOAcceptance" in response.headers["Location"] def test_submit_autoapproved_reviewed_request(monkeypatch, client, user_session): From 9f4663a8d5d164450fc249aa9c22d42177e0f791 Mon Sep 17 00:00:00 2001 From: Patrick Smith Date: Thu, 27 Sep 2018 18:06:24 -0400 Subject: [PATCH 3/5] Use initial errors as validation error until change is made This fixes a bug where the "Task Order not found" error was not shown. --- js/components/text_input.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/js/components/text_input.js b/js/components/text_input.js index 7d0bb78d..883e0a75 100644 --- a/js/components/text_input.js +++ b/js/components/text_input.js @@ -18,7 +18,10 @@ export default { type: String, default: () => '' }, - initialErrors: Array, + initialErrors: { + type: Array, + default: () => [] + }, paragraph: String, noMaxWidth: String }, @@ -30,7 +33,7 @@ export default { mask: inputValidations[this.validation].mask, pipe: inputValidations[this.validation].pipe || undefined, keepCharPositions: inputValidations[this.validation].keepCharPositions || false, - validationError: inputValidations[this.validation].validationError || '', + validationError: this.initialErrors.join(' ') || inputValidations[this.validation].validationError, value: this.initialValue, modified: false } @@ -82,6 +85,10 @@ export default { valid = false } + if (this.modified) { + this.validationError = inputValidations[this.validation].validationError + } + // Show error messages or not if (valid) { this.showError = false From a859af9eea50193a59e044c68f3a90cf8afb9037 Mon Sep 17 00:00:00 2001 From: Patrick Smith Date: Thu, 27 Sep 2018 18:14:24 -0400 Subject: [PATCH 4/5] Pass in request as `jedi_request` in request detail template Fixes the user sessions/daily traffic fields not being shown when they should be. --- atst/routes/requests/approval.py | 2 +- atst/routes/requests/requests_form.py | 2 +- templates/requests/_review.html | 2 +- templates/requests/approval.html | 12 ++++++------ templates/requests/details.html | 6 +++--- tests/routes/test_request_details.py | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/atst/routes/requests/approval.py b/atst/routes/requests/approval.py index 3d009bc8..41a6d6eb 100644 --- a/atst/routes/requests/approval.py +++ b/atst/routes/requests/approval.py @@ -35,7 +35,7 @@ def render_approval(request, form=None, internal_comment_form=None): "requests/approval.html", data=data, reviews=list(reversed(request.reviews)), - request=request, + jedi_request=request, current_status=request.status.value, review_form=form or CCPOReviewForm(), internal_comment_form=internal_comment_form, diff --git a/atst/routes/requests/requests_form.py b/atst/routes/requests/requests_form.py index 431b4828..1d7a4019 100644 --- a/atst/routes/requests/requests_form.py +++ b/atst/routes/requests/requests_form.py @@ -141,6 +141,6 @@ def view_request_details(request_id=None): return render_template( "requests/details.html", data=data, - request=request, + jedi_request=request, requires_fv_action=requires_fv_action, ) diff --git a/templates/requests/_review.html b/templates/requests/_review.html index 2bf0d665..c733a8f6 100644 --- a/templates/requests/_review.html +++ b/templates/requests/_review.html @@ -134,7 +134,7 @@ {{ DefinitionReviewField("DoD ID", "primary_poc", "dodid_poc") }} -{% if request.has_financial_data %} +{% if jedi_request.has_financial_data %}

Financial Verification diff --git a/templates/requests/approval.html b/templates/requests/approval.html index 3baa48c9..3aacf79e 100644 --- a/templates/requests/approval.html +++ b/templates/requests/approval.html @@ -17,14 +17,14 @@
-

Request: {{ request.displayname }} +

Request: {{ jedi_request.displayname }}

{{ current_status }}
- {% with data=data, request_id=request.id %} + {% with data=data, request_id=jedi_request.id %} {% include "requests/_review.html" %} {% endwith %} @@ -33,7 +33,7 @@
-
+

CCPO Internal Comments

@@ -82,7 +82,7 @@
- + {{ review_form.csrf_token }} @@ -139,7 +139,7 @@ {% endif %}
- {% if request.is_pending_ccpo_action %} + {% if jedi_request.is_pending_ccpo_action %}

Review this Request

@@ -226,7 +226,7 @@
- {% if request.is_pending_ccpo_action %} + {% if jedi_request.is_pending_ccpo_action %}
diff --git a/templates/requests/details.html b/templates/requests/details.html index a1199ffd..fed6c73b 100644 --- a/templates/requests/details.html +++ b/templates/requests/details.html @@ -5,9 +5,9 @@ {% block content %}
- {% if request.is_pending_ccpo_acceptance %} + {% if jedi_request.is_pending_ccpo_acceptance %} {{ Alert('Request submitted. Approval pending.', fragment="fragments/pending_ccpo_acceptance_alert.html") }} - {% elif request.is_pending_ccpo_approval %} + {% elif jedi_request.is_pending_ccpo_approval %} {{ Alert('Request submitted. Approval pending.', fragment="fragments/pending_ccpo_approval_modal.html") }} {% elif requires_fv_action %} {% include 'requests/review_menu.html' %} @@ -17,7 +17,7 @@

Request Details

-

{{ request.displayname }} {{ request.status_displayname }}

+

{{ jedi_request.displayname }} {{ jedi_request.status_displayname }}

diff --git a/tests/routes/test_request_details.py b/tests/routes/test_request_details.py index bd644182..eed48c53 100644 --- a/tests/routes/test_request_details.py +++ b/tests/routes/test_request_details.py @@ -19,7 +19,7 @@ def test_can_show_financial_data(client, user_session): ) body = response.data.decode() - assert re.search(">\s+Financial Verification\s+<", body) + assert re.search(r">\s+Financial Verification\s+<", body) def test_can_not_show_financial_data(client, user_session): @@ -34,4 +34,4 @@ def test_can_not_show_financial_data(client, user_session): ) body = response.data.decode() - assert not re.search(">\s+Financial Verification\s+<", body) + assert not re.search(r">\s+Financial Verification\s+<", body) From 2d7d97a03ca594337576e92e867de8ee9115db66 Mon Sep 17 00:00:00 2001 From: Patrick Smith Date: Thu, 27 Sep 2018 18:34:52 -0400 Subject: [PATCH 5/5] Expand review form if there are errors --- js/components/forms/ccpo_approval.js | 8 ++++++-- templates/requests/approval.html | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/js/components/forms/ccpo_approval.js b/js/components/forms/ccpo_approval.js index a00abde3..f286a594 100644 --- a/js/components/forms/ccpo_approval.js +++ b/js/components/forms/ccpo_approval.js @@ -9,10 +9,14 @@ export default { LocalDatetime }, + props: { + initialState: String + }, + data: function () { return { - approving: false, - denying: false + approving: this.initialState === 'approving', + denying: this.initialState === 'denying' } }, diff --git a/templates/requests/approval.html b/templates/requests/approval.html index 3aacf79e..bd7c99ba 100644 --- a/templates/requests/approval.html +++ b/templates/requests/approval.html @@ -85,7 +85,8 @@ {{ review_form.csrf_token }} - + {% set initialState = 'approving' if review_form.errors else '' %} +
@@ -148,7 +149,7 @@
- +