mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-26 02:28:06 +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>
|
</button>
|
||||||
<clr-dropdown>
|
<clr-dropdown>
|
||||||
<button type="button" class="btn btn-sm btn-secondary" clrDropdownTrigger
|
<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}}
|
<clr-icon shape="plus" size="16"></clr-icon>{{'REPOSITORY.ADD_LABELS' | translate}}
|
||||||
</button>
|
</button>
|
||||||
<clr-dropdown-menu clrPosition="bottom-left" *clrIfOpen>
|
<clr-dropdown-menu clrPosition="bottom-left" *clrIfOpen>
|
||||||
|
@ -37,7 +37,8 @@ import {
|
|||||||
ConfirmationTargets,
|
ConfirmationTargets,
|
||||||
ConfirmationState,
|
ConfirmationState,
|
||||||
DefaultHelmIcon,
|
DefaultHelmIcon,
|
||||||
ResourceType
|
ResourceType,
|
||||||
|
Roles
|
||||||
} from "../../shared/shared.const";
|
} from "../../shared/shared.const";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -48,6 +49,7 @@ import {
|
|||||||
})
|
})
|
||||||
export class ChartVersionComponent implements OnInit {
|
export class ChartVersionComponent implements OnInit {
|
||||||
signedCon: { [key: string]: any | string[] } = {};
|
signedCon: { [key: string]: any | string[] } = {};
|
||||||
|
@Input() projectRoleID: number;
|
||||||
@Input() projectId: number;
|
@Input() projectId: number;
|
||||||
@Input() projectName: string;
|
@Input() projectName: string;
|
||||||
@Input() chartName: string;
|
@Input() chartName: string;
|
||||||
@ -321,4 +323,8 @@ export class ChartVersionComponent implements OnInit {
|
|||||||
setTimeout(() => clearInterval(hnd), 5000);
|
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]="!(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>
|
<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">
|
<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>
|
<clr-dropdown-menu clrPosition="bottom-left" *clrIfOpen>
|
||||||
<div style='display:grid'>
|
<div style='display:grid'>
|
||||||
<label class="dropdown-header">{{'REPOSITORY.ADD_TO_IMAGE' | translate}}</label>
|
<label class="dropdown-header">{{'REPOSITORY.ADD_TO_IMAGE' | translate}}</label>
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
[chartName]='chartName'
|
[chartName]='chartName'
|
||||||
[roleName]='roleName'
|
[roleName]='roleName'
|
||||||
[hasSignedIn]='hasSignedIn'
|
[hasSignedIn]='hasSignedIn'
|
||||||
|
[projectRoleID]='project_member_role_id'
|
||||||
[hasProjectAdminRole]='hasProjectAdminRole'
|
[hasProjectAdminRole]='hasProjectAdminRole'
|
||||||
(versionClickEvt)='onVersionClick($event)'
|
(versionClickEvt)='onVersionClick($event)'
|
||||||
(backEvt)='gotoChartList()'>
|
(backEvt)='gotoChartList()'>
|
||||||
|
@ -23,6 +23,7 @@ export class ListChartVersionsComponent implements OnInit {
|
|||||||
hasSignedIn: boolean;
|
hasSignedIn: boolean;
|
||||||
hasProjectAdminRole: boolean;
|
hasProjectAdminRole: boolean;
|
||||||
currentUser: SessionUser;
|
currentUser: SessionUser;
|
||||||
|
project_member_role_id: number;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
@ -41,6 +42,7 @@ export class ListChartVersionsComponent implements OnInit {
|
|||||||
this.hasProjectAdminRole = project.has_project_admin_role;
|
this.hasProjectAdminRole = project.has_project_admin_role;
|
||||||
this.roleName = project.role_name;
|
this.roleName = project.role_name;
|
||||||
this.projectName = project.name;
|
this.projectName = project.name;
|
||||||
|
this.project_member_role_id = project.current_user_role_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user