diff --git a/charts/kubernetes-dashboard/values.yaml b/charts/kubernetes-dashboard/values.yaml index 8b63ba90397a..a2510eb0bc5e 100644 --- a/charts/kubernetes-dashboard/values.yaml +++ b/charts/kubernetes-dashboard/values.yaml @@ -84,6 +84,8 @@ app: # resourceAutoRefreshTimeInterval: 10 # # Hide all access denied warnings in the notification panel # disableAccessDeniedNotifications: false + # # Hide all namespaces option in namespace selection dropdown to avoid accidental selection in large clusters thus preventing OOM errors + # hideAllNamespaces: false # # Namespace that should be selected by default after logging in. # defaultNamespace: default # # List of namespaces that should be presented to user without namespace list privileges. diff --git a/modules/web/pkg/settings/settings.go b/modules/web/pkg/settings/settings.go index 2ce9469682a5..b8a0421ad103 100644 --- a/modules/web/pkg/settings/settings.go +++ b/modules/web/pkg/settings/settings.go @@ -28,6 +28,7 @@ var defaultSettings = Settings{ LogsAutoRefreshTimeInterval: lo.ToPtr(5), ResourceAutoRefreshTimeInterval: lo.ToPtr(10), DisableAccessDeniedNotifications: lo.ToPtr(false), + HideAllNamespaces: lo.ToPtr(false), DefaultNamespace: lo.ToPtr("default"), NamespaceFallbackList: []string{"default"}, } @@ -39,6 +40,7 @@ type Settings struct { LogsAutoRefreshTimeInterval *int `json:"logsAutoRefreshTimeInterval,omitempty"` ResourceAutoRefreshTimeInterval *int `json:"resourceAutoRefreshTimeInterval,omitempty"` DisableAccessDeniedNotifications *bool `json:"disableAccessDeniedNotifications,omitempty"` + HideAllNamespaces *bool `json:"hideAllNamespaces,omitempty"` DefaultNamespace *string `json:"defaultNamespace,omitempty"` NamespaceFallbackList []string `json:"namespaceFallbackList,omitempty"` } diff --git a/modules/web/src/common/components/namespace/component.ts b/modules/web/src/common/components/namespace/component.ts index 188d22ea7e67..52a0babb0d94 100644 --- a/modules/web/src/common/components/namespace/component.ts +++ b/modules/web/src/common/components/namespace/component.ts @@ -102,6 +102,10 @@ export class NamespaceSelectorComponent implements OnInit { this.loadNamespaces_(); } + showAllNamespaces(): boolean { + return !this.settingsService_.getHideAllNamespaces().valueOf + } + selectNamespace(): void { if (this.selectNamespaceInput.length === 0) { return; diff --git a/modules/web/src/common/components/namespace/template.html b/modules/web/src/common/components/namespace/template.html index 930b0e449e14..a187768ddd03 100644 --- a/modules/web/src/common/components/namespace/template.html +++ b/modules/web/src/common/components/namespace/template.html @@ -33,7 +33,7 @@ /> All namespaces + +
+ + +
+