mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-17 04:11:24 +01:00
disable scan button in tag detail page if login with normal user role
Signed-off-by: Meina Zhou <meinaz@vmware.com>
This commit is contained in:
parent
07712d37fd
commit
7f6917a2c1
@ -69,7 +69,7 @@
|
||||
</section>
|
||||
<section class="detail-section">
|
||||
<div class="vulnerability-block">
|
||||
<hbr-vulnerabilities-grid [repositoryId]="repositoryId" [tagId]="tagId"></hbr-vulnerabilities-grid>
|
||||
<hbr-vulnerabilities-grid [repositoryId]="repositoryId" [tagId]="tagId" [withAdminRole]="withAdminRole"></hbr-vulnerabilities-grid>
|
||||
</div>
|
||||
<div>
|
||||
<ng-content></ng-content>
|
||||
|
@ -23,6 +23,7 @@ export class TagDetailComponent implements OnInit {
|
||||
@Input() repositoryId: string;
|
||||
@Input() withAdmiral: boolean;
|
||||
@Input() withClair: boolean;
|
||||
@Input() withAdminRole: boolean;
|
||||
tagDetails: Tag = {
|
||||
name: "--",
|
||||
size: "--",
|
||||
|
@ -10,7 +10,7 @@
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||
<clr-datagrid>
|
||||
<clr-dg-action-bar>
|
||||
<button type="button" class="btn btn-sm btn-secondary" (click)="scanNow()"><clr-icon shape="shield-check" size="16"></clr-icon> {{'VULNERABILITY.SCAN_NOW' | translate}}</button>
|
||||
<button type="button" class="btn btn-sm btn-secondary" [disabled]="!withAdminRole" (click)="scanNow()"><clr-icon shape="shield-check" size="16"></clr-icon> {{'VULNERABILITY.SCAN_NOW' | translate}}</button>
|
||||
</clr-dg-action-bar>
|
||||
<clr-dg-column [clrDgField]="'id'">{{'VULNERABILITY.GRID.COLUMN_ID' | translate}}</clr-dg-column>
|
||||
<clr-dg-column [clrDgField]="'severity'">{{'VULNERABILITY.GRID.COLUMN_SEVERITY' | translate}}</clr-dg-column>
|
||||
|
@ -20,6 +20,7 @@ export class ResultGridComponent implements OnInit {
|
||||
|
||||
@Input() tagId: string;
|
||||
@Input() repositoryId: string;
|
||||
@Input() withAdminRole: boolean;
|
||||
|
||||
constructor(
|
||||
private scanningService: ScanningResultService,
|
||||
|
@ -57,7 +57,4 @@
|
||||
background: transparent;
|
||||
flex-wrap: wrap;
|
||||
margin-top:-20px;
|
||||
.login {
|
||||
background:transparent;
|
||||
}
|
||||
}
|
@ -4,5 +4,10 @@
|
||||
<a (click)="goBackRep()">< {{'REPOSITORY.REPOSITORIES'| translate}}</a>
|
||||
<a (click)="goBack(repositoryId)">< {{repositoryId}}</a>
|
||||
</div>
|
||||
<hbr-tag-detail (backEvt)="goBack($event)" [tagId]="tagId" [withClair]="withClair" [withAdmiral]="withAdmiral" [repositoryId]="repositoryId"></hbr-tag-detail>
|
||||
<hbr-tag-detail (backEvt)="goBack($event)"
|
||||
[tagId]="tagId"
|
||||
[withClair]="withClair"
|
||||
[withAdmiral]="withAdmiral"
|
||||
[repositoryId]="repositoryId"
|
||||
[withAdminRole]="withAdminRole"></hbr-tag-detail>
|
||||
</div>
|
@ -14,6 +14,7 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import {AppConfigService} from "../../app-config.service";
|
||||
import { SessionService } from '../../shared/session.service';
|
||||
|
||||
@Component({
|
||||
selector: 'repository',
|
||||
@ -28,7 +29,8 @@ export class TagDetailPageComponent implements OnInit {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private appConfigService: AppConfigService,
|
||||
private router: Router
|
||||
private router: Router,
|
||||
private session: SessionService
|
||||
) {
|
||||
}
|
||||
|
||||
@ -46,6 +48,10 @@ export class TagDetailPageComponent implements OnInit {
|
||||
return this.appConfigService.getConfig().with_clair;
|
||||
}
|
||||
|
||||
get withAdminRole(): boolean {
|
||||
return this.session.getCurrentUser().has_admin_role;
|
||||
}
|
||||
|
||||
goBack(tag: string): void {
|
||||
this.router.navigate(["harbor", "projects", this.projectId, "repositories", tag]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user