From 05d2f05b365a899bfaa621dc1ec3eb951f486f1c Mon Sep 17 00:00:00 2001 From: Karthikeyan Chinnakonda Date: Wed, 17 Aug 2022 00:19:30 +0530 Subject: [PATCH] pro server: Enterprise edition lite PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5219 Co-authored-by: Rakesh Emmadi <12475069+rakeshkky@users.noreply.github.com> Co-authored-by: Nithin <36623418+nithindv@users.noreply.github.com> GitOrigin-RevId: b5c33ea5653a6e107a14d106082cf4301481fc40 --- console/src/Globals.ts | 17 ++++++++++++++++- .../src/components/Services/Auth/AuthService.ts | 2 +- .../dataSources/services/postgresql/index.tsx | 4 +++- console/src/utils/__tests__/proConsole.spec.ts | 10 ++++++++++ console/src/utils/proConsole.ts | 4 +++- 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/console/src/Globals.ts b/console/src/Globals.ts index 6b26bc96cac..299a50323a6 100644 --- a/console/src/Globals.ts +++ b/console/src/Globals.ts @@ -4,7 +4,7 @@ import { getFeaturesCompatibility } from './helpers/versionUtils'; import { stripTrailingSlash } from './components/Common/utils/urlUtils'; import { isEmpty } from './components/Common/utils/jsUtils'; -type ConsoleType = 'oss' | 'cloud' | 'pro'; +type ConsoleType = 'oss' | 'cloud' | 'pro' | 'pro-lite'; type UUID = string; @@ -32,6 +32,18 @@ type ProServerEnv = { urlPrefix: string; }; +type ProLiteServerEnv = { + consoleType: 'pro-lite'; + consoleId: string; + consoleMode: 'server'; + assetsPath: string; + consolePath: string; + enableTelemetry: boolean; + isAdminSecretSet: boolean; + serverVersion: string; + urlPrefix: string; +}; + type CloudUserRole = 'owner' | 'user'; type CloudServerEnv = { @@ -91,6 +103,7 @@ export type CloudCliEnv = { }; type ProCliEnv = CloudCliEnv; +type ProLiteCliEnv = CloudCliEnv; export type EnvVars = { nodeEnv?: string; @@ -114,9 +127,11 @@ export type EnvVars = { | OSSServerEnv | CloudServerEnv | ProServerEnv + | ProLiteServerEnv | OSSCliEnv | CloudCliEnv | ProCliEnv + | ProLiteCliEnv ); declare global { diff --git a/console/src/components/Services/Auth/AuthService.ts b/console/src/components/Services/Auth/AuthService.ts index 0805548965f..421c3c35d7d 100644 --- a/console/src/components/Services/Auth/AuthService.ts +++ b/console/src/components/Services/Auth/AuthService.ts @@ -1,4 +1,4 @@ -export type AllowedConsoleTypes = 'oss' | 'pro' | 'cloud'; +export type AllowedConsoleTypes = 'oss' | 'pro' | 'cloud' | 'pro-lite'; export type AllowedConsoleModes = 'cli' | 'server'; export type Privileges = string[]; diff --git a/console/src/dataSources/services/postgresql/index.tsx b/console/src/dataSources/services/postgresql/index.tsx index ee90507d5b2..0d187587ec1 100644 --- a/console/src/dataSources/services/postgresql/index.tsx +++ b/console/src/dataSources/services/postgresql/index.tsx @@ -746,7 +746,9 @@ export const supportedFeatures: DeepRequired = { connection_lifetime: true, namingConvention: true, ssl_certificates: - globals.consoleType === 'cloud' || globals.consoleType === 'pro', + globals.consoleType === 'cloud' || + globals.consoleType === 'pro' || + globals.consoleType === 'pro-lite', }, }; diff --git a/console/src/utils/__tests__/proConsole.spec.ts b/console/src/utils/__tests__/proConsole.spec.ts index 840a937b217..90eef40b4fe 100644 --- a/console/src/utils/__tests__/proConsole.spec.ts +++ b/console/src/utils/__tests__/proConsole.spec.ts @@ -32,6 +32,16 @@ describe('isProConsole', () => { }); }); + describe('when consoleMode is server and consoleType is pro-lite', () => { + it('returns true', () => { + const env: ProConsoleEnv = { + consoleMode: 'server', + consoleType: 'pro-lite', + }; + expect(isProConsole(env)).toBe(true); + }); + }); + describe('when consoleMode is server and consoleType is oss', () => { it('returns false', () => { const env: ProConsoleEnv = { diff --git a/console/src/utils/proConsole.ts b/console/src/utils/proConsole.ts index 10bb72b83de..342e31bc3a9 100644 --- a/console/src/utils/proConsole.ts +++ b/console/src/utils/proConsole.ts @@ -9,7 +9,9 @@ export type ProConsoleEnv = { export const isProConsole = (env: ProConsoleEnv) => { if ( env.consoleMode === 'server' && - (env.consoleType === 'cloud' || env.consoleType === 'pro') + (env.consoleType === 'cloud' || + env.consoleType === 'pro' || + env.consoleType === 'pro-lite') ) { return true; }