diff --git a/mediarepo-ui/src-tauri/Cargo.lock b/mediarepo-ui/src-tauri/Cargo.lock
index eb74fdc..f7679e2 100644
--- a/mediarepo-ui/src-tauri/Cargo.lock
+++ b/mediarepo-ui/src-tauri/Cargo.lock
@@ -1492,7 +1492,7 @@ checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
[[package]]
name = "mediarepo-api"
version = "0.14.0"
-source = "git+https://github.com/Trivernis/mediarepo-api.git?rev=14f2675f5fe1a11ea3302a623d040e77dcc78080#14f2675f5fe1a11ea3302a623d040e77dcc78080"
+source = "git+https://github.com/Trivernis/mediarepo-api.git?rev=5991f5d3038386c921a901a05c4a72e4ce00b418#5991f5d3038386c921a901a05c4a72e4ce00b418"
dependencies = [
"async-trait",
"bromine",
@@ -1501,6 +1501,7 @@ dependencies = [
"futures",
"mime_guess",
"parking_lot",
+ "pathsearch",
"serde",
"serde_json",
"serde_piecewise_default",
@@ -1766,6 +1767,16 @@ version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
+[[package]]
+name = "open"
+version = "2.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "176ee4b630d174d2da8241336763bb459281dddc0f4d87f72c3b1efc9a6109b7"
+dependencies = [
+ "pathdiff",
+ "winapi",
+]
+
[[package]]
name = "openssl"
version = "0.10.36"
@@ -1855,6 +1866,22 @@ dependencies = [
"winapi",
]
+[[package]]
+name = "pathdiff"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
+
+[[package]]
+name = "pathsearch"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "da983bc5e582ab17179c190b4b66c7d76c5943a69c6d34df2a2b6bf8a2977b05"
+dependencies = [
+ "anyhow",
+ "libc",
+]
+
[[package]]
name = "percent-encoding"
version = "2.1.0"
@@ -2778,6 +2805,7 @@ dependencies = [
"http",
"ignore",
"once_cell",
+ "open",
"percent-encoding",
"rand 0.8.4",
"raw-window-handle",
diff --git a/mediarepo-ui/src-tauri/Cargo.toml b/mediarepo-ui/src-tauri/Cargo.toml
index 5a43be9..6deb78b 100644
--- a/mediarepo-ui/src-tauri/Cargo.toml
+++ b/mediarepo-ui/src-tauri/Cargo.toml
@@ -15,7 +15,7 @@ tauri-build = { version = "1.0.0-beta.4" }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = [ "derive" ] }
-tauri = { version = "1.0.0-beta.8", features = ["dialog-all", "path-all"] }
+tauri = { version = "1.0.0-beta.8", features = ["dialog-all", "path-all", "shell-open"] }
thiserror = "1.0.30"
typemap_rev = "0.1.5"
@@ -25,7 +25,7 @@ features = [ "env-filter" ]
[dependencies.mediarepo-api]
git = "https://github.com/Trivernis/mediarepo-api.git"
-rev = "14f2675f5fe1a11ea3302a623d040e77dcc78080"
+rev = "5991f5d3038386c921a901a05c4a72e4ce00b418"
features = [ "tauri-plugin" ]
[features]
diff --git a/mediarepo-ui/src-tauri/tauri.conf.json b/mediarepo-ui/src-tauri/tauri.conf.json
index 53bf593..3e34cd7 100644
--- a/mediarepo-ui/src-tauri/tauri.conf.json
+++ b/mediarepo-ui/src-tauri/tauri.conf.json
@@ -53,6 +53,9 @@
},
"path": {
"all": true
+ },
+ "shell": {
+ "open": true
}
},
"windows": [
diff --git a/mediarepo-ui/src/app/components/core/core.module.ts b/mediarepo-ui/src/app/components/core/core.module.ts
index a044706..7dc1ae2 100644
--- a/mediarepo-ui/src/app/components/core/core.module.ts
+++ b/mediarepo-ui/src/app/components/core/core.module.ts
@@ -35,6 +35,7 @@ import {MatInputModule} from "@angular/material/input";
import {TagModule} from "../shared/tag/tag.module";
import { RepositoryFormComponent } from './repositories-tab/repository-form/repository-form.component';
import { EditRepositoryDialogComponent } from './repositories-tab/edit-repository-dialog/edit-repository-dialog.component';
+import { DownloadDaemonDialogComponent } from './repositories-tab/download-daemon-dialog/download-daemon-dialog.component';
@NgModule({
@@ -49,6 +50,7 @@ import { EditRepositoryDialogComponent } from './repositories-tab/edit-repositor
AddRepositoryDialogComponent,
RepositoryFormComponent,
EditRepositoryDialogComponent,
+ DownloadDaemonDialogComponent,
],
exports: [
CoreComponent,
diff --git a/mediarepo-ui/src/app/components/core/repositories-tab/download-daemon-dialog/download-daemon-dialog.component.html b/mediarepo-ui/src/app/components/core/repositories-tab/download-daemon-dialog/download-daemon-dialog.component.html
new file mode 100644
index 0000000..d0538f6
--- /dev/null
+++ b/mediarepo-ui/src/app/components/core/repositories-tab/download-daemon-dialog/download-daemon-dialog.component.html
@@ -0,0 +1,12 @@
+
+ Download daemon
+
+
+ No daemon could be found on the system. Please download and install a daemon executable.
+
+
+
+
+
+
+
diff --git a/mediarepo-ui/src/app/components/core/repositories-tab/download-daemon-dialog/download-daemon-dialog.component.scss b/mediarepo-ui/src/app/components/core/repositories-tab/download-daemon-dialog/download-daemon-dialog.component.scss
new file mode 100644
index 0000000..c234f45
--- /dev/null
+++ b/mediarepo-ui/src/app/components/core/repositories-tab/download-daemon-dialog/download-daemon-dialog.component.scss
@@ -0,0 +1,15 @@
+.download-dialog-actions {
+ display: block;
+
+ button {
+ float: right;
+ margin-left: 1em;
+ }
+}
+
+button.download-button {
+ margin: 2em auto auto;
+ align-self: center;
+ display: flex;
+}
+
diff --git a/mediarepo-ui/src/app/components/core/repositories-tab/download-daemon-dialog/download-daemon-dialog.component.spec.ts b/mediarepo-ui/src/app/components/core/repositories-tab/download-daemon-dialog/download-daemon-dialog.component.spec.ts
new file mode 100644
index 0000000..ae0b74f
--- /dev/null
+++ b/mediarepo-ui/src/app/components/core/repositories-tab/download-daemon-dialog/download-daemon-dialog.component.spec.ts
@@ -0,0 +1,25 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { DownloadDaemonDialogComponent } from './download-daemon-dialog.component';
+
+describe('DownloadDaemonDialogComponent', () => {
+ let component: DownloadDaemonDialogComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [ DownloadDaemonDialogComponent ]
+ })
+ .compileComponents();
+ });
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(DownloadDaemonDialogComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/mediarepo-ui/src/app/components/core/repositories-tab/download-daemon-dialog/download-daemon-dialog.component.ts b/mediarepo-ui/src/app/components/core/repositories-tab/download-daemon-dialog/download-daemon-dialog.component.ts
new file mode 100644
index 0000000..957a8f8
--- /dev/null
+++ b/mediarepo-ui/src/app/components/core/repositories-tab/download-daemon-dialog/download-daemon-dialog.component.ts
@@ -0,0 +1,25 @@
+import {Component, Inject} from "@angular/core";
+import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
+import {shell} from "@tauri-apps/api";
+
+@Component({
+ selector: "app-download-daemon-dialog",
+ templateUrl: "./download-daemon-dialog.component.html",
+ styleUrls: ["./download-daemon-dialog.component.scss"]
+})
+export class DownloadDaemonDialogComponent {
+
+ constructor(public dialogRef: MatDialogRef,
+ @Inject(
+ MAT_DIALOG_DATA) data: any) {
+ }
+
+
+ public async onClickDownloadDaemon() {
+ await shell.open("https://github.com/Trivernis/mediarepo-daemon");
+ }
+
+ closeDialog(result: boolean) {
+ this.dialogRef.close(result)
+ }
+}
diff --git a/mediarepo-ui/src/app/components/core/repositories-tab/repositories-tab.component.ts b/mediarepo-ui/src/app/components/core/repositories-tab/repositories-tab.component.ts
index 0b363c9..c6df19e 100644
--- a/mediarepo-ui/src/app/components/core/repositories-tab/repositories-tab.component.ts
+++ b/mediarepo-ui/src/app/components/core/repositories-tab/repositories-tab.component.ts
@@ -1,16 +1,21 @@
-import {Component, OnInit} from "@angular/core";
+import {AfterViewInit, Component, OnInit} from "@angular/core";
import {Repository} from "../../../models/Repository";
import {RepositoryService} from "../../../services/repository/repository.service";
import {MatDialog} from "@angular/material/dialog";
import {AddRepositoryDialogComponent} from "./add-repository-dialog/add-repository-dialog.component";
+import {
+ ConfirmDialogComponent
+} from "../../shared/app-common/confirm-dialog/confirm-dialog.component";
+import {
+ DownloadDaemonDialogComponent
+} from "./download-daemon-dialog/download-daemon-dialog.component";
@Component({
selector: "app-repositories-tab",
templateUrl: "./repositories-tab.component.html",
styleUrls: ["./repositories-tab.component.scss"]
})
-export class RepositoriesTabComponent implements OnInit {
-
+export class RepositoriesTabComponent implements OnInit, AfterViewInit {
repositories: Repository[] = [];
constructor(
@@ -27,6 +32,11 @@ export class RepositoriesTabComponent implements OnInit {
});
}
+ public async ngAfterViewInit() {
+ await this.checkAndPromptDaemonExecutable();
+ }
+
+
public openAddRepositoryDialog() {
this.dialog.open(AddRepositoryDialogComponent, {
disableClose: true,
@@ -34,4 +44,16 @@ export class RepositoriesTabComponent implements OnInit {
minHeight: "30%",
});
}
+
+ private async checkAndPromptDaemonExecutable() {
+ if (!await this.repoService.checkDameonConfigured()) {
+ const result = await this.dialog.open(DownloadDaemonDialogComponent, {
+ disableClose: true,
+ }).afterClosed().toPromise();
+ if (result) {
+ // recursion avoidance
+ setTimeout(async () => await this.checkAndPromptDaemonExecutable(), 0);
+ }
+ }
+ }
}
diff --git a/mediarepo-ui/src/app/components/shared/app-common/confirm-dialog/confirm-dialog.component.ts b/mediarepo-ui/src/app/components/shared/app-common/confirm-dialog/confirm-dialog.component.ts
index b4270f8..8fbe65f 100644
--- a/mediarepo-ui/src/app/components/shared/app-common/confirm-dialog/confirm-dialog.component.ts
+++ b/mediarepo-ui/src/app/components/shared/app-common/confirm-dialog/confirm-dialog.component.ts
@@ -19,7 +19,7 @@ export class ConfirmDialogComponent {
constructor(
public dialogRef: MatDialogRef,
@Inject(
- MAT_DIALOG_DATA) data: { title: string, message: string, confirmAction: string, denyAction?: string, confirmColor?: ThemePalette, denyColor?: ThemePalette }
+ MAT_DIALOG_DATA) data: { title: string, message: string, confirmAction: string, denyAction?: string, confirmColor?: ThemePalette, denyColor?: ThemePalette}
) {
this.title = data.title;
this.message = data.message;
diff --git a/mediarepo-ui/src/app/services/repository/repository.service.ts b/mediarepo-ui/src/app/services/repository/repository.service.ts
index c075d33..1dc22ab 100644
--- a/mediarepo-ui/src/app/services/repository/repository.service.ts
+++ b/mediarepo-ui/src/app/services/repository/repository.service.ts
@@ -26,6 +26,14 @@ export class RepositoryService {
});
}
+ /**
+ * Checks if a daemon is configured in the settings or can be found on the system
+ * @returns {Promise}
+ */
+ public async checkDameonConfigured(): Promise {
+ return await invoke("plugin:mediarepo|has_executable");
+ }
+
/**
* Loads all repositories stored in the settings
* @returns {Promise}