Skip to content

Commit a95b49b

Browse files
authored
Fix issue where charts list errors if only helm hub registered (#493)
* Fix issue where charts list errored if both helm hub and helm repo's are registered - this was a regression - we shouldn't make the call if there's no registered endpoints anyway * Fix styling on install chart step 1 - apply flex to ensure form fields are correct width
1 parent def5429 commit a95b49b

File tree

4 files changed

+28
-30
lines changed

4 files changed

+28
-30
lines changed

src/frontend/packages/suse-extensions/src/custom/helm/store/helm.effects.ts

+25-13
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ import {
3131
WrapperRequestActionSuccess,
3232
} from '../../../../../store/src/types/request.types';
3333
import { helmEntityCatalog } from '../helm-entity-catalog';
34-
import { getHelmVersionId, getMonocularChartId, HELM_ENDPOINT_TYPE, HELM_HUB_ENDPOINT_TYPE } from '../helm-entity-factory';
34+
import {
35+
getHelmVersionId,
36+
getMonocularChartId,
37+
HELM_ENDPOINT_TYPE,
38+
HELM_HUB_ENDPOINT_TYPE,
39+
HELM_REPO_ENDPOINT_TYPE,
40+
} from '../helm-entity-factory';
3541
import { Chart } from '../monocular/shared/models/chart';
3642
import { stratosMonocularEndpointGuid } from '../monocular/stratos-monocular.helper';
3743
import {
@@ -144,13 +150,10 @@ export class HelmEffects {
144150
const helmHubEndpoint = helmEndpoints.find(endpoint => endpoint.sub_type === HELM_HUB_ENDPOINT_TYPE);
145151

146152
// See https://github.com/SUSE/stratos/issues/466. It would be better to use the standard proxy for this request and go out to all
147-
// valid helm sub types
148-
const stratosMonocular = this.httpClient.get<MonocularChartsResponse>(`/pp/${this.proxyAPIVersion}/chartsvc/v1/charts`);
149-
const helmHubMonocular = helmHubEndpoint ? this.createHelmHubRequest(helmHubEndpoint.guid) : of({ data: [] });
150-
153+
// valid helm sub types instead of making two requests here
151154
return combineLatest([
152-
stratosMonocular,
153-
helmHubMonocular
155+
this.createHelmRepoRequest(helmEndpoints),
156+
this.createHelmHubRequest(helmHubEndpoint)
154157
]).pipe(
155158
map(res => mergeMonocularChartResponses(entityKey, res)),
156159
mergeMap((response: NormalizedResponse) => [new WrapperRequestActionSuccess(response, action)]),
@@ -352,12 +355,21 @@ export class HelmEffects {
352355
};
353356
}
354357

355-
private createHelmHubRequest(endpointId: string): Observable<MonocularChartsResponse> {
356-
return this.httpClient.get<MonocularChartsResponse>(`/pp/${this.proxyAPIVersion}/chartsvc/v1/charts`, {
357-
headers: {
358-
'x-cap-cnsi-list': endpointId
359-
}
360-
}).pipe(map(res => addMonocularId(endpointId, res)));
358+
private createHelmHubRequest(helmHubEndpoint: EndpointModel): Observable<MonocularChartsResponse> {
359+
return helmHubEndpoint ?
360+
this.httpClient.get<MonocularChartsResponse>(`/pp/${this.proxyAPIVersion}/chartsvc/v1/charts`, {
361+
headers: {
362+
'x-cap-cnsi-list': helmHubEndpoint.guid
363+
}
364+
}).pipe(map(res => addMonocularId(helmHubEndpoint.guid, res))) :
365+
of({ data: [] });
366+
}
367+
368+
private createHelmRepoRequest(helmEndpoints: EndpointModel[]): Observable<MonocularChartsResponse> {
369+
const helmRepoEndpoints = helmEndpoints.find(endpoint => endpoint.sub_type === HELM_REPO_ENDPOINT_TYPE);
370+
return helmRepoEndpoints ?
371+
this.httpClient.get<MonocularChartsResponse>(`/pp/${this.proxyAPIVersion}/chartsvc/v1/charts`) :
372+
of({ data: [] });
361373
}
362374

363375
private makeRequest(

src/frontend/packages/suse-extensions/src/custom/kubernetes/workloads/create-release/create-release.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
</app-page-header>
44
<app-steppers [cancel]="cancelUrl">
55
<app-step [title]="'Kubernetes'" [valid]="validate$ | async">
6-
<form [formGroup]="details" class="stepper-form">
6+
<form [formGroup]="details" class="stepper-form helm-create-release">
77
<b>Select the Kubernetes cluster to install to</b>
88
<mat-form-field>
99
<mat-select formControlName="endpoint" name="endpoint">
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
:host {
2-
flex: 1;
3-
}
4-
51
.helm-create-release {
6-
&__heading {
7-
align-items: center;
8-
display: flex;
9-
}
10-
11-
&__title {
12-
flex: 1;
13-
font-size: 14px;
14-
}
15-
&__button {
16-
height: 36px;
17-
}
2+
flex: 1;
183
}

src/jetstream/go.sum

+1
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4er
256256
github.com/golang/groupcache v0.0.0-20191027212112-611e8accdfc9/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
257257
github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E=
258258
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
259+
github.com/golang/mock v1.2.0 h1:28o5sBqPkBsMGnC6b4MvE2TzSr5/AT4c/1fLqVGIwlk=
259260
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
260261
github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc=
261262
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=

0 commit comments

Comments
 (0)