Add fix for MPAC Tables account issue
This commit is contained in:
parent
caf4e9f51f
commit
039136794d
|
@ -169,14 +169,14 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
||||||
dataPlaneRbacEnabled: false,
|
dataPlaneRbacEnabled: false,
|
||||||
});
|
});
|
||||||
const { databaseAccount: account, subscriptionId, resourceGroup } = userContext;
|
const { databaseAccount: account, subscriptionId, resourceGroup } = userContext;
|
||||||
const keys: DatabaseAccountListKeysResult = await listKeys(subscriptionId, resourceGroup, account.name);
|
const keys: DatabaseAccountListKeysResult = await listKeys(subscriptionId, resourceGroup, account.name);
|
||||||
|
|
||||||
if (keys.primaryMasterKey) {
|
if (keys.primaryMasterKey) {
|
||||||
updateUserContext({ masterKey: keys.primaryMasterKey });
|
updateUserContext({ masterKey: keys.primaryMasterKey });
|
||||||
|
|
||||||
useDataPlaneRbac.setState({ dataPlaneRbacEnabled: false });
|
useDataPlaneRbac.setState({ dataPlaneRbacEnabled: false });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
LocalStorageUtility.setEntryBoolean(StorageKey.RUThresholdEnabled, ruThresholdEnabled);
|
LocalStorageUtility.setEntryBoolean(StorageKey.RUThresholdEnabled, ruThresholdEnabled);
|
||||||
LocalStorageUtility.setEntryBoolean(StorageKey.QueryTimeoutEnabled, queryTimeoutEnabled);
|
LocalStorageUtility.setEntryBoolean(StorageKey.QueryTimeoutEnabled, queryTimeoutEnabled);
|
||||||
|
|
|
@ -417,15 +417,20 @@ function configureEmulator(): Explorer {
|
||||||
return explorer;
|
return explorer;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchAndUpdateKeys(subscriptionId: string, resourceGroup: string, account: string) {
|
async function fetchAndUpdateKeys(subscriptionId: string, resourceGroup: string, account: string) {
|
||||||
try {
|
try {
|
||||||
updateUserContext({ listKeysFetchInProgress: true });
|
console.log("Starting to fetch keys...");
|
||||||
const keys = await listKeys(subscriptionId, resourceGroup, account);
|
const keys = await listKeys(subscriptionId, resourceGroup, account);
|
||||||
|
console.log("Keys fetched:", keys);
|
||||||
|
|
||||||
updateUserContext({ masterKey: keys.primaryMasterKey, listKeysFetchInProgress: false });
|
updateUserContext({
|
||||||
|
masterKey: keys.primaryMasterKey,
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("User context updated with master key.");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
updateUserContext({ listKeysFetchInProgress: false });
|
|
||||||
console.error("Error during fetching keys or updating user context:", error);
|
console.error("Error during fetching keys or updating user context:", error);
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,14 +488,8 @@ async function configurePortal(): Promise<Explorer> {
|
||||||
}
|
}
|
||||||
|
|
||||||
updateContextsFromPortalMessage(inputs);
|
updateContextsFromPortalMessage(inputs);
|
||||||
explorer = new Explorer();
|
|
||||||
resolve(explorer);
|
|
||||||
|
|
||||||
if (userContext.apiType === "Postgres" || userContext.apiType === "SQL" || userContext.apiType === "Mongo") {
|
const { databaseAccount: account, subscriptionId, resourceGroup } = userContext;
|
||||||
setTimeout(() => explorer.openNPSSurveyDialog(), 3000);
|
|
||||||
}
|
|
||||||
|
|
||||||
const { databaseAccount: account , subscriptionId, resourceGroup} = userContext;
|
|
||||||
|
|
||||||
if (userContext.apiType === "SQL") {
|
if (userContext.apiType === "SQL") {
|
||||||
if (LocalStorageUtility.hasItem(StorageKey.DataPlaneRbacEnabled)) {
|
if (LocalStorageUtility.hasItem(StorageKey.DataPlaneRbacEnabled)) {
|
||||||
|
@ -502,10 +501,8 @@ async function configurePortal(): Promise<Explorer> {
|
||||||
} else {
|
} else {
|
||||||
dataPlaneRbacEnabled = isDataPlaneRbacSetting === Constants.RBACOptions.setTrueRBACOption;
|
dataPlaneRbacEnabled = isDataPlaneRbacSetting === Constants.RBACOptions.setTrueRBACOption;
|
||||||
}
|
}
|
||||||
if(!dataPlaneRbacEnabled) {
|
if (!dataPlaneRbacEnabled) {
|
||||||
(async () => {
|
await fetchAndUpdateKeys(subscriptionId, resourceGroup, account.name);
|
||||||
await fetchAndUpdateKeys(subscriptionId, resourceGroup, account.name);
|
|
||||||
})();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateUserContext({ dataPlaneRbacEnabled });
|
updateUserContext({ dataPlaneRbacEnabled });
|
||||||
|
@ -513,20 +510,21 @@ async function configurePortal(): Promise<Explorer> {
|
||||||
} else {
|
} else {
|
||||||
const dataPlaneRbacEnabled = account.properties.disableLocalAuth;
|
const dataPlaneRbacEnabled = account.properties.disableLocalAuth;
|
||||||
|
|
||||||
if(!dataPlaneRbacEnabled) {
|
if (!dataPlaneRbacEnabled) {
|
||||||
(async () => {
|
await fetchAndUpdateKeys(subscriptionId, resourceGroup, account.name);
|
||||||
await fetchAndUpdateKeys(subscriptionId, resourceGroup, account.name);
|
}
|
||||||
})();
|
|
||||||
}
|
|
||||||
|
|
||||||
updateUserContext({ dataPlaneRbacEnabled });
|
updateUserContext({ dataPlaneRbacEnabled });
|
||||||
useDataPlaneRbac.setState({ dataPlaneRbacEnabled: dataPlaneRbacEnabled });
|
useDataPlaneRbac.setState({ dataPlaneRbacEnabled: dataPlaneRbacEnabled });
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
await fetchAndUpdateKeys(subscriptionId, resourceGroup, account.name);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
(async () => {
|
explorer = new Explorer();
|
||||||
await fetchAndUpdateKeys(subscriptionId, resourceGroup, account.name);
|
resolve(explorer);
|
||||||
})();
|
if (userContext.apiType === "Postgres" || userContext.apiType === "SQL" || userContext.apiType === "Mongo") {
|
||||||
|
setTimeout(() => explorer.openNPSSurveyDialog(), 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (openAction) {
|
if (openAction) {
|
||||||
|
@ -571,9 +569,9 @@ function updateContextsFromPortalMessage(inputs: DataExplorerInputsFrame) {
|
||||||
const authorizationToken = inputs.authorizationToken || "";
|
const authorizationToken = inputs.authorizationToken || "";
|
||||||
const databaseAccount = inputs.databaseAccount;
|
const databaseAccount = inputs.databaseAccount;
|
||||||
|
|
||||||
if(userContext.apiType !== "SQL") {
|
if (userContext.apiType !== "SQL") {
|
||||||
const masterKey = inputs.masterKey || "";
|
const masterKey = inputs.masterKey || "";
|
||||||
updateUserContext({masterKey});
|
updateUserContext({ masterKey });
|
||||||
}
|
}
|
||||||
|
|
||||||
updateConfigContext({
|
updateConfigContext({
|
||||||
|
|
Loading…
Reference in New Issue