From afe59c15896465e6d6d68daa953748102d4648d6 Mon Sep 17 00:00:00 2001 From: victor-meng <56978073+victor-meng@users.noreply.github.com> Date: Tue, 11 Oct 2022 16:03:58 -0700 Subject: [PATCH] Postgres fixes (#1341) --- .../QuickstartFirewallNotification.tsx | 3 ++- src/Explorer/SplashScreen/SplashScreen.tsx | 8 ++++++-- src/UserContext.ts | 17 ++++++++++------- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/Explorer/Quickstart/QuickstartFirewallNotification.tsx b/src/Explorer/Quickstart/QuickstartFirewallNotification.tsx index adba30082..3751cbbb5 100644 --- a/src/Explorer/Quickstart/QuickstartFirewallNotification.tsx +++ b/src/Explorer/Quickstart/QuickstartFirewallNotification.tsx @@ -2,6 +2,7 @@ import { Image, PrimaryButton, Stack, Text } from "@fluentui/react"; import { sendMessage } from "Common/MessageHandler"; import { MessageTypes } from "Contracts/ExplorerContracts"; import React from "react"; +import FirewallRuleScreenshot from "../../../images/firewallRule.png"; export const QuickstartFirewallNotification: React.FC = (): JSX.Element => ( @@ -10,7 +11,7 @@ export const QuickstartFirewallNotification: React.FC = (): JSX.Element => ( (0.0.0.0-255.255.255). We strongly recommend removing this rule once you finish using the PostgreSQL shell. - + sendMessage({ type: MessageTypes.OpenPostgresNetworkingBlade })} diff --git a/src/Explorer/SplashScreen/SplashScreen.tsx b/src/Explorer/SplashScreen/SplashScreen.tsx index 10882f8e8..9ed41bc77 100644 --- a/src/Explorer/SplashScreen/SplashScreen.tsx +++ b/src/Explorer/SplashScreen/SplashScreen.tsx @@ -186,7 +186,10 @@ export class SplashScreen extends React.Component { headline="Create your password" target={"#mainButton-quickstartDescription"} hasCloseButton - onDismiss={() => usePostgres.getState().setShowResetPasswordBubble(false)} + onDismiss={() => { + localStorage.setItem(userContext.databaseAccount.id, "true"); + usePostgres.getState().setShowResetPasswordBubble(false); + }} calloutProps={{ directionalHint: DirectionalHint.bottomRightEdge, directionalHintFixed: true, @@ -197,6 +200,7 @@ export class SplashScreen extends React.Component { primaryButtonProps={{ text: "Create", onClick: () => { + localStorage.setItem(userContext.databaseAccount.id, "true"); sendMessage({ type: MessageTypes.OpenPostgreSQLPasswordReset, }); @@ -204,7 +208,7 @@ export class SplashScreen extends React.Component { }, }} > - This password will be used to connect to the database. + If you haven't changed your password yet, change it now. )} diff --git a/src/UserContext.ts b/src/UserContext.ts index 6a1fbc508..171f842bc 100644 --- a/src/UserContext.ts +++ b/src/UserContext.ts @@ -109,16 +109,19 @@ function updateUserContext(newContext: Partial): void { ); if (!localStorage.getItem(newContext.databaseAccount.id)) { - if (newContext.apiType === "Postgres") { + if (newContext.isTryCosmosDBSubscription || isNewAccount) { + if (newContext.apiType === "Postgres") { + usePostgres.getState().setShowResetPasswordBubble(true); + usePostgres.getState().setShowPostgreTeachingBubble(true); + } else { + useCarousel.getState().setShouldOpen(true); + localStorage.setItem(newContext.databaseAccount.id, "true"); + traceOpen(Action.OpenCarousel); + } + } else if (newContext.apiType === "Postgres") { usePostgres.getState().setShowPostgreTeachingBubble(true); localStorage.setItem(newContext.databaseAccount.id, "true"); } - if (newContext.isTryCosmosDBSubscription || isNewAccount) { - useCarousel.getState().setShouldOpen(true); - usePostgres.getState().setShowResetPasswordBubble(true); - localStorage.setItem(newContext.databaseAccount.id, "true"); - traceOpen(Action.OpenCarousel); - } } } Object.assign(userContext, newContext);