mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 02:35:17 +01:00
Merge pull request #2202 from wknet123/release-1.1.0-fix-tags-action
Fix tags action display issue.
This commit is contained in:
commit
a250b3ba37
@ -94,6 +94,7 @@ const harborRoutes: Routes = [
|
|||||||
{
|
{
|
||||||
path: 'tags/:id/:repo',
|
path: 'tags/:id/:repo',
|
||||||
component: TagRepositoryComponent,
|
component: TagRepositoryComponent,
|
||||||
|
canActivate: [MemberGuard],
|
||||||
resolve: {
|
resolve: {
|
||||||
projectResolver: ProjectRoutingResolver
|
projectResolver: ProjectRoutingResolver
|
||||||
}
|
}
|
||||||
|
@ -33,20 +33,39 @@ export class MemberGuard implements CanActivate, CanActivateChild {
|
|||||||
let projectId = route.params['id'];
|
let projectId = route.params['id'];
|
||||||
this.sessionService.setProjectMembers([]);
|
this.sessionService.setProjectMembers([]);
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.projectService.checkProjectMember(projectId)
|
let user = this.sessionService.getCurrentUser();
|
||||||
|
if(user === null) {
|
||||||
|
this.sessionService.retrieveUser().then(currentUser=>{
|
||||||
|
return resolve(this.checkMemberStatus(state.url, projectId));
|
||||||
|
}).catch(err=>resolve(true));
|
||||||
|
} else {
|
||||||
|
return resolve(this.checkMemberStatus(state.url, projectId));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
checkMemberStatus(url: string, projectId: number): Promise<boolean> {
|
||||||
|
return new Promise<boolean>((resolve, reject)=>{
|
||||||
|
this.projectService.checkProjectMember(projectId)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
res=>{
|
res=>{
|
||||||
this.sessionService.setProjectMembers(res);
|
this.sessionService.setProjectMembers(res);
|
||||||
return resolve(true)
|
return resolve(true);
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
//Add exception for repository in project detail router activation.
|
//Add exception for repository in project detail router activation.
|
||||||
if(state.url.endsWith('repository')) {
|
if(url.endsWith('repository')) {
|
||||||
return resolve(true);
|
return resolve(true);
|
||||||
}
|
}
|
||||||
this.router.navigate([CommonRoutes.HARBOR_DEFAULT]);
|
this.projectService.getProject(projectId)
|
||||||
return resolve(false);
|
.subscribe(project=>{
|
||||||
});
|
if(project.public === 1) {
|
||||||
|
return resolve(true);
|
||||||
|
}
|
||||||
|
this.router.navigate([CommonRoutes.HARBOR_DEFAULT]);
|
||||||
|
return resolve(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user