Fix delete projects cancel bug (#7437)
This commit is contained in:
parent
e3f20d81e2
commit
a5df12105b
|
@ -84,10 +84,9 @@ export class ProjectsComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
async openDeleteProjectDialog(projects: ProjectListView[]) {
|
async openDeleteProjectDialog(projects: ProjectListView[]) {
|
||||||
if (projects.some((project) => project.write == false)) {
|
let projectsToDelete = projects;
|
||||||
const readOnlyProjects = projects.filter((project) => project.write == false);
|
const readOnlyProjects = projects.filter((project) => project.write == false);
|
||||||
const writeProjects = projects.filter((project) => project.write);
|
if (readOnlyProjects.length > 0) {
|
||||||
|
|
||||||
const dialogRef = this.dialogService.open<unknown, BulkConfirmationDetails>(
|
const dialogRef = this.dialogService.open<unknown, BulkConfirmationDetails>(
|
||||||
BulkConfirmationDialogComponent,
|
BulkConfirmationDialogComponent,
|
||||||
{
|
{
|
||||||
|
@ -102,20 +101,17 @@ export class ProjectsComponent implements OnInit {
|
||||||
|
|
||||||
const result = await lastValueFrom(dialogRef.closed);
|
const result = await lastValueFrom(dialogRef.closed);
|
||||||
|
|
||||||
if (result == BulkConfirmationResult.Continue) {
|
if (result !== BulkConfirmationResult.Continue) {
|
||||||
this.dialogService.open<unknown, ProjectDeleteOperation>(ProjectDeleteDialogComponent, {
|
return;
|
||||||
data: {
|
|
||||||
projects: writeProjects,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else {
|
projectsToDelete = projects.filter((project) => project.write);
|
||||||
this.dialogService.open<unknown, ProjectDeleteOperation>(ProjectDeleteDialogComponent, {
|
|
||||||
data: {
|
|
||||||
projects,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.dialogService.open<unknown, ProjectDeleteOperation>(ProjectDeleteDialogComponent, {
|
||||||
|
data: {
|
||||||
|
projects: projectsToDelete,
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private getBulkConfirmationDetails(projects: ProjectListView[]): BulkConfirmationStatus[] {
|
private getBulkConfirmationDetails(projects: ProjectListView[]): BulkConfirmationStatus[] {
|
||||||
|
|
Loading…
Reference in New Issue