mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-25 01:58:35 +01:00
Merge pull request #6195 from pureshine/labels-btn
Ordinary user login is forbidden to add labels in images.
This commit is contained in:
commit
a20d49359b
@ -49,7 +49,7 @@
|
||||
</button>
|
||||
<clr-dropdown>
|
||||
<button type="button" class="btn btn-sm btn-secondary" clrDropdownTrigger
|
||||
[disabled]="!(selectedRows.length===1)">
|
||||
[disabled]="!(selectedRows.length===1 && developerRoleOrAbove)">
|
||||
<clr-icon shape="plus" size="16"></clr-icon>{{'REPOSITORY.ADD_LABELS' | translate}}
|
||||
</button>
|
||||
<clr-dropdown-menu clrPosition="bottom-left" *clrIfOpen>
|
||||
|
@ -37,7 +37,8 @@ import {
|
||||
ConfirmationTargets,
|
||||
ConfirmationState,
|
||||
DefaultHelmIcon,
|
||||
ResourceType
|
||||
ResourceType,
|
||||
Roles
|
||||
} from "../../shared/shared.const";
|
||||
|
||||
@Component({
|
||||
@ -48,6 +49,7 @@ import {
|
||||
})
|
||||
export class ChartVersionComponent implements OnInit {
|
||||
signedCon: { [key: string]: any | string[] } = {};
|
||||
@Input() projectRoleID: number;
|
||||
@Input() projectId: number;
|
||||
@Input() projectName: string;
|
||||
@Input() chartName: string;
|
||||
@ -321,4 +323,8 @@ export class ChartVersionComponent implements OnInit {
|
||||
setTimeout(() => clearInterval(hnd), 5000);
|
||||
});
|
||||
}
|
||||
|
||||
public get developerRoleOrAbove(): boolean {
|
||||
return this.projectRoleID === Roles.DEVELOPER || this.hasProjectAdminRole;
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@
|
||||
<button type="button" class="btn btn-sm btn-secondary" [disabled]="!(canScanNow(selectedRow) && selectedRow.length==1)" (click)="scanNow(selectedRow)"><clr-icon shape="shield-check" size="16"></clr-icon> {{'VULNERABILITY.SCAN_NOW' | translate}}</button>
|
||||
<button type="button" class="btn btn-sm btn-secondary" [disabled]="!(selectedRow.length==1)" (click)="showDigestId(selectedRow)" ><clr-icon shape="copy" size="16"></clr-icon> {{'REPOSITORY.COPY_DIGEST_ID' | translate}}</button>
|
||||
<clr-dropdown *ngIf="!withAdmiral">
|
||||
<button type="button" class="btn btn-sm btn-secondary" clrDropdownTrigger [disabled]="!(selectedRow.length==1) || isGuest" (click)="addLabels(selectedRow)" ><clr-icon shape="plus" size="16"></clr-icon>{{'REPOSITORY.ADD_LABELS' | translate}}</button>
|
||||
<button type="button" class="btn btn-sm btn-secondary" clrDropdownTrigger [disabled]="!(selectedRow.length==1 && developerRoleOrAbove)" (click)="addLabels(selectedRow)" ><clr-icon shape="plus" size="16"></clr-icon>{{'REPOSITORY.ADD_LABELS' | translate}}</button>
|
||||
<clr-dropdown-menu clrPosition="bottom-left" *clrIfOpen>
|
||||
<div style='display:grid'>
|
||||
<label class="dropdown-header">{{'REPOSITORY.ADD_TO_IMAGE' | translate}}</label>
|
||||
|
@ -10,6 +10,7 @@
|
||||
[chartName]='chartName'
|
||||
[roleName]='roleName'
|
||||
[hasSignedIn]='hasSignedIn'
|
||||
[projectRoleID]='project_member_role_id'
|
||||
[hasProjectAdminRole]='hasProjectAdminRole'
|
||||
(versionClickEvt)='onVersionClick($event)'
|
||||
(backEvt)='gotoChartList()'>
|
||||
|
@ -23,6 +23,7 @@ export class ListChartVersionsComponent implements OnInit {
|
||||
hasSignedIn: boolean;
|
||||
hasProjectAdminRole: boolean;
|
||||
currentUser: SessionUser;
|
||||
project_member_role_id: number;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
@ -41,6 +42,7 @@ export class ListChartVersionsComponent implements OnInit {
|
||||
this.hasProjectAdminRole = project.has_project_admin_role;
|
||||
this.roleName = project.role_name;
|
||||
this.projectName = project.name;
|
||||
this.project_member_role_id = project.current_user_role_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user