Postgre quickstart UI (#1319)

This commit is contained in:
victor-meng
2022-09-14 14:42:09 -07:00
committed by GitHub
parent d6a58fd45f
commit d54c896d74
29 changed files with 801 additions and 64 deletions

View File

@@ -1,4 +1,5 @@
import { useCarousel } from "hooks/useCarousel";
import { usePostgres } from "hooks/usePostgres";
import { Action } from "Shared/Telemetry/TelemetryConstants";
import { traceOpen } from "Shared/Telemetry/TelemetryProcessor";
import { AuthType } from "./AuthType";
@@ -54,7 +55,7 @@ interface UserContext {
collectionCreationDefaults: CollectionCreationDefaults;
}
export type ApiType = "SQL" | "Mongo" | "Gremlin" | "Tables" | "Cassandra";
export type ApiType = "SQL" | "Mongo" | "Gremlin" | "Tables" | "Cassandra" | "Postgres";
export type PortalEnv = "localhost" | "blackforest" | "fairfax" | "mooncake" | "prod" | "dev";
const ONE_WEEK_IN_MS = 604800000;
@@ -92,13 +93,15 @@ function updateUserContext(newContext: Partial<UserContext>): void {
ONE_WEEK_IN_MS
);
if (
!localStorage.getItem(newContext.databaseAccount.id) &&
(userContext.isTryCosmosDBSubscription || isNewAccount)
) {
useCarousel.getState().setShouldOpen(true);
localStorage.setItem(newContext.databaseAccount.id, "true");
traceOpen(Action.OpenCarousel);
if (!localStorage.getItem(newContext.databaseAccount.id)) {
if (newContext.apiType === "Postgres") {
usePostgres.getState().setShowPostgreTeachingBubble(true);
localStorage.setItem(newContext.databaseAccount.id, "true");
} else if (userContext.isTryCosmosDBSubscription || isNewAccount) {
useCarousel.getState().setShouldOpen(true);
localStorage.setItem(newContext.databaseAccount.id, "true");
traceOpen(Action.OpenCarousel);
}
}
}
Object.assign(userContext, newContext);
@@ -108,6 +111,11 @@ function apiType(account: DatabaseAccount | undefined): ApiType {
if (!account) {
return "SQL";
}
if (features.enablePGQuickstart) {
return "Postgres";
}
const capabilities = account.properties?.capabilities;
if (capabilities) {
if (capabilities.find((c) => c.name === "EnableCassandra")) {