mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-02 21:11:37 +01:00
Merge pull request #7076 from cd1989/update-api-basepath
Use baseURL from config
This commit is contained in:
commit
2787306d47
@ -1,10 +1,11 @@
|
|||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable, Inject } from "@angular/core";
|
||||||
import { RetagRequest } from "./interface";
|
import { RetagRequest } from "./interface";
|
||||||
import { HTTP_JSON_OPTIONS } from "../utils";
|
import { HTTP_JSON_OPTIONS } from "../utils";
|
||||||
import { catchError } from "rxjs/operators";
|
import { catchError } from "rxjs/operators";
|
||||||
import { throwError as observableThrowError } from "rxjs/index";
|
import { throwError as observableThrowError } from "rxjs/index";
|
||||||
|
import { IServiceConfig, SERVICE_CONFIG } from "../service.config";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the service methods to perform images retag.
|
* Define the service methods to perform images retag.
|
||||||
@ -36,14 +37,16 @@ export abstract class RetagService {
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class RetagDefaultService extends RetagService {
|
export class RetagDefaultService extends RetagService {
|
||||||
constructor(
|
constructor(
|
||||||
private http: Http
|
private http: Http,
|
||||||
|
@Inject(SERVICE_CONFIG) private config: IServiceConfig
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
retag(request: RetagRequest): Observable<any> {
|
retag(request: RetagRequest): Observable<any> {
|
||||||
|
let baseUrl: string = this.config.repositoryBaseEndpoint ? this.config.repositoryBaseEndpoint : '/api/repositories';
|
||||||
return this.http
|
return this.http
|
||||||
.post(`/api/repositories/${request.targetProject}/${request.targetRepo}/tags`,
|
.post(`${baseUrl}/${request.targetProject}/${request.targetRepo}/tags`,
|
||||||
{
|
{
|
||||||
"tag": request.targetTag,
|
"tag": request.targetTag,
|
||||||
"src_image": request.srcImage,
|
"src_image": request.srcImage,
|
||||||
|
Loading…
Reference in New Issue
Block a user