diff --git a/server/config/development.yaml b/server/config/development.yaml index 7f0cce95c..0b9cedfcc 100644 --- a/server/config/development.yaml +++ b/server/config/development.yaml @@ -19,6 +19,7 @@ workflowResetDisabled: false batchActionsDisabled: false startWorkflowDisabled: false hideWorkflowQueryErrors: false +refreshWorkflowCountsDisabled: false auth: enabled: false providers: diff --git a/server/docker/config-template.yaml b/server/docker/config-template.yaml index 7ba391c7e..05191f9d8 100644 --- a/server/docker/config-template.yaml +++ b/server/docker/config-template.yaml @@ -18,6 +18,7 @@ workflowResetDisabled: {{ default .Env.TEMPORAL_WORKFLOW_RESET_DISABLED "false" batchActionsDisabled: {{ default .Env.TEMPORAL_BATCH_ACTIONS_DISABLED "false" }} startWorkflowDisabled: {{ default .Env.TEMPORAL_START_WORKFLOW_DISABLED "true" }} hideWorkflowQueryErrors: {{ default .Env.TEMPORAL_HIDE_WORKFLOW_QUERY_ERRORS "false" }} +refreshWorkflowCountsDisabled: {{ default .Env.TEMPORAL_REFRESH_WORKFLOW_COUNTS_DISABLED "false" }} cors: cookieInsecure: {{ default .Env.TEMPORAL_CSRF_COOKIE_INSECURE "false" }} allowOrigins: diff --git a/server/server/api/handler.go b/server/server/api/handler.go index 114cf54ae..84fea394f 100644 --- a/server/server/api/handler.go +++ b/server/server/api/handler.go @@ -56,22 +56,23 @@ type CodecResponse struct { } type SettingsResponse struct { - Auth *Auth - BannerText string - DefaultNamespace string - ShowTemporalSystemNamespace bool - FeedbackURL string - NotifyOnNewVersion bool - Codec *CodecResponse - Version string - DisableWriteActions bool - WorkflowTerminateDisabled bool - WorkflowCancelDisabled bool - WorkflowSignalDisabled bool - WorkflowResetDisabled bool - BatchActionsDisabled bool - StartWorkflowDisabled bool - HideWorkflowQueryErrors bool + Auth *Auth + BannerText string + DefaultNamespace string + ShowTemporalSystemNamespace bool + FeedbackURL string + NotifyOnNewVersion bool + Codec *CodecResponse + Version string + DisableWriteActions bool + WorkflowTerminateDisabled bool + WorkflowCancelDisabled bool + WorkflowSignalDisabled bool + WorkflowResetDisabled bool + BatchActionsDisabled bool + StartWorkflowDisabled bool + HideWorkflowQueryErrors bool + RefreshWorkflowCountsDisabled bool } func TemporalAPIHandler(cfgProvider *config.ConfigProviderWithRefresh, apiMiddleware []Middleware, conn *grpc.ClientConn) echo.HandlerFunc { @@ -136,15 +137,16 @@ func GetSettings(cfgProvider *config.ConfigProviderWithRefresh) func(echo.Contex PassAccessToken: cfg.Codec.PassAccessToken, IncludeCredentials: cfg.Codec.IncludeCredentials, }, - Version: version.UIVersion, - DisableWriteActions: cfg.DisableWriteActions, - WorkflowTerminateDisabled: cfg.WorkflowTerminateDisabled, - WorkflowCancelDisabled: cfg.WorkflowCancelDisabled, - WorkflowSignalDisabled: cfg.WorkflowSignalDisabled, - WorkflowResetDisabled: cfg.WorkflowResetDisabled, - BatchActionsDisabled: cfg.BatchActionsDisabled, - StartWorkflowDisabled: cfg.StartWorkflowDisabled, - HideWorkflowQueryErrors: cfg.HideWorkflowQueryErrors, + Version: version.UIVersion, + DisableWriteActions: cfg.DisableWriteActions, + WorkflowTerminateDisabled: cfg.WorkflowTerminateDisabled, + WorkflowCancelDisabled: cfg.WorkflowCancelDisabled, + WorkflowSignalDisabled: cfg.WorkflowSignalDisabled, + WorkflowResetDisabled: cfg.WorkflowResetDisabled, + BatchActionsDisabled: cfg.BatchActionsDisabled, + StartWorkflowDisabled: cfg.StartWorkflowDisabled, + HideWorkflowQueryErrors: cfg.HideWorkflowQueryErrors, + RefreshWorkflowCountsDisabled: cfg.RefreshWorkflowCountsDisabled, } return c.JSON(http.StatusOK, settings) diff --git a/server/server/config/config.go b/server/server/config/config.go index 5c23267bd..e99c0cdac 100644 --- a/server/server/config/config.go +++ b/server/server/config/config.go @@ -63,6 +63,8 @@ type ( StartWorkflowDisabled bool `yaml:"startWorkflowDisabled"` // Whether to hide server errors for workflow queries in UI HideWorkflowQueryErrors bool `yaml:"hideWorkflowQueryErrors"` + // Whether to disable refreshing workflow counts in UI + RefreshWorkflowCountsDisabled bool `yaml:"refreshWorkflowCountsDisabled"` // Forward specified HTTP headers from HTTP API requests to Temporal gRPC backend ForwardHeaders []string `yaml:"forwardHeaders"` HideLogs bool `yaml:"hideLogs"` diff --git a/src/lib/components/workflow/workflow-counts.svelte b/src/lib/components/workflow/workflow-counts.svelte index 7352695db..de77401a6 100644 --- a/src/lib/components/workflow/workflow-counts.svelte +++ b/src/lib/components/workflow/workflow-counts.svelte @@ -9,6 +9,7 @@ import { workflowFilters } from '$lib/stores/filters'; import { currentPageKey } from '$lib/stores/pagination'; import { + disableWorkflowCountsRefresh, queryWithParentWorkflowId, refresh, workflowCount, @@ -102,13 +103,15 @@ const fetchCounts = async () => { clearNewCounts(); - const interval = - getExponentialBackoffSeconds( - initialIntervalSeconds, - attempt, - maxAttempts, - ) * 1000; - refreshInterval = setInterval(() => fetchNewCounts(), interval); + if (!$disableWorkflowCountsRefresh) { + const interval = + getExponentialBackoffSeconds( + initialIntervalSeconds, + attempt, + maxAttempts, + ) * 1000; + refreshInterval = setInterval(() => fetchNewCounts(), interval); + } try { const { count, groups } = await fetchWorkflowCountByExecutionStatus({ namespace, diff --git a/src/lib/services/settings-service.ts b/src/lib/services/settings-service.ts index f76950900..1f08f1dcf 100644 --- a/src/lib/services/settings-service.ts +++ b/src/lib/services/settings-service.ts @@ -38,6 +38,9 @@ export const fetchSettings = async (request = fetch): Promise => { batchActionsDisabled: !!settingsResponse?.BatchActionsDisabled, startWorkflowDisabled: !!settingsResponse?.StartWorkflowDisabled, hideWorkflowQueryErrors: !!settingsResponse?.HideWorkflowQueryErrors, + refreshWorkflowCountsDisabled: + !!settingsResponse?.RefreshWorkflowCountsDisabled, + showTemporalSystemNamespace: settingsResponse?.ShowTemporalSystemNamespace, notifyOnNewVersion: settingsResponse?.NotifyOnNewVersion, feedbackURL: settingsResponse?.FeedbackURL, diff --git a/src/lib/stores/workflows.ts b/src/lib/stores/workflows.ts index c0536592e..f28862f95 100644 --- a/src/lib/stores/workflows.ts +++ b/src/lib/stores/workflows.ts @@ -21,6 +21,11 @@ export const hideWorkflowQueryErrors = derived( ([$page]) => $page.data?.settings?.hideWorkflowQueryErrors, ); +export const disableWorkflowCountsRefresh = derived( + [page], + ([$page]) => $page.data?.settings?.refreshWorkflowCountsDisabled, +); + export const canFetchChildWorkflows = derived( [isCloud, temporalVersion], ([$isCloud, $temporalVersion]) => { diff --git a/src/lib/types/index.ts b/src/lib/types/index.ts index 942f6b297..90dea2787 100644 --- a/src/lib/types/index.ts +++ b/src/lib/types/index.ts @@ -238,6 +238,7 @@ export type SettingsResponse = { BatchActionsDisabled: boolean; StartWorkflowDisabled: boolean; HideWorkflowQueryErrors: boolean; + RefreshWorkflowCountsDisabled: boolean; ShowTemporalSystemNamespace: boolean; NotifyOnNewVersion: boolean; FeedbackURL: string; diff --git a/tests/test-utilities/mocks/settings.ts b/tests/test-utilities/mocks/settings.ts index f149f694f..eba886388 100644 --- a/tests/test-utilities/mocks/settings.ts +++ b/tests/test-utilities/mocks/settings.ts @@ -28,6 +28,7 @@ const defaultSettings = { StartWorkflowDisabled: true, BatchActionsDisabled: false, HideWorkflowQueryErrors: false, + RefreshWorkflowCountsDisabled: false, }; export const mockSettingsApi = async (