From 2396410cce590d0d2687475fd1b205b2266f1d6f Mon Sep 17 00:00:00 2001 From: AllForNothing Date: Mon, 20 Jul 2020 18:14:11 +0800 Subject: [PATCH] get registrry from project summary api Signed-off-by: AllForNothing --- .../project/summary/summary.component.html | 4 +-- .../project/summary/summary.component.spec.ts | 6 ++++- .../app/project/summary/summary.component.ts | 25 ------------------- 3 files changed, 7 insertions(+), 28 deletions(-) diff --git a/src/portal/src/app/project/summary/summary.component.html b/src/portal/src/app/project/summary/summary.component.html index 2a80e716b..d159a42c5 100644 --- a/src/portal/src/app/project/summary/summary.component.html +++ b/src/portal/src/app/project/summary/summary.component.html @@ -1,9 +1,9 @@
-
+
{{'PROJECT.PROXY_CACHE_ENDPOINT' | translate}}
    -
  • {{endpoint?.name}}-{{endpoint?.url}}
  • +
  • {{summaryInformation?.registry?.name}}-{{summaryInformation?.registry?.url}}
diff --git a/src/portal/src/app/project/summary/summary.component.spec.ts b/src/portal/src/app/project/summary/summary.component.spec.ts index cb5ce2334..ce3deb1ea 100644 --- a/src/portal/src/app/project/summary/summary.component.spec.ts +++ b/src/portal/src/app/project/summary/summary.component.spec.ts @@ -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(() => { diff --git a/src/portal/src/app/project/summary/summary.component.ts b/src/portal/src/app/project/summary/summary.component.ts index 51f64e290..b7914d595 100644 --- a/src/portal/src/app/project/summary/summary.component.ts +++ b/src/portal/src/app/project/summary/summary.component.ts @@ -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 = 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; - } - }