From ab511137b0dcdd5c1e46426c3a846d0cc0aab066 Mon Sep 17 00:00:00 2001 From: Kuan Fan <31664961+kuanfandevops@users.noreply.github.com> Date: Wed, 29 Jun 2022 16:55:22 -0700 Subject: [PATCH] Tracking pull request to merge release-1.4.0 to main (#190) * update to 1.4.0 * user-email-and-admin-panel (#192) * Itvr350 - responsiveness- forms, tables, font sizes (#191) * -adds styling to details table for smaller screen sizes -updates media queries on header -adds error font sizes to media queries -reduces button text for bceid login on mobile * -removes font-size from small table css, it was uneccesary and caused the font to be too large on tablets * -updates css on forms/index so its better for mobile -changes input label to helper text on spouse email so text wraps * -capitalizes Enter your spouse email, removes bottom margin from that paragraph * update backend resource (#194) * update backend resource * update backend resource * check different error codes at response time (#198) * check different error codes at response time * fix comment * itvr-333--admin-console-changes (#197) * Add test for name truncation (#199) * Check redeemed rebates in Sharepoint (#193) * try various api queries * pull id * example api response * query for redeemed rebates * ncda response cleanup * remove stuff * try running task * task to set redeemed status * ncda update task * set modified * use timezone import * index ncda ids * add CRA_ENVIRONMENT (#201) * itvr-355--logout-button (#202) * itvr-333--admin-console-msg-change (#200) * add Home link and button hover (#195) * add Home link and button hover * add note and left align BCSC form data * remove Note: text * text lowercase * -renames bcscInfo component, to InfoTable, now accepts householdInfo as well, if bcsc info isn't passed it will expect household info (#204) -info on forms for bcsc and household info are now tables instead of boxes with spans, this way it can be left aligned -adds some breakpoints for font size within infotable itself * dl check integration with rhf (#203) Co-authored-by: tim738745 <98717409+tim738745@users.noreply.github.com> Co-authored-by: Emily <44536222+emi-hi@users.noreply.github.com> Co-authored-by: Naomi Co-authored-by: vibhiquartech <105294710+vibhiquartech@users.noreply.github.com> --- .pipeline/lib/config.js | 6 +- .pipeline/lib/deploy.js | 2 + django/api/admin.py | 16 ++ django/api/apps.py | 1 + django/api/authentication/keycloak.py | 2 +- django/api/messages_custom.py | 5 + .../0002_alter_goelectricrebate_ncda_id.py | 18 ++ django/api/models/go_electric_rebate.py | 2 +- .../models/go_electric_rebate_application.py | 16 ++ django/api/services/cra.py | 17 +- django/api/services/ncda.py | 158 ++++++++++++++++++ .../in/TO.ATO#@@00.R7005.IN.BCVR.A00009 | 5 + .../services/tests/cra_in_out/out/ABCVR00009 | 5 + django/api/services/tests/test_cra_read.py | 24 +++ django/api/services/tests/test_cra_write.py | 50 ++++++ django/api/settings.py | 4 +- django/api/site.py | 23 +++ django/api/tasks.py | 28 ++++ .../change_list.html | 76 ++++++++- django/templates/admin/app_index.html | 4 + django/templates/admin/base.html | 125 ++++++++++++++ django/templates/admin/index.html | 118 ++++++++++++- frontend/package.json | 2 +- frontend/src/components/BCSCInfo.js | 42 ----- frontend/src/components/DetailsTable.js | 17 +- frontend/src/components/Footer.js | 2 +- frontend/src/components/Form.js | 66 ++++---- frontend/src/components/Header.js | 34 ++-- frontend/src/components/InfoTable.js | 83 +++++++++ frontend/src/components/Logout.js | 25 +++ frontend/src/components/SpouseEmail.js | 13 +- frontend/src/components/SpouseForm.js | 23 +-- frontend/src/components/upload/Upload.js | 9 +- frontend/src/styles/Form.scss | 18 +- frontend/src/styles/Header.scss | 40 +++-- frontend/src/styles/Login.scss | 3 + frontend/src/styles/RebateTable.scss | 1 - frontend/src/styles/index.scss | 42 ++++- openshift/templates/backend/backend-dc.yaml | 5 + .../templates/task-queue/task-queue-dc.yaml | 7 +- 40 files changed, 978 insertions(+), 159 deletions(-) create mode 100644 django/api/messages_custom.py create mode 100644 django/api/migrations/0002_alter_goelectricrebate_ncda_id.py create mode 100644 django/api/services/tests/cra_in_out/in/TO.ATO#@@00.R7005.IN.BCVR.A00009 create mode 100644 django/api/services/tests/cra_in_out/out/ABCVR00009 create mode 100644 django/templates/admin/app_index.html create mode 100644 django/templates/admin/base.html delete mode 100644 frontend/src/components/BCSCInfo.js create mode 100644 frontend/src/components/InfoTable.js create mode 100644 frontend/src/components/Logout.js diff --git a/.pipeline/lib/config.js b/.pipeline/lib/config.js index a9f6afc3..a83137d1 100644 --- a/.pipeline/lib/config.js +++ b/.pipeline/lib/config.js @@ -42,7 +42,7 @@ const phases = { frontendCpuRequest: '30m', frontendCpuLimit: '60m', frontendMemoryRequest: '30Mi', frontendMemoryLimit: '60Mi', frontendReplicas: 1, reactAppBCSCKeycloakClientId: 'itvr', reactAppBCSCKeycloakRealm: 'rzh2zkjq', reactAppBCSCKeycloakUrl: 'https://dev.oidc.gov.bc.ca/auth/', reactAppApiBase: `https://itvr-backend-dev-${changeId}.apps.silver.devops.gov.bc.ca`, reactAppBCeIDKeycloakClientId: 'itvr-2674', reactAppBCeIDKeycloakRealm: 'onestopauth-basic', reactAppBCeIDKeycloakUrl: 'https://dev.oidc.gov.bc.ca/auth/', - backendCpuRequest: '60m', backendCpuLimit: '120m', backendMemoryRequest: '120Mi', backendMemoryLimit: '240Mi', backendHealthCheckDelay: 30, backendHost: `itvr-backend-dev-${changeId}.${ocpName}.gov.bc.ca`, backendReplicas: 1, backendDjangoDebug: 'True', bucketName: 'itvrdv', + backendCpuRequest: '60m', backendCpuLimit: '120m', backendMemoryRequest: '150Mi', backendMemoryLimit: '300Mi', backendHealthCheckDelay: 30, backendHost: `itvr-backend-dev-${changeId}.${ocpName}.gov.bc.ca`, backendReplicas: 1, backendDjangoDebug: 'True', bucketName: 'itvrdv', craEnvironment: 'A', minioCpuRequest: '30m', minioCpuLimit: '100m', minioMemoryRequest: '150Mi', minioMemoryLimit: '300Mi', minioPvcSize: '3Gi', schemaspyCpuRequest: '50m', schemaspyCpuLimit: '200m', schemaspyMemoryRequest: '150M', schemaspyMemoryLimit: '300M', schemaspyHealthCheckDelay: 160, rabbitmqCpuRequest: '250m', rabbitmqCpuLimit: '700m', rabbitmqMemoryRequest: '500M', rabbitmqMemoryLimit: '1G', rabbitmqPvcSize: '1G', rabbitmqReplica: 1, rabbitmqPostStartSleep: 120, storageClass: 'netapp-block-standard', @@ -57,7 +57,7 @@ const phases = { frontendCpuRequest: '30m', frontendCpuLimit: '60m', frontendMemoryRequest: '30Mi', frontendMemoryLimit: '60Mi', frontendReplicas: 2, frontendMinReplicas: 1, frontendMaxReplicas: 3, reactAppBCSCKeycloakClientId: 'itvr', reactAppBCSCKeycloakRealm: 'rzh2zkjq', reactAppBCSCKeycloakUrl: 'https://test.oidc.gov.bc.ca/auth/', reactAppApiBase: `https://itvr-backend-test.apps.silver.devops.gov.bc.ca`, reactAppBCeIDKeycloakClientId: 'itvr-2674', reactAppBCeIDKeycloakRealm: 'onestopauth-basic', reactAppBCeIDKeycloakUrl: 'https://test.oidc.gov.bc.ca/auth/', - backendCpuRequest: '30m', backendCpuLimit: '60m', backendMemoryRequest: '120Mi', backendMemoryLimit: '240Mi', backendHealthCheckDelay: 30, backendReplicas: 2, backendMinReplicas: 1, backendMaxReplicas: 3, backendHost: `itvr-backend-test.${ocpName}.gov.bc.ca`, backendDjangoDebug: 'False', bucketName: 'itvrts', + backendCpuRequest: '60m', backendCpuLimit: '120m', backendMemoryRequest: '150Mi', backendMemoryLimit: '300Mi', backendHealthCheckDelay: 30, backendReplicas: 2, backendMinReplicas: 1, backendMaxReplicas: 3, backendHost: `itvr-backend-test.${ocpName}.gov.bc.ca`, backendDjangoDebug: 'False', bucketName: 'itvrts', craEnvironment: 'A', minioCpuRequest: '30m', minioCpuLimit: '100m', minioMemoryRequest: '150Mi', minioMemoryLimit: '300Mi', minioPvcSize: '3G', schemaspyCpuRequest: '20m', schemaspyCpuLimit: '200m', schemaspyMemoryRequest: '150M', schemaspyMemoryLimit: '300M', schemaspyHealthCheckDelay: 160, rabbitmqCpuRequest: '250m', rabbitmqCpuLimit: '700m', rabbitmqMemoryRequest: '500M', rabbitmqMemoryLimit: '700M', rabbitmqPvcSize: '1G', rabbitmqReplica: 2, rabbitmqPostStartSleep: 120, storageClass: 'netapp-block-standard', @@ -72,7 +72,7 @@ const phases = { frontendCpuRequest: '30m', frontendCpuLimit: '60m', frontendMemoryRequest: '30Mi', frontendMemoryLimit: '60Mi', frontendReplicas: 2, frontendMinReplicas: 2, frontendMaxReplicas: 5, reactAppBCSCKeycloakClientId: 'itvr', reactAppBCSCKeycloakRealm: 'rzh2zkjq', reactAppBCSCKeycloakUrl: 'https://oidc.gov.bc.ca/auth/', reactAppApiBase: `https://itvr-backend-prod.apps.silver.devops.gov.bc.ca`, reactAppBCeIDKeycloakClientId: 'itvr-2674', reactAppBCeIDKeycloakRealm: 'onestopauth-basic', reactAppBCeIDKeycloakUrl: 'https://oidc.gov.bc.ca/auth/', - backendCpuRequest: '30m', backendCpuLimit: '60m', backendMemoryRequest: '240Mi', backendMemoryLimit: '480Mi', backendHealthCheckDelay: 30, backendReplicas: 3, backendMinReplicas: 3, backendMaxReplicas: 5, backendHost: `itvr-backend-prod.${ocpName}.gov.bc.ca`, backendDjangoDebug: 'False', bucketName: 'itvrpr', + backendCpuRequest: '60m', backendCpuLimit: '120m', backendMemoryRequest: '150Mi', backendMemoryLimit: '300Mi', backendHealthCheckDelay: 30, backendReplicas: 3, backendMinReplicas: 3, backendMaxReplicas: 5, backendHost: `itvr-backend-prod.${ocpName}.gov.bc.ca`, backendDjangoDebug: 'False', bucketName: 'itvrpr', craEnvironment: 'P', minioCpuRequest: '30m', minioCpuLimit: '100m', minioMemoryRequest: '150Mi', minioMemoryLimit: '300Mi', minioPvcSize: '3G', schemaspyCpuRequest: '50m', schemaspyCpuLimit: '400m', schemaspyMemoryRequest: '150M', schemaspyMemoryLimit: '300M', schemaspyHealthCheckDelay: 160, rabbitmqCpuRequest: '250m', rabbitmqCpuLimit: '700m', rabbitmqMemoryRequest: '500M', rabbitmqMemoryLimit: '1G', rabbitmqPvcSize: '5G', rabbitmqReplica: 2, rabbitmqPostStartSleep: 120, storageClass: 'netapp-block-standard', diff --git a/.pipeline/lib/deploy.js b/.pipeline/lib/deploy.js index 595a49f6..2986a755 100755 --- a/.pipeline/lib/deploy.js +++ b/.pipeline/lib/deploy.js @@ -91,6 +91,7 @@ module.exports = settings => { 'HEALTH_CHECK_DELAY': phases[phase].backendHealthCheckDelay, 'REPLICAS': phases[phase].backendReplicas, 'DJANGO_DEBUG': phases[phase].backendDjangoDebug, + 'CRA_ENVIRONMENT': phases[phase].craEnvironment, 'BUCKET_NAME': phases[phase].bucketName } })) @@ -105,6 +106,7 @@ module.exports = settings => { 'MEMORY_REQUEST': phases[phase].taskQueueMemoryRequest, 'MEMORY_LIMIT': phases[phase].taskQueueMemoryLimit, 'REPLICAS': phases[phase].taskQueueReplicas, + 'CRA_ENVIRONMENT': phases[phase].craEnvironment, 'DJANGO_DEBUG': phases[phase].taskQueueDjangoDebug } })) diff --git a/django/api/admin.py b/django/api/admin.py index 89bed27f..fcff99ee 100644 --- a/django/api/admin.py +++ b/django/api/admin.py @@ -5,6 +5,8 @@ ) from .models.household_member import HouseholdMember from .models.go_electric_rebate import GoElectricRebate +from django.contrib import messages +from . import messages_custom class HouseholdApplicationInline(admin.StackedInline): @@ -57,6 +59,7 @@ class SubmittedGoElectricRebateApplicationAdmin(admin.ModelAdmin): "first_name", "middle_names", "email", + "user_is_bcsc", "address", "city", "postal_code", @@ -94,6 +97,19 @@ def response_change(self, request, obj): obj.save(update_fields=["status"]) return ret + def message_user( + self, + request, + message, + level=messages.INFO, + extra_tags="", + fail_silently=False, + ): + revised_level = level + if "reject_application" in request.POST: + revised_level = messages_custom.NEGATIVE_SUCCESS + super().message_user(request, message, revised_level, extra_tags, fail_silently) + @admin.register(GoElectricRebate) class GoElectricRebateAdmin(admin.ModelAdmin): diff --git a/django/api/apps.py b/django/api/apps.py index 7c5e7b9b..7ef94cfc 100644 --- a/django/api/apps.py +++ b/django/api/apps.py @@ -4,6 +4,7 @@ class ApiConfig(AppConfig): name = "api" + verbose_name = "Submitted Rebate Applications" def ready(self): import api.signals diff --git a/django/api/authentication/keycloak.py b/django/api/authentication/keycloak.py index f5ce3f64..a9b4c5d0 100644 --- a/django/api/authentication/keycloak.py +++ b/django/api/authentication/keycloak.py @@ -70,7 +70,7 @@ def authenticate_credentials(self, token): username=token_info.get("sub"), defaults={ "display_name": token_info.get("display_name"), - "email": token_info.get("email"), + "email": token_info.get("email", ""), "identity_provider": token_info.get("identity_provider"), }, ) diff --git a/django/api/messages_custom.py b/django/api/messages_custom.py new file mode 100644 index 00000000..0ded657c --- /dev/null +++ b/django/api/messages_custom.py @@ -0,0 +1,5 @@ +# modelled after the constants in the django messages module + +NEGATIVE_SUCCESS = 26 + +TAGS = {NEGATIVE_SUCCESS: "negative_success"} diff --git a/django/api/migrations/0002_alter_goelectricrebate_ncda_id.py b/django/api/migrations/0002_alter_goelectricrebate_ncda_id.py new file mode 100644 index 00000000..7b130ae1 --- /dev/null +++ b/django/api/migrations/0002_alter_goelectricrebate_ncda_id.py @@ -0,0 +1,18 @@ +# Generated by Django 4.0.1 on 2022-06-24 21:14 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='goelectricrebate', + name='ncda_id', + field=models.IntegerField(blank=True, db_index=True, null=True), + ), + ] diff --git a/django/api/models/go_electric_rebate.py b/django/api/models/go_electric_rebate.py index 1ea82b68..5e3b8634 100644 --- a/django/api/models/go_electric_rebate.py +++ b/django/api/models/go_electric_rebate.py @@ -27,7 +27,7 @@ class GoElectricRebate(TimeStampedModel): redeemed = BooleanField(default=False) # sharepoint id. If something goes wrong with notification we can find # issued rebates with blank NCDA ids to try resending. - ncda_id = IntegerField(blank=True, null=True) + ncda_id = IntegerField(blank=True, null=True, db_index=True) def __str__(self): return "DL: " + self.drivers_licence + ", $" + str(self.rebate_max_amount) diff --git a/django/api/models/go_electric_rebate_application.py b/django/api/models/go_electric_rebate_application.py index fa88720a..de8c0aa8 100644 --- a/django/api/models/go_electric_rebate_application.py +++ b/django/api/models/go_electric_rebate_application.py @@ -25,6 +25,7 @@ ) from django_extensions.db.models import TimeStampedModel from django.utils.translation import gettext_lazy as _ +from django.utils.functional import classproperty media_storage = get_storage_class()() @@ -100,6 +101,13 @@ def doc2_tag(self): consent_personal = BooleanField(validators=[validate_consent]) consent_tax = BooleanField(validators=[validate_consent]) + def user_is_bcsc(self): + if self.user.identity_provider == "bcsc": + return True + return False + + user_is_bcsc.short_description = "Address is BCSC Verified" + def __str__(self): return self.last_name + ", " + self.first_name + ": " + str(self.id) @@ -126,3 +134,11 @@ class Meta: class SubmittedGoElectricRebateApplication(GoElectricRebateApplication): class Meta: proxy = True + + @classproperty + def admin_label(cls): + return "Review Applications" + + @classproperty + def admin_display_change(cls): + return False diff --git a/django/api/services/cra.py b/django/api/services/cra.py index e7b0657a..bb810e06 100644 --- a/django/api/services/cra.py +++ b/django/api/services/cra.py @@ -13,11 +13,14 @@ def read(file): results[current_application_id] = [] current_application = results[current_application_id] - # CRA-NO-DATA-RESPONSE-0023 - if subCode == "0023": - sin = line[4:13] - year = line[13:17] - current_application.append({"sin": sin, "year": year, "income": None}) + # REQUEST-STATUS-CODE + status_code = line[25:27] + # 55 UNSUCCESSFUL-ACCT-NOT-AVAIL + # 59 UNSUCCESSFUL-REQUEST NO DATA + if status_code in ["59", "55"]: + sin = line[4:13] + year = line[13:17] + current_application.append({"sin": sin, "year": year, "income": None}) # From Susan: # The business folks did flip flop on the net income @@ -56,8 +59,8 @@ def write( # Write the body for row in data: sin = row["sin"] - family_name = row["family_name"].ljust(30) - given_name = row["given_name"].ljust(30) + family_name = row["family_name"].ljust(30)[:30] + given_name = row["given_name"].ljust(30)[:30] tax_years = " ".join([str(year) for year in row["years"]]).ljust(20) birth_date = row["birth_date"] identifier = row["application_id"].ljust(30) diff --git a/django/api/services/ncda.py b/django/api/services/ncda.py index b6dbf5de..b2376bc0 100644 --- a/django/api/services/ncda.py +++ b/django/api/services/ncda.py @@ -182,3 +182,161 @@ def notify(drivers_licence, last_name, expiry_date, rebate_amount, rebate_id): ncda_id = data["d"]["ID"] GoElectricRebate.objects.filter(pk=rebate_id).update(ncda_id=ncda_id) + + +# iso_ts ex 2023-08-01T07:00:00Z +def get_rebates_redeemed_since(iso_ts): + api_endpoint = settings.NCDA_SHAREPOINT_URL + access_token = get_ncda_service_token() + + headers = { + "Authorization": "Bearer " + access_token, + "Accept": "application/json;odata=verbose", + "Content-Type": "application/json;odata=verbose", + } + + url = api_endpoint + "/lists/getbytitle('ITVREligibility')/items" + + payload = { + "$select": "Id,Title,Modified,Status", + "$filter": "(Status eq 'Redeemed')and(Modified ge datetime'%s')" % iso_ts, + } + + ncda_rs = requests.get(url, headers=headers, params=payload, verify=True) + + ncda_rs.raise_for_status() + + # { + # "d": { + # "results": [ + # { + # "__metadata": { + # "id": "a27d1060-03b2-4f1a-8006-0205c1ce6c43", + # "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)", + # "etag": '"3"', + # "type": "SP.Data.ITVREligibilityListItem", + # }, + # "Id": 5, + # "ID": 5, + # "Title": "44444444", + # "Modified": "2022-06-09T06:01:10Z", + # "Status": "Redeemed", + # } + # ] + # } + # } + data = ncda_rs.json() + items = data["d"]["results"] + ncda_ids = map(lambda item: item["ID"], items) + return list(ncda_ids) + + +# https://support.shortpoint.com/support/solutions/articles/1000307202-shortpoint-rest-api-selecting-filtering-sorting-results-in-a-sharepoint-list + + +# Example API response with one Sharepoint list item selecting all fields. +# { +# "d": { +# "results": [ +# { +# "__metadata": { +# "id": "e2356fcb-8649-4cc4-81b5-d16fa330244f", +# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)", +# "etag": '"3"', +# "type": "SP.Data.ITVREligibilityListItem", +# }, +# "FirstUniqueAncestorSecurableObject": { +# "__deferred": { +# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/FirstUniqueAncestorSecurableObject" +# } +# }, +# "RoleAssignments": { +# "__deferred": { +# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/RoleAssignments" +# } +# }, +# "AttachmentFiles": { +# "__deferred": { +# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/AttachmentFiles" +# } +# }, +# "ContentType": { +# "__deferred": { +# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/ContentType" +# } +# }, +# "GetDlpPolicyTip": { +# "__deferred": { +# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/GetDlpPolicyTip" +# } +# }, +# "FieldValuesAsHtml": { +# "__deferred": { +# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/FieldValuesAsHtml" +# } +# }, +# "FieldValuesAsText": { +# "__deferred": { +# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/FieldValuesAsText" +# } +# }, +# "FieldValuesForEdit": { +# "__deferred": { +# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/FieldValuesForEdit" +# } +# }, +# "File": { +# "__deferred": { +# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/File" +# } +# }, +# "Folder": { +# "__deferred": { +# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/Folder" +# } +# }, +# "LikedByInformation": { +# "__deferred": { +# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/LikedByInformation" +# } +# }, +# "ParentList": { +# "__deferred": { +# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/ParentList" +# } +# }, +# "Properties": { +# "__deferred": { +# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/Properties" +# } +# }, +# "Versions": { +# "__deferred": { +# "uri": "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/Web/Lists(guid'7aea54d3-9935-40a4-88cd-3ddd74c7d270')/Items(5)/Versions" +# } +# }, +# "FileSystemObjectType": 0, +# "Id": 5, +# "ServerRedirectedEmbedUri": null, +# "ServerRedirectedEmbedUrl": "", +# "ID": 5, +# "ContentTypeId": "0x01008074AAC5CAD1A241B1109194FE6D8D5D00747BB541D61F1F4CA7028C9C97E823CB", +# "Title": "44444444", +# "Modified": "2022-06-09T06:01:10Z", +# "Created": "2022-06-07T16:22:31Z", +# "AuthorId": 1073741822, +# "EditorId": 1073741822, +# "OData__UIVersionString": "3.0", +# "Attachments": false, +# "GUID": "cf205d6e-b0f1-481e-8988-4aa1119a4033", +# "ComplianceAssetId": null, +# "LastName": "Test4", +# "ExpiryDT": "2023-08-01T07:00:00Z", +# "MaxRebateAmt": 1500, +# "Status": "Redeemed", +# "ClaimType": null, +# "OData__vti_ItemDeclaredRecord": null, +# } +# ] +# } +# } diff --git a/django/api/services/tests/cra_in_out/in/TO.ATO#@@00.R7005.IN.BCVR.A00009 b/django/api/services/tests/cra_in_out/in/TO.ATO#@@00.R7005.IN.BCVR.A00009 new file mode 100644 index 00000000..319bac46 --- /dev/null +++ b/django/api/services/tests/cra_in_out/in/TO.ATO#@@00.R7005.IN.BCVR.A00009 @@ -0,0 +1,5 @@ +7100 20220516 BCVRA00009 0 +7101270300379 0020SolangeSolangeSolangeSolangeSoAliceAliceAliceAliceAliceAlice197101222020 BCVR1234 0 +7101302435839 0020Turner Wendy 197805212020 BCVR1234 0 +7101129922258 0020Redding Lily 198307072020 BCVR1234 0 +7102 20220516 BCVRA00009 00000005 0 \ No newline at end of file diff --git a/django/api/services/tests/cra_in_out/out/ABCVR00009 b/django/api/services/tests/cra_in_out/out/ABCVR00009 new file mode 100644 index 00000000..da6601e8 --- /dev/null +++ b/django/api/services/tests/cra_in_out/out/ABCVR00009 @@ -0,0 +1,5 @@ +7200 20220602 BCVRA00009 0 +72011306925442020002200015901505000000000FezRPbX9UGB5S9s2 BCVR 0 +720113069254420200022000159015050000000005G7TgFfR2c9Gckur BCVR 0 +720113069254420200022000155015050000000005G7TgFfR2c9Gckur BCVR 0 +7202 20220602 BCVRA00009 00000005 0 diff --git a/django/api/services/tests/test_cra_read.py b/django/api/services/tests/test_cra_read.py index dbaace96..19cc6117 100644 --- a/django/api/services/tests/test_cra_read.py +++ b/django/api/services/tests/test_cra_read.py @@ -52,3 +52,27 @@ def test_read_out_00008(self): ], }, ) + + # Test against response file 00009 + def test_read_out_00009(self): + cra_out_file_00009_filename = os.path.join( + os.path.dirname(__file__), + "cra_in_out", + "out", + "ABCVR00009", + ) + + with open(cra_out_file_00009_filename, "r") as cra_out_file_00009: + data = cra.read(cra_out_file_00009.read()) + self.assertDictEqual( + data, + { + "FezRPbX9UGB5S9s2": [ + {"sin": "130692544", "year": "2020", "income": None} + ], + "5G7TgFfR2c9Gckur": [ + {"sin": "130692544", "year": "2020", "income": None}, + {"sin": "130692544", "year": "2020", "income": None}, + ], + }, + ) diff --git a/django/api/services/tests/test_cra_write.py b/django/api/services/tests/test_cra_write.py index 32245918..15a466c4 100644 --- a/django/api/services/tests/test_cra_write.py +++ b/django/api/services/tests/test_cra_write.py @@ -111,3 +111,53 @@ def test_write_in_00008(self): # Check file contents are exactly equal. self.assertEqual(file_contents, file) + + # Test against cra in file 00009 + def test_write_in_00009(self): + data = [ + { + "sin": "270300379", + "years": [2020], + "given_name": "AliceAliceAliceAliceAliceAliceTruncateMe", + "family_name": "SolangeSolangeSolangeSolangeSolange", + "birth_date": "19710122", + "application_id": "1234", + }, + { + "sin": "302435839", + "years": [2020], + "given_name": "Wendy", + "family_name": "Turner", + "birth_date": "19780521", + "application_id": "1234", + }, + { + "sin": "129922258", + "years": [2020], + "given_name": "Lily", + "family_name": "Redding", + "birth_date": "19830707", + "application_id": "1234", + }, + ] + + file_contents = cra.write( + data, + today="20220516", + program_code="BCVR", + cra_env="A", + cra_sequence="00009", + ) + + cra_in_file_00009_filename = os.path.join( + os.path.dirname(__file__), + "cra_in_out", + "in", + "TO.ATO#@@00.R7005.IN.BCVR.A00009", + ) + + with open(cra_in_file_00009_filename, "r") as cra_in_file_00009: + file = cra_in_file_00009.read() + + # Check file contents are exactly equal. + self.assertEqual(file_contents, file) diff --git a/django/api/settings.py b/django/api/settings.py index 20fcb24e..72495d6c 100644 --- a/django/api/settings.py +++ b/django/api/settings.py @@ -1,8 +1,8 @@ import os import sys from pathlib import Path - from . import email +from . import messages_custom AUTH_USER_MODEL = "users.ITVRUser" @@ -249,3 +249,5 @@ "NCDA_SHAREPOINT_URL", "https://newcardealers.sharepoint.com/sites/ElectricVehicleRebateApplications/_api/web", ) + +MESSAGE_TAGS = messages_custom.TAGS diff --git a/django/api/site.py b/django/api/site.py index b60bd391..5aa60b75 100644 --- a/django/api/site.py +++ b/django/api/site.py @@ -115,4 +115,27 @@ def download_file(self, request): response["Content-Disposition"] = "attachment; filename=" + filename return response + def refine_app(self, app): + models = app.get("models") + if models is not None: + for model in models: + model_cls = model["model"] + if hasattr(model_cls, "admin_label"): + model["admin_label"] = model_cls.admin_label + else: + model["admin_label"] = model["name"] + if hasattr(model_cls, "admin_display_change"): + model["admin_display_change"] = model_cls.admin_display_change + else: + model["admin_display_change"] = True + + def _build_app_dict(self, request, label=None): + app_dict = super()._build_app_dict(request, label) + if label: + self.refine_app(app_dict) + else: + for app in app_dict.values(): + self.refine_app(app) + return app_dict + # inline or attachment diff --git a/django/api/tasks.py b/django/api/tasks.py index 0bb407f7..d1968ecd 100644 --- a/django/api/tasks.py +++ b/django/api/tasks.py @@ -1,10 +1,17 @@ import requests import json +from django.utils import timezone from django.conf import settings from email.header import Header from email.utils import formataddr from requests.auth import HTTPBasicAuth +from django_q.tasks import schedule +from api.services.ncda import get_rebates_redeemed_since +from api.models.go_electric_rebate import GoElectricRebate +from api.models.go_electric_rebate_application import ( + GoElectricRebateApplication, +) def get_email_service_token() -> str: @@ -293,3 +300,24 @@ def send_not_approve(recipient_email, application_id, tax_year): cc_list=[], optional_subject=" – Not Approved", ) + + +# check for newly redeemed rebates +# TODO schedule this task to automatically run. +def check_rebates_redeemed_since(iso_ts=None): + ts = iso_ts if iso_ts else timezone.now().strftime("%Y-%m-%dT00:00:00Z") + print("check_rebate_status " + ts) + ncda_ids = get_rebates_redeemed_since(ts) + print(ncda_ids) + + redeemed_rebates = GoElectricRebate.objects.filter(ncda_id__in=ncda_ids) + + # mark redeemed + redeemed_rebates.update(redeemed=True, modified=timezone.now()) + # update application status + GoElectricRebateApplication.objects.filter( + pk__in=list(redeemed_rebates.values_list("application_id", flat=True)) + ).update( + status=GoElectricRebateApplication.Status.REDEEMED, + modified=timezone.now(), + ) diff --git a/django/api/templates/admin/api/submittedgoelectricrebateapplication/change_list.html b/django/api/templates/admin/api/submittedgoelectricrebateapplication/change_list.html index a656dc8e..1f8ce941 100644 --- a/django/api/templates/admin/api/submittedgoelectricrebateapplication/change_list.html +++ b/django/api/templates/admin/api/submittedgoelectricrebateapplication/change_list.html @@ -1,6 +1,76 @@ -{% extends "admin/change_list.html" %} {% load i18n admin_urls jazzmin %} {% -get_jazzmin_ui_tweaks as jazzmin_ui %} - +{% extends "admin/change_list.html" %} +{% load i18n admin_urls static admin_list jazzmin %} {% {% block content_title %} Submitted Rebate Applications {% endblock %} +{% block content %} +
+
+
+

Select rebate applications to verify identity

+
+ {% block date_hierarchy %}{% if cl.date_hierarchy %}{% date_hierarchy cl %}{% endif %}{% endblock %} + {% block search %} + {% search_form cl %} + {% endblock %} +
+
+ +
+
{% csrf_token %} +
+ {% if cl.formset and cl.formset.errors %} +

+ {% if cl.formset.total_error_count == 1 %} + {% trans "Please correct the error below." %} + {% else %} + {% trans "Please correct the errors below." %} + {% endif %} +

+ {{ cl.formset.non_form_errors }} + {% endif %} +
+
+
+ {% if cl.formset %} +
{{ cl.formset.management_form }}
+ {% endif %} + + {% block result_list %} +
+
+ {% if action_form and actions_on_top and cl.show_admin_actions %} + {% admin_actions %} + {% endif %} +
+
+ {% block object-tools %} + {% block object-tools-items %} + {% change_list_object_tools %} + {% endblock %} + {% endblock %} +
+
+
+ {% result_list cl %} + {% if action_form and actions_on_bottom and cl.show_admin_actions %} +
+
+ {% admin_actions %} +
+
+ {% endif %} + {% endblock %} +
+
+
+ {% block pagination %}{% pagination cl %}{% endblock %} +
+
+
+
+
+
+
+
+{% endblock %} \ No newline at end of file diff --git a/django/templates/admin/app_index.html b/django/templates/admin/app_index.html new file mode 100644 index 00000000..d63d7356 --- /dev/null +++ b/django/templates/admin/app_index.html @@ -0,0 +1,4 @@ +{% extends "admin/app_index.html" %} +{% load i18n %} + +{% block content_title %} {% endblock %} \ No newline at end of file diff --git a/django/templates/admin/base.html b/django/templates/admin/base.html new file mode 100644 index 00000000..70d40cb7 --- /dev/null +++ b/django/templates/admin/base.html @@ -0,0 +1,125 @@ +{% extends "admin/base.html" %} +{% load i18n static jazzmin admin_urls %} +{% get_current_language as LANGUAGE_CODE %} +{% get_current_language_bidi as LANGUAGE_BIDI %} +{% get_jazzmin_settings request as jazzmin_settings %} +{% get_jazzmin_ui_tweaks as jazzmin_ui %} + + + {% block sidebar %} + {% if jazzmin_settings.show_sidebar %} + {% get_side_menu as side_menu_list %} + + + {% endif %} + {% endblock %} + + {% block messages %} + {% for message in messages %} + {% if message.tags == 'success' %} +
+ + {{ message|capfirst }} +
+ {% elif message.tags == 'negative_success' %} +
+ + {{ message|capfirst }} +
+ {% elif message.tags == 'error' %} +
+ + {{ message|capfirst }} +
+ {% elif message.tags == 'warning' %} +
+ + {{ message|capfirst }} +
+ {% elif message.tags == 'info' %} +
+ + {{ message|capfirst }} +
+ {% endif %} + {% endfor %} + {% endblock messages %} \ No newline at end of file diff --git a/django/templates/admin/index.html b/django/templates/admin/index.html index 37e97276..7cadb5d5 100644 --- a/django/templates/admin/index.html +++ b/django/templates/admin/index.html @@ -1,7 +1,122 @@ {% extends "admin/index.html" %} +{% load i18n static jazzmin %} +{% get_jazzmin_ui_tweaks as jazzmin_ui %} {% block content %} - {{ block.super }} + {% get_side_menu using="app_list" as dashboard_list %} + {% if dashboard_list %} + {% widthratio dashboard_list|length 2 1 as middle %} + {% endif %} + +
+
+
+ {% for app in dashboard_list %} +
+
+
{{ app.name }}
+
+
+ + + {% for model in app.models %} + + + + + {% endfor %} + +
+ {% if model.url %}{{ model.admin_label }}{% else %}{{ model.admin_label }}{% endif %} + +
+ {% if model.add_url %} + {% trans 'Add' %} + {% endif %} + {% if model.url %} + {% if model.view_only %} + {% trans 'View' %} + {% elif model.admin_display_change %} + {% if model.custom %}{% trans 'Go' %}{% else %}{% trans 'Change' %}{% endif %} + {% endif %} + {% endif %} +
+
+
+
+ + {% if forloop.counter == middle|add:"0" %} +
+
+ {% endif %} + + {% endfor %} +
+
+ +
+
+ +
CRA IN and OUT Files
@@ -17,4 +132,5 @@
+ {% endblock %} diff --git a/frontend/package.json b/frontend/package.json index a6dd7b1b..dc401dad 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "frontend", - "version": "1.3.0", + "version": "1.4.0", "private": true, "dependencies": { "@date-io/date-fns": "^2.14.0", diff --git a/frontend/src/components/BCSCInfo.js b/frontend/src/components/BCSCInfo.js deleted file mode 100644 index 4f40ea13..00000000 --- a/frontend/src/components/BCSCInfo.js +++ /dev/null @@ -1,42 +0,0 @@ -import React from 'react'; -import Box from '@mui/material/Box'; - -const BCSCInfo = ({ kcToken }) => { - return ( - <> -

- Your name, date of birth and address below has been provided from your - BC Services Card app. -

- - - Your last name (surname): - {kcToken.family_name} - - - First name (given name): - {kcToken.given_name} - - - Date of birth: - {kcToken.birthdate} - - - Street address: - {kcToken.street_address} - - - City: - {kcToken.locality} - - {kcToken.postal_code && ( - - Postal code: - {kcToken.postal_code} - - )} - - - ); -}; -export default BCSCInfo; diff --git a/frontend/src/components/DetailsTable.js b/frontend/src/components/DetailsTable.js index 851ec639..021893a0 100644 --- a/frontend/src/components/DetailsTable.js +++ b/frontend/src/components/DetailsTable.js @@ -77,7 +77,10 @@ const DetailsTable = ({ data }) => { rows = rows.filter((r) => r); return ( - +
{rows.map((row) => { if (row.answer) { @@ -86,15 +89,21 @@ const DetailsTable = ({ data }) => { {row.name} {row.answer} diff --git a/frontend/src/components/Footer.js b/frontend/src/components/Footer.js index 76777540..18c160b8 100644 --- a/frontend/src/components/Footer.js +++ b/frontend/src/components/Footer.js @@ -4,7 +4,7 @@ const Footer = () => {
+ + {rows.map((row) => ( + + + {row.name} + + + {row.answer} + + + ))} + +
+
+ + ); +}; +export default InfoTable; diff --git a/frontend/src/components/Logout.js b/frontend/src/components/Logout.js new file mode 100644 index 00000000..4ac7b52f --- /dev/null +++ b/frontend/src/components/Logout.js @@ -0,0 +1,25 @@ +import React from 'react'; +import { useKeycloak } from '@react-keycloak/web'; + +const Logout = () => { + const { keycloak } = useKeycloak(); + if (keycloak.authenticated) { + const kcToken = keycloak.tokenParsed; + return ( +
+ {'Logged in as: ' + kcToken.display_name + ' |'} + { + keycloak.logout(); + }} + > +  Log out + +
+ ); + } + return null; +}; + +export default Logout; diff --git a/frontend/src/components/SpouseEmail.js b/frontend/src/components/SpouseEmail.js index c1b7710b..d8c183c3 100644 --- a/frontend/src/components/SpouseEmail.js +++ b/frontend/src/components/SpouseEmail.js @@ -25,21 +25,22 @@ const SpouseEmail = ({ name }) => { {errors?.[name]?.type === 'required' && (

Spouse email address cannot be blank

)} -

enter your spouse or common law partner's email address

+

+ Enter your spouse or common law partner's email address +

Spouse email address: setValue(name, e.target.value)} - /> - - By providing this person’s email address you are confirming that the + helperText="By providing this person’s email address you are confirming that the owner has authorized you to provide their email for the purposes of - completing your rebate application for your household. - + completing your rebate application for your household." + /> ); diff --git a/frontend/src/components/SpouseForm.js b/frontend/src/components/SpouseForm.js index 99017e05..02350ccd 100644 --- a/frontend/src/components/SpouseForm.js +++ b/frontend/src/components/SpouseForm.js @@ -16,7 +16,7 @@ import LockIcon from '@mui/icons-material/Lock'; import Upload from './upload/Upload'; import Loading from './Loading'; import { useKeycloak } from '@react-keycloak/web'; -import BCSCInfo from './BCSCInfo'; +import InfoTable from './InfoTable'; import { addTokenFields } from '../keycloak'; import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns'; import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; @@ -135,28 +135,13 @@ const SpouseForm = ({ id, setNumberOfErrors, setErrorsExistCounter }) => { secure form submission -

+

The address information below has been provided from your household application and must match your identification.

- - - Street address: - {address} - - - City: - {city} - - {postalCode && ( - - Postal code: - {postalCode} - - )} - + {kcToken.identity_provider === 'bcsc' ? ( - + ) : ( <> diff --git a/frontend/src/components/upload/Upload.js b/frontend/src/components/upload/Upload.js index 24a937af..5694fd67 100644 --- a/frontend/src/components/upload/Upload.js +++ b/frontend/src/components/upload/Upload.js @@ -23,9 +23,12 @@ const Upload = (props) => { Both pieces of ID must show the same address. Image files must be in jpg or png format.

- - See examples of accepted ID - +

+ + See examples of accepted ID + + (link opens in a new tab to prevent losing form data) +

{errors?.documents?.type === 'exactlyTwo' && (

Need exactly 2 files

diff --git a/frontend/src/styles/Form.scss b/frontend/src/styles/Form.scss index 44c7ec00..4bc8dd54 100644 --- a/frontend/src/styles/Form.scss +++ b/frontend/src/styles/Form.scss @@ -1,9 +1,6 @@ #form-submission-title { display: inline; } -.primary-answer { - color: $grey-dark; -} .form-upload-instructions { h3 { margin-bottom: 1rem; @@ -12,3 +9,18 @@ margin-top: 0; } } +.MuiFormHelperText-root { + color: $black !important; + font-size: 1rem !important; +} +.MuiInputLabel-root { + white-space: normal !important; +} +#spouse-email-text { + margin-bottom: 0.5rem; +} + +.info-table-text { + margin-top: 1rem; + margin-bottom: 10px; +} diff --git a/frontend/src/styles/Header.scss b/frontend/src/styles/Header.scss index 31c30a41..25e0be70 100644 --- a/frontend/src/styles/Header.scss +++ b/frontend/src/styles/Header.scss @@ -1,21 +1,36 @@ .cleanbc-banner { background-color: $banner-blue; - font-size: 1.25rem; display: flex; border-bottom: 3px solid $border-orange; flex-direction: row; - justify-content: flex-start; + justify-content: space-between; align-items: center; + padding-left: 6rem; + padding-right: 6rem; +} + +.cleanbc-banner .left, +.cleanbc-banner .right { + display: flex; + flex-direction: row; + align-items: center; + font-size: 1.25rem; a { color: $white; text-decoration: none; font-weight: bold; } img { - margin-left: 10rem; height: 4.5rem; width: auto; } + .logout { + color: $white; + font-size: 1rem; + .logoutButton { + cursor: pointer; + } + } } .page-header { @@ -24,33 +39,34 @@ height: 191px; .title { + padding-left: 6rem; h1 { color: $white; } - h1 { - padding-left: 6rem; - } } } @media (max-width: 992px) { .cleanbc-banner { font-weight: normal; - height: 3rem; + flex-direction: column; img { margin-left: 1rem; height: 3rem; } + .logout { + font-size: 0.75rem; + } } .page-header { width: 100%; position: relative; margin: 0; - height: 140px; + height: 180px; .title { margin: 5px 0 0 1rem; + padding-left: 0; h1 { - padding-left: 0; font-size: 2rem; } } @@ -58,16 +74,14 @@ } @media (max-width: 688px) { .page-header { - height: 120px; .title { h1 { - padding-left: 0; font-size: 1.75rem; } } } } -@media (max-width: 375px) { +@media (max-width: 380px) { .page-header { a { font-size: 10pt; @@ -79,7 +93,7 @@ } } } -@media (max-width: 280px) { +@media (max-width: 330px) { .page-header { .title { h1 { diff --git a/frontend/src/styles/Login.scss b/frontend/src/styles/Login.scss index 7bb298ce..31a467dc 100644 --- a/frontend/src/styles/Login.scss +++ b/frontend/src/styles/Login.scss @@ -69,6 +69,9 @@ } } } + #bceid-login-button { + font-size: 1rem; + } .login-square { height: 10rem; width: 17rem; diff --git a/frontend/src/styles/RebateTable.scss b/frontend/src/styles/RebateTable.scss index 4744c571..56b0d5af 100644 --- a/frontend/src/styles/RebateTable.scss +++ b/frontend/src/styles/RebateTable.scss @@ -44,7 +44,6 @@ } .rebate-table-small { width: 100%; - font-size: 4vw; th { padding: 5px; } diff --git a/frontend/src/styles/index.scss b/frontend/src/styles/index.scss index dcef9bcb..8de902c7 100644 --- a/frontend/src/styles/index.scss +++ b/frontend/src/styles/index.scss @@ -121,6 +121,7 @@ a { margin-bottom: 1rem; border-radius: 4px; border: 0 solid $button-blue; + cursor:pointer; &:disabled { color: $grey-dark; @@ -133,11 +134,6 @@ a { margin: 0 6rem 0 6rem; padding-bottom: 2rem; } -@media (max-width: 992px) { - .page-content { - margin: 0 1rem 0 1rem; - } -} span.validated { display: block; @@ -160,3 +156,39 @@ span.error { color: rgb(200, 35, 51); padding-bottom: 25px; } + +@media (max-width: 992px) { + h1 { + font-size: 1.5rem; + } + h2 { + font-size: 1.3rem; + } + h3 { + font-size: 1.2rem; + } + h3 { + font-size: 1.1rem; + } + h4 { + font-size: 1.1rem; + } + h5 { + font-size: 1rem; + } + p, + ul, + li, + div, + .error { + font-size: 1rem !important; + } + + .error { + padding-bottom: 0 !important; + } + + .page-content { + margin: 0 1rem 0 1rem; + } +} diff --git a/openshift/templates/backend/backend-dc.yaml b/openshift/templates/backend/backend-dc.yaml index 8c7a2b2d..1214e1f1 100644 --- a/openshift/templates/backend/backend-dc.yaml +++ b/openshift/templates/backend/backend-dc.yaml @@ -56,6 +56,9 @@ parameters: displayName: bucket name description: bucket name required: true + - name: CRA_ENVIRONMENT + description: the environment for CRA, P for production, A for all other envs + required: true objects: - apiVersion: v1 kind: Secret @@ -372,6 +375,8 @@ objects: secretKeyRef: name: itvr-ncda key: NCDA_SHAREPOINT_URL + - name: CRA_ENVIRONMENT + value: ${CRA_ENVIRONMENT} - name: DJANGO_DEBUG value: ${DJANGO_DEBUG} livenessProbe: diff --git a/openshift/templates/task-queue/task-queue-dc.yaml b/openshift/templates/task-queue/task-queue-dc.yaml index 4cb3b44c..fb67d317 100644 --- a/openshift/templates/task-queue/task-queue-dc.yaml +++ b/openshift/templates/task-queue/task-queue-dc.yaml @@ -38,6 +38,9 @@ parameters: - name: DJANGO_DEBUG value: 'False' required: true + - name: CRA_ENVIRONMENT + description: the environment for CRA, P for production, A for all other envs + required: true objects: - apiVersion: image.openshift.io/v1 kind: ImageStream @@ -199,7 +202,9 @@ objects: - name: DJANGO_TASKS value: 'true' - name: CORS_ORIGIN_WHITELIST - value: "https://${NAME}${SUFFIX}.apps.silver.devops.gov.bc.ca" + value: "https://${NAME}${SUFFIX}.apps.silver.devops.gov.bc.ca" + - name: CRA_ENVIRONMENT + value: ${CRA_ENVIRONMENT} readinessProbe: exec: command: