From 564eeac4cfcbc37d918298cc20593e74c74661b0 Mon Sep 17 00:00:00 2001 From: Adrian Kunz Date: Fri, 22 Sep 2023 16:04:47 +0200 Subject: [PATCH] refactor(frontend): Add import module --- .../assignment/assignment-routing.module.ts | 21 +---------- .../modules/assignment/assignment.module.ts | 13 ------- .../import-consent.component.html | 0 .../import-consent.component.scss | 0 .../import-consent.component.ts | 0 .../import-embeddings.component.html | 0 .../import-embeddings.component.scss | 0 .../import-embeddings.component.ts | 0 .../import-files/import-files.component.html | 0 .../import-files/import-files.component.scss | 0 .../import-files/import-files.component.ts | 0 .../import-github.component.html | 0 .../import-github.component.scss | 0 .../import-github/import-github.component.ts | 0 .../import-modal/import-modal.component.html | 0 .../import-modal/import-modal.component.scss | 0 .../import-modal/import-modal.component.ts | 3 +- .../import-moss/import-moss.component.html | 0 .../import-moss/import-moss.component.scss | 0 .../import-moss/import-moss.component.ts | 0 .../modules/import/import-routing.module.ts | 35 +++++++++++++++++++ .../modules/import/import.module.ts | 35 +++++++++++++++++++ 22 files changed, 72 insertions(+), 35 deletions(-) rename frontend/src/app/assignment/modules/{assignment => import}/import-consent/import-consent.component.html (100%) rename frontend/src/app/assignment/modules/{assignment => import}/import-consent/import-consent.component.scss (100%) rename frontend/src/app/assignment/modules/{assignment => import}/import-consent/import-consent.component.ts (100%) rename frontend/src/app/assignment/modules/{assignment => import}/import-embeddings/import-embeddings.component.html (100%) rename frontend/src/app/assignment/modules/{assignment => import}/import-embeddings/import-embeddings.component.scss (100%) rename frontend/src/app/assignment/modules/{assignment => import}/import-embeddings/import-embeddings.component.ts (100%) rename frontend/src/app/assignment/modules/{assignment => import}/import-files/import-files.component.html (100%) rename frontend/src/app/assignment/modules/{assignment => import}/import-files/import-files.component.scss (100%) rename frontend/src/app/assignment/modules/{assignment => import}/import-files/import-files.component.ts (100%) rename frontend/src/app/assignment/modules/{assignment => import}/import-github/import-github.component.html (100%) rename frontend/src/app/assignment/modules/{assignment => import}/import-github/import-github.component.scss (100%) rename frontend/src/app/assignment/modules/{assignment => import}/import-github/import-github.component.ts (100%) rename frontend/src/app/assignment/modules/{assignment => import}/import-modal/import-modal.component.html (100%) rename frontend/src/app/assignment/modules/{assignment => import}/import-modal/import-modal.component.scss (100%) rename frontend/src/app/assignment/modules/{assignment => import}/import-modal/import-modal.component.ts (92%) rename frontend/src/app/assignment/modules/{assignment => import}/import-moss/import-moss.component.html (100%) rename frontend/src/app/assignment/modules/{assignment => import}/import-moss/import-moss.component.scss (100%) rename frontend/src/app/assignment/modules/{assignment => import}/import-moss/import-moss.component.ts (100%) create mode 100644 frontend/src/app/assignment/modules/import/import-routing.module.ts create mode 100644 frontend/src/app/assignment/modules/import/import.module.ts diff --git a/frontend/src/app/assignment/modules/assignment/assignment-routing.module.ts b/frontend/src/app/assignment/modules/assignment/assignment-routing.module.ts index b7bcd6cb2..037ec7f64 100644 --- a/frontend/src/app/assignment/modules/assignment/assignment-routing.module.ts +++ b/frontend/src/app/assignment/modules/assignment/assignment-routing.module.ts @@ -4,20 +4,6 @@ import {TokenModalComponent} from '../../pages/token-modal/token-modal.component import {assignmentChildRoutes} from './assignment-routes'; import {AssignmentComponent} from './assignment/assignment.component'; import {DeleteModalComponent} from './delete-modal/delete-modal.component'; -import {ImportModalComponent} from './import-modal/import-modal.component'; -import {ImportGithubComponent} from "./import-github/import-github.component"; -import {ImportFilesComponent} from "./import-files/import-files.component"; -import {ImportEmbeddingsComponent} from "./import-embeddings/import-embeddings.component"; -import {ImportMossComponent} from "./import-moss/import-moss.component"; -import {ImportConsentComponent} from "./import-consent/import-consent.component"; - -export const importChildren = [ - {path: 'github', component: ImportGithubComponent, data: {title: 'GitHub'}}, - {path: 'files', component: ImportFilesComponent, data: {title: 'Files'}}, - {path: 'embeddings', component: ImportEmbeddingsComponent, data: {title: 'Embeddings'}}, - {path: 'moss', component: ImportMossComponent, data: {title: 'MOSS'}}, - {path: 'consent', component: ImportConsentComponent, data: {title: 'Consent'}}, -]; const routes: Routes = [ { @@ -29,12 +15,7 @@ const routes: Routes = [ {path: 'token', component: TokenModalComponent, data: {title: 'Authorization Required'}}, { path: 'import', - component: ImportModalComponent, - data: {title: 'Import'}, - children: [ - ...importChildren, - {path: '', redirectTo: 'github', pathMatch: 'full'}, - ], + loadChildren: () => import('../import/import.module').then(m => m.ImportModule), }, {path: 'delete', component: DeleteModalComponent, data: {title: 'Delete Assignment'}}, ], diff --git a/frontend/src/app/assignment/modules/assignment/assignment.module.ts b/frontend/src/app/assignment/modules/assignment/assignment.module.ts index c66f3f63d..a9869d85c 100644 --- a/frontend/src/app/assignment/modules/assignment/assignment.module.ts +++ b/frontend/src/app/assignment/modules/assignment/assignment.module.ts @@ -17,7 +17,6 @@ import {AssignmentSharedModule} from '../shared/shared.module'; import {AssignmentRoutingModule} from './assignment-routing.module'; import {AssignmentComponent} from './assignment/assignment.component'; import {DeleteModalComponent} from './delete-modal/delete-modal.component'; -import {ImportModalComponent} from './import-modal/import-modal.component'; import {SearchComponent} from './search/search.component'; import {ShareComponent} from './share/share.component'; import {SolutionTableComponent} from './solution-table/solution-table.component'; @@ -25,12 +24,6 @@ import {StatisticsBlockComponent} from './statistics-block/statistics-block.comp import {StatisticsComponent} from './statistics/statistics.component'; import {SubmitModalComponent} from './submit-modal/submit-modal.component'; import {AssignmentTasksComponent} from './tasks/tasks.component'; -import { ImportGithubComponent } from './import-github/import-github.component'; -import { ImportFilesComponent } from './import-files/import-files.component'; -import { ImportMossComponent } from './import-moss/import-moss.component'; -import { ImportEmbeddingsComponent } from './import-embeddings/import-embeddings.component'; -import { ImportConsentComponent } from './import-consent/import-consent.component'; - @NgModule({ declarations: [ @@ -41,14 +34,8 @@ import { ImportConsentComponent } from './import-consent/import-consent.componen SolutionTableComponent, StatisticsComponent, SearchComponent, - ImportModalComponent, StatisticsBlockComponent, DeleteModalComponent, - ImportGithubComponent, - ImportFilesComponent, - ImportMossComponent, - ImportEmbeddingsComponent, - ImportConsentComponent, ], imports: [ CommonModule, diff --git a/frontend/src/app/assignment/modules/assignment/import-consent/import-consent.component.html b/frontend/src/app/assignment/modules/import/import-consent/import-consent.component.html similarity index 100% rename from frontend/src/app/assignment/modules/assignment/import-consent/import-consent.component.html rename to frontend/src/app/assignment/modules/import/import-consent/import-consent.component.html diff --git a/frontend/src/app/assignment/modules/assignment/import-consent/import-consent.component.scss b/frontend/src/app/assignment/modules/import/import-consent/import-consent.component.scss similarity index 100% rename from frontend/src/app/assignment/modules/assignment/import-consent/import-consent.component.scss rename to frontend/src/app/assignment/modules/import/import-consent/import-consent.component.scss diff --git a/frontend/src/app/assignment/modules/assignment/import-consent/import-consent.component.ts b/frontend/src/app/assignment/modules/import/import-consent/import-consent.component.ts similarity index 100% rename from frontend/src/app/assignment/modules/assignment/import-consent/import-consent.component.ts rename to frontend/src/app/assignment/modules/import/import-consent/import-consent.component.ts diff --git a/frontend/src/app/assignment/modules/assignment/import-embeddings/import-embeddings.component.html b/frontend/src/app/assignment/modules/import/import-embeddings/import-embeddings.component.html similarity index 100% rename from frontend/src/app/assignment/modules/assignment/import-embeddings/import-embeddings.component.html rename to frontend/src/app/assignment/modules/import/import-embeddings/import-embeddings.component.html diff --git a/frontend/src/app/assignment/modules/assignment/import-embeddings/import-embeddings.component.scss b/frontend/src/app/assignment/modules/import/import-embeddings/import-embeddings.component.scss similarity index 100% rename from frontend/src/app/assignment/modules/assignment/import-embeddings/import-embeddings.component.scss rename to frontend/src/app/assignment/modules/import/import-embeddings/import-embeddings.component.scss diff --git a/frontend/src/app/assignment/modules/assignment/import-embeddings/import-embeddings.component.ts b/frontend/src/app/assignment/modules/import/import-embeddings/import-embeddings.component.ts similarity index 100% rename from frontend/src/app/assignment/modules/assignment/import-embeddings/import-embeddings.component.ts rename to frontend/src/app/assignment/modules/import/import-embeddings/import-embeddings.component.ts diff --git a/frontend/src/app/assignment/modules/assignment/import-files/import-files.component.html b/frontend/src/app/assignment/modules/import/import-files/import-files.component.html similarity index 100% rename from frontend/src/app/assignment/modules/assignment/import-files/import-files.component.html rename to frontend/src/app/assignment/modules/import/import-files/import-files.component.html diff --git a/frontend/src/app/assignment/modules/assignment/import-files/import-files.component.scss b/frontend/src/app/assignment/modules/import/import-files/import-files.component.scss similarity index 100% rename from frontend/src/app/assignment/modules/assignment/import-files/import-files.component.scss rename to frontend/src/app/assignment/modules/import/import-files/import-files.component.scss diff --git a/frontend/src/app/assignment/modules/assignment/import-files/import-files.component.ts b/frontend/src/app/assignment/modules/import/import-files/import-files.component.ts similarity index 100% rename from frontend/src/app/assignment/modules/assignment/import-files/import-files.component.ts rename to frontend/src/app/assignment/modules/import/import-files/import-files.component.ts diff --git a/frontend/src/app/assignment/modules/assignment/import-github/import-github.component.html b/frontend/src/app/assignment/modules/import/import-github/import-github.component.html similarity index 100% rename from frontend/src/app/assignment/modules/assignment/import-github/import-github.component.html rename to frontend/src/app/assignment/modules/import/import-github/import-github.component.html diff --git a/frontend/src/app/assignment/modules/assignment/import-github/import-github.component.scss b/frontend/src/app/assignment/modules/import/import-github/import-github.component.scss similarity index 100% rename from frontend/src/app/assignment/modules/assignment/import-github/import-github.component.scss rename to frontend/src/app/assignment/modules/import/import-github/import-github.component.scss diff --git a/frontend/src/app/assignment/modules/assignment/import-github/import-github.component.ts b/frontend/src/app/assignment/modules/import/import-github/import-github.component.ts similarity index 100% rename from frontend/src/app/assignment/modules/assignment/import-github/import-github.component.ts rename to frontend/src/app/assignment/modules/import/import-github/import-github.component.ts diff --git a/frontend/src/app/assignment/modules/assignment/import-modal/import-modal.component.html b/frontend/src/app/assignment/modules/import/import-modal/import-modal.component.html similarity index 100% rename from frontend/src/app/assignment/modules/assignment/import-modal/import-modal.component.html rename to frontend/src/app/assignment/modules/import/import-modal/import-modal.component.html diff --git a/frontend/src/app/assignment/modules/assignment/import-modal/import-modal.component.scss b/frontend/src/app/assignment/modules/import/import-modal/import-modal.component.scss similarity index 100% rename from frontend/src/app/assignment/modules/assignment/import-modal/import-modal.component.scss rename to frontend/src/app/assignment/modules/import/import-modal/import-modal.component.scss diff --git a/frontend/src/app/assignment/modules/assignment/import-modal/import-modal.component.ts b/frontend/src/app/assignment/modules/import/import-modal/import-modal.component.ts similarity index 92% rename from frontend/src/app/assignment/modules/assignment/import-modal/import-modal.component.ts rename to frontend/src/app/assignment/modules/import/import-modal/import-modal.component.ts index 087aa5c03..89307ae60 100644 --- a/frontend/src/app/assignment/modules/assignment/import-modal/import-modal.component.ts +++ b/frontend/src/app/assignment/modules/import/import-modal/import-modal.component.ts @@ -1,8 +1,7 @@ import {Component} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {ToastService} from '@mean-stream/ngbx'; -import {Observable} from "rxjs"; -import {importChildren} from "../assignment-routing.module"; +import {importChildren} from "../import-routing.module"; @Component({ selector: 'app-import-modal', diff --git a/frontend/src/app/assignment/modules/assignment/import-moss/import-moss.component.html b/frontend/src/app/assignment/modules/import/import-moss/import-moss.component.html similarity index 100% rename from frontend/src/app/assignment/modules/assignment/import-moss/import-moss.component.html rename to frontend/src/app/assignment/modules/import/import-moss/import-moss.component.html diff --git a/frontend/src/app/assignment/modules/assignment/import-moss/import-moss.component.scss b/frontend/src/app/assignment/modules/import/import-moss/import-moss.component.scss similarity index 100% rename from frontend/src/app/assignment/modules/assignment/import-moss/import-moss.component.scss rename to frontend/src/app/assignment/modules/import/import-moss/import-moss.component.scss diff --git a/frontend/src/app/assignment/modules/assignment/import-moss/import-moss.component.ts b/frontend/src/app/assignment/modules/import/import-moss/import-moss.component.ts similarity index 100% rename from frontend/src/app/assignment/modules/assignment/import-moss/import-moss.component.ts rename to frontend/src/app/assignment/modules/import/import-moss/import-moss.component.ts diff --git a/frontend/src/app/assignment/modules/import/import-routing.module.ts b/frontend/src/app/assignment/modules/import/import-routing.module.ts new file mode 100644 index 000000000..af6855694 --- /dev/null +++ b/frontend/src/app/assignment/modules/import/import-routing.module.ts @@ -0,0 +1,35 @@ +import {NgModule} from '@angular/core'; +import {RouterModule, Routes} from '@angular/router'; +import {ImportModalComponent} from "./import-modal/import-modal.component"; +import {ImportGithubComponent} from "./import-github/import-github.component"; +import {ImportFilesComponent} from "./import-files/import-files.component"; +import {ImportEmbeddingsComponent} from "./import-embeddings/import-embeddings.component"; +import {ImportMossComponent} from "./import-moss/import-moss.component"; +import {ImportConsentComponent} from "./import-consent/import-consent.component"; + +export const importChildren = [ + {path: 'github', component: ImportGithubComponent, data: {title: 'GitHub'}}, + {path: 'files', component: ImportFilesComponent, data: {title: 'Files'}}, + {path: 'embeddings', component: ImportEmbeddingsComponent, data: {title: 'Embeddings'}}, + {path: 'moss', component: ImportMossComponent, data: {title: 'MOSS'}}, + {path: 'consent', component: ImportConsentComponent, data: {title: 'Consent'}}, +]; + +const routes: Routes = [ + { + path: '', + component: ImportModalComponent, + data: {title: 'Import'}, + children: [ + ...importChildren, + {path: '', redirectTo: 'github', pathMatch: 'full'}, + ], + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class ImportRoutingModule { +} diff --git a/frontend/src/app/assignment/modules/import/import.module.ts b/frontend/src/app/assignment/modules/import/import.module.ts new file mode 100644 index 000000000..e759d3333 --- /dev/null +++ b/frontend/src/app/assignment/modules/import/import.module.ts @@ -0,0 +1,35 @@ +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; + +import {ImportRoutingModule} from './import-routing.module'; +import {ImportConsentComponent} from "./import-consent/import-consent.component"; +import {ImportModalComponent} from "./import-modal/import-modal.component"; +import {ImportGithubComponent} from "./import-github/import-github.component"; +import {ImportFilesComponent} from "./import-files/import-files.component"; +import {ImportMossComponent} from "./import-moss/import-moss.component"; +import {ImportEmbeddingsComponent} from "./import-embeddings/import-embeddings.component"; +import {FormsModule} from "@angular/forms"; +import {ModalModule, RouteTabsModule} from "@mean-stream/ngbx"; +import {AssignmentSharedModule} from "../shared/shared.module"; + + +@NgModule({ + declarations: [ + ImportModalComponent, + ImportGithubComponent, + ImportFilesComponent, + ImportMossComponent, + ImportEmbeddingsComponent, + ImportConsentComponent, + ], + imports: [ + CommonModule, + ImportRoutingModule, + FormsModule, + RouteTabsModule, + ModalModule, + AssignmentSharedModule + ] +}) +export class ImportModule { +}