MCPcopy Index your code
hub / github.com/microsoft/SandDance / DataSourceButton

Function DataSourceButton

docs/app/js/sanddance-app.js:51690–51743  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

51688var _sanddanceExplorer = require("@msrvida/sanddance-explorer");
51689var _react = require("react");
51690function DataSourceButton(props) {
51691 const picker = props.getPicker();
51692 if (!picker) return null;
51693 const menuProps = {
51694 items: [
51695 {
51696 key: "sample-section",
51697 itemType: (0, _base.base).fluentUI.ContextualMenuItemType.Section,
51698 sectionProps: {
51699 title: (0, _language.strings).sampleDataPrefix,
51700 items: props.dataSources.map((ds, i)=>{
51701 const item = {
51702 key: ds.id,
51703 text: ds.displayName,
51704 onClick: (e)=>{
51705 picker.changeDataSource(ds);
51706 }
51707 };
51708 return item;
51709 })
51710 }
51711 },
51712 {
51713 key: "user-section",
51714 itemType: (0, _base.base).fluentUI.ContextualMenuItemType.Section,
51715 sectionProps: {
51716 topDivider: true,
51717 title: (0, _language.strings).menuUserData,
51718 items: [
51719 {
51720 key: "local",
51721 text: (0, _language.strings).menuLocal,
51722 onClick: (e)=>picker.setState({
51723 dialogMode: "local"
51724 })
51725 },
51726 {
51727 key: "url",
51728 text: (0, _language.strings).menuUrl,
51729 onClick: (e)=>picker.setState({
51730 dialogMode: "url"
51731 })
51732 }
51733 ]
51734 }
51735 }
51736 ]
51737 };
51738 return /*#__PURE__*/ _react.createElement((0, _base.base).fluentUI.PrimaryButton, {
51739 className: "sanddance-datasource-picker",
51740 text: dataSourcePrefix(props.dataSource.dataSourceType, props.dataSource.displayName),
51741 menuProps: menuProps
51742 });
51743}
51744class DataSourcePicker extends _react.Component {
51745 constructor(props){
51746 super(props);

Callers

nothing calls this directly

Calls 2

dataSourcePrefixFunction · 0.70
changeDataSourceMethod · 0.45

Tested by

no test coverage detected