removes unnecessary console.log and comments

This commit is contained in:
apapachristou 2020-11-20 15:01:57 +02:00
parent fc72c014a5
commit 0542c17aae
2 changed files with 5 additions and 48 deletions

View File

@ -16,7 +16,7 @@
<div class="funder-form">
<div *ngIf="!isCreateNewFunder">
<mat-form-field appearance="outline">
<app-single-auto-complete required='true' [formControl]="funderFormGroup.get('existFunder')" placeholder="{{'DMP-EDITOR.FIELDS.FUNDER' | translate}}" [configuration]="funderAutoCompleteConfiguration" (optionSelected)="funderSelectionChanged()">
<app-single-auto-complete required='true' [formControl]="funderFormGroup.get('existFunder')" placeholder="{{'DMP-EDITOR.FIELDS.FUNDER' | translate}}" [configuration]="funderAutoCompleteConfiguration">
</app-single-auto-complete>
</mat-form-field>
</div>

View File

@ -12,6 +12,7 @@ import { GrantCriteria } from '@app/core/query/grant/grant-criteria';
import { ProjectCriteria } from '@app/core/query/project/project-criteria';
import { FunderCriteria } from '@app/core/query/funder/funder-criteria';
import { takeUntil } from 'rxjs/operators';
import { GrantEditorModel } from '@app/ui/grant/editor/grant-editor.model';
@Component({
selector: 'funding-info',
@ -81,35 +82,9 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
.subscribe(x => {
this.configureAutoCompletes();
});
// this.funderFormGroup.statusChanges
// .pipe(takeUntil(this._destroyed))
// .subscribe(x => {
// console.log("FUNDER CHANGE: INIT");
// this.grantformGroup.reset();
// if (x == 'INVALID') {
// this.grantformGroup.get('existGrant').reset();
// this.grantformGroup.get('label').reset();
// this.grantformGroup.get('description').reset();
// this.grantformGroup.get('existGrant').disable();
// this.grantformGroup.get('label').disable();
// this.grantformGroup.get('description').disable();
// } else if (x == 'VALID') {
// if (!this.isNew) {
// this.grantformGroup.get('label').reset();
// this.grantformGroup.get('description').reset();
// this.grantformGroup.get('label').disable();
// this.grantformGroup.get('description').disable();
// this.grantformGroup.get('existGrant').enable();
// }
// }
// this.configureAutoCompletes();
// })
}
configureAutoCompletes(): void {
console.log("before Search")
this.funderAutoCompleteConfiguration = {
filterFn: this.searchFunder.bind(this),
initialItems: () => this.searchFunder(''),
@ -136,13 +111,12 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
}
searchGrant(query: any) {
// console.log("Search GRANTS");
const grantRequestItem: RequestItem<GrantCriteria> = new RequestItem();
grantRequestItem.criteria = new GrantCriteria();
grantRequestItem.criteria.like = query;
if (this.funderFormGroup.get('existFunder').value) {
grantRequestItem.criteria.funderReference = this.funderFormGroup.controls['existFunder'].value.reference;
// console.log(grantRequestItem);
console.log(grantRequestItem);
}
return this.grantService.getWithExternal(grantRequestItem);
}
@ -196,7 +170,6 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
this.grantformGroup.get('label').disable();
this.grantformGroup.get('description').disable();
} else {
// console.log("SET VALIDATORS")
this.grantformGroup.get('existGrant').enable();
this.grantformGroup.get('label').disable();
this.grantformGroup.get('label').reset();
@ -260,15 +233,12 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
}
funderValueChanged(funder: any) {
// console.log("Funder ", funder);
// console.log(this.funderFormGroup.get('existFunder').value);
if ((funder.label !== "" && funder.label != null && funder.label !== undefined)
if ((funder.label !== "" && funder.label !== null && funder.label !== undefined)
|| (funder.existFunder !== null && funder.existFunder !== undefined && funder.existFunder.id !== undefined)) {
// console.log('Funder Value Changed')
this.grantformGroup.reset();
this.grantformGroup.enable();
this.setGrantValidators();
// this.grantformGroup.updateValueAndValidity();
} else {
this.grantformGroup.reset();
this.grantformGroup.disable();
@ -276,19 +246,6 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
}
}
funderSelectionChanged() {
// console.log("onFunderSelectionChanged")
// console.log(this.funderFormGroup.get('existFunder').value);
// this.grantAutoCompleteConfiguration = null;
// this.grantAutoCompleteConfiguration = {
// filterFn: this.searchGrant.bind(this),
// initialItems: () => this.searchGrant(''),
// displayFn: (item) => item['label'] + this.getGrantIdText(item),
// titleFn: (item) => item['label'] + this.getGrantIdText(item),
// subtitleFn: (item) => item['source'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['source'] : (item['key'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['key'] : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE'))
// };
}
isGrantDisabled() {
return this.grantformGroup.disabled;
}