fix(settings): clear helm url if requested [EE-2494] (#6526)

* fix(settings): clear helm url if requested [EE-2494]

fix [EE-2494]

before this PR, helm url would clear when updating settings, if the helm url key wasn't provided.
in this PR, it will be changed only if required

* fix(settings): allow empty helm repo

* chore(deps): run yarn

* fix(settings): set helm repo url
pull/6540/head^2
Chaim Lev-Ari 3 years ago committed by GitHub
parent 9c2dbac479
commit 3165d354b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -116,6 +116,8 @@ func (handler *Handler) settingsUpdate(w http.ResponseWriter, r *http.Request) *
} }
if payload.HelmRepositoryURL != nil { if payload.HelmRepositoryURL != nil {
if *payload.HelmRepositoryURL != "" {
newHelmRepo := strings.TrimSuffix(strings.ToLower(*payload.HelmRepositoryURL), "/") newHelmRepo := strings.TrimSuffix(strings.ToLower(*payload.HelmRepositoryURL), "/")
if newHelmRepo != settings.HelmRepositoryURL && newHelmRepo != portainer.DefaultHelmRepositoryURL { if newHelmRepo != settings.HelmRepositoryURL && newHelmRepo != portainer.DefaultHelmRepositoryURL {
@ -123,12 +125,14 @@ func (handler *Handler) settingsUpdate(w http.ResponseWriter, r *http.Request) *
if err != nil { if err != nil {
return &httperror.HandlerError{http.StatusBadRequest, "Invalid Helm repository URL. Must correspond to a valid URL format", err} return &httperror.HandlerError{http.StatusBadRequest, "Invalid Helm repository URL. Must correspond to a valid URL format", err}
} }
} }
settings.HelmRepositoryURL = newHelmRepo settings.HelmRepositoryURL = newHelmRepo
} else { } else {
settings.HelmRepositoryURL = "" settings.HelmRepositoryURL = ""
} }
}
if payload.BlackListedLabels != nil { if payload.BlackListedLabels != nil {
settings.BlackListedLabels = payload.BlackListedLabels settings.BlackListedLabels = payload.BlackListedLabels

@ -85,7 +85,7 @@
<div class="form-group"> <div class="form-group">
<label for="helmrepository_url" class="col-sm-1 control-label text-left"> URL </label> <label for="helmrepository_url" class="col-sm-1 control-label text-left"> URL </label>
<div class="col-sm-11"> <div class="col-sm-11">
<input type="text" class="form-control" ng-model="settings.HelmRepositoryURL" id="helmrepository_url" placeholder="https://charts.bitnami.com/bitnami" required /> <input type="text" class="form-control" ng-model="settings.HelmRepositoryURL" id="helmrepository_url" placeholder="https://charts.bitnami.com/bitnami" />
</div> </div>
</div> </div>
</div> </div>

@ -4547,6 +4547,7 @@ angular-moment-picker@^0.10.2:
dependencies: dependencies:
angular-mocks "1.6.1" angular-mocks "1.6.1"
angular-sanitize "1.6.1" angular-sanitize "1.6.1"
lodash-es "^4.17.15"
angular-resource@1.8.2: angular-resource@1.8.2:
version "1.8.2" version "1.8.2"

Loading…
Cancel
Save