Postgres fixes (#1341)

This commit is contained in:
victor-meng 2022-10-11 16:03:58 -07:00 committed by GitHub
parent 53b5ebd39c
commit afe59c1589
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 10 deletions

View File

@ -2,6 +2,7 @@ import { Image, PrimaryButton, Stack, Text } from "@fluentui/react";
import { sendMessage } from "Common/MessageHandler"; import { sendMessage } from "Common/MessageHandler";
import { MessageTypes } from "Contracts/ExplorerContracts"; import { MessageTypes } from "Contracts/ExplorerContracts";
import React from "react"; import React from "react";
import FirewallRuleScreenshot from "../../../images/firewallRule.png";
export const QuickstartFirewallNotification: React.FC = (): JSX.Element => ( export const QuickstartFirewallNotification: React.FC = (): JSX.Element => (
<Stack style={{ padding: "16px 20px" }}> <Stack style={{ padding: "16px 20px" }}>
@ -10,7 +11,7 @@ export const QuickstartFirewallNotification: React.FC = (): JSX.Element => (
(0.0.0.0-255.255.255). (0.0.0.0-255.255.255).
</Text> </Text>
<Text block>We strongly recommend removing this rule once you finish using the PostgreSQL shell.</Text> <Text block>We strongly recommend removing this rule once you finish using the PostgreSQL shell.</Text>
<Image style={{ margin: "20px 0" }} src="../../../images/firewallRule.png" /> <Image style={{ margin: "20px 0" }} src={FirewallRuleScreenshot} />
<PrimaryButton <PrimaryButton
style={{ width: 150 }} style={{ width: 150 }}
onClick={() => sendMessage({ type: MessageTypes.OpenPostgresNetworkingBlade })} onClick={() => sendMessage({ type: MessageTypes.OpenPostgresNetworkingBlade })}

View File

@ -186,7 +186,10 @@ export class SplashScreen extends React.Component<SplashScreenProps> {
headline="Create your password" headline="Create your password"
target={"#mainButton-quickstartDescription"} target={"#mainButton-quickstartDescription"}
hasCloseButton hasCloseButton
onDismiss={() => usePostgres.getState().setShowResetPasswordBubble(false)} onDismiss={() => {
localStorage.setItem(userContext.databaseAccount.id, "true");
usePostgres.getState().setShowResetPasswordBubble(false);
}}
calloutProps={{ calloutProps={{
directionalHint: DirectionalHint.bottomRightEdge, directionalHint: DirectionalHint.bottomRightEdge,
directionalHintFixed: true, directionalHintFixed: true,
@ -197,6 +200,7 @@ export class SplashScreen extends React.Component<SplashScreenProps> {
primaryButtonProps={{ primaryButtonProps={{
text: "Create", text: "Create",
onClick: () => { onClick: () => {
localStorage.setItem(userContext.databaseAccount.id, "true");
sendMessage({ sendMessage({
type: MessageTypes.OpenPostgreSQLPasswordReset, type: MessageTypes.OpenPostgreSQLPasswordReset,
}); });
@ -204,7 +208,7 @@ export class SplashScreen extends React.Component<SplashScreenProps> {
}, },
}} }}
> >
This password will be used to connect to the database. If you haven&apos;t changed your password yet, change it now.
</TeachingBubble> </TeachingBubble>
)} )}
</div> </div>

View File

@ -109,16 +109,19 @@ function updateUserContext(newContext: Partial<UserContext>): void {
); );
if (!localStorage.getItem(newContext.databaseAccount.id)) { 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); usePostgres.getState().setShowPostgreTeachingBubble(true);
localStorage.setItem(newContext.databaseAccount.id, "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); Object.assign(userContext, newContext);