Skip to content

Commit 634efee

Browse files
authored
fix: Resolve frontend ng8107 strict warnings (#1044)
1 parent 10da052 commit 634efee

17 files changed

Lines changed: 7885 additions & 4979 deletions

File tree

admin/src/app/analytics-dashboard/analytics-dashboard.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ <h1 class="text-muted mb-0">Dashboard</h1>
9292
Total FOMs published for public comments
9393
</div>
9494
<div class="total-fom-content-value">
95-
{{ analyticsData()?.nonInitialPublishedProjectCount || 0 }}
95+
{{ analyticsData().nonInitialPublishedProjectCount || 0 }}
9696
</div>
9797
</div>
9898
</div>
@@ -191,7 +191,7 @@ <h1 class="text-muted mb-0">Dashboard</h1>
191191
<div class="unique-fc-box">
192192
<div>Unique forest clients submitting FOMs</div>
193193
<div class="unique-fc-vtxt">
194-
{{ analyticsData()?.uniqueForestClientCount || 0 }}
194+
{{ analyticsData().uniqueForestClientCount || 0 }}
195195
</div>
196196
</div>
197197
<div id="foms-by-forest-client" class="mt-3">

admin/src/app/foms/fom-detail/fom-detail.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ <h2>Details</h2>
100100
<span class="name">FSP ID:</span>
101101
<span
102102
class="value">
103-
{{project()?.fspId}}
103+
{{project().fspId}}
104104
</span>
105105
</li>
106106
}
@@ -109,7 +109,7 @@ <h2>Details</h2>
109109
<span class="name">Woodlot Licence Number:</span>
110110
<span
111111
class="value">
112-
{{project()?.woodlotLicenseNumber}}
112+
{{project().woodlotLicenseNumber}}
113113
</span>
114114
</li>
115115
}
@@ -134,7 +134,7 @@ <h2>Details</h2>
134134
<span class="name">District:</span>
135135
<span
136136
class="value">
137-
{{project().district ? project().district?.name : 'A district has not been specified'}}
137+
{{project().district ? project().district.name : 'A district has not been specified'}}
138138
</span>
139139
</li>
140140
<li>

admin/src/app/foms/fom-detail/fom-detail.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ export class FomDetailComponent implements OnInit {
5858
* value — safe here because the constructor opts this route out of component reuse, so a new
5959
* FOM always means a new component instance.
6060
*/
61-
readonly project = linkedSignal<ProjectResponse>(() => this.projectDetail()!);
61+
readonly project = linkedSignal<ProjectResponse>(() => this.projectDetail());
6262
// Route resolver data, bound as inputs (a/:appId resolve keys).
63-
readonly projectDetail = input<ProjectResponse>();
63+
readonly projectDetail = input.required<ProjectResponse>();
6464
readonly spatialDetail = input.required<SpatialFeaturePublicResponse[]>();
6565
readonly projectMetrics = input.required<ProjectMetricsResponse>();
6666
public isProjectActive = false;

admin/src/app/foms/fom-submission/fom-submission.component.html

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,16 @@ <h1 class="text-muted">{{project()?.projectPlanCode == projectPlanCodeEnum.Fsp
9898
</div>
9999
</fieldset>
100100
@if (spatialSubmission(); as sub) {
101-
@if (sub.cutblocks?.count > 0
102-
|| sub.roadSections?.count > 0
103-
|| sub.retentionAreas?.count > 0) {
101+
@if (sub.cutblocks || sub.roadSections || sub.retentionAreas) {
104102
<fieldset class="no-margin no-border"
105103
>
106104
<legend> Submitted Spatial Objects </legend>
107105
<ul class="nv-list">
108-
@if (sub.cutblocks?.count > 0) {
106+
@if (sub.cutblocks; as cutblocks) {
109107
<li
110108
style="padding-bottom: 0">
111-
<span class="name">Cut block submission - {{sub.cutblocks.count}} blocks</span>
112-
<span class="value1">{{sub.cutblocks.dateSubmitted | date}}</span>
109+
<span class="name">Cut block submission - {{cutblocks.count}} blocks</span>
110+
<span class="value1">{{cutblocks.dateSubmitted | date}}</span>
113111
<span class="action">
114112
@if (canDeleteSpatialSubmission()) {
115113
<button class="btn btn-icon no-padding no-border" title="Remove Cutblocks"
@@ -127,11 +125,11 @@ <h1 class="text-muted">{{project()?.projectPlanCode == projectPlanCodeEnum.Fsp
127125
</span>
128126
</li>
129127
}
130-
@if (sub.roadSections?.count > 0) {
128+
@if (sub.roadSections; as roadSections) {
131129
<li
132130
style="padding-bottom: 0">
133-
<span class="name">Road section submission - {{sub.roadSections.count}} sections</span>
134-
<span class="value1">{{sub.roadSections.dateSubmitted | date}}</span>
131+
<span class="name">Road section submission - {{roadSections.count}} sections</span>
132+
<span class="value1">{{roadSections.dateSubmitted | date}}</span>
135133
<span class="action">
136134
@if (canDeleteSpatialSubmission()) {
137135
<button class="btn btn-icon no-padding no-border" title="Remove Road Sections"
@@ -149,11 +147,11 @@ <h1 class="text-muted">{{project()?.projectPlanCode == projectPlanCodeEnum.Fsp
149147
</span>
150148
</li>
151149
}
152-
@if (sub.retentionAreas?.count > 0) {
150+
@if (sub.retentionAreas; as retentionAreas) {
153151
<li
154152
style="padding-bottom: 0">
155-
<span class="name">Retention area submission - {{sub.retentionAreas.count}} areas</span>
156-
<span class="value1">{{sub.retentionAreas.dateSubmitted | date}}</span>
153+
<span class="name">Retention area submission - {{retentionAreas.count}} areas</span>
154+
<span class="value1">{{retentionAreas.dateSubmitted | date}}</span>
157155
<span class="action">
158156
@if (canDeleteSpatialSubmission()) {
159157
<button class="btn btn-icon no-padding no-border" title="Remove Retention Areas"

admin/src/app/foms/interactions/interactions.component.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,14 @@ <h2 style="margin: 0;">Engagements ({{data.length}})</h2>
6666
<div class="panel-scroll">
6767
<app-interaction-detail #interactionDetailForm="interactionForm">
6868
<div class="row">
69-
@if (canModifyInteraction()) {
69+
<!-- Also gated on interaction(): this button is projected into the child, but its
70+
bindings are evaluated in this view even while the child leaves the
71+
<ng-content> slot unrendered, and interactionFormGroup is not assigned until
72+
an interaction is selected. -->
73+
@if (canModifyInteraction() && interactionDetailForm.interaction()) {
7074
<button type="button" title="Save this engagement"
7175
class="btn btn-sm btn-primary btn-container"
72-
[disabled]="loadingSvc.loading() || interactionDetailForm.interactionFormGroup?.invalid"
76+
[disabled]="loadingSvc.loading() || interactionDetailForm.interactionFormGroup.invalid"
7377
(click)="saveInteraction(interactionDetailForm.interactionFormGroup.value, interactionDetailForm.interaction())">
7478
Save interaction
7579
</button>

admin/src/app/foms/summary/summary.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ <h4>Geographic Shape Information</h4>
119119
</div>
120120
</section>
121121

122-
@if (!selectedScope()?.commentScopeCode) {
122+
@if (!selectedScope().commentScopeCode) {
123123
<section>
124124
<div>
125125
<app-interactions-summary [interactionDetails]="interactions()"
@@ -129,7 +129,7 @@ <h4>Geographic Shape Information</h4>
129129
}
130130
</section>
131131

132-
@if (!selectedScope()?.commentScopeCode) {
132+
@if (!selectedScope().commentScopeCode) {
133133
<section>
134134
<h4>Attachments</h4>
135135
@if ((attachments()?.length ?? 0) > 0) {
@@ -173,7 +173,7 @@ <h4>Attachments</h4>
173173
</section>
174174
}
175175

176-
@if (!selectedScope()?.commentScopeCode) {
176+
@if (!selectedScope().commentScopeCode) {
177177
<section>
178178
<small>
179179
{{project()?.projectPlanCode == projectPlanCodeEnum.Fsp

admin/src/app/search/search.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ <h2>
146146
[innerHTML]="project.forestClient ? (project.forestClient.name | titlecase) : ''">
147147
</td>
148148
<td>
149-
{{project.district?.name}}
149+
{{project.district.name}}
150150
</td>
151151
<td>
152152
{{project.workflowState? project.workflowState.description : 'Unknown'}}

api/openapi/swagger-spec.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2956,8 +2956,6 @@
29562956
"revisionCount",
29572957
"createTimestamp",
29582958
"commentScope",
2959-
"response",
2960-
"responseDetails",
29612959
"scopeFeatureName"
29622960
]
29632961
},
@@ -3193,10 +3191,7 @@
31933191
"required": [
31943192
"projectId",
31953193
"submissionId",
3196-
"submissionTypeCode",
3197-
"cutblocks",
3198-
"roadSections",
3199-
"retentionAreas"
3194+
"submissionTypeCode"
32003195
]
32013196
},
32023197
"SubmissionTypeCode": {

api/src/app/modules/public-comment/public-comment.dto.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ApiProperty, OmitType } from '@nestjs/swagger';
1+
import { ApiProperty, ApiPropertyOptional, OmitType } from '@nestjs/swagger';
22
import {
33
IsArray,
44
IsEmail,
@@ -90,10 +90,11 @@ export class PublicCommentAdminResponse extends OmitType(
9090
@ApiProperty()
9191
commentScope: CommentScopeCode;
9292

93-
@ApiProperty()
93+
// Optional: a comment that has not been actioned yet has no response code.
94+
@ApiPropertyOptional()
9495
response?: ResponseCode;
9596

96-
@ApiProperty()
97+
@ApiPropertyOptional()
9798
responseDetails?: string;
9899

99100
@ApiProperty()

api/src/app/modules/submission/submission.dto.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ApiProperty } from '@nestjs/swagger';
1+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
22
import { IsEnum, IsNotEmpty } from 'class-validator';
33
import { FeatureCollection } from 'geojson';
44
import { SubmissionTypeCodeEnum } from './submission-type-code.entity';
@@ -78,12 +78,15 @@ export class SubmissionDetailResponse {
7878
})
7979
submissionTypeCode: SubmissionTypeCodeEnum;
8080

81-
@ApiProperty({type: SubmissionSpatialObjectDetail})
82-
cutblocks: SubmissionSpatialObjectDetail;
81+
// All three are optional and only present when that spatial type was actually submitted:
82+
// convertToSubmissionDetailResponse assigns each one only when its count is greater than zero
83+
// (see submission.service.ts).
84+
@ApiPropertyOptional({type: SubmissionSpatialObjectDetail})
85+
cutblocks?: SubmissionSpatialObjectDetail;
8386

84-
@ApiProperty({type: SubmissionSpatialObjectDetail})
85-
roadSections: SubmissionSpatialObjectDetail;
87+
@ApiPropertyOptional({type: SubmissionSpatialObjectDetail})
88+
roadSections?: SubmissionSpatialObjectDetail;
8689

87-
@ApiProperty({type: SubmissionSpatialObjectDetail})
88-
retentionAreas: SubmissionSpatialObjectDetail;
90+
@ApiPropertyOptional({type: SubmissionSpatialObjectDetail})
91+
retentionAreas?: SubmissionSpatialObjectDetail;
8992
}

0 commit comments

Comments
 (0)