mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-19 15:17:43 +01:00
Merge pull request #12532 from AllForNothing/proxy-sum
Get registrry from project summary api
This commit is contained in:
commit
46fa64462a
@ -1,9 +1,9 @@
|
|||||||
<div class="summary summary-dark display-flex" *ngIf="summaryInformation">
|
<div class="summary summary-dark display-flex" *ngIf="summaryInformation">
|
||||||
<div class="summary-left">
|
<div class="summary-left">
|
||||||
<div class="display-flex project-detail pt-05" *ngIf="isSystemAdmin && endpoint">
|
<div class="display-flex project-detail pt-05" *ngIf="summaryInformation?.registry">
|
||||||
<h5 class="mt-0 width-7-5">{{'PROJECT.PROXY_CACHE_ENDPOINT' | translate}}</h5>
|
<h5 class="mt-0 width-7-5">{{'PROJECT.PROXY_CACHE_ENDPOINT' | translate}}</h5>
|
||||||
<ul class="list-unstyled">
|
<ul class="list-unstyled">
|
||||||
<li id="endpoint">{{endpoint?.name}}-{{endpoint?.url}}</li>
|
<li id="endpoint">{{summaryInformation?.registry?.name}}-{{summaryInformation?.registry?.url}}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="display-flex project-detail pt-05">
|
<div class="display-flex project-detail pt-05">
|
||||||
|
@ -60,7 +60,11 @@ describe('SummaryComponent', () => {
|
|||||||
chart_count: 0,
|
chart_count: 0,
|
||||||
project_admin_count: 1,
|
project_admin_count: 1,
|
||||||
maintainer_count: 0,
|
maintainer_count: 0,
|
||||||
developer_count: 0
|
developer_count: 0,
|
||||||
|
registry: {
|
||||||
|
name: "test",
|
||||||
|
url: "https://test.com"
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
|
@ -34,20 +34,10 @@ export class SummaryComponent implements OnInit {
|
|||||||
private errorHandler: ErrorHandler,
|
private errorHandler: ErrorHandler,
|
||||||
private appConfigService: AppConfigService,
|
private appConfigService: AppConfigService,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private session: SessionService,
|
|
||||||
private endpointService: EndpointService
|
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.projectId = this.route.snapshot.parent.params['id'];
|
this.projectId = this.route.snapshot.parent.params['id'];
|
||||||
const resolverData = this.route.snapshot.parent.data;
|
|
||||||
if (resolverData) {
|
|
||||||
const pro: Project = <Project>resolverData['projectResolver'];
|
|
||||||
if (pro && pro.registry_id && this.isSystemAdmin) {
|
|
||||||
this.getRegistry(pro.registry_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const permissions = [
|
const permissions = [
|
||||||
{resource: USERSTATICPERMISSION.MEMBER.KEY, action: USERSTATICPERMISSION.MEMBER.VALUE.LIST},
|
{resource: USERSTATICPERMISSION.MEMBER.KEY, action: USERSTATICPERMISSION.MEMBER.VALUE.LIST},
|
||||||
{resource: USERSTATICPERMISSION.QUOTA.KEY, action: USERSTATICPERMISSION.QUOTA.VALUE.READ},
|
{resource: USERSTATICPERMISSION.QUOTA.KEY, action: USERSTATICPERMISSION.QUOTA.VALUE.READ},
|
||||||
@ -64,15 +54,6 @@ export class SummaryComponent implements OnInit {
|
|||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getRegistry(registryId: number) {
|
|
||||||
this.endpointService.getEndpoint(registryId).subscribe(res => {
|
|
||||||
this.endpoint = res;
|
|
||||||
}, error => {
|
|
||||||
this.errorHandler.error(error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
getSuitableUnit(value) {
|
getSuitableUnit(value) {
|
||||||
const QuotaUnitsCopy = clone(QuotaUnits);
|
const QuotaUnitsCopy = clone(QuotaUnits);
|
||||||
return getSuitableUnitFn(value, QuotaUnitsCopy);
|
return getSuitableUnitFn(value, QuotaUnitsCopy);
|
||||||
@ -85,10 +66,4 @@ export class SummaryComponent implements OnInit {
|
|||||||
public get withHelmChart(): boolean {
|
public get withHelmChart(): boolean {
|
||||||
return this.appConfigService.getConfig().with_chartmuseum;
|
return this.appConfigService.getConfig().with_chartmuseum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get isSystemAdmin(): boolean {
|
|
||||||
const account = this.session.getCurrentUser();
|
|
||||||
return account && account.has_admin_role;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user