dmp new version keep title, descripion changes after blueprint change

This commit is contained in:
amentis 2024-05-29 14:50:02 +03:00
parent c237de889c
commit 16b0a3089e
2 changed files with 4 additions and 4 deletions

View File

@ -113,7 +113,7 @@ export class NewVersionDmpDialogComponent extends BaseComponent {
selectedBlueprintChanged(item: DmpBlueprint): void{ selectedBlueprintChanged(item: DmpBlueprint): void{
this.selectedBlueprintSections = item.definition?.sections?.filter(x => x.hasTemplates) || null; this.selectedBlueprintSections = item.definition?.sections?.filter(x => x.hasTemplates) || null;
if(this.selectedBlueprintSections && this.hasDescriptions()) { if(this.selectedBlueprintSections && this.hasDescriptions()) {
this.formGroup = this.editorModel.fromModel(this.dmp, item).buildForm(); this.formGroup = this.editorModel.fromModel(this.dmp, item, this.formGroup.get('label').value, this.formGroup.get('description').value).buildForm();
} }
} }

View File

@ -19,11 +19,11 @@ export class DmpNewVersionDialogEditorModel implements NewVersionDmpPersist {
constructor() { } constructor() { }
public fromModel(item: Dmp, blueprint: DmpBlueprint): DmpNewVersionDialogEditorModel { public fromModel(item: Dmp, blueprint: DmpBlueprint, label?: string, description?: string): DmpNewVersionDialogEditorModel {
if (item) { if (item) {
this.id = item.id; this.id = item.id;
this.label = this.label != undefined ? this.label : item.label; this.label = label != undefined ? label : item.label;
this.description = this.description != undefined ? this.description : item.description; this.description = description != undefined ? description : item.description;
this.blueprintId = blueprint?.id != undefined ? blueprint.id : item.blueprint.id; this.blueprintId = blueprint?.id != undefined ? blueprint.id : item.blueprint.id;
this.hash= item.hash; this.hash= item.hash;