From 1726e4df51e3d6e1dd64e9c0c7b9fa8a0e80f9a6 Mon Sep 17 00:00:00 2001 From: Asier Isayas Date: Fri, 27 Oct 2023 14:09:21 -0400 Subject: [PATCH] Remove enableResourceGraph feature flag (#1681) * fetch subs and accounts via graph * fixed subscription rendering * add feature flag enableResourceGraph * add feature flag enableResourceGraph * remove enableResourceGraph feature flag --------- Co-authored-by: Asier Isayas --- src/hooks/useDatabaseAccounts.tsx | 6 +----- src/hooks/useSubscriptions.tsx | 4 +--- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/hooks/useDatabaseAccounts.tsx b/src/hooks/useDatabaseAccounts.tsx index 6de81a100..9a28afaad 100644 --- a/src/hooks/useDatabaseAccounts.tsx +++ b/src/hooks/useDatabaseAccounts.tsx @@ -1,6 +1,5 @@ import { HttpHeaders } from "Common/Constants"; import { QueryRequestOptions, QueryResponse } from "Contracts/AzureResourceGraph"; -import { userContext } from "UserContext"; import useSWR from "swr"; import { configContext } from "../ConfigContext"; import { DatabaseAccount } from "../Contracts/DataModels"; @@ -83,10 +82,7 @@ export async function fetchDatabaseAccountsFromGraph( export function useDatabaseAccounts(subscriptionId: string, armToken: string): DatabaseAccount[] | undefined { const { data } = useSWR( () => (armToken && subscriptionId ? ["databaseAccounts", subscriptionId, armToken] : undefined), - (_, subscriptionId, armToken) => - userContext.features.enableResourceGraph - ? fetchDatabaseAccountsFromGraph(subscriptionId, armToken) - : fetchDatabaseAccounts(subscriptionId, armToken), + (_, subscriptionId, armToken) => fetchDatabaseAccountsFromGraph(subscriptionId, armToken), ); return data; } diff --git a/src/hooks/useSubscriptions.tsx b/src/hooks/useSubscriptions.tsx index 11f1626dd..5fa7073be 100644 --- a/src/hooks/useSubscriptions.tsx +++ b/src/hooks/useSubscriptions.tsx @@ -1,6 +1,5 @@ import { HttpHeaders } from "Common/Constants"; import { QueryRequestOptions, QueryResponse } from "Contracts/AzureResourceGraph"; -import { userContext } from "UserContext"; import useSWR from "swr"; import { configContext } from "../ConfigContext"; import { Subscription } from "../Contracts/DataModels"; @@ -87,8 +86,7 @@ export async function fetchSubscriptionsFromGraph(accessToken: string): Promise< export function useSubscriptions(armToken: string): Subscription[] | undefined { const { data } = useSWR( () => (armToken ? ["subscriptions", armToken] : undefined), - (_, armToken) => - userContext.features.enableResourceGraph ? fetchSubscriptionsFromGraph(armToken) : fetchSubscriptions(armToken), + (_, armToken) => fetchSubscriptionsFromGraph(armToken), ); return data; }