Fixed #7182: Required field names appearing in the warning modal.
dataset-wizard.component.ts & dmp-editor.component.ts & form-validation-errors-dialog.component.ts: a. For 'mat-select', use placeholder instead of aria-label. b. [Bug fix] For 'app-multiple-auto-complete' dig into 2 more levels (formControl.nativeElement.firstChild.firstChild.firstChild.children) --> reason: commit de99784b5e: moved <input> inside <mat-chip-list>.
This commit is contained in:
parent
7820235258
commit
7a7f12b83a
|
@ -408,7 +408,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
||||||
|
|
||||||
// private _listenersSubscription:Subscription = new Subscription();
|
// private _listenersSubscription:Subscription = new Subscription();
|
||||||
registerFormListeners() {
|
registerFormListeners() {
|
||||||
// const dmpSubscription =
|
// const dmpSubscription =
|
||||||
this.formGroup.get('dmp').valueChanges
|
this.formGroup.get('dmp').valueChanges
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(x => {
|
.subscribe(x => {
|
||||||
|
@ -424,32 +424,32 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
||||||
this.formChanged();
|
this.formChanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// const labelSubscription =
|
// const labelSubscription =
|
||||||
this.formGroup.get('label').valueChanges
|
this.formGroup.get('label').valueChanges
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(x => {
|
.subscribe(x => {
|
||||||
this.formChanged();
|
this.formChanged();
|
||||||
});
|
});
|
||||||
// const descriptionSubscription =
|
// const descriptionSubscription =
|
||||||
this.formGroup.get('description').valueChanges
|
this.formGroup.get('description').valueChanges
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(x => {
|
.subscribe(x => {
|
||||||
this.formChanged();
|
this.formChanged();
|
||||||
});
|
});
|
||||||
// const uriSubscription =
|
// const uriSubscription =
|
||||||
this.formGroup.get('uri').valueChanges
|
this.formGroup.get('uri').valueChanges
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(x => {
|
.subscribe(x => {
|
||||||
this.formChanged();
|
this.formChanged();
|
||||||
});
|
});
|
||||||
// const tagsSubscription =
|
// const tagsSubscription =
|
||||||
this.formGroup.get('tags').valueChanges
|
this.formGroup.get('tags').valueChanges
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(x => {
|
.subscribe(x => {
|
||||||
this.formChanged();
|
this.formChanged();
|
||||||
});
|
});
|
||||||
if (this.formGroup.get('datasetProfileDefinition')) {
|
if (this.formGroup.get('datasetProfileDefinition')) {
|
||||||
// const datasetProfileDefinitionSubscription =
|
// const datasetProfileDefinitionSubscription =
|
||||||
this.formGroup.get('datasetProfileDefinition').valueChanges
|
this.formGroup.get('datasetProfileDefinition').valueChanges
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(x => {
|
.subscribe(x => {
|
||||||
|
@ -555,7 +555,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
||||||
this.formGroup.addControl('datasetProfileDefinition', this.datasetProfileDefinitionModel.buildForm());
|
this.formGroup.addControl('datasetProfileDefinition', this.datasetProfileDefinitionModel.buildForm());
|
||||||
|
|
||||||
// const datasetProfileDefinitionForm = this.datasetProfileDefinitionModel.buildForm();
|
// const datasetProfileDefinitionForm = this.datasetProfileDefinitionModel.buildForm();
|
||||||
|
|
||||||
// let profId = null;
|
// let profId = null;
|
||||||
// try{
|
// try{
|
||||||
// profId = this.formGroup.get('profile').value.id;
|
// profId = this.formGroup.get('profile').value.id;
|
||||||
|
@ -651,11 +651,11 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
||||||
|| formControl.nativeElement.localName === 'richTextarea') {
|
|| formControl.nativeElement.localName === 'richTextarea') {
|
||||||
return formControl.nativeElement.getAttribute('placeholder');
|
return formControl.nativeElement.getAttribute('placeholder');
|
||||||
} else if (formControl.nativeElement.localName === 'mat-select') {
|
} else if (formControl.nativeElement.localName === 'mat-select') {
|
||||||
return formControl.nativeElement.getAttribute('aria-label');
|
return formControl.nativeElement.getAttribute('placeholder');
|
||||||
} else if (formControl.nativeElement.localName === 'app-single-auto-complete') {
|
} else if (formControl.nativeElement.localName === 'app-single-auto-complete') {
|
||||||
return (Array.from(formControl.nativeElement.firstChild.children).filter((x: any) => x.localName === 'input')[0] as any).getAttribute('placeholder');
|
return (Array.from(formControl.nativeElement.firstChild.children).filter((x: any) => x.localName === 'input')[0] as any).getAttribute('placeholder');
|
||||||
} else if (formControl.nativeElement.localName === 'app-multiple-auto-complete') {
|
} else if (formControl.nativeElement.localName === 'app-multiple-auto-complete') {
|
||||||
return (Array.from(formControl.nativeElement.firstChild.children).filter((x: any) => x.localName === 'input')[0] as any).getAttribute('placeholder');
|
return (Array.from(formControl.nativeElement.firstChild.firstChild.firstChild.children).filter((x: any) => x.localName === 'input')[0] as any).getAttribute('placeholder');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -687,7 +687,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const errorMessage = this._getErrorMessage(aControl, controlName);
|
const errorMessage = this._getErrorMessage(aControl, controlName);
|
||||||
|
|
||||||
errmess.push(...errorMessage);
|
errmess.push(...errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -695,7 +695,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
||||||
No need to check case of FormControl below*/
|
No need to check case of FormControl below*/
|
||||||
|
|
||||||
if(aControl instanceof FormGroup){
|
if(aControl instanceof FormGroup){
|
||||||
|
|
||||||
const fg = aControl as FormGroup;
|
const fg = aControl as FormGroup;
|
||||||
//check children
|
//check children
|
||||||
Object.keys(fg.controls).forEach(controlName=>{
|
Object.keys(fg.controls).forEach(controlName=>{
|
||||||
|
@ -708,7 +708,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
||||||
fa.controls.forEach((control,index)=>{
|
fa.controls.forEach((control,index)=>{
|
||||||
errmess.push(... this._buildErrorMessagesForAbstractControl(control, `${controlName} --> ${index+1}`));
|
errmess.push(... this._buildErrorMessagesForAbstractControl(control, `${controlName} --> ${index+1}`));
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -729,7 +729,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
||||||
if (!this.isSemiFormValid(this.formGroup)) {
|
if (!this.isSemiFormValid(this.formGroup)) {
|
||||||
//build messages
|
//build messages
|
||||||
const errorMessages = this._buildSemiFormErrorMessages();
|
const errorMessages = this._buildSemiFormErrorMessages();
|
||||||
this.showValidationErrorsDialog(undefined, errorMessages);
|
this.showValidationErrorsDialog(undefined, errorMessages);
|
||||||
this.hintErrors = true;
|
this.hintErrors = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1153,7 +1153,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
||||||
// }else{
|
// }else{
|
||||||
// this.formGroup.get(key).reset();
|
// this.formGroup.get(key).reset();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
} else {
|
} else {
|
||||||
|
@ -1252,7 +1252,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
||||||
|
|
||||||
|
|
||||||
// const tempResult:ToCEntry[] = [];
|
// const tempResult:ToCEntry[] = [];
|
||||||
|
|
||||||
// if(sections &§ions.length){
|
// if(sections &§ions.length){
|
||||||
// sections.controls.forEach(section=>{
|
// sections.controls.forEach(section=>{
|
||||||
// tempResult.push(this._buildRecursively(section as FormGroup, ToCEntryType.Section));
|
// tempResult.push(this._buildRecursively(section as FormGroup, ToCEntryType.Section));
|
||||||
|
@ -1288,9 +1288,9 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// private _sortByOrdinal(tocentries: ToCEntry[]){
|
// private _sortByOrdinal(tocentries: ToCEntry[]){
|
||||||
|
|
||||||
// if(!tocentries || !tocentries.length) return;
|
// if(!tocentries || !tocentries.length) return;
|
||||||
|
|
||||||
// tocentries.sort(this._customCompare);
|
// tocentries.sort(this._customCompare);
|
||||||
// tocentries.forEach(entry=>{
|
// tocentries.forEach(entry=>{
|
||||||
// this._sortByOrdinal(entry.subEntries);
|
// this._sortByOrdinal(entry.subEntries);
|
||||||
|
@ -1315,7 +1315,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
// getTocEntries(form): ToCEntry[] {
|
// getTocEntries(form): ToCEntry[] {
|
||||||
// if (form == null) { return []; }
|
// if (form == null) { return []; }
|
||||||
// const result: ToCEntry[] = [];
|
// const result: ToCEntry[] = [];
|
||||||
|
@ -1355,6 +1355,6 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -583,7 +583,7 @@ export class DmpEditorComponent extends CheckDeactivateBaseComponent implements
|
||||||
try{
|
try{
|
||||||
showDialog = this.isNew && !this.formGroup.get('datasets').value.length;
|
showDialog = this.isNew && !this.formGroup.get('datasets').value.length;
|
||||||
}catch{
|
}catch{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.editDataset(dmp.id, true, showDialog);
|
this.editDataset(dmp.id, true, showDialog);
|
||||||
|
@ -825,11 +825,11 @@ export class DmpEditorComponent extends CheckDeactivateBaseComponent implements
|
||||||
|| formControl.nativeElement.localName === 'richTextarea') {
|
|| formControl.nativeElement.localName === 'richTextarea') {
|
||||||
return formControl.nativeElement.getAttribute('placeholder');
|
return formControl.nativeElement.getAttribute('placeholder');
|
||||||
} else if (formControl.nativeElement.localName === 'mat-select') {
|
} else if (formControl.nativeElement.localName === 'mat-select') {
|
||||||
return formControl.nativeElement.getAttribute('aria-label');
|
return formControl.nativeElement.getAttribute('placeholder');
|
||||||
} else if (formControl.nativeElement.localName === 'app-single-auto-complete') {
|
} else if (formControl.nativeElement.localName === 'app-single-auto-complete') {
|
||||||
return (Array.from(formControl.nativeElement.firstChild.children).filter((x: any) => x.localName === 'input')[0] as any).getAttribute('placeholder');
|
return (Array.from(formControl.nativeElement.firstChild.children).filter((x: any) => x.localName === 'input')[0] as any).getAttribute('placeholder');
|
||||||
} else if (formControl.nativeElement.localName === 'app-multiple-auto-complete') {
|
} else if (formControl.nativeElement.localName === 'app-multiple-auto-complete') {
|
||||||
return (Array.from(formControl.nativeElement.firstChild.children).filter((x: any) => x.localName === 'input')[0] as any).getAttribute('placeholder');
|
return (Array.from(formControl.nativeElement.firstChild.firstChild.firstChild.children).filter((x: any) => x.localName === 'input')[0] as any).getAttribute('placeholder');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -861,14 +861,14 @@ export class DmpEditorComponent extends CheckDeactivateBaseComponent implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const errorMessage = this._getErrorMessage(aControl, controlName);
|
const errorMessage = this._getErrorMessage(aControl, controlName);
|
||||||
|
|
||||||
errmess.push(...errorMessage);
|
errmess.push(...errorMessage);
|
||||||
}
|
}
|
||||||
/*in case the aControl is FormControl then the it should have provided its error messages above.
|
/*in case the aControl is FormControl then the it should have provided its error messages above.
|
||||||
No need to check case of FormControl below*/
|
No need to check case of FormControl below*/
|
||||||
|
|
||||||
if(aControl instanceof FormGroup){
|
if(aControl instanceof FormGroup){
|
||||||
|
|
||||||
const fg = aControl as FormGroup;
|
const fg = aControl as FormGroup;
|
||||||
//check children
|
//check children
|
||||||
Object.keys(fg.controls).forEach(controlName=>{
|
Object.keys(fg.controls).forEach(controlName=>{
|
||||||
|
@ -881,9 +881,9 @@ export class DmpEditorComponent extends CheckDeactivateBaseComponent implements
|
||||||
fa.controls.forEach((control,index)=>{
|
fa.controls.forEach((control,index)=>{
|
||||||
errmess.push(... this._buildErrorMessagesForAbstractControl(control, `${controlName} --> ${index+1}`));
|
errmess.push(... this._buildErrorMessagesForAbstractControl(control, `${controlName} --> ${index+1}`));
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return errmess;
|
return errmess;
|
||||||
|
@ -950,7 +950,7 @@ export class DmpEditorComponent extends CheckDeactivateBaseComponent implements
|
||||||
|
|
||||||
editDataset(id: string, isNew: boolean, showModal:boolean = false) {
|
editDataset(id: string, isNew: boolean, showModal:boolean = false) {
|
||||||
|
|
||||||
|
|
||||||
if(showModal){
|
if(showModal){
|
||||||
const dialogRef = this.dialog.open(DmpToDatasetDialogComponent, {
|
const dialogRef = this.dialog.open(DmpToDatasetDialogComponent, {
|
||||||
width: '500px',
|
width: '500px',
|
||||||
|
@ -972,7 +972,7 @@ export class DmpEditorComponent extends CheckDeactivateBaseComponent implements
|
||||||
} else {
|
} else {
|
||||||
this.router.navigate(['/datasets', 'edit', id]);
|
this.router.navigate(['/datasets', 'edit', id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,14 +70,15 @@ export class FormValidationErrorsDialogComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlaceHolder(formControl: any): string {
|
getPlaceHolder(formControl: any): string {
|
||||||
if (formControl.nativeElement.localName === 'input' || formControl.nativeElement.localName === 'textarea') {
|
if (formControl.nativeElement.localName === 'input' || formControl.nativeElement.localName === 'textarea'
|
||||||
|
|| formControl.nativeElement.localName === 'richTextarea') {
|
||||||
return formControl.nativeElement.getAttribute('placeholder');
|
return formControl.nativeElement.getAttribute('placeholder');
|
||||||
} else if (formControl.nativeElement.localName === 'mat-select') {
|
} else if (formControl.nativeElement.localName === 'mat-select') {
|
||||||
return formControl.nativeElement.getAttribute('aria-label');
|
return formControl.nativeElement.getAttribute('placeholder');
|
||||||
} else if (formControl.nativeElement.localName === 'app-single-auto-complete') {
|
} else if (formControl.nativeElement.localName === 'app-single-auto-complete') {
|
||||||
return (Array.from(formControl.nativeElement.firstChild.children).filter((x: any) => x.localName === 'input')[0] as any).getAttribute('placeholder');
|
return (Array.from(formControl.nativeElement.firstChild.children).filter((x: any) => x.localName === 'input')[0] as any).getAttribute('placeholder');
|
||||||
} else if (formControl.nativeElement.localName === 'app-multiple-auto-complete') {
|
} else if (formControl.nativeElement.localName === 'app-multiple-auto-complete') {
|
||||||
return (Array.from(formControl.nativeElement.firstChild.children).filter((x: any) => x.localName === 'input')[0] as any).getAttribute('placeholder');
|
return (Array.from(formControl.nativeElement.firstChild.firstChild.firstChild.children).filter((x: any) => x.localName === 'input')[0] as any).getAttribute('placeholder');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Needs to have <mat-label> in <mat-form-field> in html in order to fill results
|
// Needs to have <mat-label> in <mat-form-field> in html in order to fill results
|
||||||
|
|
Loading…
Reference in New Issue