diff --git a/frontend/src/AppBuilder/CodeEditor/MultiLineCodeEditor.jsx b/frontend/src/AppBuilder/CodeEditor/MultiLineCodeEditor.jsx index 98af1dc9e4..325c5c8ac5 100644 --- a/frontend/src/AppBuilder/CodeEditor/MultiLineCodeEditor.jsx +++ b/frontend/src/AppBuilder/CodeEditor/MultiLineCodeEditor.jsx @@ -58,7 +58,7 @@ const MultiLineCodeEditor = (props) => { const replaceIdsWithName = useStore((state) => state.replaceIdsWithName, shallow); const wrapperRef = useRef(null); const getSuggestions = useStore((state) => state.getSuggestions, shallow); - const getServerSideGlobalSuggestions = useStore((state) => state.getServerSideGlobalSuggestions, shallow); + const getServerSideGlobalResolveSuggestions = useStore((state) => state.getServerSideGlobalResolveSuggestions, shallow); const isInsideQueryPane = !!document.querySelector('.code-hinter-wrapper')?.closest('.query-details'); const isInsideQueryManager = useMemo( @@ -116,7 +116,7 @@ const MultiLineCodeEditor = (props) => { const hints = getSuggestions(); - const serverHints = getServerSideGlobalSuggestions(isInsideQueryManager); + const serverHints = getServerSideGlobalResolveSuggestions(isInsideQueryManager); const allHints = { ...hints, diff --git a/frontend/src/AppBuilder/CodeEditor/PreviewBox.jsx b/frontend/src/AppBuilder/CodeEditor/PreviewBox.jsx index 5c422b1eb3..a24c41543f 100644 --- a/frontend/src/AppBuilder/CodeEditor/PreviewBox.jsx +++ b/frontend/src/AppBuilder/CodeEditor/PreviewBox.jsx @@ -98,7 +98,7 @@ export const PreviewBox = ({ const [largeDataset, setLargeDataset] = useState(false); const globals = useStore((state) => state.getAllExposedValues(moduleId).constants || {}, shallow); const secrets = useStore((state) => state.getSecrets(), shallow); - const globalServerConstantsRegex = /^\{\{.*globals\.server.*\}\}$/; + const globalServerConstantsRegex = /\{\{.*globals\.server.*\}\}/; const getPreviewContent = (content, type) => { if (content === undefined || content === null) return currentValue; @@ -251,7 +251,10 @@ const RenderResolvedValue = ({ isServerConstant = false, isLargeDataset, }) => { - const isServerSideGlobalEnabled = useStore((state) => !!state?.license?.featureAccess?.serverSideGlobal, shallow); + const isServerSideGlobalResolveEnabled = useStore( + (state) => !!state?.license?.featureAccess?.serverSideGlobalResolve, + shallow + ); const computeCoersionPreview = (resolvedValue, coersionData) => { if (coersionData?.typeBeforeCoercion === coersionData?.typeAfterCoercion) return resolvedValue; @@ -276,7 +279,7 @@ const RenderResolvedValue = ({ : previewType; const previewContent = isServerConstant - ? isServerSideGlobalEnabled + ? isServerSideGlobalResolveEnabled ? 'Server variables would be resolved at runtime' : 'Server variables are only available in paid plans' : isSecretConstant diff --git a/frontend/src/AppBuilder/CodeEditor/SingleLineCodeEditor.jsx b/frontend/src/AppBuilder/CodeEditor/SingleLineCodeEditor.jsx index 9c85e0bf43..fba7322bb2 100644 --- a/frontend/src/AppBuilder/CodeEditor/SingleLineCodeEditor.jsx +++ b/frontend/src/AppBuilder/CodeEditor/SingleLineCodeEditor.jsx @@ -216,7 +216,7 @@ const EditorInput = ({ const getSuggestions = useStore((state) => state.getSuggestions, shallow); const [codeMirrorView, setCodeMirrorView] = useState(undefined); - const getServerSideGlobalSuggestions = useStore((state) => state.getServerSideGlobalSuggestions, shallow); + const getServerSideGlobalResolveSuggestions = useStore((state) => state.getServerSideGlobalResolveSuggestions, shallow); const { queryPanelKeybindings } = useQueryPanelKeyHooks(onBlurUpdate, currentValue, 'singleline'); @@ -226,7 +226,7 @@ const EditorInput = ({ ); function autoCompleteExtensionConfig(context) { const hintsWithoutParamHints = getSuggestions(); - const serverHints = getServerSideGlobalSuggestions(isInsideQueryManager); + const serverHints = getServerSideGlobalResolveSuggestions(isInsideQueryManager); let word = context.matchBefore(/\w*/); diff --git a/frontend/src/AppBuilder/_stores/slices/codeHinterSlice.js b/frontend/src/AppBuilder/_stores/slices/codeHinterSlice.js index 854cba49da..60d4a88afd 100644 --- a/frontend/src/AppBuilder/_stores/slices/codeHinterSlice.js +++ b/frontend/src/AppBuilder/_stores/slices/codeHinterSlice.js @@ -36,11 +36,11 @@ export const createCodeHinterSlice = (set, get) => ({ setSuggestions({ appHints: suggestionList, jsHints: jsHints }); }, getSuggestions: () => get().suggestions, - getServerSideGlobalSuggestions: (isInsideQueryManager) => { - const isServerSideGlobalEnabled = !!get()?.license?.featureAccess?.serverSideGlobal; + getServerSideGlobalResolveSuggestions: (isInsideQueryManager) => { + const isServerSideGlobalResolveEnabled = !!get()?.license?.featureAccess?.serverSideGlobalResolve; const serverHints = []; const hints = get().getSuggestions(); - if (isInsideQueryManager && isServerSideGlobalEnabled) { + if (isInsideQueryManager && isServerSideGlobalResolveEnabled) { serverHints.push({ hint: 'globals.server', type: 'Object' }); hints?.appHints?.forEach((appHint) => { if (appHint?.hint?.startsWith('globals.currentUser')) { diff --git a/server/src/modules/licensing/configs/LicenseBase.ts b/server/src/modules/licensing/configs/LicenseBase.ts index 8153708a44..c20c7bc5bb 100644 --- a/server/src/modules/licensing/configs/LicenseBase.ts +++ b/server/src/modules/licensing/configs/LicenseBase.ts @@ -19,7 +19,7 @@ export default class LicenseBase { private _isCustomStyling: boolean; private _isWhiteLabelling: boolean; private _isCustomThemes: boolean; - private _isServerSideGlobal: boolean; + private _isServerSideGlobalResolve: boolean; private _isMultiEnvironment: boolean; private _isMultiPlayerEdit: boolean; private _isComments: boolean; @@ -65,7 +65,7 @@ export default class LicenseBase { this._isCustomStyling = true; this._isWhiteLabelling = true; this._isCustomThemes = true; - this._isServerSideGlobal = true; + this._isServerSideGlobalResolve = true; this._isLicenseValid = true; this._isMultiEnvironment = true; this._isAi = true; @@ -108,7 +108,7 @@ export default class LicenseBase { this._isWhiteLabelling = this.getFeatureValue('whiteLabelling'); this._isAppWhiteLabelling = this.getFeatureValue('appWhiteLabelling'); this._isCustomThemes = this.getFeatureValue('customThemes'); - this._isServerSideGlobal = this.getFeatureValue('serverSideGlobal'); + this._isServerSideGlobalResolve = this.getFeatureValue('serverSideGlobalResolve'); this._isMultiEnvironment = this.getFeatureValue('multiEnvironment'); this._isMultiPlayerEdit = this.getFeatureValue('multiPlayerEdit'); this._isComments = this.getFeatureValue('comments'); @@ -285,11 +285,11 @@ export default class LicenseBase { return this._isCustomThemes; } - public get serverSideGlobal(): boolean { + public get serverSideGlobalResolve(): boolean { if (this.IsBasicPlan) { - return !!this.BASIC_PLAN_TERMS.features?.serverSideGlobal; + return !!this.BASIC_PLAN_TERMS.features?.serverSideGlobalResolve; } - return this._isServerSideGlobal; + return this._isServerSideGlobalResolve; } public get externalApis(): boolean { if (this.IsBasicPlan) { @@ -340,7 +340,7 @@ export default class LicenseBase { customStyling: this.customStyling, whiteLabelling: this.whiteLabelling, customThemes: this.customThemes, - serverSideGlobal: this.serverSideGlobal, + serverSideGlobalResolve: this.serverSideGlobalResolve, multiEnvironment: this.multiEnvironment, multiPlayerEdit: this.multiPlayerEdit, gitSync: this.gitSync, @@ -370,7 +370,7 @@ export default class LicenseBase { samlEnabled: this.saml, customStylingEnabled: this.customStyling, customThemesEnabled: this.customThemes, - serverSideGlobalEnabled: this.serverSideGlobal, + serverSideGlobalResolveEnabled: this.serverSideGlobalResolve, multiEnvironmentEnabled: this.multiEnvironment, multiPlayerEditEnabled: this.multiPlayerEdit, commentsEnabled: this.comments, diff --git a/server/src/modules/licensing/constants/PlanTerms.ts b/server/src/modules/licensing/constants/PlanTerms.ts index 509de76918..23617a1f02 100644 --- a/server/src/modules/licensing/constants/PlanTerms.ts +++ b/server/src/modules/licensing/constants/PlanTerms.ts @@ -25,7 +25,7 @@ export const BASIC_PLAN_TERMS: Partial = { gitSync: false, comments: false, customThemes: false, - serverSideGlobal: false, + serverSideGlobalResolve: false, }, domains: [], workflows: { diff --git a/server/src/modules/licensing/constants/index.ts b/server/src/modules/licensing/constants/index.ts index 19973beef0..eedf9fad36 100644 --- a/server/src/modules/licensing/constants/index.ts +++ b/server/src/modules/licensing/constants/index.ts @@ -104,7 +104,7 @@ export enum LICENSE_FIELD { CUSTOM_STYLE = 'customStylingEnabled', WHITE_LABEL = 'whitelabellingEnabled', CUSTOM_THEMES = 'customThemeEnabled', - SERVER_SIDE_GLOBAL = 'serverSideGlobalEnabled', + SERVER_SIDE_GLOBAL = 'serverSideGlobalResolveEnabled', AUDIT_LOGS = 'auditLogsEnabled', MAX_DURATION_FOR_AUDIT_LOGS = 'maxDaysForAuditLogs', MULTI_ENVIRONMENT = 'multiEnvironmentEnabled', diff --git a/server/src/modules/licensing/helper.ts b/server/src/modules/licensing/helper.ts index 7fbc9a5feb..f3fc442b42 100644 --- a/server/src/modules/licensing/helper.ts +++ b/server/src/modules/licensing/helper.ts @@ -60,7 +60,7 @@ export function getLicenseFieldValue(type: LICENSE_FIELD, licenseInstance: Licen return licenseInstance.customThemes; case LICENSE_FIELD.SERVER_SIDE_GLOBAL: - return licenseInstance.serverSideGlobal; + return licenseInstance.serverSideGlobalResolve; case LICENSE_FIELD.EXTERNAL_API: return licenseInstance.externalApis; diff --git a/server/src/modules/licensing/interfaces/terms.ts b/server/src/modules/licensing/interfaces/terms.ts index c0d3421384..a1b270aab2 100644 --- a/server/src/modules/licensing/interfaces/terms.ts +++ b/server/src/modules/licensing/interfaces/terms.ts @@ -27,7 +27,7 @@ export interface Terms { gitSync?: boolean; comments?: boolean; customThemes?: boolean; - serverSideGlobal?: boolean; + serverSideGlobalResolve?: boolean; ai?: boolean; externalApi?: boolean; appWhiteLabelling?: boolean;