Merge pull request #6621 from pureshine/download-cert

When harbor is deployed in http mode, the registry certificate download button is not displayed in the project page.
This commit is contained in:
Mia ZHOU 2018-12-26 09:45:46 +08:00 committed by GitHub
commit 9a597e274f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 4 deletions

View File

@ -3,7 +3,7 @@
<div class="toolbar">
<div class="row flex-items-xs-right option-right rightPos">
<div class="flex-xs-middle">
<a #certDownloadLink [href]="downloadLink" target="_blank" class="btn btn-link btn-font download-link">
<a #certDownloadLink *ngIf="canDownloadCert" [href]="downloadLink" target="_blank" class="btn btn-link btn-font download-link">
<clr-icon shape="download"></clr-icon>
{{'CONFIG.REGISTRY_CERTIFICATE' | translate | uppercase}}
</a>

View File

@ -51,6 +51,7 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
@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>();
@ -118,6 +119,10 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
return this.withClair && !this.isClairDBReady;
}
get canDownloadCert(): boolean {
return this.hasCAFile;
}
ngOnChanges(changes: SimpleChanges): void {
if (changes["projectId"] && changes["projectId"].currentValue) {
this.refresh();

View File

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

View File

@ -17,7 +17,7 @@ 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'
@ -32,7 +32,8 @@ export class RepositoryPageComponent implements OnInit {
constructor(
private route: ActivatedRoute,
private session: SessionService,
private router: Router
private router: Router,
private appConfigService: AppConfigService,
) {
}
@ -51,4 +52,8 @@ 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;
}
}