Fix delete projects cancel bug (#7437)

This commit is contained in:
Thomas Avery 2024-01-09 09:35:44 -06:00 committed by GitHub
parent e3f20d81e2
commit a5df12105b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 16 deletions

View File

@ -84,10 +84,9 @@ export class ProjectsComponent implements OnInit {
}
async openDeleteProjectDialog(projects: ProjectListView[]) {
if (projects.some((project) => project.write == false)) {
const readOnlyProjects = projects.filter((project) => project.write == false);
const writeProjects = projects.filter((project) => project.write);
let projectsToDelete = projects;
const readOnlyProjects = projects.filter((project) => project.write == false);
if (readOnlyProjects.length > 0) {
const dialogRef = this.dialogService.open<unknown, BulkConfirmationDetails>(
BulkConfirmationDialogComponent,
{
@ -102,20 +101,17 @@ export class ProjectsComponent implements OnInit {
const result = await lastValueFrom(dialogRef.closed);
if (result == BulkConfirmationResult.Continue) {
this.dialogService.open<unknown, ProjectDeleteOperation>(ProjectDeleteDialogComponent, {
data: {
projects: writeProjects,
},
});
if (result !== BulkConfirmationResult.Continue) {
return;
}
} else {
this.dialogService.open<unknown, ProjectDeleteOperation>(ProjectDeleteDialogComponent, {
data: {
projects,
},
});
projectsToDelete = projects.filter((project) => project.write);
}
this.dialogService.open<unknown, ProjectDeleteOperation>(ProjectDeleteDialogComponent, {
data: {
projects: projectsToDelete,
},
});
}
private getBulkConfirmationDetails(projects: ProjectListView[]): BulkConfirmationStatus[] {