mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-17 04:11:24 +01:00
Merge pull request #12420 from AllForNothing/proxy-from-api
Add query string for getting registry
This commit is contained in:
commit
71e50bd364
@ -23,8 +23,8 @@ import {
|
|||||||
OnChanges,
|
OnChanges,
|
||||||
SimpleChanges, AfterViewInit, ElementRef
|
SimpleChanges, AfterViewInit, ElementRef
|
||||||
} from "@angular/core";
|
} from "@angular/core";
|
||||||
import { NgForm, Validators, AbstractControl } from "@angular/forms";
|
import { NgForm, Validators } from "@angular/forms";
|
||||||
import { fromEvent, Subject, Subscription } from "rxjs";
|
import { fromEvent, Subscription } from "rxjs";
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateService } from "@ngx-translate/core";
|
||||||
import { MessageHandlerService } from "../../shared/message-handler/message-handler.service";
|
import { MessageHandlerService } from "../../shared/message-handler/message-handler.service";
|
||||||
import { InlineAlertComponent } from "../../shared/inline-alert/inline-alert.component";
|
import { InlineAlertComponent } from "../../shared/inline-alert/inline-alert.component";
|
||||||
@ -32,6 +32,7 @@ import { Project } from "../project";
|
|||||||
import { QuotaUnits, QuotaUnlimited } from "../../../lib/entities/shared.const";
|
import { QuotaUnits, QuotaUnlimited } from "../../../lib/entities/shared.const";
|
||||||
import { Endpoint, EndpointService, ProjectService, QuotaHardInterface } from '../../../lib/services';
|
import { Endpoint, EndpointService, ProjectService, QuotaHardInterface } from '../../../lib/services';
|
||||||
import { clone, getByte, GetIntegerAndUnit, validateLimit } from "../../../lib/utils/utils";
|
import { clone, getByte, GetIntegerAndUnit, validateLimit } from "../../../lib/utils/utils";
|
||||||
|
import { HttpParams } from '@angular/common/http';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -74,7 +75,7 @@ export class CreateProjectComponent implements OnInit, AfterViewInit, OnChanges
|
|||||||
checkNameSubscribe: Subscription;
|
checkNameSubscribe: Subscription;
|
||||||
|
|
||||||
registries: Endpoint[] = [];
|
registries: Endpoint[] = [];
|
||||||
supportedRegistryType: string[] = ['docker-hub', 'harbor'];
|
supportedRegistryTypeQueryString: string = "type={docker-hub harbor}";
|
||||||
|
|
||||||
constructor(private projectService: ProjectService,
|
constructor(private projectService: ProjectService,
|
||||||
private translateService: TranslateService,
|
private translateService: TranslateService,
|
||||||
@ -87,10 +88,10 @@ export class CreateProjectComponent implements OnInit, AfterViewInit, OnChanges
|
|||||||
}
|
}
|
||||||
|
|
||||||
getRegistries() {
|
getRegistries() {
|
||||||
this.endpointService.getEndpoints()
|
this.endpointService.getEndpoints(null, new HttpParams().set('q', this.supportedRegistryTypeQueryString))
|
||||||
.subscribe(targets => {
|
.subscribe(targets => {
|
||||||
if (targets && targets.length) {
|
if (targets && targets.length) {
|
||||||
this.registries = targets.filter(item => this.supportedRegistryType.indexOf(item.type) !== -1);
|
this.registries = targets;
|
||||||
}
|
}
|
||||||
}, error => {
|
}, error => {
|
||||||
this.messageHandlerService.handleError(error);
|
this.messageHandlerService.handleError(error);
|
||||||
|
Loading…
Reference in New Issue
Block a user