[DURACOM-170] Fixed "add collection" behavior

This commit is contained in:
Alisa Ismailati
2023-06-22 12:14:15 +02:00
parent 499bfe3154
commit 47e7eb1a4f

View File

@@ -22,6 +22,8 @@ import { MetadataValue } from '../../core/shared/metadata.models';
import { getFirstSucceededRemoteListPayload } from '../../core/shared/operators'; import { getFirstSucceededRemoteListPayload } from '../../core/shared/operators';
import { collectionFormEntityTypeSelectionConfig, collectionFormModels, } from './collection-form.models'; import { collectionFormEntityTypeSelectionConfig, collectionFormModels, } from './collection-form.models';
import { NONE_ENTITY_TYPE } from '../../core/shared/item-relationships/item-type.resource-type'; import { NONE_ENTITY_TYPE } from '../../core/shared/item-relationships/item-type.resource-type';
import { hasNoValue, isNotNull } from 'src/app/shared/empty.util';
/** /**
* Form used for creating and editing collections * Form used for creating and editing collections
@@ -66,6 +68,12 @@ export class CollectionFormComponent extends ComColFormComponent<Collection> imp
super(formService, translate, notificationsService, authService, requestService, objectCache); super(formService, translate, notificationsService, authService, requestService, objectCache);
} }
ngOnInit(): void {
if (hasNoValue(this.formModel) && isNotNull(this.dso)) {
this.initializeForm();
}
}
/** /**
* Detect changes to the dso and initialize the form, * Detect changes to the dso and initialize the form,
* if the dso changes, exists and it is not the first change * if the dso changes, exists and it is not the first change