Skip to content

Commit

Permalink
Mongo Shell and MS Graph changes (no RBAC functionality)
Browse files Browse the repository at this point in the history
  • Loading branch information
Asier Isayas committed Jul 11, 2024
1 parent 17754cb commit 12442fa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/Contracts/AzureResourceGraph.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
export interface QueryRequestOptions {
$skipToken?: string;
$top?: number;
subscriptions: string[];
$allowPartialScopes: boolean;
subscriptions?: string[];
}

export interface QueryResponse {
Expand Down
9 changes: 8 additions & 1 deletion src/Explorer/Tabs/MongoShellTab/MongoShellTabComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useMongoProxyEndpoint } from "Common/MongoProxyClient";
import React, { Component } from "react";
import * as Constants from "../../../Common/Constants";
import { configContext } from "../../../ConfigContext";
import * as ViewModels from "../../../Contracts/ViewModels";
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
Expand Down Expand Up @@ -112,6 +113,12 @@ export default class MongoShellTabComponent extends Component<
const resourceId = databaseAccount?.id;
const accountName = databaseAccount?.name;
const documentEndpoint = databaseAccount?.properties.mongoEndpoint || databaseAccount?.properties.documentEndpoint;
const mongoEndpoint =
documentEndpoint.substr(
Constants.MongoDBAccounts.protocol.length + 3,
documentEndpoint.length -
(Constants.MongoDBAccounts.protocol.length + 2 + Constants.MongoDBAccounts.defaultPort.length),
) + Constants.MongoDBAccounts.defaultPort.toString();
const databaseId = this.props.collection.databaseId;
const collectionId = this.props.collection.id();
const apiEndpoint = this._useMongoProxyEndpoint
Expand All @@ -125,7 +132,7 @@ export default class MongoShellTabComponent extends Component<
data: {
resourceId: resourceId,
accountName: accountName,
mongoEndpoint: documentEndpoint,
mongoEndpoint: this._useMongoProxyEndpoint ? documentEndpoint : mongoEndpoint,
authorization: authorization,
databaseId: databaseId,
collectionId: collectionId,
Expand Down
18 changes: 7 additions & 11 deletions src/hooks/useSubscriptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,13 @@ export async function fetchSubscriptionsFromGraph(accessToken: string): Promise<
do {
const body = {
query: subscriptionsQuery,
...(skipToken
? {
options: {
$skipToken: skipToken,
} as QueryRequestOptions,
}
: {
options: {
$top: 150,
} as QueryRequestOptions,
}),
options: {
$allowPartialScopes: true,
$top: 150,
...(skipToken && {
$skipToken: skipToken,
}),
} as QueryRequestOptions,
};

const response = await fetch(managementResourceGraphAPIURL, {
Expand Down

0 comments on commit 12442fa

Please sign in to comment.