From 54f74ff91df6816b6f83e93d0b73719a912ebc36 Mon Sep 17 00:00:00 2001 From: FangyuanCheng Date: Fri, 1 Feb 2019 16:22:49 +0800 Subject: [PATCH] Download the certificate link by default on ui Signed-off-by: FangyuanCheng --- .../lib/src/config/system/system-settings.component.ts | 4 ++-- .../repository-gridview/repository-gridview.component.ts | 7 +++---- src/portal/lib/src/service.config.ts | 1 - .../src/app/repository/repository-page.component.html | 2 +- src/portal/src/app/repository/repository-page.component.ts | 6 ------ 5 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/portal/lib/src/config/system/system-settings.component.ts b/src/portal/lib/src/config/system/system-settings.component.ts index 410a97277..8fc0ea1f8 100644 --- a/src/portal/lib/src/config/system/system-settings.component.ts +++ b/src/portal/lib/src/config/system/system-settings.component.ts @@ -1,7 +1,7 @@ import { Component, Input, Output, EventEmitter, ViewChild, Inject, OnChanges, SimpleChanges } from '@angular/core'; import { NgForm } from '@angular/forms'; import { Configuration, StringValueItem } from '../config'; -import { SERVICE_CONFIG, IServiceConfig, downloadUrl } from '../../service.config'; +import { SERVICE_CONFIG, IServiceConfig } from '../../service.config'; import { clone, isEmpty, getChanges, toPromise } from '../../utils'; import { ErrorHandler } from '../../error-handler/index'; import { ConfirmationMessage } from '../../confirmation-dialog/confirmation-message'; @@ -23,7 +23,7 @@ export class SystemSettingsComponent implements OnChanges { config: Configuration = new Configuration(); onGoing = false; private originalConfig: Configuration; - downloadLink: string = downloadUrl; + downloadLink: string; @Output() configChange: EventEmitter = new EventEmitter(); @Output() readOnlyChange: EventEmitter = new EventEmitter(); @Output() reloadSystemConfig: EventEmitter = new EventEmitter(); diff --git a/src/portal/lib/src/repository-gridview/repository-gridview.component.ts b/src/portal/lib/src/repository-gridview/repository-gridview.component.ts index baf7f9fce..244619b9d 100644 --- a/src/portal/lib/src/repository-gridview/repository-gridview.component.ts +++ b/src/portal/lib/src/repository-gridview/repository-gridview.component.ts @@ -38,7 +38,7 @@ import { OperationService } from "../operation/operation.service"; import { UserPermissionService } from "../service/permission.service"; import { USERSTATICPERMISSION } from "../service/permission-static"; import { OperateInfo, OperationState, operateChanges } from "../operation/operate"; -import { SERVICE_CONFIG, IServiceConfig, downloadUrl } from '../service.config'; +import { SERVICE_CONFIG, IServiceConfig } from '../service.config'; @Component({ selector: "hbr-repository-gridview", templateUrl: "./repository-gridview.component.html", @@ -47,13 +47,12 @@ import { SERVICE_CONFIG, IServiceConfig, downloadUrl } from '../service.config'; }) export class RepositoryGridviewComponent implements OnChanges, OnInit { signedCon: { [key: string]: any | string[] } = {}; - downloadLink: string = downloadUrl; + downloadLink: string; @Input() projectId: number; @Input() projectName = "unknown"; @Input() urlPrefix: string; @Input() hasSignedIn: boolean; @Input() hasProjectAdminRole: boolean; - @Input() hasCAFile: boolean = false; @Input() mode = "admiral"; @Output() repoClickEvent = new EventEmitter(); @Output() repoProvisionEvent = new EventEmitter(); @@ -124,7 +123,7 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit { } get canDownloadCert(): boolean { - return this.hasCAFile; + return this.systemInfo && this.systemInfo.has_ca_root; } ngOnChanges(changes: SimpleChanges): void { diff --git a/src/portal/lib/src/service.config.ts b/src/portal/lib/src/service.config.ts index fb21ddb60..984685e0b 100644 --- a/src/portal/lib/src/service.config.ts +++ b/src/portal/lib/src/service.config.ts @@ -1,7 +1,6 @@ import { InjectionToken } from '@angular/core'; export let SERVICE_CONFIG = new InjectionToken("service.config"); -export const downloadUrl = "/api/systeminfo/getcert"; export interface IServiceConfig { /** * The base endpoint of service used to retrieve the system configuration information. diff --git a/src/portal/src/app/repository/repository-page.component.html b/src/portal/src/app/repository/repository-page.component.html index e041726d9..fb579e7e4 100644 --- a/src/portal/src/app/repository/repository-page.component.html +++ b/src/portal/src/app/repository/repository-page.component.html @@ -1,5 +1,5 @@
-
\ No newline at end of file diff --git a/src/portal/src/app/repository/repository-page.component.ts b/src/portal/src/app/repository/repository-page.component.ts index ee9e847ba..072b4be6e 100644 --- a/src/portal/src/app/repository/repository-page.component.ts +++ b/src/portal/src/app/repository/repository-page.component.ts @@ -17,7 +17,6 @@ import { RepositoryItem } from '@harbor/ui'; import { Project } from '../project/project'; import { SessionService } from '../shared/session.service'; -import { AppConfigService } from '../app-config.service'; @Component({ selector: 'repository', templateUrl: 'repository-page.component.html' @@ -33,7 +32,6 @@ export class RepositoryPageComponent implements OnInit { private route: ActivatedRoute, private session: SessionService, private router: Router, - private appConfigService: AppConfigService, ) { } @@ -52,8 +50,4 @@ export class RepositoryPageComponent implements OnInit { let linkUrl = ['harbor', 'projects', repoEvt.project_id, 'repositories', repoEvt.name]; this.router.navigate(linkUrl); } - - public get hasCAFile(): boolean { - return this.appConfigService.getConfig().has_ca_root; - } }