Commit ab025331 authored by Samuel Schepp's avatar Samuel Schepp

added loading indicator for single-model-input

parent 4b4bafe5
Pipeline #17526 passed with stages
in 7 minutes and 59 seconds
<div *ngIf="loading">
<span class="fa fa-spinner"></span>
</div>
<div ngbDropdown class="d-inline-block" *ngIf="model">
<button class="btn btn-outline-primary" id="dropdownBasic1" ngbDropdownToggle>
{{model.toString()}}
......
......@@ -15,16 +15,23 @@ export class SingleModelInputComponent implements OnInit {
@Input() modelDefinition: IModelDefinition<IModel>;
availableObjects: IModel[];
loading: boolean;
constructor(private genericDataLoader: GenericDataService) {
this.availableObjects = [];
this.loading = false;
}
async ngOnInit() {
this.availableObjects = await this.genericDataLoader.get(this.modelDefinition);
if (!this.model || !this.availableObjects.map((val) => val.getID()).includes(this.model.getID())) {
this.setObject(this.availableObjects[0]);
this.loading = true;
try {
this.availableObjects = await this.genericDataLoader.get(this.modelDefinition);
if (!this.model || !this.availableObjects.map((val) => val.getID()).includes(this.model.getID())) {
this.setObject(this.availableObjects[0]);
}
} finally {
this.loading = false;
}
}
......
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