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 <aisayas@microsoft.com>
This commit is contained in:
parent
bc68b4dbf9
commit
1726e4df51
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue