From 1ce3adff0fa7599fad4c6ca4fe9ee711029d0591 Mon Sep 17 00:00:00 2001 From: victor-meng <56978073+victor-meng@users.noreply.github.com> Date: Wed, 19 Oct 2022 17:12:41 -0700 Subject: [PATCH] Hide launch quick start button and postgres teaching bubbles if account is a replica (#1344) --- src/Contracts/ViewModels.ts | 1 + src/Explorer/SplashScreen/SplashScreen.less | 4 ---- src/Explorer/SplashScreen/SplashScreen.tsx | 6 +++++- src/UserContext.ts | 3 ++- src/hooks/useKnockoutExplorer.ts | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Contracts/ViewModels.ts b/src/Contracts/ViewModels.ts index fbfbec69c..dbca00fed 100644 --- a/src/Contracts/ViewModels.ts +++ b/src/Contracts/ViewModels.ts @@ -397,6 +397,7 @@ export interface DataExplorerInputsFrame { dataExplorerVersion?: string; defaultCollectionThroughput?: CollectionCreationDefaults; isPostgresAccount?: boolean; + isReplica?: boolean; // TODO: Update this param in the OSS extension to remove isFreeTier, isMarlinServerGroup, and make nodes a flat array instead of an nested array connectionStringParams?: any; flights?: readonly string[]; diff --git a/src/Explorer/SplashScreen/SplashScreen.less b/src/Explorer/SplashScreen/SplashScreen.less index 996554f8f..a8aa3b58d 100644 --- a/src/Explorer/SplashScreen/SplashScreen.less +++ b/src/Explorer/SplashScreen/SplashScreen.less @@ -14,10 +14,6 @@ padding-right: 16px; max-width: 1168px; - > * { - justify-content: space-between; - } - > .title { position: relative; // To attach FeaturePanelLauncher as absolute color: @BaseHigh; diff --git a/src/Explorer/SplashScreen/SplashScreen.tsx b/src/Explorer/SplashScreen/SplashScreen.tsx index 9ed41bc77..c9c73ed5e 100644 --- a/src/Explorer/SplashScreen/SplashScreen.tsx +++ b/src/Explorer/SplashScreen/SplashScreen.tsx @@ -304,7 +304,11 @@ export class SplashScreen extends React.Component { public createMainItems(): SplashScreenItem[] { const heroes: SplashScreenItem[] = []; - if (userContext.apiType === "SQL" || userContext.apiType === "Mongo" || userContext.apiType === "Postgres") { + if ( + userContext.apiType === "SQL" || + userContext.apiType === "Mongo" || + (userContext.apiType === "Postgres" && !userContext.isReplica) + ) { const launchQuickstartBtn = { id: "quickstartDescription", iconSrc: QuickStartIcon, diff --git a/src/UserContext.ts b/src/UserContext.ts index 171f842bc..90aff4e2f 100644 --- a/src/UserContext.ts +++ b/src/UserContext.ts @@ -67,6 +67,7 @@ interface UserContext { partitionKey?: string; }; readonly postgresConnectionStrParams?: PostgresConnectionStrParams; + readonly isReplica?: boolean; collectionCreationDefaults: CollectionCreationDefaults; } @@ -110,7 +111,7 @@ function updateUserContext(newContext: Partial): void { if (!localStorage.getItem(newContext.databaseAccount.id)) { if (newContext.isTryCosmosDBSubscription || isNewAccount) { - if (newContext.apiType === "Postgres") { + if (newContext.apiType === "Postgres" && !newContext.isReplica) { usePostgres.getState().setShowResetPasswordBubble(true); usePostgres.getState().setShowPostgreTeachingBubble(true); } else { diff --git a/src/hooks/useKnockoutExplorer.ts b/src/hooks/useKnockoutExplorer.ts index 186bb7fd9..94ff11343 100644 --- a/src/hooks/useKnockoutExplorer.ts +++ b/src/hooks/useKnockoutExplorer.ts @@ -364,7 +364,7 @@ function updateContextsFromPortalMessage(inputs: DataExplorerInputsFrame) { }); if (inputs.isPostgresAccount) { - updateUserContext({ apiType: "Postgres" }); + updateUserContext({ apiType: "Postgres", isReplica: !!inputs.isReplica }); if (inputs.connectionStringParams) { // TODO: Remove after the nodes param has been updated to be a flat array in the OSS extension