Add ui change

using api/chartreport for ui

Signed-off-by: DQ <dengq@vmware.com>
This commit is contained in:
DQ 2020-03-30 22:53:00 +08:00
parent 9ff7d46e8f
commit 6216073d2a
5 changed files with 21 additions and 9 deletions

View File

@ -46,7 +46,7 @@ import { ListChartVersionRoComponent } from "./list-chart-version-ro/list-chart-
import { IServiceConfig, SERVICE_CONFIG } from "../../lib/entities/service.config";
import { ErrorHandler } from "../../lib/utils/error-handler";
import { HarborLibraryModule } from "../../lib/harbor-library.module";
import { CURRENT_BASE_HREF } from "../../lib/utils/utils";
import { CURRENT_BASE_HREF, V1_BASE_HREF } from "../../lib/utils/utils";
const uiLibConfig: IServiceConfig = {
enablei18Support: true,
@ -67,8 +67,9 @@ const uiLibConfig: IServiceConfig = {
configurationEndpoint: CURRENT_BASE_HREF + "/configurations",
scanJobEndpoint: CURRENT_BASE_HREF + "/jobs/scan",
labelEndpoint: CURRENT_BASE_HREF + "/labels",
helmChartEndpoint: CURRENT_BASE_HREF + "/chartrepo",
helmChartEndpoint: V1_BASE_HREF + "/chartrepo",
downloadChartEndpoint: "/chartrepo",
helmChartLabelEndpoint: CURRENT_BASE_HREF + "/chartrepo",
gcEndpoint: CURRENT_BASE_HREF + "/system/gc",
ScanAllEndpoint: CURRENT_BASE_HREF + "/system/scanAll",
quotaUrl: CURRENT_BASE_HREF + "/quotas"

View File

@ -229,6 +229,8 @@ export interface IServiceConfig {
*/
downloadChartEndpoint?: string;
helmChartLabelEndpoint?: string;
gcEndpoint?: string;
ScanAllEndpoint?: string;

View File

@ -34,7 +34,7 @@ import {
ErrorHandler,
DefaultErrorHandler
} from './utils/error-handler';
import { DEFAULT_LANG_COOKIE_KEY, DEFAULT_SUPPORTING_LANGS, DEFAULT_LANG, CURRENT_BASE_HREF } from './utils/utils';
import { DEFAULT_LANG_COOKIE_KEY, DEFAULT_SUPPORTING_LANGS, DEFAULT_LANG, CURRENT_BASE_HREF, V1_BASE_HREF } from './utils/utils';
import { OperationService } from './components/operation/operation.service';
import { GcHistoryComponent } from "./components/config/gc/gc-history/gc-history.component";
import { GcComponent } from "./components/config/gc/gc.component";
@ -97,7 +97,8 @@ export const DefaultServiceConfig: IServiceConfig = {
configurationEndpoint: CURRENT_BASE_HREF + "/configurations",
scanJobEndpoint: CURRENT_BASE_HREF + "/jobs/scan",
labelEndpoint: CURRENT_BASE_HREF + "/labels",
helmChartEndpoint: CURRENT_BASE_HREF + "/chartrepo",
helmChartEndpoint: V1_BASE_HREF + "/chartrepo",
helmChartLabelEndpoint: CURRENT_BASE_HREF + "/chartrepo",
downloadChartEndpoint: "/chartrepo",
gcEndpoint: CURRENT_BASE_HREF + "/system/gc",
ScanAllEndpoint: CURRENT_BASE_HREF + "/system/scanAll"

View File

@ -6,7 +6,7 @@ import { RequestQueryParams } from "./RequestQueryParams";
import { Label } from "./interface";
import { IServiceConfig, SERVICE_CONFIG } from "../entities/service.config";
import { buildHttpRequestOptions, CURRENT_BASE_HREF, HTTP_JSON_OPTIONS } from "../utils/utils";
import { buildHttpRequestOptions, CURRENT_BASE_HREF, V1_BASE_HREF, HTTP_JSON_OPTIONS } from "../utils/utils";
import { Observable, throwError as observableThrowError } from "rxjs";
export abstract class LabelService {
@ -72,6 +72,7 @@ export abstract class LabelService {
export class LabelDefaultService extends LabelService {
labelUrl: string;
chartUrl: string;
chartLabelUrl: string;
constructor(
@Inject(SERVICE_CONFIG) config: IServiceConfig,
@ -79,7 +80,8 @@ export class LabelDefaultService extends LabelService {
) {
super();
this.labelUrl = config.labelEndpoint ? config.labelEndpoint : CURRENT_BASE_HREF + "/labels";
this.chartUrl = config.helmChartEndpoint ? config.helmChartEndpoint : CURRENT_BASE_HREF + "/chartrepo";
this.chartUrl = config.helmChartEndpoint ? config.helmChartEndpoint : V1_BASE_HREF + "/chartrepo";
this.chartLabelUrl = config.helmChartLabelEndpoint ? config.helmChartLabelEndpoint : CURRENT_BASE_HREF + "/chartrepo";
}
@ -208,7 +210,7 @@ export class LabelDefaultService extends LabelService {
chartName: string,
version: string
): Observable<Label[]> {
return this.http.get<Label[]>(`${this.chartUrl}/${projectName}/charts/${chartName}/${version}/labels`);
return this.http.get<Label[]>(`${this.chartLabelUrl}/${projectName}/charts/${chartName}/${version}/labels`);
}
markChartLabel(
@ -217,7 +219,7 @@ export class LabelDefaultService extends LabelService {
version: string,
label: Label,
): Observable<any> {
return this.http.post(`${this.chartUrl}/${projectName}/charts/${chartName}/${version}/labels`,
return this.http.post(`${this.chartLabelUrl}/${projectName}/charts/${chartName}/${version}/labels`,
JSON.stringify(label), HTTP_JSON_OPTIONS);
}
@ -227,7 +229,7 @@ export class LabelDefaultService extends LabelService {
version: string,
label: Label,
): Observable<any> {
return this.http.delete(`${this.chartUrl}/${projectName}/charts/${chartName}/${version}/labels/${label.id}`, HTTP_JSON_OPTIONS);
return this.http.delete(`${this.chartLabelUrl}/${projectName}/charts/${chartName}/${version}/labels/${label.id}`, HTTP_JSON_OPTIONS);
}
}

View File

@ -13,6 +13,12 @@ enum APILevels {
V1 = '',
V2 = '/v2.0'
}
/**
* v1 base href
*/
export const V1_BASE_HREF = '/api' + APILevels.V1;
/**
* Current base href
*/