From 4a48bbb418118fc6f53dd1fa08fcf02b5e91da21 Mon Sep 17 00:00:00 2001 From: kunw Date: Mon, 13 Feb 2017 18:01:48 +0800 Subject: [PATCH] Refactor code structures. --- harbor-app/src/app/app.module.ts | 6 ++- .../base-routing.module.ts} | 20 ++++------ harbor-app/src/app/base/base.component.html | 1 + harbor-app/src/app/base/base.component.ts | 9 +++++ harbor-app/src/app/base/base.module.ts | 35 +++++++++++++++++ .../{ => base}/footer/footer.component.html | 0 .../app/{ => base}/footer/footer.component.ts | 0 .../global-search.component.html | 0 .../global-search/global-search.component.ts | 0 .../harbor-shell/harbor-shell.component.html | 0 .../harbor-shell/harbor-shell.component.ts | 0 .../navigator/navigator.component.html | 2 +- .../navigator/navigator.component.ts | 0 harbor-app/src/app/core.module.ts | 3 -- harbor-app/src/app/footer/footer.module.ts | 8 ---- .../app/global-search/global-search.module.ts | 10 ----- .../app/harbor-shell/harbor.shell.module.ts | 30 --------------- .../src/app/navigator/navigator.module.ts | 19 ---------- .../project-detail-routing.module.ts | 30 --------------- .../project-detail/project-detail.module.ts | 34 ----------------- .../create-project.component.html | 25 ++++++++++++ .../create-project.component.ts | 9 +++++ .../filter-project.component.html | 10 +++++ .../filter-project.component.ts | 7 ++++ .../list-project.component.html} | 2 +- .../list-project.component.ts} | 8 ++-- .../project-detail.component.html | 1 - .../project-detail.component.ts | 0 .../project-detail/project-detail.css | 0 .../project-detail/project-detail.module.ts | 27 +++++++++++++ .../src/app/project/project-routing.module.ts | 38 +++++++++++++++++++ .../src/app/project/project.component.html | 30 ++------------- .../src/app/project/project.component.ts | 3 -- harbor-app/src/app/project/project.module.ts | 24 +++++++++--- .../search-project.component.html | 1 + .../search-project.component.ts | 9 +++++ 36 files changed, 210 insertions(+), 191 deletions(-) rename harbor-app/src/app/{harbor-shell/harbor-shell-routing.module.ts => base/base-routing.module.ts} (58%) create mode 100644 harbor-app/src/app/base/base.component.html create mode 100644 harbor-app/src/app/base/base.component.ts create mode 100644 harbor-app/src/app/base/base.module.ts rename harbor-app/src/app/{ => base}/footer/footer.component.html (100%) rename harbor-app/src/app/{ => base}/footer/footer.component.ts (100%) rename harbor-app/src/app/{ => base}/global-search/global-search.component.html (100%) rename harbor-app/src/app/{ => base}/global-search/global-search.component.ts (100%) rename harbor-app/src/app/{ => base}/harbor-shell/harbor-shell.component.html (100%) rename harbor-app/src/app/{ => base}/harbor-shell/harbor-shell.component.ts (100%) rename harbor-app/src/app/{ => base}/navigator/navigator.component.html (96%) rename harbor-app/src/app/{ => base}/navigator/navigator.component.ts (100%) delete mode 100644 harbor-app/src/app/footer/footer.module.ts delete mode 100644 harbor-app/src/app/global-search/global-search.module.ts delete mode 100644 harbor-app/src/app/harbor-shell/harbor.shell.module.ts delete mode 100644 harbor-app/src/app/navigator/navigator.module.ts delete mode 100644 harbor-app/src/app/project-detail/project-detail-routing.module.ts delete mode 100644 harbor-app/src/app/project-detail/project-detail.module.ts create mode 100644 harbor-app/src/app/project/create-project/create-project.component.html create mode 100644 harbor-app/src/app/project/create-project/create-project.component.ts create mode 100644 harbor-app/src/app/project/filter-project/filter-project.component.html create mode 100644 harbor-app/src/app/project/filter-project/filter-project.component.ts rename harbor-app/src/app/project/{project-list.component.html => list-project/list-project.component.html} (87%) rename harbor-app/src/app/project/{project-list.component.ts => list-project/list-project.component.ts} (85%) rename harbor-app/src/app/{ => project}/project-detail/project-detail.component.html (96%) rename harbor-app/src/app/{ => project}/project-detail/project-detail.component.ts (100%) rename harbor-app/src/app/{ => project}/project-detail/project-detail.css (100%) create mode 100644 harbor-app/src/app/project/project-detail/project-detail.module.ts create mode 100644 harbor-app/src/app/project/project-routing.module.ts create mode 100644 harbor-app/src/app/project/search-project/search-project.component.html create mode 100644 harbor-app/src/app/project/search-project/search-project.component.ts diff --git a/harbor-app/src/app/app.module.ts b/harbor-app/src/app/app.module.ts index 55cb0822e..d00891d23 100644 --- a/harbor-app/src/app/app.module.ts +++ b/harbor-app/src/app/app.module.ts @@ -5,7 +5,9 @@ import { HttpModule } from '@angular/http'; import { ClarityModule } from 'clarity-angular'; import { AppComponent } from './app.component'; import { AccountModule } from './account/account.module'; -import { HarborShellModule } from './harbor-shell/harbor.shell.module'; + +import { BaseModule } from './base/base.module'; + import { HarborRoutingModule } from './harbor-routing.module'; import { SharedModule } from './shared.module'; @@ -16,7 +18,7 @@ import { SharedModule } from './shared.module'; imports: [ SharedModule, AccountModule, - HarborShellModule, + BaseModule, HarborRoutingModule ], providers: [], diff --git a/harbor-app/src/app/harbor-shell/harbor-shell-routing.module.ts b/harbor-app/src/app/base/base-routing.module.ts similarity index 58% rename from harbor-app/src/app/harbor-shell/harbor-shell-routing.module.ts rename to harbor-app/src/app/base/base-routing.module.ts index 70f00adc4..36f5e5a20 100644 --- a/harbor-app/src/app/harbor-shell/harbor-shell-routing.module.ts +++ b/harbor-app/src/app/base/base-routing.module.ts @@ -1,35 +1,31 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; - -import { HarborShellComponent } from './harbor-shell.component'; +import { BaseComponent } from './base.component'; import { DashboardComponent } from '../dashboard/dashboard.component'; import { ProjectComponent } from '../project/project.component'; -import { ProjectListComponent } from '../project/project-list.component'; -import { ProjectDetailComponent } from '../project-detail/project-detail.component'; +import { ProjectDetailComponent } from '../project/project-detail/project-detail.component'; import { RepositoryComponent } from '../repository/repository.component'; import { ReplicationComponent } from '../replication/replication.component'; import { MemberComponent } from '../member/member.component'; import { LogComponent } from '../log/log.component'; -const harborShellRoutes: Routes = [ +const baseRoutes: Routes = [ { - path: 'harbor', - component: HarborShellComponent, + path: 'harbor', component: BaseComponent, children: [ { path: 'dashboard', component: DashboardComponent }, - { path: 'project', component: ProjectComponent } + { path: 'projects', component: ProjectComponent } ] - } -]; + }]; @NgModule({ imports: [ - RouterModule.forChild(harborShellRoutes) + RouterModule.forChild(baseRoutes) ], exports: [ RouterModule ] }) -export class HarborShellRoutingModule { +export class BaseRoutingModule { } \ No newline at end of file diff --git a/harbor-app/src/app/base/base.component.html b/harbor-app/src/app/base/base.component.html new file mode 100644 index 000000000..2b6840b6f --- /dev/null +++ b/harbor-app/src/app/base/base.component.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/harbor-app/src/app/base/base.component.ts b/harbor-app/src/app/base/base.component.ts new file mode 100644 index 000000000..616c8f560 --- /dev/null +++ b/harbor-app/src/app/base/base.component.ts @@ -0,0 +1,9 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'base', + templateUrl: 'base.component.html' +}) +export class BaseComponent { + +} \ No newline at end of file diff --git a/harbor-app/src/app/base/base.module.ts b/harbor-app/src/app/base/base.module.ts new file mode 100644 index 000000000..176983905 --- /dev/null +++ b/harbor-app/src/app/base/base.module.ts @@ -0,0 +1,35 @@ +import { NgModule } from '@angular/core'; +import { SharedModule } from '../shared.module'; + +import { DashboardModule } from '../dashboard/dashboard.module'; +import { ProjectModule } from '../project/project.module'; +import { ProjectDetailModule } from '../project/project-detail/project-detail.module'; + +import { NavigatorComponent } from './navigator/navigator.component'; +import { GlobalSearchComponent } from './global-search/global-search.component'; +import { FooterComponent } from './footer/footer.component'; +import { HarborShellComponent } from './harbor-shell/harbor-shell.component'; +import { BaseComponent } from './base.component'; + +import { BaseRoutingModule } from './base-routing.module'; + +@NgModule({ + imports: [ + SharedModule, + DashboardModule, + ProjectModule, + ProjectDetailModule, + BaseRoutingModule + ], + declarations: [ + BaseComponent, + NavigatorComponent, + GlobalSearchComponent, + FooterComponent, + HarborShellComponent + ], + exports: [ BaseComponent ] +}) +export class BaseModule { + +} \ No newline at end of file diff --git a/harbor-app/src/app/footer/footer.component.html b/harbor-app/src/app/base/footer/footer.component.html similarity index 100% rename from harbor-app/src/app/footer/footer.component.html rename to harbor-app/src/app/base/footer/footer.component.html diff --git a/harbor-app/src/app/footer/footer.component.ts b/harbor-app/src/app/base/footer/footer.component.ts similarity index 100% rename from harbor-app/src/app/footer/footer.component.ts rename to harbor-app/src/app/base/footer/footer.component.ts diff --git a/harbor-app/src/app/global-search/global-search.component.html b/harbor-app/src/app/base/global-search/global-search.component.html similarity index 100% rename from harbor-app/src/app/global-search/global-search.component.html rename to harbor-app/src/app/base/global-search/global-search.component.html diff --git a/harbor-app/src/app/global-search/global-search.component.ts b/harbor-app/src/app/base/global-search/global-search.component.ts similarity index 100% rename from harbor-app/src/app/global-search/global-search.component.ts rename to harbor-app/src/app/base/global-search/global-search.component.ts diff --git a/harbor-app/src/app/harbor-shell/harbor-shell.component.html b/harbor-app/src/app/base/harbor-shell/harbor-shell.component.html similarity index 100% rename from harbor-app/src/app/harbor-shell/harbor-shell.component.html rename to harbor-app/src/app/base/harbor-shell/harbor-shell.component.html diff --git a/harbor-app/src/app/harbor-shell/harbor-shell.component.ts b/harbor-app/src/app/base/harbor-shell/harbor-shell.component.ts similarity index 100% rename from harbor-app/src/app/harbor-shell/harbor-shell.component.ts rename to harbor-app/src/app/base/harbor-shell/harbor-shell.component.ts diff --git a/harbor-app/src/app/navigator/navigator.component.html b/harbor-app/src/app/base/navigator/navigator.component.html similarity index 96% rename from harbor-app/src/app/navigator/navigator.component.html rename to harbor-app/src/app/base/navigator/navigator.component.html index 41b4af2d1..ecc514510 100644 --- a/harbor-app/src/app/navigator/navigator.component.html +++ b/harbor-app/src/app/base/navigator/navigator.component.html @@ -10,7 +10,7 @@ Dashboard - + Project diff --git a/harbor-app/src/app/navigator/navigator.component.ts b/harbor-app/src/app/base/navigator/navigator.component.ts similarity index 100% rename from harbor-app/src/app/navigator/navigator.component.ts rename to harbor-app/src/app/base/navigator/navigator.component.ts diff --git a/harbor-app/src/app/core.module.ts b/harbor-app/src/app/core.module.ts index 2392d176d..36e924e9f 100644 --- a/harbor-app/src/app/core.module.ts +++ b/harbor-app/src/app/core.module.ts @@ -5,9 +5,6 @@ import { HttpModule } from '@angular/http'; import { ClarityModule } from 'clarity-angular'; import { AppComponent } from './app.component'; import { AccountModule } from './account/account.module'; -import { HarborShellModule } from './harbor-shell/harbor.shell.module'; -import { HarborRoutingModule } from './harbor-routing.module'; - @NgModule({ imports: [ diff --git a/harbor-app/src/app/footer/footer.module.ts b/harbor-app/src/app/footer/footer.module.ts deleted file mode 100644 index 1fac5bd49..000000000 --- a/harbor-app/src/app/footer/footer.module.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { NgModule } from '@angular/core'; -import { FooterComponent } from './footer.component'; - -@NgModule({ - declarations: [ FooterComponent ], - exports: [ FooterComponent ] -}) -export class FooterModule {} \ No newline at end of file diff --git a/harbor-app/src/app/global-search/global-search.module.ts b/harbor-app/src/app/global-search/global-search.module.ts deleted file mode 100644 index b72d33a44..000000000 --- a/harbor-app/src/app/global-search/global-search.module.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { NgModule } from '@angular/core'; -import { GlobalSearchComponent } from './global-search.component'; -import { SharedModule } from '../shared.module'; - -@NgModule({ - imports: [ SharedModule ], - declarations: [ GlobalSearchComponent ], - exports: [ GlobalSearchComponent ] -}) -export class GlobalSearchModule {} \ No newline at end of file diff --git a/harbor-app/src/app/harbor-shell/harbor.shell.module.ts b/harbor-app/src/app/harbor-shell/harbor.shell.module.ts deleted file mode 100644 index 868bf764e..000000000 --- a/harbor-app/src/app/harbor-shell/harbor.shell.module.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { NgModule } from '@angular/core'; -import { NavigatorModule } from '../navigator/navigator.module'; -import { GlobalSearchModule } from '../global-search/global-search.module'; -import { FooterModule } from '../footer/footer.module'; - -import { DashboardModule } from '../dashboard/dashboard.module'; -import { ProjectModule } from '../project/project.module'; -import { ProjectDetailModule } from '../project-detail/project-detail.module'; - -import { HarborShellRoutingModule } from './harbor-shell-routing.module'; - -import { HarborShellComponent } from './harbor-shell.component'; - -import { SharedModule } from '../shared.module'; - -@NgModule({ - imports: [ - SharedModule, - GlobalSearchModule, - NavigatorModule, - FooterModule, - DashboardModule, - ProjectModule, - ProjectDetailModule, - HarborShellRoutingModule - ], - declarations: [ HarborShellComponent ], - exports: [ HarborShellComponent ] -}) -export class HarborShellModule {} \ No newline at end of file diff --git a/harbor-app/src/app/navigator/navigator.module.ts b/harbor-app/src/app/navigator/navigator.module.ts deleted file mode 100644 index dcf9232af..000000000 --- a/harbor-app/src/app/navigator/navigator.module.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { NgModule } from '@angular/core'; -import { NavigatorComponent } from './navigator.component'; - -import { SharedModule } from '../shared.module'; -import { GlobalSearchComponent } from '../global-search/global-search.component'; - -import { GlobalSearchModule } from '../global-search/global-search.module'; -import { RouterModule } from '@angular/router'; - -@NgModule({ - imports: [ - SharedModule, - GlobalSearchModule, - RouterModule - ], - declarations: [ NavigatorComponent ], - exports: [ NavigatorComponent ] -}) -export class NavigatorModule {} \ No newline at end of file diff --git a/harbor-app/src/app/project-detail/project-detail-routing.module.ts b/harbor-app/src/app/project-detail/project-detail-routing.module.ts deleted file mode 100644 index 069c04f86..000000000 --- a/harbor-app/src/app/project-detail/project-detail-routing.module.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { ProjectDetailComponent } from './project-detail.component'; - -import { RepositoryComponent } from '../repository/repository.component'; -import { ReplicationComponent } from '../replication/replication.component'; -import { MemberComponent } from '../member/member.component'; -import { LogComponent } from '../log/log.component'; - -const projectDetailRoutes: Routes = [ - { - path: 'projects/:id', - component: ProjectDetailComponent, - children: [ - { path: 'repository', component: RepositoryComponent }, - { path: 'replication', component: ReplicationComponent }, - { path: 'member', component: MemberComponent }, - { path: 'log', component: LogComponent } - ] - } -]; - -@NgModule({ - imports: [ - RouterModule.forChild(projectDetailRoutes) - ], - exports: [ RouterModule ] -}) -export class ProjectDetailRoutingModule {} \ No newline at end of file diff --git a/harbor-app/src/app/project-detail/project-detail.module.ts b/harbor-app/src/app/project-detail/project-detail.module.ts deleted file mode 100644 index 2163f92f6..000000000 --- a/harbor-app/src/app/project-detail/project-detail.module.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { NgModule } from '@angular/core'; - -import { NavigatorModule } from '../navigator/navigator.module'; -import { GlobalSearchModule } from '../global-search/global-search.module'; -import { FooterModule } from '../footer/footer.module'; - - -import { RepositoryModule } from '../repository/repository.module'; -import { ReplicationModule } from '../replication/replication.module'; -import { MemberModule } from '../member/member.module'; -import { LogModule } from '../log/log.module'; - -import { ProjectDetailComponent } from './project-detail.component'; - -import { SharedModule } from '../shared.module'; - -import { ProjectDetailRoutingModule } from './project-detail-routing.module'; - -@NgModule({ - imports: [ - SharedModule, - GlobalSearchModule, - NavigatorModule, - FooterModule, - RepositoryModule, - ReplicationModule, - MemberModule, - LogModule, - ProjectDetailRoutingModule - ], - declarations: [ ProjectDetailComponent ], - exports: [ ProjectDetailComponent ] -}) -export class ProjectDetailModule {} \ No newline at end of file diff --git a/harbor-app/src/app/project/create-project/create-project.component.html b/harbor-app/src/app/project/create-project/create-project.component.html new file mode 100644 index 000000000..5a2d82f46 --- /dev/null +++ b/harbor-app/src/app/project/create-project/create-project.component.html @@ -0,0 +1,25 @@ + + + + + + \ No newline at end of file diff --git a/harbor-app/src/app/project/create-project/create-project.component.ts b/harbor-app/src/app/project/create-project/create-project.component.ts new file mode 100644 index 000000000..26319e4e9 --- /dev/null +++ b/harbor-app/src/app/project/create-project/create-project.component.ts @@ -0,0 +1,9 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'create-project', + templateUrl: 'create-project.component.html' +}) +export class CreateProjectComponent { + +} \ No newline at end of file diff --git a/harbor-app/src/app/project/filter-project/filter-project.component.html b/harbor-app/src/app/project/filter-project/filter-project.component.html new file mode 100644 index 000000000..263169d93 --- /dev/null +++ b/harbor-app/src/app/project/filter-project/filter-project.component.html @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/harbor-app/src/app/project/filter-project/filter-project.component.ts b/harbor-app/src/app/project/filter-project/filter-project.component.ts new file mode 100644 index 000000000..aee1f8637 --- /dev/null +++ b/harbor-app/src/app/project/filter-project/filter-project.component.ts @@ -0,0 +1,7 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'filter-project', + templateUrl: 'filter-project.component.html' +}) +export class FilterProjectComponent {} \ No newline at end of file diff --git a/harbor-app/src/app/project/project-list.component.html b/harbor-app/src/app/project/list-project/list-project.component.html similarity index 87% rename from harbor-app/src/app/project/project-list.component.html rename to harbor-app/src/app/project/list-project/list-project.component.html index 9044fec22..b3177f9bf 100644 --- a/harbor-app/src/app/project/project-list.component.html +++ b/harbor-app/src/app/project/list-project/list-project.component.html @@ -7,7 +7,7 @@ Owner Description - {{p.name}} + {{p.name}} {{p.isPublic ? 'Public': 'Private'}} {{p.repoCount}} {{p.creationTime}} diff --git a/harbor-app/src/app/project/project-list.component.ts b/harbor-app/src/app/project/list-project/list-project.component.ts similarity index 85% rename from harbor-app/src/app/project/project-list.component.ts rename to harbor-app/src/app/project/list-project/list-project.component.ts index e9f8dbbbd..050d30897 100644 --- a/harbor-app/src/app/project/project-list.component.ts +++ b/harbor-app/src/app/project/list-project/list-project.component.ts @@ -1,12 +1,12 @@ import { Component, OnInit } from '@angular/core'; -import { Project } from './project'; +import { Project } from '../project'; @Component({ - selector: 'project-list', - templateUrl: 'project-list.component.html' + selector: 'list-project', + templateUrl: 'list-project.component.html' }) -export class ProjectListComponent implements OnInit { +export class ListProjectComponent implements OnInit { projects: Project[]; ngOnInit(): void { diff --git a/harbor-app/src/app/project-detail/project-detail.component.html b/harbor-app/src/app/project/project-detail/project-detail.component.html similarity index 96% rename from harbor-app/src/app/project-detail/project-detail.component.html rename to harbor-app/src/app/project/project-detail/project-detail.component.html index cf04d30f8..bf65b2bdd 100644 --- a/harbor-app/src/app/project-detail/project-detail.component.html +++ b/harbor-app/src/app/project/project-detail/project-detail.component.html @@ -1,4 +1,3 @@ -

Project 01

PROJECT