diff --git a/src/Contracts/DataModels.ts b/src/Contracts/DataModels.ts index 39006ab76..a72ac434e 100644 --- a/src/Contracts/DataModels.ts +++ b/src/Contracts/DataModels.ts @@ -600,12 +600,6 @@ export interface IContainerData { forwardingId: string; } -export interface IDbAccountAllow { - status: number; - message?: string; - type?: string; -} - export interface IResponse { status: number; data: T; diff --git a/src/Explorer/Notebook/useNotebook.ts b/src/Explorer/Notebook/useNotebook.ts index 1ab4171fd..88b39aab8 100644 --- a/src/Explorer/Notebook/useNotebook.ts +++ b/src/Explorer/Notebook/useNotebook.ts @@ -1,15 +1,13 @@ -import { isPublicInternetAccessAllowed } from "Common/DatabaseAccountUtility"; -import { PhoenixClient } from "Phoenix/PhoenixClient"; import { cloneDeep } from "lodash"; import create, { UseStore } from "zustand"; import { AuthType } from "../../AuthType"; import * as Constants from "../../Common/Constants"; -import { ConnectionStatusType, HttpStatusCodes } from "../../Common/Constants"; +import { ConnectionStatusType } from "../../Common/Constants"; import { getErrorMessage } from "../../Common/ErrorHandlingUtils"; import * as Logger from "../../Common/Logger"; import { configContext } from "../../ConfigContext"; import * as DataModels from "../../Contracts/DataModels"; -import { ContainerConnectionInfo, ContainerInfo, PhoenixErrorType } from "../../Contracts/DataModels"; +import { ContainerConnectionInfo, ContainerInfo } from "../../Contracts/DataModels"; import { IPinnedRepo } from "../../Juno/JunoClient"; import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants"; import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor"; @@ -309,34 +307,9 @@ export const useNotebook: UseStore = create((set, get) => ({ setContainerStatus: (containerStatus: ContainerInfo) => set({ containerStatus }), getPhoenixStatus: async () => { if (get().isPhoenixNotebooks === undefined || get().isPhoenixFeatures === undefined) { - const startKey = TelemetryProcessor.traceStart(Action.CheckPhoenixStatus, { - dataExplorerArea: "Notebook", - }); - let isPhoenixNotebooks = false; - let isPhoenixFeatures = false; - - const isPublicInternetAllowed = isPublicInternetAccessAllowed(); - const phoenixClient = new PhoenixClient(userContext?.databaseAccount?.id); - const dbAccountAllowedInfo = await phoenixClient.getDbAccountAllowedStatus(); - - if (dbAccountAllowedInfo.status === HttpStatusCodes.OK) { - if (dbAccountAllowedInfo?.type === PhoenixErrorType.PhoenixFlightFallback) { - isPhoenixNotebooks = isPublicInternetAllowed && userContext.features.phoenixNotebooks === true; - isPhoenixFeatures = - isPublicInternetAllowed && - // phoenix needs to be enabled for Postgres and VCoreMongo accounts since the PSQL and mongo shell requires phoenix containers - (userContext.features.phoenixFeatures === true || - userContext.apiType === "Postgres" || - userContext.apiType === "VCoreMongo"); - } else { - isPhoenixNotebooks = isPhoenixFeatures = isPublicInternetAllowed; - } - } else { - isPhoenixNotebooks = isPhoenixFeatures = false; - } - set({ isPhoenixNotebooks: isPhoenixNotebooks }); - set({ isPhoenixFeatures: isPhoenixFeatures }); - TelemetryProcessor.traceSuccess(Action.CheckPhoenixStatus, { isPhoenixNotebooks, isPhoenixFeatures }, startKey); + // getDbAccountAllowedStatus has been deprecated; Phoenix features are no longer available. + set({ isPhoenixNotebooks: false }); + set({ isPhoenixFeatures: false }); } }, setIsPhoenixNotebooks: (isPhoenixNotebooks: boolean) => set({ isPhoenixNotebooks: isPhoenixNotebooks }), diff --git a/src/Phoenix/PhoenixClient.ts b/src/Phoenix/PhoenixClient.ts index d64787f0d..f1d722e3b 100644 --- a/src/Phoenix/PhoenixClient.ts +++ b/src/Phoenix/PhoenixClient.ts @@ -12,13 +12,12 @@ import { HttpStatusCodes, Notebook, } from "../Common/Constants"; -import { getErrorMessage, getErrorStack } from "../Common/ErrorHandlingUtils"; +import { getErrorMessage } from "../Common/ErrorHandlingUtils"; import * as Logger from "../Common/Logger"; import { ContainerConnectionInfo, ContainerInfo, IContainerData, - IDbAccountAllow, IMaxAllocationTimeExceeded, IPhoenixConnectionInfoResult, IPhoenixError, @@ -196,51 +195,6 @@ export class PhoenixClient { } } - public async getDbAccountAllowedStatus(): Promise { - const startKey = TelemetryProcessor.traceStart(Action.PhoenixDBAccountAllowed, { - dataExplorerArea: Areas.Notebook, - }); - let responseJson; - try { - const response = await window.fetch(`${this.getPhoenixControlPlanePathPrefix()}`, { - method: "GET", - headers: PhoenixClient.getHeaders(), - }); - responseJson = await response?.json(); - if (response.status !== HttpStatusCodes.OK) { - throw new Error(`Received status code: ${response?.status}`); - } - TelemetryProcessor.traceSuccess( - Action.PhoenixDBAccountAllowed, - { - dataExplorerArea: Areas.Notebook, - }, - startKey, - ); - return { - status: response.status, - message: responseJson?.message, - type: responseJson?.type, - }; - } catch (error) { - TelemetryProcessor.traceFailure( - Action.PhoenixDBAccountAllowed, - { - dataExplorerArea: Areas.Notebook, - error: getErrorMessage(error), - errorStack: getErrorStack(error), - }, - startKey, - ); - Logger.logError(getErrorMessage(error), "PhoenixClient/IsDbAcountWhitelisted"); - return { - status: HttpStatusCodes.Forbidden, - message: responseJson?.message, - type: responseJson?.type, - }; - } - } - private getPhoenixControlPlanePathPrefix(): string { if (!this.armResourceId) { throw new Error("The Phoenix client was not initialized properly: missing ARM resource id");