Skip to content

Commit 50ac28f

Browse files
committed
Fixes demographic field validation.
Updates field validation logic to prevent errors when no sectors/subsectors are selected. Also updates 'select' dropdowns to read 'Select' instead of 'Select Option' for consistency across translations.
1 parent 3021837 commit 50ac28f

File tree

11 files changed

+33
-211
lines changed

11 files changed

+33
-211
lines changed

CSETWebApi/CSETWeb_Api/CSETWebCore.Business/App_Data/FieldValidation/FieldValidation.json

Lines changed: 3 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
},
66
{
77
"key": "OrganizationName",
8-
"value": "Organization Name"
8+
"value": "Name of Organization"
99
},
1010
{
1111
"key": "BusinessUnit",
@@ -15,21 +15,13 @@
1515
"key": "SectorSubsectors",
1616
"value": "Sector and Subsector"
1717
},
18-
//{
19-
// "key": "Subsector",
20-
// "value": "Subsector"
21-
//},
2218
{
2319
"key": "NumberEmployeesTotal",
2420
"value": "Number of employees in the agency/business"
2521
},
26-
//{
27-
// "key": "NumberEmployeesUnit",
28-
// "value": "Number of employees in the department/unit"
29-
//},
3022
{
3123
"key": "AnnualRevenue",
32-
"value": "Annual revenue/funding"
24+
"value": "Annual revenue/funding of agency/business"
3325
},
3426
{
3527
"key": "Standard1",
@@ -47,14 +39,7 @@
4739
"key": "RegulationType2",
4840
"value": "Regulation Type 2"
4941
},
50-
//{
51-
// "key": "Barrier1",
52-
// "value": "Most significant information sharing barrier"
53-
//},
54-
//{
55-
// "key": "Barrier2",
56-
// "value": "Second most significant information sharing barrier"
57-
//},
42+
5843

5944

6045

@@ -65,21 +50,6 @@
6550
"key": "cisaregion",
6651
"value": "CISA Region"
6752
},
68-
//11
69-
//{
70-
// "key": "CriticalDependencyIncidentResponseSupport",
71-
// "value": "Critical Dependency for Incident Response Support"
72-
//},
73-
//12
74-
//{
75-
// "key": "CriticalServiceRevenuePercent",
76-
// "value": "Percent of annual revenue dependent on the Critical Service"
77-
//},
78-
//13
79-
//{
80-
// "key": "NumberPeopleServedByCritSvc",
81-
// "value": "Number of people served annually by the Critical Service"
82-
//},
8353

8454

8555

@@ -103,59 +73,4 @@
10373
"key": "DisruptedSector2",
10474
"value": "Second most important disrupted sector"
10575
}
106-
// 16
107-
//{
108-
// "key": "ItIcsName",
109-
// "value": "Critical Service - IT/ICS System"
110-
//},
111-
//18
112-
//{
113-
// "key": "ItIcsStaffCount",
114-
// "value": "Critical Service - IT/ICS management and staff count"
115-
//},
116-
//19
117-
//{
118-
// "key": "CybersecurityItIcsStaffCount",
119-
// "value": "Critical Service - IT/ICS cybersecurity management and staff count"
120-
//},
121-
//20
122-
//{
123-
// "key": "AuthorizedOrganizationalUserCount",
124-
// "value": "Critical Service - Organizational user count"
125-
////},
126-
//21
127-
//{
128-
// "key": "AuthorizedNonOrganizationalUserCount",
129-
// "value": "Critical Service - Non-organizational user count"
130-
////},
131-
//22
132-
//{
133-
// "key": "CustomersCount",
134-
// "value": "Critical Service - Customer count"
135-
//},
136-
//23
137-
//{
138-
// "key": "NetworksDescription",
139-
// "value": "Critical Service - Networks description"
140-
//},
141-
//24
142-
//{
143-
// "key": "ServicesDescription",
144-
// "value": "Critical Service - Services description"
145-
//},
146-
//25
147-
//{
148-
// "key": "ApplicationsDescription",
149-
// "value": "Critical Service - Applications description"
150-
//},
151-
//26
152-
//{
153-
// "key": "ConnectionsDescription",
154-
// "value": "Critical Service - Connections description"
155-
//},
156-
//27
157-
//{
158-
// "key": "PersonnelDescription",
159-
// "value": "Critical Service - Individuals Description"
160-
//}
16176
]

CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Demographic/CisaAssessorWorkflowFieldValidator.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,15 @@ public CisaWorkflowFieldValidationResponse ValidateFields()
9393
// special case for sector/subsector
9494
if (field.Key == "SectorSubsectors")
9595
{
96-
96+
var ss = (List<SectorSubsector>)propertyValue;
97+
if (ss.All(x => x.SectorId == null && x.SubsectorId == null)
98+
|| ss.Any(x => x.SectorId != null && x.SubsectorId == null))
99+
{
100+
invalidFields.Add(field.Value);
101+
continue;
102+
}
97103
}
98104

99-
100105
if (propertyValue == null)
101106
{
102107
invalidFields.Add(field?.Value ?? property.Name);

CSETWebNg/src/app/assessment/prepare/assessment-info/assessment-config-iod/assessment-config-iod.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<label for="name" class="form-label">{{t('cisa region')}}</label>
6161
<select class="form-select" id="cisaRegion" tabindex="0" name="cisaRegion" (change)="updateDemographicsIod()"
6262
[(ngModel)]="iodDemographics.cisaRegion">
63-
<option [ngValue]="null">-- Select Region --</option>
63+
<option [ngValue]="null">-- {{t('select')}} --</option>
6464
<option *ngFor="let region of iodDemographics.cisaRegions" [ngValue]="region.optionValue">
6565
{{region.optionText}}
6666
</option>
@@ -136,7 +136,7 @@ <h4>{{ t('assessment settings') }}</h4>
136136
<label class="form-label" for="facilitator">{{t('contact.facilitator')}}</label>
137137
<select class="form-select" id="facilitator" tabindex="0" name="facilitator" (change)="updateDemographics()"
138138
[(ngModel)]="demographics.facilitatorId">
139-
<option [ngValue]="null">-- {{t('select facilitator')}} --</option>
139+
<option [ngValue]="null">-- {{t('select')}} --</option>
140140
<option *ngFor="let contact of contacts" [value]="contact.assessmentContactId">{{contact.firstName}}
141141
{{contact.lastName}}</option>
142142
</select>

CSETWebNg/src/app/assessment/prepare/assessment-info/assessment-demographics/assessment-demographics.component.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ <h4>{{t('demographics')}}</h4>
6363
<label class="form-label" for="assetValue">{{t('asset gross value')}}</label>
6464
<select #assetValueSelect class="form-select" id="assetValue" tabindex="0" name="assetValue"
6565
[(ngModel)]="demographicData.assetValue" (ngModelChange)="update($event)">
66-
<option [ngValue]="null">-- {{t('select gross value')}} --</option>
66+
<option [ngValue]="null">-- {{t('select')}} --</option>
6767
<option *ngFor="let asset of assetValues" [ngValue]="asset.demographicsAssetId"
6868
[selected]="asset.demographicsAssetId === demographicData.assetValue">{{asset.assetValue}}</option>
6969
</select>
@@ -73,7 +73,7 @@ <h4>{{t('demographics')}}</h4>
7373
<label class="form-label" for="size">{{t('expected effort')}}</label>
7474
<select class="form-select" id="size" tabindex="0" name="size" [(ngModel)]="demographicData.size"
7575
(ngModelChange)="update($event)">
76-
<option [ngValue]="null">-- {{t('select effort')}} --</option>
76+
<option [ngValue]="null">-- {{t('select')}} --</option>
7777
<option *ngFor="let s of sizeList" [ngValue]="s.sizeId">{{s.description}}</option>
7878
</select>
7979
</div>
@@ -82,9 +82,9 @@ <h4>{{t('demographics')}}</h4>
8282
<label class="form-label" for="facilitator">{{t('contact.facilitator')}}</label>
8383
<select class="form-select" id="facilitator" tabindex="0" name="facilitator"
8484
[(ngModel)]="demographicData.facilitatorId" (ngModelChange)="update($event)">
85-
<option [ngValue]="null">-- {{t('select facilitator')}} --</option>
86-
<option *ngFor="let contact of contacts" [ngValue]="contact.assessmentContactId">{{contact.firstName}}
87-
{{contact.lastName}}</option>
85+
<option [ngValue]="null">-- {{t('select')}} --</option>
86+
<option *ngFor="let contact of contacts" [ngValue]="contact.assessmentContactId">
87+
{{contact.firstName}} {{contact.lastName}}</option>
8888
</select>
8989
</div>
9090

@@ -106,12 +106,12 @@ <h4>{{t('demographics')}}</h4>
106106
<label class="form-label" for="edmOrganizationType">{{t('org type')}}</label>
107107
<select *ngIf="isSLTT" class="form-select" id="edmOrganizationType" tabindex="0" name="edmOrganizationType"
108108
[(ngModel)]="demographicData.organizationType" (ngModelChange)="update($event)">
109-
<option [ngValue]="null">-- {{t('select type')}} --</option>
109+
<option [ngValue]="null">-- {{t('select')}} --</option>
110110
<option *ngFor="let t of orgTypes" [ngValue]="t.id">{{t.text}}</option>
111111
</select>
112112
<select *ngIf="!isSLTT" class="form-select" id="edmOrganizationType" tabindex="0" name="edmOrganizationType"
113113
[(ngModel)]="demographicData.organizationType" (ngModelChange)="update($event)">
114-
<option [ngValue]="null">-- {{t('select type')}} --</option>
114+
<option [ngValue]="null">-- {{t('select')}} --</option>
115115
<ng-container *ngFor="let t of orgTypes">
116116
<option *ngIf="t.id!==3" [ngValue]="t.id">{{t.text}}
117117
</option>
@@ -123,7 +123,7 @@ <h4>{{t('demographics')}}</h4>
123123
<label class="form-label" for="orgPointOfContact">{{t('org poc')}}</label>
124124
<select class="form-select" id="orgPointOfContact" tabindex="0" name="orgPointOfContact"
125125
[(ngModel)]="demographicData.orgPointOfContact" (ngModelChange)="update($event)">
126-
<option [ngValue]="null">-- {{t('select contact')}} --</option>
126+
<option [ngValue]="null">-- {{t('select')}} --</option>
127127
<option *ngFor="let contact of contacts" [ngValue]="contact.assessmentContactId">{{contact.firstName}}
128128
{{contact.lastName}}</option>
129129
</select>
@@ -140,7 +140,7 @@ <h4>{{t('demographics')}}</h4>
140140
<label class="form-label" for="critSvcPointOfContact">{{t('crit svc poc')}}</label>
141141
<select class="form-select" id="critSvcPointOfContact" tabindex="0" name="critSvcPointOfContact"
142142
[(ngModel)]="demographicData.pointOfContact" (ngModelChange)="update($event)">
143-
<option [ngValue]="null">-- {{t('select contact')}} --</option>
143+
<option [ngValue]="null">-- {{t('select')}} --</option>
144144
<option *ngFor="let contact of contacts" [ngValue]="contact.assessmentContactId">
145145
{{contact.firstName}}
146146
{{contact.lastName}}</option>

CSETWebNg/src/app/assessment/prepare/assessment-info/demographics-iod/demographics-iod.component.html

Lines changed: 6 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ <h6 class="mb-4">
3030
<label for="orgType" class="form-label">Organization Type</label>
3131
<select [ngClass]="{ 'is-invalid' : !demographicData.organizationType }" class="form-select" id="orgType"
3232
tabindex="0" name="orgType" [(ngModel)]="demographicData.organizationType" (ngModelChange)="update($event)">
33-
<option [ngValue]="null">-- Select Type --</option>
33+
<option [ngValue]="null">-- {{t('select')}} --</option>
3434
<option *ngFor="let t of demographicData.listOrgTypes" [ngValue]="t.optionValue"
3535
[selected]="t.optionValue === demographicData.organizationType">
3636
{{ t.optionText }}
@@ -64,6 +64,7 @@ <h6 class="mb-4">
6464
</div>
6565
</div>
6666

67+
6768
<!-- #1 -->
6869
<div class="mb-5">
6970
<label for="numberEmployeesTotal" class="form-label" *ngIf="demographicData.organizationType == 1">
@@ -75,37 +76,14 @@ <h6 class="mb-4">
7576
<select [ngClass]="{ 'is-invalid' : !demographicData.numberEmployeesTotal }" class="form-select"
7677
id="numberEmployeesTotal" tabindex="0" name="numberEmployeesTotal"
7778
[(ngModel)]="demographicData.numberEmployeesTotal" (ngModelChange)="update($event)">
78-
<option [ngValue]="null">-- Select --</option>
79+
<option [ngValue]="null">-- {{t('select')}} --</option>
7980
<option *ngFor="let i of demographicData.listNumberEmployeeTotal" [ngValue]="i.optionValue">
8081
{{ i.optionText }}
8182
</option>
8283
</select>
8384
</div>
8485

85-
<!-- #2 -->
86-
<!-- <div class="mb-5">
87-
<label for="numberEmployeesUnit" *ngIf="demographicData.organizationType == 1" class="form-label"> Number of
88-
employees in the business unit? </label>
89-
<label for="numberEmployeesUnit" *ngIf="demographicData.organizationType != 1" class="form-label"> Number of
90-
employees in the department? </label>
91-
92-
<select [ngClass]="{ 'is-invalid' : !demographicData.numberEmployeesUnit }" class="form-select"
93-
id="numberEmployeesUnit" tabindex="0" name="numberEmployeesUnit" [(ngModel)]="demographicData.numberEmployeesUnit"
94-
(ngModelChange)="update($event)">
95-
<option [ngValue]="null">-- Select --</option>
96-
<option *ngFor="let i of demographicData.listNumberEmployeeUnit" [ngValue]="i.optionValue"
97-
[selected]="i.optionValue === demographicData.numberEmployeesUnit">
98-
{{ i.optionText }}
99-
</option>
100-
</select>
10186

102-
<div *ngIf="demographicData.organizationType == 1" class="fst-italic mb-2">
103-
Please select N/A if the business unit and the overall organization are the same.
104-
</div>
105-
<div *ngIf="demographicData.organizationType != 1" class="fst-italic mb-2">
106-
Please select N/A if the department and the overall organization are the same.
107-
</div>
108-
</div> -->
10987

11088
<!-- #3 -->
11189
<div class="mb-5">
@@ -119,18 +97,15 @@ <h6 class="mb-4">
11997
<select class="form-select" id="totalAnnualRevenue"
12098
tabindex="0" name="totalAnnualRevenue" [(ngModel)]="demographicData.annualRevenue"
12199
(ngModelChange)="update($event)">
122-
<option [ngValue]="null">-- Select --</option>
100+
<option [ngValue]="null">-- {{t('select')}} --</option>
123101
<option *ngFor="let i of demographicData.listRevenueAmounts" [ngValue]="i.optionValue"
124102
[selected]="i.optionValue === demographicData.annualRevenue">
125103
{{ i.optionText }}
126104
</option>
127105
</select>
128106
</div>
129107

130-
<!-- #4, #5, and #6 are located on the iod assessment configuration page with the other critical service fields -->
131-
<!-- #4 -->
132-
<!-- #5 -->
133-
<!-- #6 -->
108+
134109

135110
<!-- #7 -->
136111
<div class="mb-5">
@@ -213,54 +188,5 @@ <h6 class="mb-4">
213188
</div>
214189
</div>
215190

216-
<!-- #9 -->
217-
<!-- <div class="mb-5">
218-
<label for="assetValue" class="form-label">
219-
Please indicate the group(s) that your organization shares with or obtains cybersecurity-related information from.
220-
</label>
221-
<div class="ms-5">
222-
<div class="fst-italic my-2">Check all that apply.</div>
223-
<div class="mb-3">
224-
<ng-container *ngFor="let org of demographicData.listShareOrgs">
225-
<input type="checkbox" tabindex="0" [id]="'share-org-' + org.optionValue"
226-
[name]="'share-org-' + org.optionValue" class="checkbox-custom mt-1" (change)="changeShareOrg(org, $event)"
227-
[checked]="isSharedOrgChecked(org)" />
228-
<label [for]="'share-org-' + org.optionValue" class="checkbox-custom-label">
229-
{{ org.optionText }}
230-
</label>
231-
</ng-container>
232-
</div>
233-
234-
If other, please list:
235-
<input type="text" class="form-control" maxlength="150" [(ngModel)]="demographicData.shareOther"
236-
(change)="update($event)" name="shareOther" />
237-
<p class="fst-italic">Commas should be used to separate more than one entry.</p>
238-
</div>
239-
</div> -->
240-
241-
<!-- #10 -->
242-
<!-- <div>
243-
<label for="assetValue" class="form-label">
244-
Please select the two most significant barriers or concerns limiting your organization's participation in
245-
cybersecurity information sharing groups or initiatives.
246-
</label>
247-
<div class="ms-5">
248-
<div class="fst-italic my-2">
249-
If the name of the barrier is not listed please enter it directly into each box as applicable.
250-
</div>
251-
<label for="barrier1" class="form-label">Most significant</label>
252-
<input [ngClass]="{ 'is-invalid' : !demographicData.barrier1 }" type="text" maxlength="250"
253-
class="form-control mb-3" id="barrier1" name="barrier1" list="listBarriers"
254-
[(ngModel)]="demographicData.barrier1" (change)="update($event)" />
255-
<label for="barrier2" class="form-label">Second most significant</label>
256-
<input [ngClass]="{ 'is-invalid' : !demographicData.barrier2 }" type="text" maxlength="250"
257-
class="form-control mb-3" id="barrier2" name="barrier2" list="listBarriers"
258-
[(ngModel)]="demographicData.barrier2" (change)="update($event)" />
259-
</div>
260-
</div>
261-
262-
<datalist id="listBarriers">
263-
<option *ngFor="let barrier of demographicData.listBarriers" [attr.data-value]="barrier.optionValue"
264-
[value]="barrier.optionText"></option>
265-
</datalist> -->
191+
266192
</form>

CSETWebNg/src/app/assessment/prepare/csi/critical-service.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
Contact</label>
4646
<select class="form-select" id="critSvcPointOfContact" tabindex="0" name="critSvcPointOfContact"
4747
(change)="updateDemographics()" [(ngModel)]="demographics.pointOfContact">
48-
<option [ngValue]="null">-- Select Contact --</option>
48+
<option [ngValue]="null">-- {{t('select')}} --</option>
4949
<option *ngFor="let contact of contacts" [ngValue]="contact.assessmentContactId">
5050
{{ contact.firstName }} {{ contact.lastName }}
5151
</option>
@@ -66,7 +66,7 @@
6666
<select [ngClass]="{ 'is-invalid' : !iodDemographics.disruptedSector1 }" class="form-select mb-3"
6767
name="disruptedSector1" tabindex="0" [(ngModel)]="iodDemographics.disruptedSector1"
6868
(change)="updateDemographics()">
69-
<option [ngValue]="null">-- Select --</option>
69+
<option [ngValue]="null">-- {{t('select')}} --</option>
7070
<option *ngFor="let i of iodDemographics.listSectors" [ngValue]="i.optionValue"
7171
[selected]="i.optionValue === iodDemographics.disruptedSector1">
7272
{{ i.optionText }}
@@ -77,7 +77,7 @@
7777
<select [ngClass]="{ 'is-invalid' : !iodDemographics.disruptedSector2 }" class="form-select mb-3"
7878
name="disruptedSector2" tabindex="0" [(ngModel)]="iodDemographics.disruptedSector2"
7979
(change)="updateDemographics()">
80-
<option [ngValue]="null">-- Select --</option>
80+
<option [ngValue]="null">-- {{t('select')}} --</option>
8181
<option *ngFor="let i of iodDemographics.listSectors" [ngValue]="i.optionValue"
8282
[selected]="i.optionValue === iodDemographics.disruptedSector2">
8383
{{ i.optionText }}

0 commit comments

Comments
 (0)