Commits

Giuseppe Digilio authored d9857a7a9a6 Merge
Merge branch 'main' into fix-bistream-download-cache
No tags

src/app/collection-page/collection-form/collection-form.component.ts

Modified
15 15 import { CommunityDataService } from '../../core/data/community-data.service';
16 16 import { AuthService } from '../../core/auth/auth.service';
17 17 import { RequestService } from '../../core/data/request.service';
18 18 import { ObjectCacheService } from '../../core/cache/object-cache.service';
19 19 import { EntityTypeDataService } from '../../core/data/entity-type-data.service';
20 20 import { ItemType } from '../../core/shared/item-relationships/item-type.model';
21 21 import { MetadataValue } from '../../core/shared/metadata.models';
22 22 import { getFirstSucceededRemoteListPayload } from '../../core/shared/operators';
23 23 import { collectionFormEntityTypeSelectionConfig, collectionFormModels, } from './collection-form.models';
24 24 import { NONE_ENTITY_TYPE } from '../../core/shared/item-relationships/item-type.resource-type';
25 +import { hasNoValue, isNotNull } from 'src/app/shared/empty.util';
26 +
25 27
26 28 /**
27 29 * Form used for creating and editing collections
28 30 */
29 31 @Component({
30 32 selector: 'ds-collection-form',
31 33 styleUrls: ['../../shared/comcol/comcol-forms/comcol-form/comcol-form.component.scss'],
32 34 templateUrl: '../../shared/comcol/comcol-forms/comcol-form/comcol-form.component.html'
33 35 })
34 36 export class CollectionFormComponent extends ComColFormComponent<Collection> implements OnInit, OnChanges {
59 61 protected notificationsService: NotificationsService,
60 62 protected authService: AuthService,
61 63 protected dsoService: CommunityDataService,
62 64 protected requestService: RequestService,
63 65 protected objectCache: ObjectCacheService,
64 66 protected entityTypeService: EntityTypeDataService,
65 67 protected chd: ChangeDetectorRef) {
66 68 super(formService, translate, notificationsService, authService, requestService, objectCache);
67 69 }
68 70
71 + ngOnInit(): void {
72 + if (hasNoValue(this.formModel) && isNotNull(this.dso)) {
73 + this.initializeForm();
74 + }
75 + }
76 +
69 77 /**
70 78 * Detect changes to the dso and initialize the form,
71 79 * if the dso changes, exists and it is not the first change
72 80 */
73 81 ngOnChanges(changes: SimpleChanges) {
74 82 const dsoChange: SimpleChange = changes.dso;
75 83 if (this.dso && dsoChange && !dsoChange.isFirstChange()) {
76 84 this.initializeForm();
77 85 }
78 86 }

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut