diff --git a/app/client/src/ce/api/TenantApi.ts b/app/client/src/ce/api/TenantApi.ts index 4b83aae03e4..67fced88bc2 100644 --- a/app/client/src/ce/api/TenantApi.ts +++ b/app/client/src/ce/api/TenantApi.ts @@ -14,6 +14,7 @@ export type UpdateTenantConfigResponse = ApiResponse<{ export type UpdateTenantConfigRequest = { tenantConfiguration: Record; + needsRefresh?: boolean; isOnlyTenantSettings: boolean; }; diff --git a/app/client/src/ce/constants/messages.ts b/app/client/src/ce/constants/messages.ts index e64b179af5f..dfa9d29429e 100644 --- a/app/client/src/ce/constants/messages.ts +++ b/app/client/src/ce/constants/messages.ts @@ -1247,6 +1247,7 @@ export const OIDC_AUTH_DESC = () => "Enable your workspace to sign in with your preferred OIDC compliant provider."; export const SAVE_BUTTON = () => "Save"; export const SAVE_AND_RESTART_BUTTON = () => "Save & Restart"; +export const SAVE_AND_REFRESH_BUTTON = () => "Save & Refresh"; export const RESET_BUTTON = () => "Reset"; export const BUSINESS_TAG = () => "Business"; export const ENTERPRISE_TAG = () => "Enterprise"; diff --git a/app/client/src/ce/pages/AdminSettings/config/types.ts b/app/client/src/ce/pages/AdminSettings/config/types.ts index a46675a5717..e6188bd1564 100644 --- a/app/client/src/ce/pages/AdminSettings/config/types.ts +++ b/app/client/src/ce/pages/AdminSettings/config/types.ts @@ -91,6 +91,7 @@ export interface Category { slug: string; subText?: string; isConnected?: boolean; + needsRefresh?: boolean; children?: Category[]; icon?: string; categoryType: string; @@ -130,6 +131,7 @@ export type AdminConfigType = { children?: AdminConfigType[]; canSave: boolean; isConnected?: boolean; + needsRefresh?: boolean; icon?: string; needsUpgrade?: boolean; categoryType: CategoryType; diff --git a/app/client/src/ce/sagas/tenantSagas.tsx b/app/client/src/ce/sagas/tenantSagas.tsx index 2b5d3d4e4cb..f1d78a39446 100644 --- a/app/client/src/ce/sagas/tenantSagas.tsx +++ b/app/client/src/ce/sagas/tenantSagas.tsx @@ -95,6 +95,10 @@ export function* updateTenantConfigSaga( kind: "success", }); } + + if (action.payload.needsRefresh) { + location.reload(); + } } } catch (error) { const errorObj = error as APIResponseError; diff --git a/app/client/src/pages/Settings/SaveSettings.tsx b/app/client/src/pages/Settings/SaveSettings.tsx index 697961ea47d..6654a5ed41b 100644 --- a/app/client/src/pages/Settings/SaveSettings.tsx +++ b/app/client/src/pages/Settings/SaveSettings.tsx @@ -1,6 +1,7 @@ import React from "react"; import { RESET_BUTTON, + SAVE_AND_REFRESH_BUTTON, SAVE_AND_RESTART_BUTTON, SAVE_BUTTON, createMessage, @@ -32,6 +33,7 @@ const SettingsButtonWrapper = styled.div` type SaveAdminSettingsProps = { isOnlyTenantConfig?: boolean; isSaving?: boolean; + needsRefresh?: boolean; onSave?: () => void; onClear?: () => void; settings: Record; @@ -43,6 +45,7 @@ const saveAdminSettings = (props: SaveAdminSettingsProps) => { const { isOnlyTenantConfig = false, isSaving, + needsRefresh = false, onClear, onSave, settings, @@ -50,6 +53,18 @@ const saveAdminSettings = (props: SaveAdminSettingsProps) => { valid, } = props; + let saveButtonText = SAVE_AND_RESTART_BUTTON; + + if (needsRefresh) { + saveButtonText = SAVE_AND_REFRESH_BUTTON; + } else if ( + isOnlyTenantConfig || + (updatedTenantSettings?.length === Object.keys(settings).length && + updatedTenantSettings?.length !== 0) + ) { + saveButtonText = SAVE_BUTTON; + } + return (