From 0357a6e8bfa20075d1ae8621ef0de96ed75831bf Mon Sep 17 00:00:00 2001 From: trivernis Date: Mon, 29 Nov 2021 20:06:18 +0100 Subject: [PATCH] Fix deleted repository staying opened When deleting the currently selected repository it gets closed before deletion. TG-2 #closed Signed-off-by: trivernis --- .../add-repository-dialog.component.ts | 6 +++++- .../repository-card/repository-card.component.ts | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/mediarepo-ui/src/app/components/core/repositories-tab/add-repository-dialog/add-repository-dialog.component.ts b/mediarepo-ui/src/app/components/core/repositories-tab/add-repository-dialog/add-repository-dialog.component.ts index 5409473..7db16d3 100644 --- a/mediarepo-ui/src/app/components/core/repositories-tab/add-repository-dialog/add-repository-dialog.component.ts +++ b/mediarepo-ui/src/app/components/core/repositories-tab/add-repository-dialog/add-repository-dialog.component.ts @@ -57,7 +57,11 @@ export class AddRepositoryDialogComponent implements OnInit { public async initLocalRepository() { const path = this.formGroup.value.path; - await this.repoService.initRepository(path); + try { + await this.repoService.initRepository(path); + } catch (err) { + this.errorBroker.showError(err); + } await this.checkLocalRepoExists(); } diff --git a/mediarepo-ui/src/app/components/core/repositories-tab/repository-card/repository-card.component.ts b/mediarepo-ui/src/app/components/core/repositories-tab/repository-card/repository-card.component.ts index 77eeb02..66f964b 100644 --- a/mediarepo-ui/src/app/components/core/repositories-tab/repository-card/repository-card.component.ts +++ b/mediarepo-ui/src/app/components/core/repositories-tab/repository-card/repository-card.component.ts @@ -54,6 +54,13 @@ export class RepositoryCardComponent implements OnInit, OnDestroy { } }).afterClosed().subscribe(async confirmation => { 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); } });