mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-22 02:11:29 +00:00
Migrated Hosted Explorer to React (#360)
Co-authored-by: Victor Meng <vimeng@microsoft.com> Co-authored-by: Steve Faulkner <stfaul@microsoft.com>
This commit is contained in:
39
src/Platform/Hosted/Components/DirectoryPickerPanel.tsx
Normal file
39
src/Platform/Hosted/Components/DirectoryPickerPanel.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import { Panel, PanelType, ChoiceGroup } from "office-ui-fabric-react";
|
||||
import * as React from "react";
|
||||
import { useDirectories } from "../../../hooks/useDirectories";
|
||||
|
||||
interface Props {
|
||||
isOpen: boolean;
|
||||
dismissPanel: () => void;
|
||||
tenantId: string;
|
||||
armToken: string;
|
||||
switchTenant: (tenantId: string) => void;
|
||||
}
|
||||
|
||||
export const DirectoryPickerPanel: React.FunctionComponent<Props> = ({
|
||||
isOpen,
|
||||
dismissPanel,
|
||||
armToken,
|
||||
tenantId,
|
||||
switchTenant
|
||||
}: Props) => {
|
||||
const directories = useDirectories(armToken);
|
||||
return (
|
||||
<Panel
|
||||
type={PanelType.medium}
|
||||
headerText="Select Directory"
|
||||
isOpen={isOpen}
|
||||
onDismiss={dismissPanel}
|
||||
closeButtonAriaLabel="Close"
|
||||
>
|
||||
<ChoiceGroup
|
||||
options={directories.map(dir => ({ key: dir.tenantId, text: `${dir.displayName} (${dir.tenantId})` }))}
|
||||
selectedKey={tenantId}
|
||||
onChange={(event, option) => {
|
||||
switchTenant(option.key);
|
||||
dismissPanel();
|
||||
}}
|
||||
/>
|
||||
</Panel>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user