|
21 | 21 | <td |
22 | 22 | mat-cell |
23 | 23 | *matCellDef="let row; let i = dataIndex" |
24 | | - [formGroupName]="i"> |
| 24 | + [formGroupName]="getFormArrayIndex(i)"> |
25 | 25 | <mat-form-field subscriptSizing="dynamic" appearance="outline"> |
26 | 26 | <mat-label>{{ |
27 | 27 | 'roles.accessOverview.tableHeadings.service' | transloco |
28 | 28 | }}</mat-label> |
29 | 29 | <mat-select |
30 | 30 | formControlName="service" |
31 | 31 | panelWidth="null" |
32 | | - (selectionChange)="getComponents(i)"> |
| 32 | + (selectionChange)="getComponents(getFormArrayIndex(i))" |
| 33 | + required> |
33 | 34 | <mat-option [value]="0">All</mat-option> |
34 | 35 | <mat-option |
35 | 36 | *ngFor="let option of serviceOptions" |
36 | 37 | [value]="option.id" |
37 | 38 | >{{ option.name }}</mat-option |
38 | 39 | > |
39 | 40 | </mat-select> |
| 41 | + <mat-error *ngIf="formArray.controls[getFormArrayIndex(i)]?.get('service')?.hasError('required')"> |
| 42 | + Service is required |
| 43 | + </mat-error> |
40 | 44 | </mat-form-field> |
41 | 45 | </td> |
42 | 46 | </ng-container> |
|
48 | 52 | <td |
49 | 53 | mat-cell |
50 | 54 | *matCellDef="let row; let i = dataIndex" |
51 | | - [formGroupName]="i"> |
| 55 | + [formGroupName]="getFormArrayIndex(i)"> |
52 | 56 | <mat-form-field subscriptSizing="dynamic" appearance="outline"> |
53 | 57 | <mat-label>{{ |
54 | 58 | 'roles.accessOverview.tableHeadings.component' | transloco |
55 | 59 | }}</mat-label> |
56 | | - <mat-select formControlName="component" panelWdith="null"> |
| 60 | + <mat-select formControlName="component" panelWdith="null" required> |
57 | 61 | <mat-option |
58 | | - *ngFor="let option of getComponentArray(i)" |
| 62 | + *ngFor="let option of getComponentArray(getFormArrayIndex(i))" |
59 | 63 | [value]="option" |
60 | 64 | >{{ option }}</mat-option |
61 | 65 | > |
62 | 66 | </mat-select> |
| 67 | + <mat-error *ngIf="formArray.controls[getFormArrayIndex(i)]?.get('component')?.hasError('required')"> |
| 68 | + Component is required |
| 69 | + </mat-error> |
63 | 70 | </mat-form-field> |
64 | 71 | </td> |
65 | 72 | </ng-container> |
|
71 | 78 | <td |
72 | 79 | mat-cell |
73 | 80 | *matCellDef="let row; let i = dataIndex" |
74 | | - [formGroupName]="i"> |
| 81 | + [formGroupName]="getFormArrayIndex(i)"> |
75 | 82 | <mat-form-field subscriptSizing="dynamic" appearance="outline"> |
76 | 83 | <mat-label>{{ |
77 | 84 | 'roles.accessOverview.tableHeadings.access' | transloco |
|
80 | 87 | formControlName="access" |
81 | 88 | multiple |
82 | 89 | panelWidth="null" |
83 | | - (selectionChange)="accessChange(i, $event.value)"> |
| 90 | + (selectionChange)="accessChange(getFormArrayIndex(i), $event.value)" |
| 91 | + required> |
84 | 92 | <mat-option |
85 | 93 | *ngFor="let option of accessOptions" |
86 | 94 | [value]="option.value" |
87 | 95 | >{{ option.label }} |
88 | 96 | <span |
89 | 97 | class="example-additional-selection" |
90 | 98 | *ngIf=" |
91 | | - (formArray.controls[i].value.access.length || 0) > 1 |
| 99 | + (formArray.controls[getFormArrayIndex(i)]?.value.access.length || 0) > 1 |
92 | 100 | "> |
93 | 101 | (+{{ |
94 | | - (formArray.controls[i].value.access.length || 0) - 1 |
| 102 | + (formArray.controls[getFormArrayIndex(i)]?.value.access.length || 0) - 1 |
95 | 103 | }} |
96 | 104 | {{ |
97 | | - formArray.controls[i].value.access.length === 2 |
| 105 | + formArray.controls[getFormArrayIndex(i)]?.value.access.length === 2 |
98 | 106 | ? 'other' |
99 | 107 | : 'others' |
100 | 108 | }}) |
101 | 109 | </span> |
102 | 110 | </mat-option> |
103 | 111 | </mat-select> |
| 112 | + <mat-error *ngIf="formArray.controls[getFormArrayIndex(i)]?.get('access')?.hasError('required')"> |
| 113 | + Access is required |
| 114 | + </mat-error> |
104 | 115 | </mat-form-field> |
105 | 116 | </td> |
106 | 117 | </ng-container> |
|
112 | 123 | <td |
113 | 124 | mat-cell |
114 | 125 | *matCellDef="let row; let i = dataIndex" |
115 | | - [formGroupName]="i"> |
| 126 | + [formGroupName]="getFormArrayIndex(i)"> |
116 | 127 | <mat-form-field subscriptSizing="dynamic" appearance="outline"> |
117 | 128 | <mat-label>{{ |
118 | 129 | 'roles.accessOverview.tableHeadings.requester' | transloco |
|
140 | 151 | <td |
141 | 152 | mat-cell |
142 | 153 | *matCellDef="let row; let i = dataIndex" |
143 | | - [formGroupName]="i"> |
| 154 | + [formGroupName]="getFormArrayIndex(i)"> |
144 | 155 | <button |
145 | 156 | mat-icon-button |
146 | 157 | color="primary" |
147 | 158 | type="button" |
148 | | - (click)="toggleRow(row, i)"> |
| 159 | + (click)="toggleRow(row, getFormArrayIndex(i))"> |
149 | 160 | <fa-icon [icon]="faPlus" size="xs"></fa-icon> |
150 | 161 | </button> |
151 | 162 | </td> |
|
165 | 176 | <td |
166 | 177 | mat-cell |
167 | 178 | *matCellDef="let row; let i = dataIndex" |
168 | | - [formGroupName]="i"> |
| 179 | + [formGroupName]="getFormArrayIndex(i)"> |
169 | 180 | <button mat-icon-button (click)="remove(i)"> |
170 | 181 | <fa-icon [icon]="faTrashCan" size="xs"></fa-icon> |
171 | 182 | </button> |
|
177 | 188 | mat-cell |
178 | 189 | *matCellDef="let element; let i = dataIndex" |
179 | 190 | [attr.colspan]="6" |
180 | | - [formGroupName]="i"> |
| 191 | + [formGroupName]="getFormArrayIndex(i)"> |
181 | 192 | <div |
182 | 193 | class="element-detail" |
183 | 194 | formArrayName="advancedFilters" |
|
186 | 197 | "> |
187 | 198 | <ng-container |
188 | 199 | *ngFor=" |
189 | | - let advancedFilter of getAdvancedFilters(i).controls; |
| 200 | + let advancedFilter of getAdvancedFilters(getFormArrayIndex(i)).controls; |
190 | 201 | let j = index |
191 | 202 | "> |
192 | 203 | <div [formArrayName]="j" class="expandedItems"> |
|
220 | 231 | <mat-button-toggle-group |
221 | 232 | aria-label="Service Definition Type" |
222 | 233 | formControlName="filterOp" |
223 | | - (change)="filterOpChange($event, i)"> |
| 234 | + (change)="filterOpChange($event, getFormArrayIndex(i))"> |
224 | 235 | <mat-button-toggle value="AND">AND</mat-button-toggle> |
225 | 236 | <mat-button-toggle value="OR">OR</mat-button-toggle> |
226 | 237 | </mat-button-toggle-group> |
|
229 | 240 | <button |
230 | 241 | mat-icon-button |
231 | 242 | type="button" |
232 | | - (click)="addAdvancedFilter(i)"> |
| 243 | + (click)="addAdvancedFilter(getFormArrayIndex(i))"> |
233 | 244 | <fa-icon [icon]="faPlus" size="xs"></fa-icon> |
234 | 245 | </button> |
235 | 246 | <button |
236 | 247 | mat-icon-button |
237 | 248 | type="button" |
238 | | - (click)="removeAdvancedFilter(i, j)"> |
| 249 | + (click)="removeAdvancedFilter(getFormArrayIndex(i), j)"> |
239 | 250 | <fa-icon [icon]="faTrashCan" size="xs"></fa-icon> |
240 | 251 | </button> |
241 | 252 | </div> |
|
0 commit comments