Compare commits

...

42 Commits

Author SHA1 Message Date
Senthamil Sindhu
22144982bd Merge branch 'users/sindhuba/rbac-fix' into users/sindhuba/fix-tables-api 2024-07-03 00:09:45 -07:00
Senthamil Sindhu
3e48393fbb Merge branch 'master' of https://github.com/Azure/cosmos-explorer 2024-07-03 00:07:17 -07:00
Senthamil Sindhu
9274f50500 Address bug in fetching data for Tables Account 2024-07-03 00:02:29 -07:00
Senthamil Sindhu
8b4d9bd354 Run format 2024-07-01 16:44:43 -07:00
Senthamil Sindhu
2c78625f83 Merge branch 'users/sindhuba/rbac' into users/sindhuba/rbac-fix 2024-07-01 16:32:56 -07:00
Senthamil Sindhu
0079a9147f Resolved merge conflict 2024-07-01 16:22:04 -07:00
Senthamil Sindhu
602a697fe9 Address lint error 2024-07-01 16:16:40 -07:00
Senthamil Sindhu
28d8216b32 Run npm format 2024-07-01 16:09:47 -07:00
Senthamil Sindhu
3b9261ef76 Address Local storage default setting issue 2024-07-01 16:08:08 -07:00
Senthamil Sindhu
6be839991f Run npm format 2024-07-01 08:22:12 -07:00
Senthamil Sindhu
72eca5ed79 Fix Tables test 2024-06-28 10:49:01 -07:00
Senthamil Sindhu
473a6d34bd Add new fixes 2024-06-27 23:20:05 -07:00
Senthamil Sindhu
912688dc14 Merge branch 'master' of https://github.com/Azure/cosmos-explorer 2024-06-27 11:00:31 -07:00
Senthamil Sindhu
805d72c55b Minor fix 2024-06-27 09:49:00 -07:00
Senthamil Sindhu
eb7c737066 Address feedback comments 2024-06-27 09:37:08 -07:00
Senthamil Sindhu
478467bda5 Fix enable AAD dataplane feature flag behavior 2024-06-25 16:27:40 -07:00
Senthamil Sindhu
fd3a83dcd8 Fix enableAadDataPlane feature flag behavior 2024-06-25 15:37:08 -07:00
Senthamil Sindhu
713df1869a Run npm format 2024-06-25 12:15:59 -07:00
Senthamil Sindhu
192a275139 Remove unnecessary code 2024-06-25 12:09:43 -07:00
Senthamil Sindhu
77ee359adb Fix unit tests 2024-06-25 10:23:01 -07:00
Senthamil Sindhu
a50108c375 Run format 2024-06-25 09:59:21 -07:00
Senthamil Sindhu
d3fb5eabdb Cleanup DP RBAC code 2024-06-25 09:28:08 -07:00
Senthamil Sindhu
4792e2d1c7 Address errors and checks 2024-06-19 21:00:55 -07:00
Senthamil Sindhu
8849526fab Merge branch 'add-dp-rbac' of https://github.com/Azure/cosmos-explorer 2024-06-19 15:20:20 -07:00
Senthamil Sindhu
24af64a66d Add additional changes for Portal RBAC functionality 2024-06-19 15:05:14 -07:00
Senthamil Sindhu
be871737ad Support data plane RBAC 2024-06-14 12:45:21 -07:00
Senthamil Sindhu
4d8bb5c3ea Merge branch 'master' of https://github.com/Azure/cosmos-explorer 2024-06-14 12:18:14 -07:00
Senthamil Sindhu
10a8505b9a Support data plane RBAC 2024-06-14 12:12:30 -07:00
Senthamil Sindhu
ef7c2fe2f7 Remove dev endpoint 2024-04-10 11:59:57 -07:00
Senthamil Sindhu
4c7aca95e1 Merge branch 'users/aisayas/mp-cp-activate-prod' of https://github.com/Azure/cosmos-explorer into users/sindhuba/activate-prod 2024-04-09 12:27:51 -07:00
Senthamil Sindhu
2243ad895a Remove prod endpoint 2024-04-09 12:16:13 -07:00
Senthamil Sindhu
b2d5f91fe1 Remove prod 2024-04-09 11:22:17 -07:00
Asier Isayas
a712193477 fix pr check tests 2024-04-09 11:43:24 -04:00
Senthamil Sindhu
5ee411693c Add prod endpoint 2024-04-09 08:41:47 -07:00
Asier Isayas
16c7b2567b fix bug that blocked local mongo proxy and cassandra proxy development 2024-04-09 11:39:11 -04:00
Senthamil Sindhu
78d9a0cd8d Revert code 2024-04-08 16:20:40 -07:00
Senthamil Sindhu
c6ad538559 Run npm format and tests 2024-04-08 15:58:10 -07:00
Senthamil Sindhu
2bc09a6efe Add CP Prod endpoint 2024-04-08 15:37:19 -07:00
Senthamil Sindhu
d3a3033b25 Merge branch 'master' of https://github.com/Azure/cosmos-explorer 2024-04-08 15:32:50 -07:00
Asier Isayas
6bdc714e11 activate Mongo Proxy and Cassandra Proxy in Prod 2024-04-08 16:52:09 -04:00
Senthamil Sindhu
5042f28229 Merge branch 'master' of https://github.com/Azure/cosmos-explorer 2024-03-25 15:11:53 -07:00
Senthamil Sindhu
e1430fd06f Fix API endpoint for CassandraProxy query API 2024-03-18 10:25:17 -07:00
3 changed files with 27 additions and 4 deletions

