Commit 2396410c authored by AllForNothing's avatar AllForNothing
Browse files

get registrry from project summary api


Signed-off-by: default avatarAllForNothing <sshijun@vmware.com>
parent ee35e1ec
<div class="summary summary-dark display-flex" *ngIf="summaryInformation">
<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>
<ul class="list-unstyled">
<li id="endpoint">{{endpoint?.name}}-{{endpoint?.url}}</li>
<li id="endpoint">{{summaryInformation?.registry?.name}}-{{summaryInformation?.registry?.url}}</li>
</ul>
</div>
<div class="display-flex project-detail pt-05">
......
......@@ -60,7 +60,11 @@ describe('SummaryComponent', () => {
chart_count: 0,
project_admin_count: 1,
maintainer_count: 0,
developer_count: 0
developer_count: 0,
registry: {
name: "test",
url: "https://test.com"
}
};
beforeEach(async(() => {
......
......@@ -34,20 +34,10 @@ export class SummaryComponent implements OnInit {
private errorHandler: ErrorHandler,
private appConfigService: AppConfigService,
private route: ActivatedRoute,
private session: SessionService,
private endpointService: EndpointService
) { }
ngOnInit() {
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 = [
{resource: USERSTATICPERMISSION.MEMBER.KEY, action: USERSTATICPERMISSION.MEMBER.VALUE.LIST},
{resource: USERSTATICPERMISSION.QUOTA.KEY, action: USERSTATICPERMISSION.QUOTA.VALUE.READ},
......@@ -64,15 +54,6 @@ export class SummaryComponent implements OnInit {
this.errorHandler.error(error);
});
}
getRegistry(registryId: number) {
this.endpointService.getEndpoint(registryId).subscribe(res => {
this.endpoint = res;
}, error => {
this.errorHandler.error(error);
});
}
getSuitableUnit(value) {
const QuotaUnitsCopy = clone(QuotaUnits);
return getSuitableUnitFn(value, QuotaUnitsCopy);
......@@ -85,10 +66,4 @@ export class SummaryComponent implements OnInit {
public get withHelmChart(): boolean {
return this.appConfigService.getConfig().with_chartmuseum;
}
public get isSystemAdmin(): boolean {
const account = this.session.getCurrentUser();
return account && account.has_admin_role;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment