,
+ @Inject(
+ MAT_DIALOG_DATA) data: { title: string, message: string, confirmAction: string, denyAction?: string, confirmColor?: ThemePalette, denyColor?: ThemePalette }
+ ) {
+ this.title = data.title;
+ this.message = data.message;
+ this.confirmAction = data.confirmAction;
+ this.denyAction = data.denyAction ?? this.denyAction;
+ this.confirmColor = data.confirmColor ?? this.confirmColor;
+ this.denyColor = data.denyColor ?? this.denyColor;
+ }
+
+ public closeDialog(result: boolean) {
+ this.dialogRef.close(result);
+ }
+}
diff --git a/mediarepo-ui/src/app/pages/home/repositories-tab/add-repository-dialog/add-repository-dialog.component.html b/mediarepo-ui/src/app/pages/home/repositories-tab/add-repository-dialog/add-repository-dialog.component.html
index c31b827..bf5b3e6 100644
--- a/mediarepo-ui/src/app/pages/home/repositories-tab/add-repository-dialog/add-repository-dialog.component.html
+++ b/mediarepo-ui/src/app/pages/home/repositories-tab/add-repository-dialog/add-repository-dialog.component.html
@@ -38,6 +38,7 @@
+
-
diff --git a/mediarepo-ui/src/app/pages/home/repositories-tab/repository-card/repository-card.component.html b/mediarepo-ui/src/app/pages/home/repositories-tab/repository-card/repository-card.component.html
index 36e10c5..a42a172 100644
--- a/mediarepo-ui/src/app/pages/home/repositories-tab/repository-card/repository-card.component.html
+++ b/mediarepo-ui/src/app/pages/home/repositories-tab/repository-card/repository-card.component.html
@@ -12,5 +12,10 @@
+
+
+
+
+
diff --git a/mediarepo-ui/src/app/pages/home/repositories-tab/repository-card/repository-card.component.ts b/mediarepo-ui/src/app/pages/home/repositories-tab/repository-card/repository-card.component.ts
index 5491464..7623bfb 100644
--- a/mediarepo-ui/src/app/pages/home/repositories-tab/repository-card/repository-card.component.ts
+++ b/mediarepo-ui/src/app/pages/home/repositories-tab/repository-card/repository-card.component.ts
@@ -3,6 +3,8 @@ import {Repository} from "../../../../models/Repository";
import {RepositoryService} from "../../../../services/repository/repository.service";
import {Router} from "@angular/router";
import {ErrorBrokerService} from "../../../../services/error-broker/error-broker.service";
+import {MatDialog} from "@angular/material/dialog";
+import {ConfirmDialogComponent} from "../../../../components/confirm-dialog/confirm-dialog.component";
@Component({
selector: 'app-repository-card',
@@ -17,12 +19,18 @@ export class RepositoryCardComponent implements OnInit, OnDestroy {
statusRefreshInterval: number | undefined;
- constructor(public repoService: RepositoryService, private router: Router, private errorBroker: ErrorBrokerService) {}
+ constructor(
+ public repoService: RepositoryService,
+ private router: Router,
+ private errorBroker: ErrorBrokerService,
+ public dialog: MatDialog) {
+ }
public async ngOnInit() {
if (!this.repository.local) {
await this.checkRemoteRepositoryStatus();
- this.statusRefreshInterval = setInterval(async() => await this.checkRemoteRepositoryStatus(), 10000);
+ this.statusRefreshInterval = setInterval(
+ async () => await this.checkRemoteRepositoryStatus(), 10000);
}
}
@@ -36,6 +44,21 @@ export class RepositoryCardComponent implements OnInit, OnDestroy {
return this.repoService.selectedRepository.getValue()?.name === this.repository.name
}
+ public async removeRepository() {
+ await this.dialog.open(ConfirmDialogComponent, {
+ data: {
+ title: "Remove repository",
+ message: `Do you really want to remove the repository "${this.repository.name}"?`,
+ confirmAction: "Remove",
+ confirmColor: "warn"
+ }
+ }).afterClosed().subscribe(async confirmation => {
+ if (confirmation === true) {
+ await this.repoService.removeRepository(this.repository.name);
+ }
+ });
+ }
+
public getDaemonStatusText(): string {
if (this.repository.local) {
return "Local";
@@ -72,14 +95,15 @@ export class RepositoryCardComponent implements OnInit, OnDestroy {
}
public async selectRepository() {
- try {
- await this.repoService.setRepository(this.repository);
- } catch(err) {
- this.errorBroker.showError(err);
- }
+ try {
+ await this.repoService.setRepository(this.repository);
+ } catch (err) {
+ this.errorBroker.showError(err);
+ }
}
async checkRemoteRepositoryStatus() {
- this.daemonRunning = await this.repoService.checkDaemonRunning(this.repository.address!);
+ this.daemonRunning = await this.repoService.checkDaemonRunning(
+ this.repository.address!);
}
}
diff --git a/mediarepo-ui/src/app/services/repository/repository.service.ts b/mediarepo-ui/src/app/services/repository/repository.service.ts
index 5e4c52a..9131041 100644
--- a/mediarepo-ui/src/app/services/repository/repository.service.ts
+++ b/mediarepo-ui/src/app/services/repository/repository.service.ts
@@ -108,7 +108,8 @@ export class RepositoryService {
* @returns {Promise}
*/
public async removeRepository(name: string): Promise {
- await invoke("plugin:mediarepo|remove_repository", {name})
+ await invoke("plugin:mediarepo|remove_repository", {name});
+ await this.loadRepositories();
}
/**