View File

@@ -81,6 +81,12 @@ export const tokenProvider = async (requestInfo: Cosmos.RequestInfo) => {
}
}
let retryAttempts: number = 50;
while (retryAttempts > 0 && userContext.listKeysFetchInProgress) {
retryAttempts--;
await sleep(100);
}
if (userContext.masterKey) {
// TODO This SDK method mutates the headers object. Find a better one or fix the SDK.
await Cosmos.setAuthorizationTokenHeaderUsingMasterKey(
@@ -118,6 +124,10 @@ export const tokenProvider = async (requestInfo: Cosmos.RequestInfo) => {
return decodeURIComponent(result.PrimaryReadWriteToken);
};
function sleep(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
export const requestPlugin: Cosmos.Plugin<any> = async (requestContext, diagnosticNode, next) => {
requestContext.endpoint = new URL(configContext.PROXY_PATH, window.location.href).href;
requestContext.headers["x-ms-proxy-target"] = endpoint();

View File

@@ -73,6 +73,7 @@ export interface UserContext {
readonly fabricContext?: FabricContext;
readonly authType?: AuthType;
readonly masterKey?: string;
readonly listKeysFetchInProgress?: boolean;
readonly subscriptionId?: string;
readonly resourceGroup?: string;
readonly databaseAccount?: DatabaseAccount;

View File

@@ -499,10 +499,9 @@ async function configurePortal(): Promise<Explorer> {
useDataPlaneRbac.setState({ dataPlaneRbacEnabled: dataPlaneRbacEnabled });
}
} else {
const keys: DatabaseAccountListKeysResult = await listKeys(subscriptionId, resourceGroup, account.name);
updateUserContext({
masterKey: keys.primaryMasterKey,
});
(async () => {
await fetchAndUpdateKeys(subscriptionId, resourceGroup, account.name);
})();
}
if (openAction) {
@@ -530,6 +529,18 @@ async function configurePortal(): Promise<Explorer> {
});
}
async function fetchAndUpdateKeys(subscriptionId: string, resourceGroup: string, account: string) {
try {
updateUserContext({ listKeysFetchInProgress: true });
const keys = await listKeys(subscriptionId, resourceGroup, account);
updateUserContext({ masterKey: keys.primaryMasterKey, listKeysFetchInProgress: false });
} catch (error) {
updateUserContext({ listKeysFetchInProgress: false });
console.error("Error during fetching keys or updating user context:", error);
}
}
function shouldForwardMessage(message: PortalMessage, messageOrigin: string) {
// Only allow forwarding messages from the same origin
return messageOrigin === window.document.location.origin && message.type === MessageTypes.TelemetryInfo;
@@ -567,6 +578,7 @@ function updateContextsFromPortalMessage(inputs: DataExplorerInputsFrame) {
collectionCreationDefaults: inputs.defaultCollectionThroughput,
isTryCosmosDBSubscription: inputs.isTryCosmosDBSubscription,
feedbackPolicies: inputs.feedbackPolicies,
listKeysFetchInProgress: false,
});
if (inputs.isPostgresAccount) {