From c224e6317a8e6d38c93328e53959fc9d653a0061 Mon Sep 17 00:00:00 2001 From: avanish23 Date: Thu, 17 Oct 2024 18:50:47 +0530 Subject: [PATCH] hide namespaces via settings (cherry picked from commit 534a365efcf56aa7b3592b55e0885d021f97688c) added translation; bumped up charts version;fixed lint revert chart version bumpup add hideAllNamespaces in externalSettings func fix conflict --- charts/kubernetes-dashboard/values.yaml | 2 ++ modules/web/i18n/de/messages.de.xlf | 8 ++++++++ modules/web/i18n/es/messages.es.xlf | 8 ++++++++ modules/web/i18n/fr/messages.fr.xlf | 8 ++++++++ modules/web/i18n/ja/messages.ja.xlf | 8 ++++++++ modules/web/i18n/ko/messages.ko.xlf | 8 ++++++++ modules/web/i18n/messages.xlf | 6 ++++++ modules/web/i18n/zh-Hans/messages.zh-Hans.xlf | 8 ++++++++ .../i18n/zh-Hant-HK/messages.zh-Hant-HK.xlf | 8 ++++++++ modules/web/i18n/zh-Hant/messages.zh-Hant.xlf | 8 ++++++++ modules/web/pkg/settings/settings.go | 2 ++ .../common/components/namespace/component.ts | 4 ++++ .../common/components/namespace/template.html | 2 +- .../common/services/global/globalsettings.ts | 5 +++++ modules/web/src/settings/global/component.ts | 5 +++++ modules/web/src/settings/global/template.html | 18 ++++++++++++++++++ modules/web/src/typings/root.api.ts | 1 + 17 files changed, 108 insertions(+), 1 deletion(-) diff --git a/charts/kubernetes-dashboard/values.yaml b/charts/kubernetes-dashboard/values.yaml index cc7db3f365c9..1ff579b61f27 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/i18n/de/messages.de.xlf b/modules/web/i18n/de/messages.de.xlf index 738785464d63..036f36645b5a 100644 --- a/modules/web/i18n/de/messages.de.xlf +++ b/modules/web/i18n/de/messages.de.xlf @@ -2672,6 +2672,14 @@ Owner Owner + + Hide All Namespaces option + Hide All Namespaces option + + + Hides all-namespaces option from the namespaces dropdown list in UI. + Hides all-namespaces option from the namespaces dropdown list in UI. + \ No newline at end of file diff --git a/modules/web/i18n/es/messages.es.xlf b/modules/web/i18n/es/messages.es.xlf index c772489580ab..3be64eb2ca50 100644 --- a/modules/web/i18n/es/messages.es.xlf +++ b/modules/web/i18n/es/messages.es.xlf @@ -2664,6 +2664,14 @@ Owner Owner + + Hide All Namespaces option + Hide All Namespaces option + + + Hides all-namespaces option from the namespaces dropdown list in UI. + Hides all-namespaces option from the namespaces dropdown list in UI. + \ No newline at end of file diff --git a/modules/web/i18n/fr/messages.fr.xlf b/modules/web/i18n/fr/messages.fr.xlf index f09ec23b1e16..30b315d787ec 100644 --- a/modules/web/i18n/fr/messages.fr.xlf +++ b/modules/web/i18n/fr/messages.fr.xlf @@ -2660,6 +2660,14 @@ Owner Owner + + Hide All Namespaces option + Hide All Namespaces option + + + Hides all-namespaces option from the namespaces dropdown list in UI. + Hides all-namespaces option from the namespaces dropdown list in UI. + \ No newline at end of file diff --git a/modules/web/i18n/ja/messages.ja.xlf b/modules/web/i18n/ja/messages.ja.xlf index 2a982ecc4f93..6cfdb6643836 100644 --- a/modules/web/i18n/ja/messages.ja.xlf +++ b/modules/web/i18n/ja/messages.ja.xlf @@ -2664,6 +2664,14 @@ Owner Owner + + Hide All Namespaces option + Hide All Namespaces option + + + Hides all-namespaces option from the namespaces dropdown list in UI. + Hides all-namespaces option from the namespaces dropdown list in UI. + \ No newline at end of file diff --git a/modules/web/i18n/ko/messages.ko.xlf b/modules/web/i18n/ko/messages.ko.xlf index 84e709b0c885..3d7d8376f4bd 100644 --- a/modules/web/i18n/ko/messages.ko.xlf +++ b/modules/web/i18n/ko/messages.ko.xlf @@ -2664,6 +2664,14 @@ Owner Owner + + Hide All Namespaces option + Hide All Namespaces option + + + Hides all-namespaces option from the namespaces dropdown list in UI. + Hides all-namespaces option from the namespaces dropdown list in UI. + \ No newline at end of file diff --git a/modules/web/i18n/messages.xlf b/modules/web/i18n/messages.xlf index e8ebce5bfabd..4739a587fcc7 100644 --- a/modules/web/i18n/messages.xlf +++ b/modules/web/i18n/messages.xlf @@ -1973,6 +1973,12 @@ Owner + + Hide All Namespaces option + + + Hides all-namespaces option from the namespaces dropdown list in UI. + \ No newline at end of file diff --git a/modules/web/i18n/zh-Hans/messages.zh-Hans.xlf b/modules/web/i18n/zh-Hans/messages.zh-Hans.xlf index 1f22bd19a455..e84355efac43 100644 --- a/modules/web/i18n/zh-Hans/messages.zh-Hans.xlf +++ b/modules/web/i18n/zh-Hans/messages.zh-Hans.xlf @@ -2664,6 +2664,14 @@ Owner Owner + + Hide All Namespaces option + Hide All Namespaces option + + + Hides all-namespaces option from the namespaces dropdown list in UI. + Hides all-namespaces option from the namespaces dropdown list in UI. + \ No newline at end of file diff --git a/modules/web/i18n/zh-Hant-HK/messages.zh-Hant-HK.xlf b/modules/web/i18n/zh-Hant-HK/messages.zh-Hant-HK.xlf index 029d1e53fb58..ef55efed9f0e 100644 --- a/modules/web/i18n/zh-Hant-HK/messages.zh-Hant-HK.xlf +++ b/modules/web/i18n/zh-Hant-HK/messages.zh-Hant-HK.xlf @@ -2664,6 +2664,14 @@ Owner Owner + + Hide All Namespaces option + Hide All Namespaces option + + + Hides all-namespaces option from the namespaces dropdown list in UI. + Hides all-namespaces option from the namespaces dropdown list in UI. + \ No newline at end of file diff --git a/modules/web/i18n/zh-Hant/messages.zh-Hant.xlf b/modules/web/i18n/zh-Hant/messages.zh-Hant.xlf index e5d10eba5db8..55da7a4d01a0 100644 --- a/modules/web/i18n/zh-Hant/messages.zh-Hant.xlf +++ b/modules/web/i18n/zh-Hant/messages.zh-Hant.xlf @@ -2664,6 +2664,14 @@ Owner Owner + + Hide All Namespaces option + Hide All Namespaces option + + + Hides all-namespaces option from the namespaces dropdown list in UI. + Hides all-namespaces option from the namespaces dropdown list in UI. + \ No newline at end of file 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..d5f76ce7665a 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(); + } + 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 + +
+ + +
+