added background reload for project and file data
This commit is contained in:
parent
ca9d62b3f4
commit
f9e5bb132e
@ -12,6 +12,8 @@ import {SortingOption} from '../../utils/types';
|
||||
import {DoughnutChartConfig} from '../../components/simple-doughnut-chart/simple-doughnut-chart.component';
|
||||
import {groupBy} from '../../utils/functions';
|
||||
import {DialogService} from '../../dialogs/dialog.service';
|
||||
import {interval} from "rxjs";
|
||||
import {flatMap, tap} from "rxjs/operators";
|
||||
|
||||
|
||||
@Component({
|
||||
@ -20,7 +22,6 @@ import {DialogService} from '../../dialogs/dialog.service';
|
||||
styleUrls: ['./project-overview-screen.component.scss']
|
||||
})
|
||||
export class ProjectOverviewScreenComponent implements OnInit, OnDestroy {
|
||||
private _fileStatusInterval;
|
||||
private _selectedFileIds: string[] = [];
|
||||
|
||||
public sortingOptions: SortingOption[] = [
|
||||
@ -52,17 +53,10 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy {
|
||||
ngOnInit(): void {
|
||||
this._fileDropOverlayService.initFileDropHandling();
|
||||
this._calculateChartConfig();
|
||||
this._fileStatusInterval = setInterval(() => {
|
||||
this._getFileStatus();
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this._fileDropOverlayService.cleanupFileDropHandling();
|
||||
if (this._fileStatusInterval) {
|
||||
clearInterval(this._fileStatusInterval);
|
||||
this._fileStatusInterval = null;
|
||||
}
|
||||
}
|
||||
|
||||
public get activeProject() {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import {Injectable} from "@angular/core";
|
||||
import {Injectable, EventEmitter} from "@angular/core";
|
||||
import {
|
||||
FileStatus,
|
||||
Project,
|
||||
@ -10,6 +10,8 @@ import {NotificationService, NotificationType} from "../notification/notificatio
|
||||
import {TranslateService} from "@ngx-translate/core";
|
||||
import {Router} from "@angular/router";
|
||||
import {UserService} from "../user/user.service";
|
||||
import {interval} from "rxjs";
|
||||
import {tap} from "rxjs/operators";
|
||||
|
||||
|
||||
export interface AppState {
|
||||
@ -39,6 +41,8 @@ export class AppStateService {
|
||||
|
||||
private _appState: AppState;
|
||||
|
||||
public fileStatusChanged = new EventEmitter<void>();
|
||||
|
||||
|
||||
constructor(
|
||||
private readonly _router: Router,
|
||||
@ -53,6 +57,14 @@ export class AppStateService {
|
||||
activeProject: null,
|
||||
activeFile: null
|
||||
}
|
||||
|
||||
interval(5000).pipe(tap(() => {
|
||||
this.reloadActiveProjectFiles();
|
||||
})).subscribe();
|
||||
|
||||
interval(30000).pipe(tap(() => {
|
||||
this.loadAllProjects();
|
||||
})).subscribe();
|
||||
}
|
||||
|
||||
|
||||
@ -201,7 +213,9 @@ export class AppStateService {
|
||||
}
|
||||
|
||||
async reloadActiveProjectFiles() {
|
||||
await this.getFiles(this._appState.activeProject.project.projectId);
|
||||
if(this._appState.activeProject?.project) {
|
||||
await this.getFiles(this._appState.activeProject.project.projectId);
|
||||
}
|
||||
}
|
||||
|
||||
async loadAllProjectsIfNecessary() {
|
||||
@ -214,4 +228,5 @@ export class AppStateService {
|
||||
await this._reanalysisControllerService.reanalyzeFile(this._appState.activeProject.project.projectId, this._appState.activeFile.fileId).toPromise();
|
||||
await this.reloadActiveProjectFiles();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user