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