Merge pull request #6397 from ninjadq/fix_helm_chart_api_in_ui

Fix: helmchart api change caused problems
This commit is contained in:
Mia ZHOU 2018-11-30 16:43:19 +08:00 committed by GitHub
commit 42fe0ec30a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 22 deletions

View File

@ -113,26 +113,6 @@ export class HelmChartDefaultService extends HelmChartService {
return res.json() || []; return res.json() || [];
} }
private extractHelmItems(res: Response) {
if (res.text() === "") {
return [];
}
let charts = res.json();
if (charts) {
return charts.map( chart => {
return {
name: chart.Name,
total_versions: chart.total_versions,
latest_version: chart.latest_version,
created: chart.Created,
icon: chart.Icon,
home: chart.Home};
});
} else {
return [];
}
}
private handleErrorObservable(error: HttpErrorResponse) { private handleErrorObservable(error: HttpErrorResponse) {
return observableThrowError(error.message || error); return observableThrowError(error.message || error);
} }
@ -147,7 +127,7 @@ export class HelmChartDefaultService extends HelmChartService {
return this.http return this.http
.get(`${this.config.helmChartEndpoint}/${projectName}/charts`, HTTP_GET_OPTIONS) .get(`${this.config.helmChartEndpoint}/${projectName}/charts`, HTTP_GET_OPTIONS)
.pipe( .pipe(
map(response => this.extractHelmItems(response), map(response => this.extractData(response),
catchError(error => this.handleErrorObservable(error)) catchError(error => this.handleErrorObservable(error))
)); ));
} }

View File

@ -306,12 +306,13 @@ export interface HelmChartItem {
total_versions: number; total_versions: number;
latest_version: string; latest_version: string;
created: string; created: string;
updated: string;
icon: string; icon: string;
home: string; home: string;
deprecated?: boolean;
status?: string; status?: string;
pulls?: number; pulls?: number;
maintainer?: string; maintainer?: string;
deprecated?: boolean;
} }
export interface HelmChartVersion { export interface HelmChartVersion {