Merge pull request #6902 from pureshine/cert-link

Download the certificate link by default on ui
This commit is contained in:
Fangyuan Cheng 2019-02-13 21:24:12 +08:00 committed by GitHub
commit 6d782e0fe4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 14 deletions

View File

@ -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<Configuration> = new EventEmitter<Configuration>();
@Output() readOnlyChange: EventEmitter<boolean> = new EventEmitter<boolean>();
@Output() reloadSystemConfig: EventEmitter<any> = new EventEmitter<any>();

View File

@ -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<RepositoryItem>();
@Output() repoProvisionEvent = new EventEmitter<RepositoryItem>();
@ -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 {

View File

@ -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.

View File

@ -1,5 +1,5 @@
<div>
<hbr-repository-gridview [projectId]="projectId" [projectName]="projectName" [hasSignedIn]="hasSignedIn" [hasCAFile]="hasCAFile"
<hbr-repository-gridview [projectId]="projectId" [projectName]="projectName" [hasSignedIn]="hasSignedIn"
[hasProjectAdminRole]="hasProjectAdminRole" [mode]="mode"
(repoClickEvent)="watchRepoClickEvent($event)"></hbr-repository-gridview>
</div>

View File

@ -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;
}
}