mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-21 16:19:21 +01:00
Refactor code structures.
This commit is contained in:
parent
9a97af1783
commit
4a48bbb418
@ -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: [],
|
||||
|
@ -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 {
|
||||
|
||||
}
|
1
harbor-app/src/app/base/base.component.html
Normal file
1
harbor-app/src/app/base/base.component.html
Normal file
@ -0,0 +1 @@
|
||||
<harbor-shell></harbor-shell>
|
9
harbor-app/src/app/base/base.component.ts
Normal file
9
harbor-app/src/app/base/base.component.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'base',
|
||||
templateUrl: 'base.component.html'
|
||||
})
|
||||
export class BaseComponent {
|
||||
|
||||
}
|
35
harbor-app/src/app/base/base.module.ts
Normal file
35
harbor-app/src/app/base/base.module.ts
Normal file
@ -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 {
|
||||
|
||||
}
|
@ -10,7 +10,7 @@
|
||||
<a class="nav-link" id="dashboard-link" [routerLink]="['/harbor', 'dashboard']" routerLinkActive="active">
|
||||
<span class="nav-text">Dashboard</span>
|
||||
</a>
|
||||
<a class="nav-link" id="dashboard-link" [routerLink]="['/harbor', 'project']" routerLinkActive="active">
|
||||
<a class="nav-link" id="dashboard-link" [routerLink]="['/harbor', 'projects']" routerLinkActive="active">
|
||||
<span class="nav-text">Project</span>
|
||||
</a>
|
||||
</div>
|
@ -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: [
|
||||
|
@ -1,8 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FooterComponent } from './footer.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [ FooterComponent ],
|
||||
exports: [ FooterComponent ]
|
||||
})
|
||||
export class FooterModule {}
|
@ -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 {}
|
@ -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 {}
|
@ -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 {}
|
@ -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 {}
|
@ -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 {}
|
@ -0,0 +1,25 @@
|
||||
<clr-modal [(clrModalOpen)]="create_project_opened">
|
||||
<h3 class="modal-title">New Project</h3>
|
||||
<div class="modal-body">
|
||||
<form>
|
||||
<section class="form-block">
|
||||
<div class="form-group">
|
||||
<label for="create_project_username" class="col-md-4">Project Name</label>
|
||||
<input type="text" class="col-md-8" id="create_project_username" size="20">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-4">Public</label>
|
||||
<div class="checkbox-inline">
|
||||
<input type="checkbox" id="create_project_public">
|
||||
<label for="create_project_public"></label>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline" (click)="create_project_opened = false">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" (click)="create_project_opened = false">Ok</button>
|
||||
</div>
|
||||
</clr-modal>
|
||||
<button class="btn btn-sm" (click)="create_project_opened = true">New Project</button>
|
@ -0,0 +1,9 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'create-project',
|
||||
templateUrl: 'create-project.component.html'
|
||||
})
|
||||
export class CreateProjectComponent {
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<clr-dropdown [clrMenuPosition]="'bottom-left'">
|
||||
<button class="btn btn-sm btn-outline-primary" clrDropdownToggle>
|
||||
My Projects
|
||||
<clr-icon shape="caret down"></clr-icon>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a href="javascript:void(0)" clrDropdownItem>My Projects</a>
|
||||
<a href="javascript:void(0)" clrDropdownItem>Public Projects</a>
|
||||
</div>
|
||||
</clr-dropdown>
|
@ -0,0 +1,7 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'filter-project',
|
||||
templateUrl: 'filter-project.component.html'
|
||||
})
|
||||
export class FilterProjectComponent {}
|
@ -7,7 +7,7 @@
|
||||
<clr-dg-column>Owner</clr-dg-column>
|
||||
<clr-dg-column>Description</clr-dg-column>
|
||||
<clr-dg-row *ngFor="let p of projects">
|
||||
<clr-dg-cell><a [routerLink]="['/projects', p.id, 'repository']" >{{p.name}}</a></clr-dg-cell>
|
||||
<clr-dg-cell><a [routerLink]="['/harbor', 'projects', p.id, 'repository']" >{{p.name}}</a></clr-dg-cell>
|
||||
<clr-dg-cell>{{p.isPublic ? 'Public': 'Private'}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{p.repoCount}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{p.creationTime}}</clr-dg-cell>
|
@ -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 {
|
@ -1,4 +1,3 @@
|
||||
<navigator></navigator>
|
||||
<h1 class="display-in-line">Project 01</h1><h6 class="display-in-line project-title">PROJECT</h6>
|
||||
<nav class="subnav">
|
||||
<ul class="nav">
|
@ -0,0 +1,27 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
|
||||
import { SharedModule } from '../../shared.module';
|
||||
|
||||
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';
|
||||
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
SharedModule,
|
||||
RouterModule
|
||||
],
|
||||
declarations: [
|
||||
ProjectDetailComponent,
|
||||
RepositoryComponent,
|
||||
ReplicationComponent,
|
||||
MemberComponent,
|
||||
LogComponent
|
||||
],
|
||||
exports: [ ProjectDetailComponent ]
|
||||
})
|
||||
export class ProjectDetailModule {}
|
38
harbor-app/src/app/project/project-routing.module.ts
Normal file
38
harbor-app/src/app/project/project-routing.module.ts
Normal file
@ -0,0 +1,38 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { BaseComponent } from '../base/base.component';
|
||||
|
||||
import { ProjectComponent } from './project.component';
|
||||
import { ProjectDetailComponent } from './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 projectRoutes: Routes = [
|
||||
{ path: 'harbor',
|
||||
component: BaseComponent,
|
||||
children: [
|
||||
{ path: 'projects', component: ProjectComponent },
|
||||
{
|
||||
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(projectRoutes)
|
||||
],
|
||||
exports: [ RouterModule ]
|
||||
})
|
||||
export class ProjectRoutingModule {}
|
@ -1,31 +1,7 @@
|
||||
<h3>Projects</h3>
|
||||
<clr-modal [(clrModalOpen)]="create_project_opened">
|
||||
<h3 class="modal-title">New Project</h3>
|
||||
<div class="modal-body">
|
||||
<form>
|
||||
<section class="form-block">
|
||||
<div class="form-group">
|
||||
<label for="create_project_username" class="col-md-4">Project Name</label>
|
||||
<input type="text" class="col-md-8" id="create_project_username" size="20">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-4">Public</label>
|
||||
<div class="checkbox-inline">
|
||||
<input type="checkbox" id="create_project_public">
|
||||
<label for="create_project_public"></label>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline" (click)="create_project_opened = false">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" (click)="create_project_opened = false">Ok</button>
|
||||
</div>
|
||||
</clr-modal>
|
||||
<div class="row flex-items-xs-between">
|
||||
<div class="col-xs-4">
|
||||
<button class="btn btn-sm" (click)="create_project_opened = true">New Project</button>
|
||||
<create-project></create-project>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<clr-dropdown [clrMenuPosition]="'bottom-left'">
|
||||
@ -38,9 +14,9 @@
|
||||
<a href="javascript:void(0)" clrDropdownItem>Public Projects</a>
|
||||
</div>
|
||||
</clr-dropdown>
|
||||
<input type="text" placeholder="Search for projects">
|
||||
<search-project></search-project>
|
||||
</div>
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||
<project-list></project-list>
|
||||
<list-project></list-project>
|
||||
</div>
|
||||
</div>
|
@ -8,9 +8,6 @@ import { Router } from '@angular/router';
|
||||
styleUrls: [ 'project.css' ]
|
||||
})
|
||||
export class ProjectComponent implements OnInit {
|
||||
|
||||
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
}
|
||||
|
@ -1,18 +1,30 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { ProjectComponent } from './project.component';
|
||||
import { ProjectListComponent } from './project-list.component';
|
||||
|
||||
import { SharedModule } from '../shared.module';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { ProjectDetailModule } from './project-detail/project-detail.module';
|
||||
|
||||
import { ProjectComponent } from './project.component';
|
||||
import { CreateProjectComponent } from './create-project/create-project.component';
|
||||
import { SearchProjectComponent } from './search-project/search-project.component';
|
||||
import { FilterProjectComponent } from './filter-project/filter-project.component';
|
||||
import { ListProjectComponent } from './list-project/list-project.component';
|
||||
import { ProjectDetailComponent } from './project-detail/project-detail.component';
|
||||
import { ProjectRoutingModule } from './project-routing.module';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
SharedModule,
|
||||
RouterModule
|
||||
ProjectDetailModule,
|
||||
ProjectRoutingModule
|
||||
],
|
||||
declarations: [
|
||||
ProjectComponent,
|
||||
ProjectListComponent
|
||||
CreateProjectComponent,
|
||||
SearchProjectComponent,
|
||||
FilterProjectComponent,
|
||||
ListProjectComponent
|
||||
],
|
||||
exports: [ ProjectComponent ]
|
||||
exports: [ ListProjectComponent ]
|
||||
})
|
||||
export class ProjectModule {}
|
@ -0,0 +1 @@
|
||||
<input type="text" placeholder="Search for projects">
|
@ -0,0 +1,9 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'search-project',
|
||||
templateUrl: 'search-project.component.html'
|
||||
})
|
||||
export class SearchProjectComponent {
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user