Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

back-merge main into develop #1648

Merged
merged 38 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
207ae5c
Merge pull request #1512 from bcgov/develop
trslater Apr 29, 2024
bdae64e
Merge pull request #1632 from bcgov/develop
dhaselhan Apr 29, 2024
ea8adfa
Always send emails for applications when submitting to LG
Apr 30, 2024
41e9533
Merge pull request #1636 from bcgov/feature/ALCS-1878
dhaselhan Apr 30, 2024
1322b07
Merge pull request #1635 from bcgov/develop
mhuseinov Apr 30, 2024
2ae8f9f
Allow Snowplow via CSP
Apr 30, 2024
fa771d6
Move snowplow to its own script
Apr 30, 2024
878c4cc
More Snowplow
May 1, 2024
d354fb3
Add connect-src for snowplower, fix main docker
May 1, 2024
c074ec1
Merge pull request #1646 from bcgov/feature/ALCS-1890-2
dhaselhan May 2, 2024
7c1bb20
fix send email on LFNG change
mhuseinov May 2, 2024
3f60bef
Merge pull request #1647 from bcgov/bugfix/ALCS-1815-fix-send-email
mhuseinov May 2, 2024
3a9411b
Navigate to planning review detail view from header search (#1650)
sandratoh May 2, 2024
194ba08
Do not count planning referrals without cards for PR header
May 6, 2024
b80dc5c
Add inquiry to assigned and subtask counts
May 6, 2024
40714d5
Merge pull request #1653 from bcgov/feature/ALCS-1902
dhaselhan May 6, 2024
b829665
Merge pull request #1654 from bcgov/feature/ALCS-1901
dhaselhan May 6, 2024
ae50cee
do not populate visibility flag on Planning Review documents
mhuseinov May 6, 2024
57b904a
Merge pull request #1655 from bcgov/bugfix/ALCS-1916-pr-documents-flag
mhuseinov May 6, 2024
755ad1d
Retain file type when renaming file
May 6, 2024
d749934
Merge pull request #1657 from bcgov/feature/ALCS-1915
dhaselhan May 6, 2024
048d8e1
Add submission date to PR search results and update default sor field…
sandratoh May 6, 2024
85a908d
Filter out PRs without Cards from Schedule
May 6, 2024
d6d77ca
Merge pull request #1658 from bcgov/feature/ALCS-1908
dhaselhan May 7, 2024
1f4c952
Fix for PR decision indexing
mhuseinov May 7, 2024
dc71b5c
Filter out empty emails
trslater May 7, 2024
644275d
Merge pull request #1659 from bcgov/bugfix/ALCS-1907-decision-indexin…
mhuseinov May 7, 2024
73224d4
Fail resend if email isn't sent
trslater May 7, 2024
ec6143e
Return strict boolean from email service
trslater May 7, 2024
0ba08ba
Merge pull request #1660 from bcgov/hotfix/ALCS-1918
trslater May 7, 2024
e1c6b43
properly retrieve properties for PR insert
mhuseinov May 8, 2024
0c30d21
Downgrade CLS Package
May 8, 2024
b50bf82
Merge pull request #1665 from bcgov/feature/hotfix
dhaselhan May 8, 2024
d5ebc02
Mount CLS directly
May 8, 2024
d38962c
Merge pull request #1666 from bcgov/feature/hotfix
dhaselhan May 8, 2024
867c74b
Re-update CLS
May 8, 2024
8195b25
Merge pull request #1667 from bcgov/daniel/hotfix
dhaselhan May 8, 2024
7374e44
Merge pull request #1664 from bcgov/bugfix/planning-review-decisions-etl
mhuseinov May 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions alcs-frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ FROM node:20-alpine AS build
WORKDIR /app

# Copy package.json file
COPY package.json .
COPY package.json package-lock.json ./

# Install dependencies
RUN npm install
RUN npm ci

# Copy the source code to the /app directory
COPY . .

ENV NODE_OPTIONS="--max-old-space-size=2048"

# Build the application
RUN npm run build -- --output-path=dist --output-hashing=all

Expand Down
2 changes: 1 addition & 1 deletion alcs-frontend/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ http {
add_header 'X-XSS-Protection' '1; mode=block';
add_header 'Strict-Transport-Security' 'max-age=31536000; includeSubDomains; preload';
add_header 'Cache-control' 'no-cache';
add_header 'Content-Security-Policy' "default-src 'self';img-src 'self';style-src 'unsafe-inline' 'self';connect-src $ENABLED_CONNECT_SRC; font-src 'self' https://fonts.gstatic.com https://fonts.googleapis.com; base-uri 'self'; object-src https://nrs.objectstore.gov.bc.ca; frame-src https://alcs-metabase-test.apps.silver.devops.gov.bc.ca https://alcs-metabase-prod.apps.silver.devops.gov.bc.ca https://nrs.objectstore.gov.bc.ca;";
add_header 'Content-Security-Policy' "default-src 'self'; img-src 'self'; style-src 'unsafe-inline' 'self'; connect-src $ENABLED_CONNECT_SRC; font-src 'self' https://fonts.gstatic.com https://fonts.googleapis.com; base-uri 'self'; object-src https://nrs.objectstore.gov.bc.ca; frame-src https://alcs-metabase-test.apps.silver.devops.gov.bc.ca https://alcs-metabase-prod.apps.silver.devops.gov.bc.ca https://nrs.objectstore.gov.bc.ca; script-src 'self' https://www2.gov.bc.ca";
add_header 'Permissions-Policy' 'camera=(), geolocation=(), microphone=()';
add_header 'Referrer-Policy' 'same-origin';

Expand Down
2 changes: 2 additions & 0 deletions alcs-frontend/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ import { Component } from '@angular/core';
})
export class AppComponent {
title = 'alcs-frontend';

constructor() {}
}
12 changes: 6 additions & 6 deletions alcs-frontend/src/app/features/board/board.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,18 +390,18 @@ export class BoardComponent implements OnInit, OnDestroy {

private mapPlanningReferralToCard(referral: PlanningReferralDto): CardData {
return {
status: referral.card.status.code,
status: referral.card!.status.code,
typeLabel: 'Planning Review',
title: `${referral.planningReview.fileNumber} (${referral.planningReview.documentName})`,
titleTooltip: referral.planningReview.type.label,
assignee: referral.card.assignee,
id: referral.card.uuid,
assignee: referral.card!.assignee,
id: referral.card!.uuid,
labels: [referral.planningReview.type],
cardType: CardType.PLAN,
paused: false,
highPriority: referral.card.highPriority,
cardUuid: referral.card.uuid,
dateReceived: referral.card.createdAt,
highPriority: referral.card!.highPriority,
cardUuid: referral.card!.uuid,
dateReceived: referral.card!.createdAt,
dueDate: referral.dueDate ? new Date(referral.dueDate) : undefined,
decisionMeetings: referral.planningReview.meetings,
showDueDate: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class CreatePlanningReviewDialogComponent implements OnInit, OnDestroy {
this.dialogRef.close(true);
if (res) {
await this.router.navigate(this.activatedRoute.snapshot.url, {
queryParams: res.card.uuid && res.card.type ? { card: res.card.uuid, type: res.card.type } : {},
queryParams: res.card && res.card.uuid && res.card.type ? { card: res.card.uuid, type: res.card.type } : {},
relativeTo: this.activatedRoute,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class PlanningReviewDialogComponent extends CardDialogComponent implement
...this.data.planningReview.type,
borderColor: this.data.planningReview.type.backgroundColor,
};
this.populateCardData(this.data.card);
this.populateCardData(this.data.card!);

this.selectedRegion = this.data.planningReview.region.code;
this.cardTitle = `${this.data.planningReview.fileNumber} (${this.data.planningReview.documentName})`;
Expand All @@ -64,16 +64,16 @@ export class PlanningReviewDialogComponent extends CardDialogComponent implement
}

private async reload() {
const planningReferral = await this.planningReferralService.fetchByCardUuid(this.planningReferral.card.uuid);
const planningReferral = await this.planningReferralService.fetchByCardUuid(this.planningReferral.card!.uuid);
if (planningReferral) {
await this.populateCardData(planningReferral.card);
await this.populateCardData(planningReferral.card!);
}
}

async onBoardSelected(board: BoardWithFavourite) {
this.selectedBoard = board.code;
try {
await this.boardService.changeBoard(this.planningReferral.card.uuid, board.code);
await this.boardService.changeBoard(this.planningReferral.card!.uuid, board.code);
const loadedBoard = await this.boardService.fetchBoardDetail(board.code);
if (loadedBoard) {
this.boardStatuses = loadedBoard.statuses;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ export class AssignedComponent implements OnInit {

this.planningReferrals = [
...planningReferrals
.filter((r) => r.card.highPriority)
.filter((r) => r.card!.highPriority)
.map((r) => this.mapPlanningReferral(r))
.sort((a, b) => a.date! - b.date!),
...planningReferrals
.filter((r) => !r.card.highPriority)
.filter((r) => !r.card!.highPriority)
.map((r) => this.mapPlanningReferral(r))
.sort((a, b) => a.date! - b.date!),
];
Expand Down Expand Up @@ -133,16 +133,17 @@ export class AssignedComponent implements OnInit {
this.applications.length +
this.planningReferrals.length +
this.noticeOfIntents.length +
this.notifications.length;
this.notifications.length +
this.inquiries.length;
}

private mapPlanningReferral(p: PlanningReferralDto): AssignedToMeFile {
return {
title: `${p.planningReview.fileNumber} (${p.planningReview.documentName})`,
type: p.card.type,
date: p.card.createdAt,
card: p.card,
highPriority: p.card.highPriority,
type: p.card!.type,
date: p.card!.createdAt,
card: p.card!,
highPriority: p.card!.highPriority,
labels: [p.planningReview.type],
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ export class SubtaskComponent implements OnInit, OnDestroy {

if (this.showAppAndNonApp) {
this.totalSubtaskCount =
this.applicationSubtasks.length + this.planningReviewSubtasks.length + this.notificationSubtasks.length;
this.applicationSubtasks.length +
this.planningReviewSubtasks.length +
this.notificationSubtasks.length +
this.inquirySubtasks.length;
}

if (this.showAppAndNonApp && this.showNoi) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class DecisionDocumentUploadDialogComponent implements OnInit {
async onSubmit() {
const file = this.pendingFile;
if (file) {
const renamedFile = new File([file], this.name.value + this.extension ?? file.name);
const renamedFile = new File([file], this.name.value + this.extension ?? file.name, { type: file.type });
this.isSaving = true;
if (this.data.existingDocument) {
await this.decisionService.deleteFile(this.data.decisionUuid, this.data.existingDocument.uuid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class DecisionDocumentUploadDialogComponent implements OnInit {
async onSubmit() {
const file = this.pendingFile;
if (file) {
const renamedFile = new File([file], this.name.value + this.extension ?? file.name);
const renamedFile = new File([file], this.name.value + this.extension ?? file.name, { type: file.type });
this.isSaving = true;
if (this.data.existingDocument) {
await this.decisionService.deleteFile(this.data.decisionUuid, this.data.existingDocument.uuid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ export class HeaderComponent implements OnChanges {
async setupLinkedCards() {
if ('referrals' in this.planningReview) {
for (const [index, referral] of this.planningReview.referrals.entries()) {
this.linkedCards.push({
...referral.card,
displayName: `Referral #${this.planningReview.referrals.length - index}`,
});
if (referral.card) {
this.linkedCards.push({
...referral.card,
displayName: `Referral #${this.planningReview.referrals.length - index}`,
});
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class InquirySearchTableComponent {
itemsPerPage = 20;
total = 0;
sortDirection: SortDirection = 'desc';
sortField = 'fileId';
sortField = 'dateSubmitted';
isLoading = false;

constructor(private router: Router) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
</td>
</ng-container>

<ng-container matColumnDef="dateSubmitted">
<th *matHeaderCellDef mat-header-cell mat-sort-header>Date Submitted to ALC</th>
<td *matCellDef="let element" mat-cell>
{{ element.dateSubmitted | date | emptyColumn }}
</td>
</ng-container>

<ng-container matColumnDef="type">
<th *matHeaderCellDef mat-header-cell mat-sort-header>Type</th>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { TableChange } from '../search.interface';

interface SearchResult {
fileNumber: string;
dateSubmitted: number;
applicant: string;
localGovernmentName?: string;
referenceId: string;
Expand Down Expand Up @@ -36,13 +37,13 @@ export class PlanningReviewSearchTableComponent {

@Output() tableChange = new EventEmitter<TableChange>();

displayedColumns = ['fileId', 'type', 'applicant', 'government', 'status'];
displayedColumns = ['fileId', 'dateSubmitted', 'type', 'applicant', 'government', 'status'];
dataSource: PlanningReviewSearchResultDto[] = [];

itemsPerPage = 20;
total = 0;
sortDirection: SortDirection = 'desc';
sortField = 'fileId';
sortField = 'dateSubmitted';
isLoading = false;

constructor(private router: Router) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export interface PlanningReferralDto {
responseDescription?: string;
submissionDate: number;
planningReview: PlanningReviewDto;
card: CardDto;
card?: CardDto;
}

export interface UpdatePlanningReviewDto {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ export class SearchBarComponent implements AfterViewInit {
break;
case 'COV':
case 'PLAN':
await this.router.navigateByUrl(
`/board/${result.boardCode}?card=${result.referenceId}&type=${result.type}`,
);
await this.router.navigate(['planning-review', result.referenceId]);
break;
default:
this.toastService.showErrorToast(`Unable to navigate to ${result.referenceId}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def _map_data(row):
"planning_review_uuid": row["planning_review_uuid"],
"document_uuid": row["document_uuid"],
"type_code": row["type_code"],
"visibility_flags": row["visibility_flags"],
"visibility_flags": '{""}',
"oats_document_id": row["oats_document_id"],
"oats_planning_review_id": row["oats_planning_review_id"],
"audit_created_by": OATS_ETL_USER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ with oats_documents_to_map as (
select otm.planning_review_uuid,
otm.document_uuid,
otm.code as type_code,
(
case
when is_public = 'Y'
and is_app_lg = 'Y' then '{P, A, C, G}'::text []
when is_public = 'Y' then '{P}'::text []
when is_app_lg = 'Y' then '{A, C, G}'::text []
else '{}'::text []
end
) as visibility_flags,
oats_document_id,
oats_planning_review_id,
otm."description"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
add_timezone_and_keep_date_part,
OatsToAlcsDecisionOutcomes,
AlcsPlanningReviewOutcomes,
to_alcs_format,
get_now_with_offset,
)
from db import inject_conn_pool
from psycopg2.extras import RealDictCursor, execute_batch
Expand Down Expand Up @@ -39,6 +41,8 @@ def process_planning_review_decisions(conn=None, batch_size=BATCH_UPLOAD_SIZE):
failed_inserts_count = 0
successful_inserts_count = 0
last_planning_decision_id = 0
last_file_number = 0
last_decision_date = ""

with open(
"planning_review/sql/decisions/planning_review_decisions_insert.sql",
Expand All @@ -47,10 +51,16 @@ def process_planning_review_decisions(conn=None, batch_size=BATCH_UPLOAD_SIZE):
) as sql_file:
query = sql_file.read()
while True:
query_condition = ""
if last_decision_date:
query_condition = f"WHERE pr.file_number::bigint >= {last_file_number} AND opd.decision_date >= '{last_decision_date}' AND opd.planning_decision_id > {last_planning_decision_id} ORDER BY pr.file_number::bigint, opd.decision_date, opd.planning_decision_id;"
else:
query_condition = f"WHERE pr.file_number::bigint >= {last_file_number} AND opd.planning_decision_id > {last_planning_decision_id} ORDER BY pr.file_number::bigint, opd.decision_date, opd.planning_decision_id;"

cursor.execute(
f"""
{query}
WHERE opd.planning_decision_id > {last_planning_decision_id} ORDER BY opd.planning_decision_id;
{query_condition}
"""
)

Expand All @@ -64,9 +74,18 @@ def process_planning_review_decisions(conn=None, batch_size=BATCH_UPLOAD_SIZE):
successful_inserts_count = successful_inserts_count + len(
inserted_data
)
last_planning_decision_id = dict(inserted_data[-1])[
"planning_decision_id"
]
last_record = dict(inserted_data[-1])
last_planning_decision_id = last_record["planning_decision_id"]
last_inserted_row = next(
(
row
for row in rows
if row["uuid"] == last_record["review_uuid"]
),
None,
)
last_file_number = last_inserted_row["file_number"]
last_decision_date = last_inserted_row["decision_date"]

logger.debug(
f"Retrieved/updated items count: {len(inserted_data)}; total successfully inserted planning referral so far {successful_inserts_count}; last updated planning_decision_id: {last_planning_decision_id}"
Expand Down Expand Up @@ -106,7 +125,8 @@ def _insert_base_fields(conn, batch_size, cursor, rows):
outcome_code,
resolution_number,
resolution_year,
date
date,
created_at
)
VALUES (
%(review_uuid)s,
Expand All @@ -116,13 +136,16 @@ def _insert_base_fields(conn, batch_size, cursor, rows):
%(outcome_code)s,
%(resolution_number)s,
%(resolution_year)s,
%(date)s
%(date)s,
%(created_at)s
)
ON CONFLICT DO NOTHING;
"""


def _prepare_oats_planning_review_data(row_data_list):
mapped_data_list = []
insert_index = 0
for row in row_data_list:
mapped_data_list.append(
{
Expand All @@ -134,8 +157,11 @@ def _prepare_oats_planning_review_data(row_data_list):
"outcome_code": _map_outcome_code(row),
"resolution_number": row["resolution_number"],
"resolution_year": _map_resolution_year(row),
"created_at": to_alcs_format(get_now_with_offset(insert_index)),
"file_number": row["file_number"],
}
)
insert_index += 1

return mapped_data_list

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ SELECT
opd.planning_acceptance_code,
pr."uuid",
opd.resolution_number,
opd.planning_decision_id
opd.planning_decision_id,
pr.file_number::bigint
FROM
oats.oats_planning_decisions opd
JOIN alcs.planning_review pr ON opd.planning_review_id::TEXT = pr.file_number
2 changes: 2 additions & 0 deletions portal-frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ RUN npm ci
# Copy the source code to the /app directory
COPY . .

ENV NODE_OPTIONS="--max-old-space-size=2048"

# Build the application
RUN npm run build -- --output-path=dist --output-hashing=all

Expand Down
Loading
Loading