Refactored code structures.

This commit is contained in:
kunw 2017-02-14 12:59:37 +08:00
parent f27d2e41fa
commit c78d391868
22 changed files with 110 additions and 35 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@ -1,6 +1,6 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { SignInComponent } from './sign-in.component'; import { SignInComponent } from './sign-in.component';
import { SharedModule } from '../shared.module'; import { SharedModule } from '../shared/shared.module';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
@NgModule({ @NgModule({

View File

@ -9,14 +9,14 @@ import { AccountModule } from './account/account.module';
import { BaseModule } from './base/base.module'; import { BaseModule } from './base/base.module';
import { HarborRoutingModule } from './harbor-routing.module'; import { HarborRoutingModule } from './harbor-routing.module';
import { SharedModule } from './shared.module'; import { CoreModule } from './core/core.module';
@NgModule({ @NgModule({
declarations: [ declarations: [
AppComponent, AppComponent,
], ],
imports: [ imports: [
SharedModule, CoreModule,
AccountModule, AccountModule,
BaseModule, BaseModule,
HarborRoutingModule HarborRoutingModule

View File

@ -5,12 +5,6 @@ import { HarborShellComponent } from './harbor-shell/harbor-shell.component';
import { DashboardComponent } from '../dashboard/dashboard.component'; import { DashboardComponent } from '../dashboard/dashboard.component';
import { ProjectComponent } from '../project/project.component'; import { ProjectComponent } from '../project/project.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 baseRoutes: Routes = [ const baseRoutes: Routes = [
{ {
path: 'harbor', component: HarborShellComponent, path: 'harbor', component: HarborShellComponent,

View File

@ -1,8 +1,9 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { SharedModule } from '../shared.module'; import { SharedModule } from '../shared/shared.module';
import { DashboardModule } from '../dashboard/dashboard.module'; import { DashboardModule } from '../dashboard/dashboard.module';
import { ProjectModule } from '../project/project.module'; import { ProjectModule } from '../project/project.module';
import { UserModule } from '../user/user.module';
import { NavigatorComponent } from './navigator/navigator.component'; import { NavigatorComponent } from './navigator/navigator.component';
import { GlobalSearchComponent } from './global-search/global-search.component'; import { GlobalSearchComponent } from './global-search/global-search.component';
@ -16,6 +17,7 @@ import { BaseRoutingModule } from './base-routing.module';
SharedModule, SharedModule,
DashboardModule, DashboardModule,
ProjectModule, ProjectModule,
UserModule,
BaseRoutingModule BaseRoutingModule
], ],
declarations: [ declarations: [

View File

@ -3,8 +3,6 @@ import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http'; import { HttpModule } from '@angular/http';
import { ClarityModule } from 'clarity-angular'; import { ClarityModule } from 'clarity-angular';
import { AppComponent } from './app.component';
import { AccountModule } from './account/account.module';
@NgModule({ @NgModule({
imports: [ imports: [

View File

@ -1,6 +1,6 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { DashboardComponent } from './dashboard.component'; import { DashboardComponent } from './dashboard.component';
import { SharedModule } from '../shared.module'; import { SharedModule } from '../shared/shared.module';
@NgModule({ @NgModule({
imports: [ SharedModule ], imports: [ SharedModule ],

View File

@ -11,14 +11,14 @@
<clr-dg-column>Tag</clr-dg-column> <clr-dg-column>Tag</clr-dg-column>
<clr-dg-column>Operation</clr-dg-column> <clr-dg-column>Operation</clr-dg-column>
<clr-dg-column>Timestamp</clr-dg-column> <clr-dg-column>Timestamp</clr-dg-column>
<clr-dg-row *ngFor="let l of logs"> <clr-dg-row *ngFor="let l of auditLogs">
<clr-dg-cell>{{l.username}}</clr-dg-cell> <clr-dg-cell>{{l.username}}</clr-dg-cell>
<clr-dg-cell>{{l.repoName}}</clr-dg-cell> <clr-dg-cell>{{l.repoName}}</clr-dg-cell>
<clr-dg-cell>{{l.tag}}</clr-dg-cell> <clr-dg-cell>{{l.tag}}</clr-dg-cell>
<clr-dg-cell>{{l.operation}}</clr-dg-cell> <clr-dg-cell>{{l.operation}}</clr-dg-cell>
<clr-dg-cell>{{l.timestamp}}</clr-dg-cell> <clr-dg-cell>{{l.timestamp}}</clr-dg-cell>
</clr-dg-row> </clr-dg-row>
<clr-dg-footer>{{logs.length}} item(s)</clr-dg-footer> <clr-dg-footer>{{auditLogs.length}} item(s)</clr-dg-footer>
</clr-datagrid> </clr-datagrid>
</div> </div>
</div> </div>

View File

@ -1,15 +1,15 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Log } from './log'; import { AuditLog } from './audit-log';
@Component({ @Component({
templateUrl: './log.component.html' templateUrl: './audit-log.component.html'
}) })
export class LogComponent implements OnInit { export class AuditLogComponent implements OnInit {
logs: Log[]; auditLogs: AuditLog[];
ngOnInit(): void { ngOnInit(): void {
this.logs = [ this.auditLogs = [
{ username: 'Admin', repoName: 'project01', tag: '', operation: 'create', timestamp: '2016-12-23 12:05:17' }, { username: 'Admin', repoName: 'project01', tag: '', operation: 'create', timestamp: '2016-12-23 12:05:17' },
{ username: 'Admin', repoName: 'project01/ubuntu', tag: '14.04', operation: 'push', timestamp: '2016-12-30 14:52:23' }, { username: 'Admin', repoName: 'project01/ubuntu', tag: '14.04', operation: 'push', timestamp: '2016-12-30 14:52:23' },
{ username: 'user1', repoName: 'project01/mysql', tag: '5.6', operation: 'pull', timestamp: '2016-12-30 12:12:33' } { username: 'user1', repoName: 'project01/mysql', tag: '5.6', operation: 'pull', timestamp: '2016-12-30 12:12:33' }

View File

@ -1,4 +1,4 @@
export class Log { export class AuditLog {
username: string; username: string;
repoName: string; repoName: string;
tag: string; tag: string;

View File

@ -1,10 +1,10 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { LogComponent } from './log.component'; import { AuditLogComponent } from './audit-log.component';
import { SharedModule } from '../shared.module'; import { SharedModule } from '../shared/shared.module';
@NgModule({ @NgModule({
imports: [ SharedModule ], imports: [ SharedModule ],
declarations: [ LogComponent ], declarations: [ AuditLogComponent ],
exports: [ LogComponent ] exports: [ AuditLogComponent ]
}) })
export class LogModule {} export class LogModule {}

View File

@ -0,0 +1,35 @@
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="row flex-items-xs-between">
<div class="col-xs-4">
<button class="btn btn-sm">new user</button>
</div>
<div class="col-xs-4">
<input type="text" placeholder="Search for users">
</div>
</div>
<clr-datagrid>
<clr-dg-column>Name</clr-dg-column>
<clr-dg-column>Role</clr-dg-column>
<clr-dg-column>Action</clr-dg-column>
<clr-dg-row *ngFor="let u of members">
<clr-dg-cell>{{u.name}}</clr-dg-cell>
<clr-dg-cell>{{u.role}}</clr-dg-cell>
<clr-dg-cell>
<clr-dropdown [clrMenuPosition]="'bottom-left'">
<button class="btn btn-sm btn-link" clrDropdownToggle>
Actions
<clr-icon shape="caret down"></clr-icon>
</button>
<div class="dropdown-menu">
<a href="javascript:void(0)" clrDropdownItem>Project Admin</a>
<a href="javascript:void(0)" clrDropdownItem>Developer</a>
<a href="javascript:void(0)" clrDropdownItem>Guest</a>
</div>
</clr-dropdown>
</clr-dg-cell>
</clr-dg-row>
<clr-dg-footer>{{members.length}} item(s)</clr-dg-footer>
</clr-datagrid>
</div>
</div>

View File

@ -0,0 +1,18 @@
import { Component, OnInit } from '@angular/core';
import { Member } from './member';
@Component({
templateUrl: 'member.component.html'
})
export class MemberComponent implements OnInit {
members: Member[];
ngOnInit(): void {
this.members = [
{ name: 'Admin', role: 'Sys admin'},
{ name: 'user01', role: 'Project Admin'},
{ name: 'user02', role: 'Developer'},
{ name: 'user03', role: 'Guest'}
];
}
}

View File

@ -0,0 +1,4 @@
export class Member {
name: string;
role: string;
}

View File

@ -7,8 +7,8 @@ import { ProjectDetailComponent } from './project-detail/project-detail.componen
import { RepositoryComponent } from '../repository/repository.component'; import { RepositoryComponent } from '../repository/repository.component';
import { ReplicationComponent } from '../replication/replication.component'; import { ReplicationComponent } from '../replication/replication.component';
import { MemberComponent } from '../member/member.component'; import { MemberComponent } from './member/member.component';
import { LogComponent } from '../log/log.component'; import { AuditLogComponent } from '../log/audit-log.component';
const projectRoutes: Routes = [ const projectRoutes: Routes = [
{ path: 'harbor', { path: 'harbor',
@ -22,7 +22,7 @@ const projectRoutes: Routes = [
{ path: 'repository', component: RepositoryComponent }, { path: 'repository', component: RepositoryComponent },
{ path: 'replication', component: ReplicationComponent }, { path: 'replication', component: ReplicationComponent },
{ path: 'member', component: MemberComponent }, { path: 'member', component: MemberComponent },
{ path: 'log', component: LogComponent } { path: 'log', component: AuditLogComponent }
] ]
} }
] ]

View File

@ -1,9 +1,8 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { SharedModule } from '../shared.module'; import { SharedModule } from '../shared/shared.module';
import { RepositoryModule } from '../repository/repository.module'; import { RepositoryModule } from '../repository/repository.module';
import { ReplicationModule } from '../replication/replication.module'; import { ReplicationModule } from '../replication/replication.module';
import { MemberModule} from '../member/member.module';
import { LogModule } from '../log/log.module'; import { LogModule } from '../log/log.module';
import { ProjectComponent } from './project.component'; import { ProjectComponent } from './project.component';
@ -12,6 +11,7 @@ import { SearchProjectComponent } from './search-project/search-project.componen
import { FilterProjectComponent } from './filter-project/filter-project.component'; import { FilterProjectComponent } from './filter-project/filter-project.component';
import { ListProjectComponent } from './list-project/list-project.component'; import { ListProjectComponent } from './list-project/list-project.component';
import { ProjectDetailComponent } from './project-detail/project-detail.component'; import { ProjectDetailComponent } from './project-detail/project-detail.component';
import { MemberComponent } from './member/member.component';
import { ProjectRoutingModule } from './project-routing.module'; import { ProjectRoutingModule } from './project-routing.module';
@ -20,7 +20,6 @@ import { ProjectRoutingModule } from './project-routing.module';
SharedModule, SharedModule,
RepositoryModule, RepositoryModule,
ReplicationModule, ReplicationModule,
MemberModule,
LogModule, LogModule,
ProjectRoutingModule ProjectRoutingModule
], ],
@ -30,7 +29,8 @@ import { ProjectRoutingModule } from './project-routing.module';
SearchProjectComponent, SearchProjectComponent,
FilterProjectComponent, FilterProjectComponent,
ListProjectComponent, ListProjectComponent,
ProjectDetailComponent ProjectDetailComponent,
MemberComponent
], ],
exports: [ ListProjectComponent ] exports: [ ListProjectComponent ]
}) })

View File

@ -1,6 +1,6 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { ReplicationComponent } from './replication.component'; import { ReplicationComponent } from './replication.component';
import { SharedModule } from '../shared.module'; import { SharedModule } from '../shared/shared.module';
@NgModule({ @NgModule({
imports: [ SharedModule ], imports: [ SharedModule ],

View File

@ -1,6 +1,6 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RepositoryComponent } from './repository.component'; import { RepositoryComponent } from './repository.component';
import { SharedModule } from '../shared.module'; import { SharedModule } from '../shared/shared.module';
@NgModule({ @NgModule({
imports: [ SharedModule ], imports: [ SharedModule ],

View File

@ -1,5 +1,5 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CoreModule } from './core.module'; import { CoreModule } from '../core/core.module';
@NgModule({ @NgModule({
imports: [ imports: [

View File

@ -0,0 +1,7 @@
import { Component } from '@angular/core';
@Component({
selector: 'harbor-user',
templateUrl: 'user.component.html'
})
export class UserComponent {}

View File

@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { SharedModule } from '../shared/shared.module';
import { UserComponent } from './user.component';
@NgModule({
imports: [
SharedModule
],
declarations: [
UserComponent
],
exports: [
UserComponent
]
})
export class UserModule {
}