ngOnInit() {
this.context = this.tasksService.tasksContext;
this.params = {...this.context};
this.form = {q: this.context.q, checkboxes: []};
this.itemsSelected = this.context.itemsSelected || [];
this.appsState$ = this.appsService.appsState();
this.sharedAboutService.getFeatureInfo()
.subscribe((featureInfo: FeatureInfo) => {
this.schedulerEnabled = !!featureInfo.schedulerEnabled;
this.refresh();
});
}
refresh() {
this.loading = true;
this.tasksService
.getDefinitions(this.params).pipe(map((page: Page<TaskDefinition>) => {
this.form.checkboxes = page.items.map((task) => {
return this.itemsSelected.indexOf(task.name) > -1;
});
return page;
}))
.subscribe((page: Page<TaskDefinition>) => {
if (page.items.length === 0 && this.params.page > 0) {
this.params.page = 0;
this.refresh();
return;
}
this.taskDefinitions = page;
this.changeCheckboxes();
this.updateContext();
this.loading = false;
},
error => {
this.loading = false;
this.notificationService.error('错误', error);
});
}
加载动画有时消失,有时不消失,脏检测问题? 我认为这是一个肮脏的测试问题,但我不知道如何解决。 可能还有其他问题。