Properly load a postgres account in data explorer (#1323)

This commit is contained in:
victor-meng 2022-09-20 10:42:09 -07:00 committed by GitHub
parent d54c896d74
commit beca0d6608
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 8 deletions

View File

@ -395,6 +395,7 @@ export interface DataExplorerInputsFrame {
sharedThroughputDefault?: number;
dataExplorerVersion?: string;
defaultCollectionThroughput?: CollectionCreationDefaults;
isPostgresAccount?: boolean;
flights?: readonly string[];
features?: {
[key: string]: string;

View File

@ -185,7 +185,7 @@ export default class Explorer {
useNotebook.getState().setNotebookBasePath(userContext.features.notebookBasePath);
}
if (!userContext.features.enablePGQuickstart || userContext.apiType !== "Postgres") {
if (userContext.apiType !== "Postgres") {
this.refreshExplorer();
}
}

View File

@ -34,7 +34,7 @@ export const CommandBar: React.FC<Props> = ({ container }: Props) => {
const buttons = useCommandBar((state) => state.contextButtons);
const backgroundColor = StyleConstants.BaseLight;
if (userContext.features.enablePGQuickstart && userContext.apiType === "Postgres") {
if (userContext.apiType === "Postgres") {
const buttons = CommandBarComponentButtonFactory.createPostgreButtons(container);
return (
<div className="commandBarContainer">

View File

@ -29,7 +29,6 @@ export type Features = {
readonly mongoProxyEndpoint?: string;
readonly mongoProxyAPIs?: string;
readonly enableThroughputCap: boolean;
readonly enablePGQuickstart: boolean;
// can be set via both flight and feature flag
autoscaleDefault: boolean;
@ -91,7 +90,6 @@ export function extractFeatures(given = new URLSearchParams(window.location.sear
partitionKeyDefault2: "true" === get("pkpartitionkeytest"),
notebooksDownBanner: "true" === get("notebooksDownBanner"),
enableThroughputCap: "true" === get("enablethroughputcap"),
enablePGQuickstart: "true" === get("enablepgquickstart"),
};
}

View File

@ -112,10 +112,6 @@ function apiType(account: DatabaseAccount | undefined): ApiType {
return "SQL";
}
if (features.enablePGQuickstart) {
return "Postgres";
}
const capabilities = account.properties?.capabilities;
if (capabilities) {
if (capabilities.find((c) => c.name === "EnableCassandra")) {

View File

@ -354,9 +354,15 @@ function updateContextsFromPortalMessage(inputs: DataExplorerInputsFrame) {
collectionCreationDefaults: inputs.defaultCollectionThroughput,
isTryCosmosDBSubscription: inputs.isTryCosmosDBSubscription,
});
if (inputs.isPostgresAccount) {
updateUserContext({ apiType: "Postgres" });
}
if (inputs.features) {
Object.assign(userContext.features, extractFeatures(new URLSearchParams(inputs.features)));
}
if (inputs.flights) {
if (inputs.flights.indexOf(Flights.AutoscaleTest) !== -1) {
userContext.features.autoscaleDefault;