MOBILE-2949 rating: Event that notifies rate component loading status
parent
8e9af2fdda
commit
d8c76b0c35
|
@ -35,6 +35,7 @@ export class CoreRatingRateComponent implements OnChanges {
|
||||||
@Input() aggregateMethod: number;
|
@Input() aggregateMethod: number;
|
||||||
@Input() scaleId: number;
|
@Input() scaleId: number;
|
||||||
@Input() userId: number;
|
@Input() userId: number;
|
||||||
|
@Output() onLoading: EventEmitter<boolean>; // Eevent that indicates whether the component is loading data.
|
||||||
@Output() onUpdate: EventEmitter<void>; // Event emitted when the rating is updated online.
|
@Output() onUpdate: EventEmitter<void>; // Event emitted when the rating is updated online.
|
||||||
|
|
||||||
item: CoreRatingInfoItem;
|
item: CoreRatingInfoItem;
|
||||||
|
@ -43,6 +44,7 @@ export class CoreRatingRateComponent implements OnChanges {
|
||||||
|
|
||||||
constructor(private domUtils: CoreDomUtilsProvider, private translate: TranslateService,
|
constructor(private domUtils: CoreDomUtilsProvider, private translate: TranslateService,
|
||||||
private ratingProvider: CoreRatingProvider, private ratingOffline: CoreRatingOfflineProvider) {
|
private ratingProvider: CoreRatingProvider, private ratingOffline: CoreRatingOfflineProvider) {
|
||||||
|
this.onLoading = new EventEmitter<boolean>();
|
||||||
this.onUpdate = new EventEmitter<void>();
|
this.onUpdate = new EventEmitter<void>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,6 +79,7 @@ export class CoreRatingRateComponent implements OnChanges {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.onLoading.emit(true);
|
||||||
this.ratingOffline.getRating(this.contextLevel, this.instanceId, this.ratingInfo.component, this.ratingInfo.ratingarea,
|
this.ratingOffline.getRating(this.contextLevel, this.instanceId, this.ratingInfo.component, this.ratingInfo.ratingarea,
|
||||||
this.itemId).then((rating) => {
|
this.itemId).then((rating) => {
|
||||||
this.rating = rating.rating;
|
this.rating = rating.rating;
|
||||||
|
@ -86,6 +89,8 @@ export class CoreRatingRateComponent implements OnChanges {
|
||||||
} else {
|
} else {
|
||||||
this.rating = CoreRatingProvider.UNSET_RATING;
|
this.rating = CoreRatingProvider.UNSET_RATING;
|
||||||
}
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
this.onLoading.emit(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue