Commits

Alexandre Vryghem authored f65b96412a9
Fixed multiple edit relationship bugs

- Fixed issue making it impossible to add new relationships until the page is refreshed after deleting an existing one (only when you refreshed the page after creating the initial relationship) - Fixed NPE in DsDynamicLookupRelationModalComponent - Grouped buttons on relationship page in order to assure that they always have the same behaviour
No tags

src/app/item-page/edit-item-page/abstract-item-update/abstract-item-update.component.ts

Modified
28 28 /**
29 29 * The item to display the edit page for
30 30 */
31 31 @Input() item: Item;
32 32 /**
33 33 * The current values and updates for all this item's fields
34 34 * Should be initialized in the initializeUpdates method of the child component
35 35 */
36 36 updates$: Observable<FieldUpdates>;
37 37
38 + hasChanges$: Observable<boolean>;
39 +
40 + isReinstatable$: Observable<boolean>;
41 +
38 42 /**
39 43 * Route to the item's page
40 44 */
41 45 itemPageRoute: string;
42 46
43 47 /**
44 48 * A subscription that checks when the item is deleted in cache and reloads the item by sending a new request
45 49 * This is used to update the item in cache after bitstreams are deleted
46 50 */
47 51 itemUpdateSubscription: Subscription;
75 79 return this.itemService.findByHref(rd.payload._links.self.href, true, true, ...ITEM_PAGE_LINKS_TO_FOLLOW);
76 80 }),
77 81 getAllSucceededRemoteData()
78 82 ).subscribe((rd: RemoteData<Item>) => {
79 83 this.setItem(rd.payload);
80 84 });
81 85 }
82 86
83 87 this.discardTimeOut = environment.item.edit.undoTimeout;
84 88 this.url = this.router.url;
89 + this.hasChanges$ = this.hasChanges();
90 + this.isReinstatable$ = this.isReinstatable();
85 91 if (this.url.indexOf('?') > 0) {
86 92 this.url = this.url.substr(0, this.url.indexOf('?'));
87 93 }
88 94 this.hasChanges().pipe(first()).subscribe((hasChanges) => {
89 95 if (!hasChanges) {
90 96 this.initializeOriginalFields();
91 97 } else {
92 98 this.checkLastModified();
93 99 }
94 100 });

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

Add shortcut