Skip to content

Commit

Permalink
refactor(frontend): Add import module
Browse files Browse the repository at this point in the history
  • Loading branch information
Clashsoft committed Sep 22, 2023
1 parent a4b6356 commit 564eeac
Show file tree
Hide file tree
Showing 22 changed files with 72 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
{
Expand All @@ -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'}},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,13 @@ 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';
import {StatisticsBlockComponent} from './statistics-block/statistics-block.component';
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: [
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
}
35 changes: 35 additions & 0 deletions frontend/src/app/assignment/modules/import/import.module.ts
Original file line number Diff line number Diff line change
@@ -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 {
}

0 comments on commit 564eeac

Please sign in to comment.