#7892 - prefill rda field only when a new dataset is created or a new version is made

This commit is contained in:
Bernaldo Mihasi 2022-10-25 09:36:11 +03:00
parent 49ce0efb40
commit 18dcabbac2
3 changed files with 18 additions and 3 deletions

View File

@ -1,5 +1,6 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms'; import { FormGroup } from '@angular/forms';
import { Router } from '@angular/router';
import { DatasetIdentifierDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/dataset-identifier-data-editor-models'; import { DatasetIdentifierDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/dataset-identifier-data-editor-models';
@Component({ @Component({
@ -12,8 +13,12 @@ export class DatasetProfileEditorDatasetIdentifierFieldComponent implements OnIn
@Input() form: FormGroup; @Input() form: FormGroup;
private data: DatasetIdentifierDataEditorModel = new DatasetIdentifierDataEditorModel(); private data: DatasetIdentifierDataEditorModel = new DatasetIdentifierDataEditorModel();
constructor(private router: Router) {}
ngOnInit() { ngOnInit() {
this.form.patchValue({'rdaCommonStandard': 'dataset.dataset_id'}); if(this.router.url.includes('new')){
this.form.patchValue({'rdaCommonStandard': 'dataset.dataset_id'});
}
if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); } if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); }
} }
} }

View File

@ -7,6 +7,7 @@ import { RegistriesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/f
import { ServicesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/services-data-editor-models'; import { ServicesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/services-data-editor-models';
import { TagsDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/tags-data-editor-models'; import { TagsDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/tags-data-editor-models';
import { ResearchersDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/researchers-data-editor-models'; import { ResearchersDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/researchers-data-editor-models';
import { Router } from '@angular/router';
@Component({ @Component({
selector: 'app-dataset-profile-editor-researchers-field-component', selector: 'app-dataset-profile-editor-researchers-field-component',
@ -18,8 +19,12 @@ export class DatasetProfileEditorResearchersFieldComponent implements OnInit {
@Input() form: FormGroup; @Input() form: FormGroup;
private data: ResearchersDataEditorModel = new ResearchersDataEditorModel(); private data: ResearchersDataEditorModel = new ResearchersDataEditorModel();
constructor(private router: Router) {}
ngOnInit() { ngOnInit() {
this.form.patchValue({'rdaCommonStandard': 'dmp.contributor'}); if(this.router.url.includes('new')){
this.form.patchValue({'rdaCommonStandard': 'dmp.contributor'});
}
if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); } if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); }
} }
} }

View File

@ -6,6 +6,7 @@ import { DataRepositoriesDataEditorModel } from '@app/ui/admin/dataset-profile/a
import { RegistriesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/registries-data-editor-models'; import { RegistriesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/registries-data-editor-models';
import { ServicesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/services-data-editor-models'; import { ServicesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/services-data-editor-models';
import { TagsDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/tags-data-editor-models'; import { TagsDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/tags-data-editor-models';
import { Router } from '@angular/router';
@Component({ @Component({
selector: 'app-dataset-profile-editor-tags-field-component', selector: 'app-dataset-profile-editor-tags-field-component',
@ -17,8 +18,12 @@ export class DatasetProfileEditorTagsFieldComponent implements OnInit {
@Input() form: FormGroup; @Input() form: FormGroup;
private data: TagsDataEditorModel = new TagsDataEditorModel(); private data: TagsDataEditorModel = new TagsDataEditorModel();
constructor(private router: Router) {}
ngOnInit() { ngOnInit() {
this.form.patchValue({'rdaCommonStandard': 'dataset.keyword'}); if(this.router.url.includes('new')){
this.form.patchValue({'rdaCommonStandard': 'dataset.keyword'});
}
if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); } if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); }
} }
} }