Fix deleted repository staying opened

When deleting the currently selected repository it gets closed
before deletion.
TG-2 #closed

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/4/head
trivernis 3 years ago
parent e233c1e59c
commit 0357a6e8bf

@ -57,7 +57,11 @@ export class AddRepositoryDialogComponent implements OnInit {
public async initLocalRepository() { public async initLocalRepository() {
const path = this.formGroup.value.path; const path = this.formGroup.value.path;
try {
await this.repoService.initRepository(path); await this.repoService.initRepository(path);
} catch (err) {
this.errorBroker.showError(err);
}
await this.checkLocalRepoExists(); await this.checkLocalRepoExists();
} }

@ -54,6 +54,13 @@ export class RepositoryCardComponent implements OnInit, OnDestroy {
} }
}).afterClosed().subscribe(async confirmation => { }).afterClosed().subscribe(async confirmation => {
if (confirmation === true) { if (confirmation === true) {
if (this.isSelectedRepository()) {
if (this.repository.local) {
await this.repoService.closeSelectedRepository();
} else {
await this.repoService.disconnectSelectedRepository();
}
}
await this.repoService.removeRepository(this.repository.name); await this.repoService.removeRepository(this.repository.name);
} }
}); });

Loading…
Cancel
Save