feat(ui): hide sync option 'replace' if sync with replace is disabled in the server (issue no. #22625) (#22647)

Signed-off-by: jan-mrm <67435696+jan-mrm@users.noreply.github.com>
This commit is contained in:
jan-mrm
2025-10-06 15:48:06 +02:00
committed by GitHub
parent 30abebda3d
commit afaf16b808
7 changed files with 153 additions and 89 deletions

View File

@@ -1071,7 +1071,7 @@ func newArgoCDServiceSet(a *ArgoCDServer) *ArgoCDServiceSet {
projectService := project.NewServer(a.Namespace, a.KubeClientset, a.AppClientset, a.enf, projectLock, a.sessionMgr, a.policyEnforcer, a.projInformer, a.settingsMgr, a.db, a.EnableK8sEvent)
appsInAnyNamespaceEnabled := len(a.ApplicationNamespaces) > 0
settingsService := settings.NewServer(a.settingsMgr, a.RepoClientset, a, a.DisableAuth, appsInAnyNamespaceEnabled, a.HydratorEnabled)
settingsService := settings.NewServer(a.settingsMgr, a.RepoClientset, a, a.DisableAuth, appsInAnyNamespaceEnabled, a.HydratorEnabled, a.SyncWithReplaceAllowed)
accountService := account.NewServer(a.sessionMgr, a.settingsMgr, a.enf)
notificationService := notification.NewServer(a.apiFactory)

View File

@@ -25,6 +25,7 @@ type Server struct {
disableAuth bool
appsInAnyNamespaceEnabled bool
hydratorEnabled bool
syncWithReplaceAllowed bool
}
type Authenticator interface {
@@ -32,8 +33,8 @@ type Authenticator interface {
}
// NewServer returns a new instance of the Settings service
func NewServer(mgr *settings.SettingsManager, repoClient apiclient.Clientset, authenticator Authenticator, disableAuth, appsInAnyNamespaceEnabled bool, hydratorEnabled bool) *Server {
return &Server{mgr: mgr, repoClient: repoClient, authenticator: authenticator, disableAuth: disableAuth, appsInAnyNamespaceEnabled: appsInAnyNamespaceEnabled, hydratorEnabled: hydratorEnabled}
func NewServer(mgr *settings.SettingsManager, repoClient apiclient.Clientset, authenticator Authenticator, disableAuth, appsInAnyNamespaceEnabled bool, hydratorEnabled bool, syncWithReplaceAllowed bool) *Server {
return &Server{mgr: mgr, repoClient: repoClient, authenticator: authenticator, disableAuth: disableAuth, appsInAnyNamespaceEnabled: appsInAnyNamespaceEnabled, hydratorEnabled: hydratorEnabled, syncWithReplaceAllowed: syncWithReplaceAllowed}
}
// Get returns Argo CD settings
@@ -122,6 +123,7 @@ func (s *Server) Get(ctx context.Context, _ *settingspkg.SettingsQuery) (*settin
AppsInAnyNamespaceEnabled: s.appsInAnyNamespaceEnabled,
ImpersonationEnabled: argoCDSettings.ImpersonationEnabled,
HydratorEnabled: s.hydratorEnabled,
SyncWithReplaceAllowed: s.syncWithReplaceAllowed,
}
if sessionmgr.LoggedIn(ctx) || s.disableAuth {

View File

@@ -46,6 +46,7 @@ message Settings {
string installationID = 26;
repeated string additionalUrls = 27 [(gogoproto.customname) = "AdditionalURLs"];
bool hydratorEnabled = 28;
bool syncWithReplaceAllowed = 29;
}
message GoogleAnalyticsConfig {