Revert changes to tags route. (#2179)

This commit is contained in:
kun wang 2017-04-28 16:55:44 +08:00 committed by Daniel Jiang
parent d03657e1d0
commit 62f9f842d4
2 changed files with 15 additions and 21 deletions

View File

@ -94,7 +94,6 @@ const harborRoutes: Routes = [
{
path: 'tags/:id/:repo',
component: TagRepositoryComponent,
canActivate: [MemberGuard],
resolve: {
projectResolver: ProjectRoutingResolver
}

View File

@ -33,29 +33,24 @@ export class MemberGuard implements CanActivate, CanActivateChild {
let projectId = route.params['id'];
this.sessionService.setProjectMembers([]);
return new Promise((resolve, reject) => {
if(!this.sessionService.getCurrentUser()) {
return resolve(true);
}
this.projectService.checkProjectMember(projectId)
.subscribe(
res=>{
this.sessionService.setProjectMembers(res);
return resolve(true)
},
error => {
//Add exception for repository in project detail router activation.
if(state.url.endsWith('repository')) {
let projectId = route.params['id'];
this.sessionService.setProjectMembers([]);
return new Promise((resolve, reject) => {
this.projectService.checkProjectMember(projectId)
.subscribe(
res=>{
this.sessionService.setProjectMembers(res);
return resolve(true)
},
error => {
//Add exception for repository in project detail router activation.
if(state.url.endsWith('repository')) {
return resolve(true);
}
this.projectService.getProject(projectId).subscribe(project=>{
if(project.public === 1) {
return resolve(true);
} else {
this.router.navigate([CommonRoutes.HARBOR_DEFAULT]);
return resolve(false);
}
this.router.navigate([CommonRoutes.HARBOR_DEFAULT]);
return resolve(false);
});
});
});
});
}