From 88749085965210d5e0e435d656e061e3e6ea3205 Mon Sep 17 00:00:00 2001 From: ElonH Date: Thu, 14 May 2020 20:58:26 +0800 Subject: [PATCH] feat(dashboard): a page for watching rclone states --- .../dashboard/dashboard-routing.module.ts | 12 +++++++++ .../dashboard/dashboard.component.spec.ts | 25 +++++++++++++++++++ .../pages/dashboard/dashboard.component.ts | 20 +++++++++++++++ src/app/pages/dashboard/dashboard.module.ts | 15 +++++++++++ src/app/pages/dashboard/pages.module.ts | 15 +++++++++++ src/app/pages/pages-menu.ts | 6 +++++ src/app/pages/pages-routing.module.ts | 8 ++++++ 7 files changed, 101 insertions(+) create mode 100644 src/app/pages/dashboard/dashboard-routing.module.ts create mode 100644 src/app/pages/dashboard/dashboard.component.spec.ts create mode 100644 src/app/pages/dashboard/dashboard.component.ts create mode 100644 src/app/pages/dashboard/dashboard.module.ts create mode 100644 src/app/pages/dashboard/pages.module.ts diff --git a/src/app/pages/dashboard/dashboard-routing.module.ts b/src/app/pages/dashboard/dashboard-routing.module.ts new file mode 100644 index 0000000..8970650 --- /dev/null +++ b/src/app/pages/dashboard/dashboard-routing.module.ts @@ -0,0 +1,12 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { DashboardComponent } from './dashboard.component'; + +const routes: Routes = [{ path: '', component: DashboardComponent }]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class DashboardRoutingModule { } diff --git a/src/app/pages/dashboard/dashboard.component.spec.ts b/src/app/pages/dashboard/dashboard.component.spec.ts new file mode 100644 index 0000000..9c996c3 --- /dev/null +++ b/src/app/pages/dashboard/dashboard.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DashboardComponent } from './dashboard.component'; + +describe('DashboardComponent', () => { + let component: DashboardComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ DashboardComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(DashboardComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/dashboard/dashboard.component.ts b/src/app/pages/dashboard/dashboard.component.ts new file mode 100644 index 0000000..1283706 --- /dev/null +++ b/src/app/pages/dashboard/dashboard.component.ts @@ -0,0 +1,20 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-dashboard', + template: ` +

+ dashboard works! +

+ `, + styles: [ + ] +}) +export class DashboardComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/pages/dashboard/dashboard.module.ts b/src/app/pages/dashboard/dashboard.module.ts new file mode 100644 index 0000000..f4b9c93 --- /dev/null +++ b/src/app/pages/dashboard/dashboard.module.ts @@ -0,0 +1,15 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { DashboardRoutingModule } from './dashboard-routing.module'; +import { DashboardComponent } from './dashboard.component'; + + +@NgModule({ + declarations: [DashboardComponent], + imports: [ + CommonModule, + DashboardRoutingModule + ] +}) +export class DashboardModule { } diff --git a/src/app/pages/dashboard/pages.module.ts b/src/app/pages/dashboard/pages.module.ts new file mode 100644 index 0000000..228e739 --- /dev/null +++ b/src/app/pages/dashboard/pages.module.ts @@ -0,0 +1,15 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { PagesRoutingModule } from '../pages-routing.module'; +import { PagesComponent } from './pages.component'; + + +@NgModule({ + declarations: [PagesComponent], + imports: [ + CommonModule, + PagesRoutingModule + ] +}) +export class PagesModule { } diff --git a/src/app/pages/pages-menu.ts b/src/app/pages/pages-menu.ts index 5ffcb34..ac25dad 100644 --- a/src/app/pages/pages-menu.ts +++ b/src/app/pages/pages-menu.ts @@ -1,4 +1,10 @@ import { NbMenuItem } from '@nebular/theme'; export const MENU_ITEMS: NbMenuItem[] = [ + { + title: 'Dashboard', + icon: 'home-outline', + link: 'dashboard', + home: true, + }, ]; diff --git a/src/app/pages/pages-routing.module.ts b/src/app/pages/pages-routing.module.ts index feb1ae3..bad183c 100644 --- a/src/app/pages/pages-routing.module.ts +++ b/src/app/pages/pages-routing.module.ts @@ -7,6 +7,14 @@ const routes: Routes = [ { path: '', component: PagesComponent, + children: [ + { + path: 'dashboard', + loadChildren: () => import('./dashboard/dashboard.module').then((m) => m.DashboardModule), + }, + { path: '', redirectTo: 'dashboard', pathMatch: 'full' }, + { path: '**', redirectTo: 'dashboard' }, + ], }, ];