mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-19 17:01:13 +00:00
Cleanup DP RBAC code
This commit is contained in:
@@ -15,6 +15,7 @@ import OpenQueryFromDiskIcon from "../../../../images/OpenQueryFromDisk.svg";
|
||||
import OpenInTabIcon from "../../../../images/open-in-tab.svg";
|
||||
import SettingsIcon from "../../../../images/settings_15x15.svg";
|
||||
import SynapseIcon from "../../../../images/synapse-link.svg";
|
||||
import EntraIDIcon from "../../../../images/EntraID.svg";
|
||||
import { AuthType } from "../../../AuthType";
|
||||
import * as Constants from "../../../Common/Constants";
|
||||
import { Platform, configContext } from "../../../ConfigContext";
|
||||
@@ -69,6 +70,15 @@ export function createStaticCommandBarButtons(
|
||||
}
|
||||
}
|
||||
|
||||
if (userContext.apiType === "SQL") {
|
||||
const addLoginForEntraIDBtn = createLoginForEntraIDButton(container);
|
||||
|
||||
if (addLoginForEntraIDBtn) {
|
||||
addDivider();
|
||||
buttons.push(addLoginForEntraIDBtn);
|
||||
}
|
||||
}
|
||||
|
||||
if (userContext.apiType !== "Tables") {
|
||||
newCollectionBtn.children = [createNewCollectionGroup(container)];
|
||||
const newDatabaseBtn = createNewDatabase(container);
|
||||
@@ -275,6 +285,22 @@ function createOpenSynapseLinkDialogButton(container: Explorer): CommandButtonCo
|
||||
};
|
||||
}
|
||||
|
||||
function createLoginForEntraIDButton(container: Explorer): CommandButtonComponentProps {
|
||||
if (configContext.platform !== Platform.Portal) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const label = "Login for Entra ID RBAC";
|
||||
return {
|
||||
iconSrc: EntraIDIcon,
|
||||
iconAlt: label,
|
||||
onCommandClick: () => container.openLoginForEntraIDPopUp(),
|
||||
commandButtonLabel: label,
|
||||
hasPopup: true,
|
||||
ariaLabel: label,
|
||||
};
|
||||
}
|
||||
|
||||
function createNewDatabase(container: Explorer): CommandButtonComponentProps {
|
||||
const label = "New " + getDatabaseName();
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user