From 25786f9d3cc7587aa3f5205f525c3757aa5a6860 Mon Sep 17 00:00:00 2001 From: Trivernis Date: Mon, 27 Dec 2021 16:35:42 +0100 Subject: [PATCH] Move repository dialogs to separate shared component Signed-off-by: Trivernis --- .../src/app/components/core/core.module.ts | 16 ++----- .../repositories-tab.component.ts | 6 +-- .../repository-card.component.ts | 2 +- .../add-repository-dialog.component.html | 0 .../add-repository-dialog.component.scss | 0 .../add-repository-dialog.component.spec.ts | 0 .../add-repository-dialog.component.ts | 10 ++--- .../edit-repository-dialog.component.html | 0 .../edit-repository-dialog.component.scss | 0 .../edit-repository-dialog.component.spec.ts | 0 .../edit-repository-dialog.component.ts | 11 ++--- .../repository-form.component.html | 0 .../repository-form.component.scss | 0 .../repository-form.component.spec.ts | 0 .../repository-form.component.ts | 4 +- .../repository/repository.module.ts | 44 +++++++++++++++++++ 16 files changed, 63 insertions(+), 30 deletions(-) rename mediarepo-ui/src/app/components/{core/repositories-tab => shared/repository/repository}/add-repository-dialog/add-repository-dialog.component.html (100%) rename mediarepo-ui/src/app/components/{core/repositories-tab => shared/repository/repository}/add-repository-dialog/add-repository-dialog.component.scss (100%) rename mediarepo-ui/src/app/components/{core/repositories-tab => shared/repository/repository}/add-repository-dialog/add-repository-dialog.component.spec.ts (100%) rename mediarepo-ui/src/app/components/{core/repositories-tab => shared/repository/repository}/add-repository-dialog/add-repository-dialog.component.ts (93%) rename mediarepo-ui/src/app/components/{core/repositories-tab => shared/repository/repository}/edit-repository-dialog/edit-repository-dialog.component.html (100%) rename mediarepo-ui/src/app/components/{core/repositories-tab => shared/repository/repository}/edit-repository-dialog/edit-repository-dialog.component.scss (100%) rename mediarepo-ui/src/app/components/{core/repositories-tab => shared/repository/repository}/edit-repository-dialog/edit-repository-dialog.component.spec.ts (100%) rename mediarepo-ui/src/app/components/{core/repositories-tab => shared/repository/repository}/edit-repository-dialog/edit-repository-dialog.component.ts (87%) rename mediarepo-ui/src/app/components/{core/repositories-tab => shared/repository/repository}/repository-form/repository-form.component.html (100%) rename mediarepo-ui/src/app/components/{core/repositories-tab => shared/repository/repository}/repository-form/repository-form.component.scss (100%) rename mediarepo-ui/src/app/components/{core/repositories-tab => shared/repository/repository}/repository-form/repository-form.component.spec.ts (100%) rename mediarepo-ui/src/app/components/{core/repositories-tab => shared/repository/repository}/repository-form/repository-form.component.ts (97%) create mode 100644 mediarepo-ui/src/app/components/shared/repository/repository/repository.module.ts diff --git a/mediarepo-ui/src/app/components/core/core.module.ts b/mediarepo-ui/src/app/components/core/core.module.ts index d77e036..b271819 100644 --- a/mediarepo-ui/src/app/components/core/core.module.ts +++ b/mediarepo-ui/src/app/components/core/core.module.ts @@ -33,24 +33,18 @@ import {ReactiveFormsModule} from "@angular/forms"; import { RepositoryCardComponent } from "./repositories-tab/repository-card/repository-card.component"; -import { - AddRepositoryDialogComponent -} from "./repositories-tab/add-repository-dialog/add-repository-dialog.component"; import {MatCardModule} from "@angular/material/card"; import {MatListModule} from "@angular/material/list"; import {MatDialogModule} from "@angular/material/dialog"; import {MatTooltipModule} from "@angular/material/tooltip"; 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"; +import { + RepositoryModule +} from "../shared/repository/repository/repository.module"; @NgModule({ @@ -62,9 +56,6 @@ import { ImportTabComponent, ImportTabSidebarComponent, RepositoryCardComponent, - AddRepositoryDialogComponent, - RepositoryFormComponent, - EditRepositoryDialogComponent, DownloadDaemonDialogComponent, ], exports: [ @@ -96,6 +87,7 @@ import { MatTooltipModule, MatInputModule, TagModule, + RepositoryModule, ] }) export class CoreModule { 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 9715e67..1159d5c 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 @@ -4,12 +4,12 @@ import { RepositoryService } from "../../../services/repository/repository.service"; import {MatDialog} from "@angular/material/dialog"; -import { - AddRepositoryDialogComponent -} from "./add-repository-dialog/add-repository-dialog.component"; import { DownloadDaemonDialogComponent } from "./download-daemon-dialog/download-daemon-dialog.component"; +import { + AddRepositoryDialogComponent +} from "../../shared/repository/repository/add-repository-dialog/add-repository-dialog.component"; @Component({ selector: "app-repositories-tab", 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 c47131d..0c70358 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 @@ -15,7 +15,7 @@ import { } from "../../../shared/app-common/busy-indicator/busy-indicator.component"; import { EditRepositoryDialogComponent -} from "../edit-repository-dialog/edit-repository-dialog.component"; +} from "../../../shared/repository/repository/edit-repository-dialog/edit-repository-dialog.component"; @Component({ selector: "app-repository-card", diff --git a/mediarepo-ui/src/app/components/core/repositories-tab/add-repository-dialog/add-repository-dialog.component.html b/mediarepo-ui/src/app/components/shared/repository/repository/add-repository-dialog/add-repository-dialog.component.html similarity index 100% rename from mediarepo-ui/src/app/components/core/repositories-tab/add-repository-dialog/add-repository-dialog.component.html rename to mediarepo-ui/src/app/components/shared/repository/repository/add-repository-dialog/add-repository-dialog.component.html diff --git a/mediarepo-ui/src/app/components/core/repositories-tab/add-repository-dialog/add-repository-dialog.component.scss b/mediarepo-ui/src/app/components/shared/repository/repository/add-repository-dialog/add-repository-dialog.component.scss similarity index 100% rename from mediarepo-ui/src/app/components/core/repositories-tab/add-repository-dialog/add-repository-dialog.component.scss rename to mediarepo-ui/src/app/components/shared/repository/repository/add-repository-dialog/add-repository-dialog.component.scss diff --git a/mediarepo-ui/src/app/components/core/repositories-tab/add-repository-dialog/add-repository-dialog.component.spec.ts b/mediarepo-ui/src/app/components/shared/repository/repository/add-repository-dialog/add-repository-dialog.component.spec.ts similarity index 100% rename from mediarepo-ui/src/app/components/core/repositories-tab/add-repository-dialog/add-repository-dialog.component.spec.ts rename to mediarepo-ui/src/app/components/shared/repository/repository/add-repository-dialog/add-repository-dialog.component.spec.ts 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/shared/repository/repository/add-repository-dialog/add-repository-dialog.component.ts similarity index 93% rename from mediarepo-ui/src/app/components/core/repositories-tab/add-repository-dialog/add-repository-dialog.component.ts rename to mediarepo-ui/src/app/components/shared/repository/repository/add-repository-dialog/add-repository-dialog.component.ts index 058cca5..1e18048 100644 --- a/mediarepo-ui/src/app/components/core/repositories-tab/add-repository-dialog/add-repository-dialog.component.ts +++ b/mediarepo-ui/src/app/components/shared/repository/repository/add-repository-dialog/add-repository-dialog.component.ts @@ -1,14 +1,14 @@ import {Component, Inject, ViewChild} from "@angular/core"; import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog"; +import { + RepositoryFormComponent +} from "../repository-form/repository-form.component"; import { RepositoryService -} from "../../../../services/repository/repository.service"; +} from "../../../../../services/repository/repository.service"; import { ErrorBrokerService -} from "../../../../services/error-broker/error-broker.service"; -import { - RepositoryFormComponent -} from "../repository-form/repository-form.component"; +} from "../../../../../services/error-broker/error-broker.service"; @Component({ selector: "app-add-repository-dialog", diff --git a/mediarepo-ui/src/app/components/core/repositories-tab/edit-repository-dialog/edit-repository-dialog.component.html b/mediarepo-ui/src/app/components/shared/repository/repository/edit-repository-dialog/edit-repository-dialog.component.html similarity index 100% rename from mediarepo-ui/src/app/components/core/repositories-tab/edit-repository-dialog/edit-repository-dialog.component.html rename to mediarepo-ui/src/app/components/shared/repository/repository/edit-repository-dialog/edit-repository-dialog.component.html diff --git a/mediarepo-ui/src/app/components/core/repositories-tab/edit-repository-dialog/edit-repository-dialog.component.scss b/mediarepo-ui/src/app/components/shared/repository/repository/edit-repository-dialog/edit-repository-dialog.component.scss similarity index 100% rename from mediarepo-ui/src/app/components/core/repositories-tab/edit-repository-dialog/edit-repository-dialog.component.scss rename to mediarepo-ui/src/app/components/shared/repository/repository/edit-repository-dialog/edit-repository-dialog.component.scss diff --git a/mediarepo-ui/src/app/components/core/repositories-tab/edit-repository-dialog/edit-repository-dialog.component.spec.ts b/mediarepo-ui/src/app/components/shared/repository/repository/edit-repository-dialog/edit-repository-dialog.component.spec.ts similarity index 100% rename from mediarepo-ui/src/app/components/core/repositories-tab/edit-repository-dialog/edit-repository-dialog.component.spec.ts rename to mediarepo-ui/src/app/components/shared/repository/repository/edit-repository-dialog/edit-repository-dialog.component.spec.ts diff --git a/mediarepo-ui/src/app/components/core/repositories-tab/edit-repository-dialog/edit-repository-dialog.component.ts b/mediarepo-ui/src/app/components/shared/repository/repository/edit-repository-dialog/edit-repository-dialog.component.ts similarity index 87% rename from mediarepo-ui/src/app/components/core/repositories-tab/edit-repository-dialog/edit-repository-dialog.component.ts rename to mediarepo-ui/src/app/components/shared/repository/repository/edit-repository-dialog/edit-repository-dialog.component.ts index 12c4336..857c32f 100644 --- a/mediarepo-ui/src/app/components/core/repositories-tab/edit-repository-dialog/edit-repository-dialog.component.ts +++ b/mediarepo-ui/src/app/components/shared/repository/repository/edit-repository-dialog/edit-repository-dialog.component.ts @@ -4,15 +4,12 @@ import { } from "../repository-form/repository-form.component"; import { RepositoryService -} from "../../../../services/repository/repository.service"; +} from "../../../../../services/repository/repository.service"; import { ErrorBrokerService -} from "../../../../services/error-broker/error-broker.service"; +} from "../../../../../services/error-broker/error-broker.service"; import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog"; -import { - AddRepositoryDialogComponent -} from "../add-repository-dialog/add-repository-dialog.component"; -import {Repository} from "../../../../models/Repository"; +import {Repository} from "../../../../../models/Repository"; @Component({ selector: "app-edit-repository-dialog", @@ -29,7 +26,7 @@ export class EditRepositoryDialogComponent { constructor( public repoService: RepositoryService, public errorBroker: ErrorBrokerService, - public dialogRef: MatDialogRef, + public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) data: any) { this.selectedRepository = data.repository; this.originalName = this.selectedRepository.name; diff --git a/mediarepo-ui/src/app/components/core/repositories-tab/repository-form/repository-form.component.html b/mediarepo-ui/src/app/components/shared/repository/repository/repository-form/repository-form.component.html similarity index 100% rename from mediarepo-ui/src/app/components/core/repositories-tab/repository-form/repository-form.component.html rename to mediarepo-ui/src/app/components/shared/repository/repository/repository-form/repository-form.component.html diff --git a/mediarepo-ui/src/app/components/core/repositories-tab/repository-form/repository-form.component.scss b/mediarepo-ui/src/app/components/shared/repository/repository/repository-form/repository-form.component.scss similarity index 100% rename from mediarepo-ui/src/app/components/core/repositories-tab/repository-form/repository-form.component.scss rename to mediarepo-ui/src/app/components/shared/repository/repository/repository-form/repository-form.component.scss diff --git a/mediarepo-ui/src/app/components/core/repositories-tab/repository-form/repository-form.component.spec.ts b/mediarepo-ui/src/app/components/shared/repository/repository/repository-form/repository-form.component.spec.ts similarity index 100% rename from mediarepo-ui/src/app/components/core/repositories-tab/repository-form/repository-form.component.spec.ts rename to mediarepo-ui/src/app/components/shared/repository/repository/repository-form/repository-form.component.spec.ts diff --git a/mediarepo-ui/src/app/components/core/repositories-tab/repository-form/repository-form.component.ts b/mediarepo-ui/src/app/components/shared/repository/repository/repository-form/repository-form.component.ts similarity index 97% rename from mediarepo-ui/src/app/components/core/repositories-tab/repository-form/repository-form.component.ts rename to mediarepo-ui/src/app/components/shared/repository/repository/repository-form/repository-form.component.ts index 518b88e..2a4ba02 100644 --- a/mediarepo-ui/src/app/components/core/repositories-tab/repository-form/repository-form.component.ts +++ b/mediarepo-ui/src/app/components/shared/repository/repository/repository-form/repository-form.component.ts @@ -6,10 +6,10 @@ import { ValidationErrors, Validators } from "@angular/forms"; -import {Repository} from "../../../../models/Repository"; +import {Repository} from "../../../../../models/Repository"; import { RepositoryService -} from "../../../../services/repository/repository.service"; +} from "../../../../../services/repository/repository.service"; import {dialog} from "@tauri-apps/api"; import {MatDialog} from "@angular/material/dialog"; diff --git a/mediarepo-ui/src/app/components/shared/repository/repository/repository.module.ts b/mediarepo-ui/src/app/components/shared/repository/repository/repository.module.ts new file mode 100644 index 0000000..3f84742 --- /dev/null +++ b/mediarepo-ui/src/app/components/shared/repository/repository/repository.module.ts @@ -0,0 +1,44 @@ +import {NgModule} from "@angular/core"; +import {CommonModule} from "@angular/common"; +import { + AddRepositoryDialogComponent +} from "./add-repository-dialog/add-repository-dialog.component"; +import { + RepositoryFormComponent +} from "./repository-form/repository-form.component"; +import { + EditRepositoryDialogComponent +} from "./edit-repository-dialog/edit-repository-dialog.component"; +import {MatDialogModule} from "@angular/material/dialog"; +import {MatButtonModule} from "@angular/material/button"; +import {MatTooltipModule} from "@angular/material/tooltip"; +import {MatSelectModule} from "@angular/material/select"; +import {MatInputModule} from "@angular/material/input"; +import {ReactiveFormsModule} from "@angular/forms"; +import {NgIconsModule} from "@ng-icons/core"; +import {MatFolder} from "@ng-icons/material-icons" + + +@NgModule({ + declarations: [ + AddRepositoryDialogComponent, + EditRepositoryDialogComponent, + RepositoryFormComponent + ], + exports: [ + AddRepositoryDialogComponent, + EditRepositoryDialogComponent, + ], + imports: [ + CommonModule, + MatDialogModule, + MatButtonModule, + MatTooltipModule, + MatSelectModule, + MatInputModule, + ReactiveFormsModule, + NgIconsModule.withIcons({MatFolder}) + ] +}) +export class RepositoryModule { +}