fixed dmp blueprint editor on new version
This commit is contained in:
parent
ac9a377eb4
commit
17a431d97c
|
@ -62,7 +62,6 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
|||
isDeleted = false;
|
||||
formGroup: UntypedFormGroup = null;
|
||||
showInactiveDetails = false;
|
||||
finalized: boolean = false;
|
||||
|
||||
hoveredSectionIndex:number = -1;
|
||||
hoveredDescriptionTemplateIndex:number = -1;
|
||||
|
@ -106,10 +105,6 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
|||
return this.editorModel.status == DmpBlueprintStatus.Finalized;
|
||||
}
|
||||
|
||||
protected get isObsoleteVersion(): boolean {
|
||||
return this.editorModel.versionStatus == DmpBlueprintVersionStatus.Previous;
|
||||
}
|
||||
|
||||
private hasPermission(permission: AppPermission): boolean {
|
||||
return this.authService.hasPermission(permission) || this.editorModel?.permissions?.includes(permission);
|
||||
}
|
||||
|
@ -146,8 +141,8 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
|||
|
||||
ngOnInit(): void {
|
||||
this.matomoService.trackPageView('Admin: DMP Blueprints');
|
||||
super.ngOnInit();
|
||||
this.initModelFlags(this.route.snapshot.data['action']);
|
||||
super.ngOnInit();
|
||||
this.route.data.subscribe(d => {
|
||||
this.initModelFlags(d['action']);
|
||||
});
|
||||
|
@ -197,11 +192,10 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
|||
buildForm() {
|
||||
this.formGroup = this.editorModel.buildForm(null, this.isDeleted || !this.authService.hasPermission(AppPermission.EditDmpBlueprint));
|
||||
this.dmpBlueprintEditorService.setValidationErrorModel(this.editorModel.validationErrorModel);
|
||||
if (this.isFinalized || this.isDeleted || this.isObsoleteVersion || this.finalized) {
|
||||
if (this.isFinalized || this.isDeleted) {
|
||||
this.formGroup.disable();
|
||||
}
|
||||
const action = this.route.snapshot.data['action'];
|
||||
if (action && action == 'new-version' && !(this.isObsoleteVersion || this.finalized)) {
|
||||
if (this.isNewVersion) {
|
||||
this.formGroup.enable();
|
||||
}
|
||||
}
|
||||
|
@ -212,7 +206,7 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
|||
|
||||
refreshOnNavigateToData(id?: Guid): void {
|
||||
this.formGroup.markAsPristine();
|
||||
if (this.isNew) {
|
||||
if (this.isNew || this.isNewVersion) {
|
||||
let route = [];
|
||||
route.push('/dmp-blueprints/' + id);
|
||||
this.router.navigate(route, { queryParams: { 'lookup': this.queryParamsService.serializeLookup(this.lookupParams), 'lv': ++this.lv }, replaceUrl: true, relativeTo: this.route });
|
||||
|
@ -563,7 +557,6 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
|
|||
if (this.checkValidity() || !this.hasDescriptionTemplates()) {
|
||||
this.formGroup.get('status').setValue(DmpBlueprintStatus.Finalized);
|
||||
if(this.isNewVersion) this.isNewVersion = false;
|
||||
this.finalized = true;
|
||||
this.formSubmit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ export class DmpBlueprintEditorResolver extends BaseEditorResolver {
|
|||
nameof<DmpBlueprint>(x => x.id),
|
||||
nameof<DmpBlueprint>(x => x.label),
|
||||
nameof<DmpBlueprint>(x => x.status),
|
||||
nameof<DmpBlueprint>(x => x.versionStatus),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.id)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.label)].join('.'),
|
||||
[nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.description)].join('.'),
|
||||
|
|
Loading…
Reference in New Issue