Skip to content

Commit

Permalink
Fix issue where charts list errors if only helm hub registered (#493)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
richard-cox authored Sep 21, 2020
1 parent def5429 commit a95b49b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ import {
WrapperRequestActionSuccess,
} from '../../../../../store/src/types/request.types';
import { helmEntityCatalog } from '../helm-entity-catalog';
import { getHelmVersionId, getMonocularChartId, HELM_ENDPOINT_TYPE, HELM_HUB_ENDPOINT_TYPE } from '../helm-entity-factory';
import {
getHelmVersionId,
getMonocularChartId,
HELM_ENDPOINT_TYPE,
HELM_HUB_ENDPOINT_TYPE,
HELM_REPO_ENDPOINT_TYPE,
} from '../helm-entity-factory';
import { Chart } from '../monocular/shared/models/chart';
import { stratosMonocularEndpointGuid } from '../monocular/stratos-monocular.helper';
import {
Expand Down Expand Up @@ -144,13 +150,10 @@ export class HelmEffects {
const helmHubEndpoint = helmEndpoints.find(endpoint => endpoint.sub_type === HELM_HUB_ENDPOINT_TYPE);

// 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
// valid helm sub types
const stratosMonocular = this.httpClient.get<MonocularChartsResponse>(`/pp/${this.proxyAPIVersion}/chartsvc/v1/charts`);
const helmHubMonocular = helmHubEndpoint ? this.createHelmHubRequest(helmHubEndpoint.guid) : of({ data: [] });

// valid helm sub types instead of making two requests here
return combineLatest([
stratosMonocular,
helmHubMonocular
this.createHelmRepoRequest(helmEndpoints),
this.createHelmHubRequest(helmHubEndpoint)
]).pipe(
map(res => mergeMonocularChartResponses(entityKey, res)),
mergeMap((response: NormalizedResponse) => [new WrapperRequestActionSuccess(response, action)]),
Expand Down Expand Up @@ -352,12 +355,21 @@ export class HelmEffects {
};
}

private createHelmHubRequest(endpointId: string): Observable<MonocularChartsResponse> {
return this.httpClient.get<MonocularChartsResponse>(`/pp/${this.proxyAPIVersion}/chartsvc/v1/charts`, {
headers: {
'x-cap-cnsi-list': endpointId
}
}).pipe(map(res => addMonocularId(endpointId, res)));
private createHelmHubRequest(helmHubEndpoint: EndpointModel): Observable<MonocularChartsResponse> {
return helmHubEndpoint ?
this.httpClient.get<MonocularChartsResponse>(`/pp/${this.proxyAPIVersion}/chartsvc/v1/charts`, {
headers: {
'x-cap-cnsi-list': helmHubEndpoint.guid
}
}).pipe(map(res => addMonocularId(helmHubEndpoint.guid, res))) :
of({ data: [] });
}

private createHelmRepoRequest(helmEndpoints: EndpointModel[]): Observable<MonocularChartsResponse> {
const helmRepoEndpoints = helmEndpoints.find(endpoint => endpoint.sub_type === HELM_REPO_ENDPOINT_TYPE);
return helmRepoEndpoints ?
this.httpClient.get<MonocularChartsResponse>(`/pp/${this.proxyAPIVersion}/chartsvc/v1/charts`) :
of({ data: [] });
}

private makeRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</app-page-header>
<app-steppers [cancel]="cancelUrl">
<app-step [title]="'Kubernetes'" [valid]="validate$ | async">
<form [formGroup]="details" class="stepper-form">
<form [formGroup]="details" class="stepper-form helm-create-release">
<b>Select the Kubernetes cluster to install to</b>
<mat-form-field>
<mat-select formControlName="endpoint" name="endpoint">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
:host {
flex: 1;
}

.helm-create-release {
&__heading {
align-items: center;
display: flex;
}

&__title {
flex: 1;
font-size: 14px;
}
&__button {
height: 36px;
}
flex: 1;
}
1 change: 1 addition & 0 deletions src/jetstream/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4er
github.com/golang/groupcache v0.0.0-20191027212112-611e8accdfc9/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.2.0 h1:28o5sBqPkBsMGnC6b4MvE2TzSr5/AT4c/1fLqVGIwlk=
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
Expand Down

0 comments on commit a95b49b

Please sign in to comment.