ocket8888 commented on code in PR #7353: URL: https://github.com/apache/trafficcontrol/pull/7353#discussion_r1116371022
########## experimental/traffic-portal/src/app/core/cdns/cdn-detail/cdn-detail.component.html: ########## @@ -0,0 +1,41 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +<mat-card> + <tp-loading *ngIf="!cdn"></tp-loading> + <form ngNativeValidate (ngSubmit)="submit($event)" *ngIf="cdn"> + <mat-card-content> + <mat-form-field> + <mat-label>Name</mat-label> + <input matInput type="text" name="name" required [(ngModel)]="cdn.name"> Review Comment: This lets me enter strings that aren't valid, and relies on the API to stop me. It's a better UX to not allow forms to be invalid. I believe the API only allows `^(\d[a-zA-Z]\.-)+$` (HTML `pattern` attributes are whole-match, so you can omit <kbd>^</kbd> and <kbd>$</kbd> whenever you're using it; it's implied). I realize that TPv1 lets you do this too, but that's just an insufficiency of TPv1, which should be fixed if we weren't simply replacing it. ########## experimental/traffic-portal/src/app/core/cdns/cdn-detail/cdn-detail.component.html: ########## @@ -0,0 +1,41 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +<mat-card> + <tp-loading *ngIf="!cdn"></tp-loading> + <form ngNativeValidate (ngSubmit)="submit($event)" *ngIf="cdn"> + <mat-card-content> + <mat-form-field> + <mat-label>Name</mat-label> + <input matInput type="text" name="name" required [(ngModel)]="cdn.name"> + </mat-form-field> + <mat-form-field *ngIf="!new"> + <mat-label>ID</mat-label> + <input matInput type="text" name="id" disabled readonly [defaultValue]="cdn.id"> + </mat-form-field> + <mat-form-field *ngIf="!new"> + <mat-label>Last Updated</mat-label> + <input matInput type="text" name="lastUpdated" disabled readonly [defaultValue]="cdn.lastUpdated"> + </mat-form-field> + <mat-form-field> + <mat-label>Domain</mat-label> + <input matInput type="text" name="domainName" required [(ngModel)]="cdn.domainName"> Review Comment: This allows invalid domain names to be entered. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
