mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-06-05 15:12:04 +01:00
Properly load a postgres account in data explorer (#1323)
This commit is contained in:
parent
d54c896d74
commit
beca0d6608
@ -395,6 +395,7 @@ export interface DataExplorerInputsFrame {
|
|||||||
sharedThroughputDefault?: number;
|
sharedThroughputDefault?: number;
|
||||||
dataExplorerVersion?: string;
|
dataExplorerVersion?: string;
|
||||||
defaultCollectionThroughput?: CollectionCreationDefaults;
|
defaultCollectionThroughput?: CollectionCreationDefaults;
|
||||||
|
isPostgresAccount?: boolean;
|
||||||
flights?: readonly string[];
|
flights?: readonly string[];
|
||||||
features?: {
|
features?: {
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
|
@ -185,7 +185,7 @@ export default class Explorer {
|
|||||||
useNotebook.getState().setNotebookBasePath(userContext.features.notebookBasePath);
|
useNotebook.getState().setNotebookBasePath(userContext.features.notebookBasePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!userContext.features.enablePGQuickstart || userContext.apiType !== "Postgres") {
|
if (userContext.apiType !== "Postgres") {
|
||||||
this.refreshExplorer();
|
this.refreshExplorer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ export const CommandBar: React.FC<Props> = ({ container }: Props) => {
|
|||||||
const buttons = useCommandBar((state) => state.contextButtons);
|
const buttons = useCommandBar((state) => state.contextButtons);
|
||||||
const backgroundColor = StyleConstants.BaseLight;
|
const backgroundColor = StyleConstants.BaseLight;
|
||||||
|
|
||||||
if (userContext.features.enablePGQuickstart && userContext.apiType === "Postgres") {
|
if (userContext.apiType === "Postgres") {
|
||||||
const buttons = CommandBarComponentButtonFactory.createPostgreButtons(container);
|
const buttons = CommandBarComponentButtonFactory.createPostgreButtons(container);
|
||||||
return (
|
return (
|
||||||
<div className="commandBarContainer">
|
<div className="commandBarContainer">
|
||||||
|
@ -29,7 +29,6 @@ export type Features = {
|
|||||||
readonly mongoProxyEndpoint?: string;
|
readonly mongoProxyEndpoint?: string;
|
||||||
readonly mongoProxyAPIs?: string;
|
readonly mongoProxyAPIs?: string;
|
||||||
readonly enableThroughputCap: boolean;
|
readonly enableThroughputCap: boolean;
|
||||||
readonly enablePGQuickstart: boolean;
|
|
||||||
|
|
||||||
// can be set via both flight and feature flag
|
// can be set via both flight and feature flag
|
||||||
autoscaleDefault: boolean;
|
autoscaleDefault: boolean;
|
||||||
@ -91,7 +90,6 @@ export function extractFeatures(given = new URLSearchParams(window.location.sear
|
|||||||
partitionKeyDefault2: "true" === get("pkpartitionkeytest"),
|
partitionKeyDefault2: "true" === get("pkpartitionkeytest"),
|
||||||
notebooksDownBanner: "true" === get("notebooksDownBanner"),
|
notebooksDownBanner: "true" === get("notebooksDownBanner"),
|
||||||
enableThroughputCap: "true" === get("enablethroughputcap"),
|
enableThroughputCap: "true" === get("enablethroughputcap"),
|
||||||
enablePGQuickstart: "true" === get("enablepgquickstart"),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,10 +112,6 @@ function apiType(account: DatabaseAccount | undefined): ApiType {
|
|||||||
return "SQL";
|
return "SQL";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (features.enablePGQuickstart) {
|
|
||||||
return "Postgres";
|
|
||||||
}
|
|
||||||
|
|
||||||
const capabilities = account.properties?.capabilities;
|
const capabilities = account.properties?.capabilities;
|
||||||
if (capabilities) {
|
if (capabilities) {
|
||||||
if (capabilities.find((c) => c.name === "EnableCassandra")) {
|
if (capabilities.find((c) => c.name === "EnableCassandra")) {
|
||||||
|
@ -354,9 +354,15 @@ function updateContextsFromPortalMessage(inputs: DataExplorerInputsFrame) {
|
|||||||
collectionCreationDefaults: inputs.defaultCollectionThroughput,
|
collectionCreationDefaults: inputs.defaultCollectionThroughput,
|
||||||
isTryCosmosDBSubscription: inputs.isTryCosmosDBSubscription,
|
isTryCosmosDBSubscription: inputs.isTryCosmosDBSubscription,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (inputs.isPostgresAccount) {
|
||||||
|
updateUserContext({ apiType: "Postgres" });
|
||||||
|
}
|
||||||
|
|
||||||
if (inputs.features) {
|
if (inputs.features) {
|
||||||
Object.assign(userContext.features, extractFeatures(new URLSearchParams(inputs.features)));
|
Object.assign(userContext.features, extractFeatures(new URLSearchParams(inputs.features)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inputs.flights) {
|
if (inputs.flights) {
|
||||||
if (inputs.flights.indexOf(Flights.AutoscaleTest) !== -1) {
|
if (inputs.flights.indexOf(Flights.AutoscaleTest) !== -1) {
|
||||||
userContext.features.autoscaleDefault;
|
userContext.features.autoscaleDefault;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user