Commit 4b4bafe5 authored by Samuel Schepp's avatar Samuel Schepp

added loading indicator for multi-model-input

parent 30b62ed3
......@@ -10,6 +10,9 @@
type="text"
[(ngModel)]="this.searchManager.searchTerm">
<div class="row mt-3">
<div class="col-6" *ngIf="loading">
<span class="fa fa-spinner"></span>
</div>
<div class="col-6" *ngFor="let model of searchManager.getFilteredData(selectionList)">
<ng-container *ngIf="!shouldHideObject(model)">
<a href="javascript:" (click)="addButtonClicked(model)">
......
......@@ -24,17 +24,27 @@ export class MultiModelInputComponent implements OnInit {
listSelectionExpanded: boolean;
constructor(private genericDataService: GenericDataService) {
loading: boolean;
constructor(public genericDataService: GenericDataService) {
this.listSelectionExpanded = false;
this.searchManager = new SearchManager();
this.selectionList = [];
this.typeAheadManager = new TypeAheadManager<string>(() => {
return this.selectionList.map((m) => m.toString());
});
this.loading = false;
}
async ngOnInit(): Promise<void> {
this.selectionList = await this.genericDataService.get(this.modelDefinition);
this.loading = true;
try {
this.selectionList = await this.genericDataService.get(this.modelDefinition);
this.loading = false;
} catch (err) {
this.loading = false;
return Promise.reject(err);
}
}
removeButtonClicked(index: number): void {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment