fix(helm): allow clearing global helm repo EE-1965 (#5991)

* fix(helm): allow clearing global helm repo EE-1965

* fix(helm): show hint if global helm repo is blank EE-1965

* fix(helm): skip loading charts if repo is blank EE-1965

Co-authored-by: Simon Meng <simon.meng@portainer.io>
pull/6007/head
Matt Hook 3 years ago committed by GitHub
parent 71de07bbea
commit cec8f34ae9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -121,6 +121,8 @@ func (handler *Handler) settingsUpdate(w http.ResponseWriter, r *http.Request) *
}
settings.HelmRepositoryURL = newHelmRepo
} else {
settings.HelmRepositoryURL = ""
}
if payload.BlackListedLabels != nil {

@ -98,8 +98,9 @@ export default class HelmTemplatesController {
try {
// fetch globally set helm repo and user helm repos (parallel)
const { GlobalRepository, UserRepositories } = await this.HelmService.getHelmRepositories(this.endpoint.Id);
this.state.globalRepository = GlobalRepository;
const userHelmReposUrls = UserRepositories.map((repo) => repo.URL);
const uniqueHelmRepos = [...new Set([GlobalRepository, ...userHelmReposUrls])].map((url) => url.toLowerCase()); // remove duplicates, to lowercase
const uniqueHelmRepos = [...new Set([GlobalRepository, ...userHelmReposUrls])].map((url) => url.toLowerCase()).filter((url) => url); // remove duplicates and blank, to lowercase
this.state.repos = uniqueHelmRepos;
return uniqueHelmRepos;
} catch (err) {
@ -169,6 +170,8 @@ export default class HelmTemplatesController {
chartsLoading: false,
resourcePoolsLoading: false,
viewReady: false,
isAdmin: this.Authentication.isAdmin(),
globalRepository: undefined,
};
const helmRepos = await this.getHelmRepoURLs();

@ -8,6 +8,11 @@
<i class="fa fa-exclamation-circle orange-icon" aria-hidden="true" style="margin-right: 2px;"></i>
This is a first version for Helm charts, for more information see this <a href="https://www.portainer.io/blog/portainer-now-with-helm-support" target="_blank">blog post</a>.
</p>
<p ng-if="$ctrl.state.globalRepository === ''">
<i class="fa fa-exclamation-circle blue-icon" aria-hidden="true" style="margin-right: 2px;"></i>
<span>The Global Helm Repository is not configured.</span>
<a ng-if="$ctrl.state.isAdmin" ui-sref="portainer.settings">Configure Global Helm Repository in Settings</a>
</p>
</span>
</information-panel>

@ -45,7 +45,7 @@ export function HelmService(HelmFactory) {
}
/**
* @description: Show values helm of a helm chart, this basically runs `helm show values`
* @description: Get a list of all the helm repositories available for the current user
* @returns {Promise} - Resolves with an object containing list of user helm repos and default/global settings helm repo
* @throws {PortainerError} - Rejects with error if helm show fails
*/

Loading…
Cancel
Save