Hide vulnrability if clair is not installed

Signed-off-by: FangyuanCheng <fangyuanc@vmware.com>
This commit is contained in:
FangyuanCheng 2019-04-18 16:03:31 +08:00
parent d1f4a73004
commit 33852973e3
2 changed files with 12 additions and 3 deletions

View File

@ -46,15 +46,15 @@
</a>
</clr-vertical-nav-group-children>
</clr-vertical-nav-group>
<clr-vertical-nav-group *ngIf="isSystemAdmin" routerLinkActive="active">
<clr-vertical-nav-group *ngIf="isSystemAdmin && (withClair || hasAdminRole)" routerLinkActive="active">
<clr-icon shape="event" clrVerticalNavIcon></clr-icon>
{{'SIDE_NAV.TASKS' | translate}}
<a routerLink="#" hidden aria-hidden="true"></a>
<clr-vertical-nav-group-children *clrIfExpanded="true">
<a clrVerticalNavLink routerLink="/harbor/vulnerability" routerLinkActive="active">
<a clrVerticalNavLink *ngIf="withClair" routerLink="/harbor/vulnerability" routerLinkActive="active">
{{'SIDE_NAV.SYSTEM_MGMT.VULNERABILITY' | translate}}
</a>
<a clrVerticalNavLink routerLink="/harbor/gc" routerLinkActive="active">
<a clrVerticalNavLink *ngIf="hasAdminRole" routerLink="/harbor/gc" routerLinkActive="active">
{{'SIDE_NAV.SYSTEM_MGMT.GARBAGE_COLLECTION' | translate}}
</a>
</clr-vertical-nav-group-children>

View File

@ -107,6 +107,15 @@ export class HarborShellComponent implements OnInit, OnDestroy {
return account != null;
}
public get withClair(): boolean {
return this.appConfigService.getConfig().with_clair;
}
public get hasAdminRole(): boolean {
return this.session.getCurrentUser() &&
this.session.getCurrentUser().has_admin_role;
}
// Open modal dialog
openModal(event: ModalEvent): void {
switch (event.modalName) {