This commit is contained in:
Michele Artini 2023-01-26 11:14:41 +01:00
parent 229e7798d0
commit 8ec682096a
4 changed files with 11 additions and 17 deletions

View File

@ -6,12 +6,12 @@
<mat-form-field appearance="fill" style="width: 100%;">
<mat-label>ID</mat-label>
<input matInput required readonly value="{{data.id}}"/>
<input matInput readonly value="{{data.id}}"/>
</mat-form-field>
<mat-form-field appearance="fill" style="width: 100%;">
<mat-label>Content ({{data.contentType}})</mat-label>
<textarea matInput formControlName="content" rows="16" required style="font-size: 0.8em;"></textarea>
<textarea matInput formControlName="content" required rows="16" style="font-size: 0.8em;"></textarea>
<mat-error *ngIf="contentForm.get('content')?.invalid">This field is <strong>required</strong></mat-error>
</mat-form-field>
</div>

View File

@ -5,14 +5,12 @@
<mat-form-field appearance="fill" style="width: 100%;">
<mat-label>ID</mat-label>
<input matInput formControlName="id" required readonly />
<mat-error *ngIf="metadataForm.get('id')?.invalid">This field should not be empty</mat-error>
<input matInput readonly value="{{data.id}}"/>
</mat-form-field>
<mat-form-field appearance="fill" style="width: 100%;">
<mat-label>Type</mat-label>
<input matInput formControlName="type" required readonly />
<mat-error *ngIf="metadataForm.get('type')?.invalid">This field should not be empty</mat-error>
<input matInput readonly value="{{data.type}}" />
</mat-form-field>
<mat-form-field appearance="fill" style="width: 100%;">

View File

@ -16,7 +16,7 @@
<mat-form-field appearance="fill" style="width: 100%;">
<mat-label>Content ({{data.contentType}})</mat-label>
<textarea matInput formControlName="content" rows="10" required style="font-size: 0.8em;"></textarea>
<textarea matInput formControlName="content" required rows="10" style="font-size: 0.8em;"></textarea>
<mat-error *ngIf="newResourceForm.get('content')?.invalid">This field is <strong>required</strong></mat-error>
</mat-form-field>

View File

@ -110,7 +110,7 @@ export class ResourcesComponent implements OnInit {
styleUrls: ['resources.component.css']
})
export class ResContentDialog {
contentFormControl = new FormControl('', [Validators.required]);
contentFormControl = new FormControl('');
contentForm = new FormGroup({
content : this.contentFormControl
@ -145,15 +145,11 @@ export class ResContentDialog {
})
export class ResMetadataDialog {
metadataForm = new FormGroup({
id: new FormControl('', [Validators.required]),
type: new FormControl('', [Validators.required]),
name: new FormControl('', [Validators.required]),
description : new FormControl('', [])
name: new FormControl(''),
description : new FormControl('')
});
constructor(public dialogRef: MatDialogRef<ResMetadataDialog>, @Inject(MAT_DIALOG_DATA) public data: any, public service: ISService) {
this.metadataForm.get('id')?.setValue(data.id);
this.metadataForm.get('type')?.setValue(data.type);
this.metadataForm.get('name')?.setValue(data.name);
if (data.description) {
this.metadataForm.get('description')?.setValue(data.description);
@ -184,9 +180,9 @@ export class ResMetadataDialog {
})
export class ResCreateNewDialog {
newResourceForm = new FormGroup({
name: new FormControl('', [Validators.required]),
description : new FormControl('', []),
content : new FormControl('', [Validators.required])
name: new FormControl(''),
description : new FormControl(''),
content : new FormControl('')
});
constructor(public dialogRef: MatDialogRef<ResCreateNewDialog>, @Inject(MAT_DIALOG_DATA) public data: any, public service: ISService) {}