improved bulk performance
This commit is contained in:
parent
7ba346466c
commit
5906225de6
@ -173,7 +173,7 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
reloadProjects() {
|
||||
this.appStateService.getFiles().then(() => {
|
||||
this.appStateService.getFiles(this.appStateService.activeProject, false).then(() => {
|
||||
this.calculateData();
|
||||
});
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ export class AppStateService {
|
||||
return this.getProjectById(projectId).files.find((file) => file.fileId === fileId);
|
||||
}
|
||||
|
||||
async loadAllProjects() {
|
||||
async loadAllProjects(emitEvents: boolean = true) {
|
||||
const projects = await this._projectControllerService.getProjects().toPromise();
|
||||
if (projects) {
|
||||
const mappedProjects = projects.map((p) => {
|
||||
@ -213,7 +213,8 @@ export class AppStateService {
|
||||
for (const projectId of Object.keys(fileData)) {
|
||||
this._processFiles(
|
||||
mappedProjects.find((p) => p.projectId === projectId),
|
||||
fileData[projectId]
|
||||
fileData[projectId],
|
||||
emitEvents
|
||||
);
|
||||
}
|
||||
|
||||
@ -244,16 +245,16 @@ export class AppStateService {
|
||||
return activeFileWrapper;
|
||||
}
|
||||
|
||||
async getFiles(project?: ProjectWrapper) {
|
||||
async getFiles(project?: ProjectWrapper, emitEvents: boolean = true) {
|
||||
if (!project) {
|
||||
project = this.activeProject;
|
||||
}
|
||||
const files = await this._statusControllerService.getProjectStatus(project.project.projectId).toPromise();
|
||||
|
||||
return this._processFiles(project, files);
|
||||
return this._processFiles(project, files, emitEvents);
|
||||
}
|
||||
|
||||
private _processFiles(project: ProjectWrapper, files: FileStatus[]) {
|
||||
private _processFiles(project: ProjectWrapper, files: FileStatus[], emitEvents: boolean = true) {
|
||||
const oldFiles = [...project.files];
|
||||
|
||||
const fileStatusChangedEvent = [];
|
||||
@ -285,8 +286,10 @@ export class AppStateService {
|
||||
project.files = files.map((f) => new FileStatusWrapper(f, this._userService.getNameForId(f.currentReviewer)));
|
||||
this._computeStats();
|
||||
|
||||
fileReanalysedEvent.forEach((file) => this.fileReanalysed.emit(file));
|
||||
fileStatusChangedEvent.forEach((file) => this.fileChanged.emit(file));
|
||||
if (emitEvents) {
|
||||
fileReanalysedEvent.forEach((file) => this.fileReanalysed.emit(file));
|
||||
fileStatusChangedEvent.forEach((file) => this.fileChanged.emit(file));
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
@ -9,7 +9,6 @@ if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
platformBrowserDynamic();
|
||||
platformBrowserDynamic()
|
||||
.bootstrapModule(AppModule)
|
||||
.then((moduleRef) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user