Removal of feature flag notebooksTemporarilyDown (#1178)

* Removal of feature flag notebooksTemporarilyDown

* Update flag

* Add Vnet/Firewall check for enabling phoenix
This commit is contained in:
Karthik chakravarthy 2021-12-22 13:15:12 -05:00 committed by GitHub
parent 529202ba7e
commit be28eb387b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 17 deletions

View File

@ -83,7 +83,6 @@ export const createCollectionContextMenuButton = (
items.push({ items.push({
iconSrc: HostedTerminalIcon, iconSrc: HostedTerminalIcon,
isDisabled: useNotebook.getState().isShellEnabled && userContext.features.notebooksTemporarilyDown,
onClick: () => { onClick: () => {
const selectedCollection: ViewModels.Collection = useSelectedNode.getState().findSelectedCollection(); const selectedCollection: ViewModels.Collection = useSelectedNode.getState().findSelectedCollection();
if (useNotebook.getState().isShellEnabled) { if (useNotebook.getState().isShellEnabled) {

View File

@ -111,7 +111,7 @@ export function createStaticCommandBarButtons(
buttons.push(btn); buttons.push(btn);
}); });
} else { } else {
if (!isRunningOnNationalCloud() && !userContext.features.notebooksTemporarilyDown) { if (!isRunningOnNationalCloud() && useNotebook.getState().isPhoenix) {
buttons.push(createDivider()); buttons.push(createDivider());
buttons.push(createEnableNotebooksButton(container)); buttons.push(createEnableNotebooksButton(container));
} }
@ -169,9 +169,7 @@ export function createContextCommandBarButtons(
onCommandClick: () => { onCommandClick: () => {
const selectedCollection: ViewModels.Collection = selectedNodeState.findSelectedCollection(); const selectedCollection: ViewModels.Collection = selectedNodeState.findSelectedCollection();
if (useNotebook.getState().isShellEnabled) { if (useNotebook.getState().isShellEnabled) {
if (!userContext.features.notebooksTemporarilyDown) { container.openNotebookTerminal(ViewModels.TerminalKind.Mongo);
container.openNotebookTerminal(ViewModels.TerminalKind.Mongo);
}
} else { } else {
selectedCollection && selectedCollection.onNewMongoShellClick(); selectedCollection && selectedCollection.onNewMongoShellClick();
} }
@ -179,13 +177,6 @@ export function createContextCommandBarButtons(
commandButtonLabel: label, commandButtonLabel: label,
ariaLabel: label, ariaLabel: label,
hasPopup: true, hasPopup: true,
tooltipText:
useNotebook.getState().isShellEnabled && userContext.features.notebooksTemporarilyDown
? Constants.Notebook.mongoShellTemporarilyDownMsg
: undefined,
disabled:
(selectedNodeState.isDatabaseNodeOrNoneSelected() && userContext.apiType === "Mongo") ||
(useNotebook.getState().isShellEnabled && userContext.features.notebooksTemporarilyDown),
}; };
buttons.push(newMongoShellBtn); buttons.push(newMongoShellBtn);
} }

View File

@ -1,3 +1,4 @@
import { isPublicInternetAccessAllowed } from "Common/DatabaseAccountUtility";
import { cloneDeep } from "lodash"; import { cloneDeep } from "lodash";
import { PhoenixClient } from "Phoenix/PhoenixClient"; import { PhoenixClient } from "Phoenix/PhoenixClient";
import create, { UseStore } from "zustand"; import create, { UseStore } from "zustand";
@ -302,7 +303,7 @@ export const useNotebook: UseStore<NotebookState> = create((set, get) => ({
let isPhoenix = false; let isPhoenix = false;
if (userContext.features.phoenix) { if (userContext.features.phoenix) {
const phoenixClient = new PhoenixClient(); const phoenixClient = new PhoenixClient();
isPhoenix = await phoenixClient.isDbAcountWhitelisted(); isPhoenix = isPublicInternetAccessAllowed() && (await phoenixClient.isDbAcountWhitelisted());
} }
set({ isPhoenix }); set({ isPhoenix });
} }

View File

@ -221,7 +221,7 @@ export class SplashScreen extends React.Component<SplashScreenProps> {
}); });
} }
if (useNotebook.getState().isNotebookEnabled && !userContext.features.notebooksTemporarilyDown) { if (useNotebook.getState().isPhoenix) {
heroes.push({ heroes.push({
iconSrc: NewNotebookIcon, iconSrc: NewNotebookIcon,
title: "New Notebook", title: "New Notebook",

View File

@ -516,7 +516,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
isNotebookEnabled && isNotebookEnabled &&
userContext.apiType === "Mongo" && userContext.apiType === "Mongo" &&
isPublicInternetAccessAllowed() && isPublicInternetAccessAllowed() &&
!userContext.features.notebooksTemporarilyDown useNotebook.getState().isPhoenix
) { ) {
children.push({ children.push({
label: "Schema (Preview)", label: "Schema (Preview)",

View File

@ -33,7 +33,6 @@ export type Features = {
readonly ttl90Days: boolean; readonly ttl90Days: boolean;
readonly mongoProxyEndpoint?: string; readonly mongoProxyEndpoint?: string;
readonly mongoProxyAPIs?: string; readonly mongoProxyAPIs?: string;
readonly notebooksTemporarilyDown: boolean;
readonly enableThroughputCap: boolean; readonly enableThroughputCap: boolean;
}; };
@ -84,7 +83,6 @@ export function extractFeatures(given = new URLSearchParams(window.location.sear
autoscaleDefault: "true" === get("autoscaledefault"), autoscaleDefault: "true" === get("autoscaledefault"),
partitionKeyDefault: "true" === get("partitionkeytest"), partitionKeyDefault: "true" === get("partitionkeytest"),
partitionKeyDefault2: "true" === get("pkpartitionkeytest"), partitionKeyDefault2: "true" === get("pkpartitionkeytest"),
notebooksTemporarilyDown: "true" === get("notebookstemporarilydown", "true"),
phoenix: "true" === get("phoenix"), phoenix: "true" === get("phoenix"),
notebooksDownBanner: "true" === get("notebooksDownBanner"), notebooksDownBanner: "true" === get("notebooksDownBanner"),
enableThroughputCap: "true" === get("enablethroughputcap"), enableThroughputCap: "true" === get("enablethroughputcap"),