Skip to content

Commit 8ee3750

Browse files
115046: Fixed loading animation not resetting hen closing modal
1 parent f1706e2 commit 8ee3750

3 files changed

Lines changed: 17 additions & 8 deletions

File tree

src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
toArray,
2727
concatMap
2828
} from 'rxjs/operators';
29-
import { hasNoValue, hasValue, hasValueOperator } from '../../../../shared/empty.util';
29+
import { hasNoValue, hasValue, hasValueOperator, isNotEmpty } from '../../../../shared/empty.util';
3030
import { Relationship } from '../../../../core/shared/item-relationships/relationship.model';
3131
import {
3232
RelationshipType
@@ -278,7 +278,7 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
278278
}
279279
}
280280

281-
this.loading$.next(true);
281+
this.loading$.next(isNotEmpty(modalComp.toAdd) || isNotEmpty(modalComp.toRemove));
282282
// emit the last page again to trigger a fieldupdates refresh
283283
this.relationshipsRd$.next(this.relationshipsRd$.getValue());
284284
});
@@ -296,6 +296,7 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
296296
} else {
297297
modalComp.toRemove.push(searchResult);
298298
}
299+
this.loading$.next(isNotEmpty(modalComp.toAdd) || isNotEmpty(modalComp.toRemove));
299300
});
300301
};
301302

@@ -369,6 +370,11 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
369370

370371
modalComp.toAdd = [];
371372
modalComp.toRemove = [];
373+
this.loading$.next(false);
374+
};
375+
376+
modalComp.closeEv = () => {
377+
this.loading$.next(false);
372378
};
373379

374380
this.relatedEntityType$

src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { DsDynamicLookupRelationModalComponent } from './dynamic-lookup-relation
77
import { NgbActiveModal, NgbModule } from '@ng-bootstrap/ng-bootstrap';
88
import { SelectableListService } from '../../../../object-list/selectable-list/selectable-list.service';
99
import { RelationshipDataService } from '../../../../../core/data/relationship-data.service';
10-
import { RelationshipTypeDataService } from '../../../../../core/data/relationship-type-data.service';
1110
import { Store } from '@ngrx/store';
1211
import { Item } from '../../../../../core/shared/item.model';
1312
import { ItemSearchResult } from '../../../../object-collection/shared/item-search-result.model';
@@ -119,7 +118,6 @@ describe('DsDynamicLookupRelationModalComponent', () => {
119118
{
120119
provide: RelationshipDataService, useValue: { getNameVariant: () => observableOf(nameVariant) }
121120
},
122-
{ provide: RelationshipTypeDataService, useValue: {} },
123121
{ provide: RemoteDataBuildService, useValue: rdbService },
124122
{
125123
provide: Store, useValue: {

src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
UpdateRelationshipNameVariantAction,
1818
} from './relationship.actions';
1919
import { RelationshipDataService } from '../../../../../core/data/relationship-data.service';
20-
import { RelationshipTypeDataService } from '../../../../../core/data/relationship-type-data.service';
2120
import { Store } from '@ngrx/store';
2221
import { AppState } from '../../../../../app.reducer';
2322
import { Context } from '../../../../../core/shared/context.model';
@@ -164,7 +163,6 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
164163
public modal: NgbActiveModal,
165164
private selectableListService: SelectableListService,
166165
private relationshipService: RelationshipDataService,
167-
private relationshipTypeService: RelationshipTypeDataService,
168166
private externalSourceService: ExternalSourceDataService,
169167
private lookupRelationService: LookupRelationService,
170168
private searchConfigService: SearchConfigurationService,
@@ -217,6 +215,7 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
217215
this.toAdd = [];
218216
this.toRemove = [];
219217
this.modal.close();
218+
this.closeEv();
220219
}
221220

222221
/**
@@ -311,13 +310,19 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
311310

312311
/* eslint-disable no-empty,@typescript-eslint/no-empty-function */
313312
/**
314-
* Called when discard button is clicked, emit discard event to parent to conclude functionality
313+
* Called when close button is clicked
314+
*/
315+
closeEv(): void {
316+
}
317+
318+
/**
319+
* Called when discard button is clicked
315320
*/
316321
discardEv(): void {
317322
}
318323

319324
/**
320-
* Called when submit button is clicked, emit submit event to parent to conclude functionality
325+
* Called when submit button is clicked
321326
*/
322327
submitEv(): void {
323328
}

0 commit comments

Comments
 (0)