diff --git a/lerna.json b/lerna.json index f174892e686..78f2726b208 100644 --- a/lerna.json +++ b/lerna.json @@ -1,8 +1,6 @@ { "npmClient": "yarn", "useWorkspaces": true, - "packages": [ - "packages/*" - ], + "packages": ["packages/*"], "version": "10.1.0-pre" } diff --git a/public/app/features/datasources/components/picker/AddNewDataSourceButton.tsx b/public/app/features/datasources/components/picker/AddNewDataSourceButton.tsx new file mode 100644 index 00000000000..256ce1ef89e --- /dev/null +++ b/public/app/features/datasources/components/picker/AddNewDataSourceButton.tsx @@ -0,0 +1,32 @@ +import React from 'react'; + +import { LinkButton, ButtonVariant } from '@grafana/ui'; +import { config } from 'app/core/config'; +import { contextSrv } from 'app/core/core'; +import { ROUTES as CONNECTIONS_ROUTES } from 'app/features/connections/constants'; +import { DATASOURCES_ROUTES } from 'app/features/datasources/constants'; +import { AccessControlAction } from 'app/types'; + +interface AddNewDataSourceButtonProps { + onClick?: () => void; + variant?: ButtonVariant; +} + +export function AddNewDataSourceButton({ variant, onClick }: AddNewDataSourceButtonProps) { + const hasCreateRights = contextSrv.hasPermission(AccessControlAction.DataSourcesCreate); + const newDataSourceURL = config.featureToggles.dataConnectionsConsole + ? CONNECTIONS_ROUTES.DataSourcesNew + : DATASOURCES_ROUTES.New; + + return ( + + Configure a new data source + + ); +} diff --git a/public/app/features/datasources/components/picker/DataSourceDropdown.tsx b/public/app/features/datasources/components/picker/DataSourceDropdown.tsx index 560d54dbec3..21166c00d55 100644 --- a/public/app/features/datasources/components/picker/DataSourceDropdown.tsx +++ b/public/app/features/datasources/components/picker/DataSourceDropdown.tsx @@ -25,6 +25,7 @@ const INTERACTION_ITEM = { SELECT_DS: 'select_ds', ADD_FILE: 'add_file', OPEN_ADVANCED_DS_PICKER: 'open_advanced_ds_picker', + CONFIG_NEW_DS_EMPTY_STATE: 'config_new_ds_empty_state', }; export function DataSourceDropdown(props: DataSourceDropdownProps) { @@ -205,16 +206,19 @@ const PickerContent = React.forwardRef((prop return (
-
- matchDataSourceWithSearch(ds, filterTerm)} - > -
- + matchDataSourceWithSearch(ds, filterTerm)} + onClickEmptyStateCTA={() => + reportInteraction(INTERACTION_EVENT_NAME, { + item: INTERACTION_ITEM.CONFIG_NEW_DS_EMPTY_STATE, + }) + } + >
{onClickAddCSV && config.featureToggles.editPanelCSVDragAndDrop && (
- { reportInteraction(INTERACTION_EVENT_NAME, { item: INTERACTION_ITEM.CONFIG_NEW_DS, src: analyticsInteractionSrc, }); }} - > - Configure a new data source - + />
@@ -203,6 +197,9 @@ function getDataSourceModalStyles(theme: GrafanaTheme2) { flex: 1; margin-bottom: ${theme.spacing(4)}; `, + dataSourceList: css` + height: 100%; + `, builtInDataSourceList: css` margin-bottom: ${theme.spacing(4)}; `,