mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Connections: Stop using dataConnectionsConsole
feature toggle (#72111)
* remove dataConnectionsConsole feature toggle * fix imports * reintroduce dataConnectionsConsole To prevent breaking change
This commit is contained in:
parent
84f94cdc24
commit
b08271da32
@ -294,7 +294,6 @@ func TestAddAppLinks(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Should replace page from plugin", func(t *testing.T) {
|
t.Run("Should replace page from plugin", func(t *testing.T) {
|
||||||
service.features = featuremgmt.WithFeatures(featuremgmt.FlagDataConnectionsConsole)
|
|
||||||
service.navigationAppConfig = map[string]NavigationAppConfig{}
|
service.navigationAppConfig = map[string]NavigationAppConfig{}
|
||||||
service.navigationAppPathConfig = map[string]NavigationAppConfig{
|
service.navigationAppPathConfig = map[string]NavigationAppConfig{
|
||||||
"/connections/add-new-connection": {SectionID: "connections"},
|
"/connections/add-new-connection": {SectionID: "connections"},
|
||||||
@ -334,7 +333,6 @@ func TestAddAppLinks(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Should not register pages under the app plugin section unless AddToNav=true", func(t *testing.T) {
|
t.Run("Should not register pages under the app plugin section unless AddToNav=true", func(t *testing.T) {
|
||||||
service.features = featuremgmt.WithFeatures(featuremgmt.FlagDataConnectionsConsole)
|
|
||||||
service.navigationAppPathConfig = map[string]NavigationAppConfig{} // We don't configure it as a standalone plugin page
|
service.navigationAppPathConfig = map[string]NavigationAppConfig{} // We don't configure it as a standalone plugin page
|
||||||
|
|
||||||
treeRoot := navtree.NavTreeRoot{}
|
treeRoot := navtree.NavTreeRoot{}
|
||||||
|
@ -142,10 +142,8 @@ func (s *ServiceImpl) GetNavTree(c *contextmodel.ReqContext, prefs *pref.Prefere
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.features.IsEnabled(featuremgmt.FlagDataConnectionsConsole) {
|
if connectionsSection := s.buildDataConnectionsNavLink(c); connectionsSection != nil {
|
||||||
if connectionsSection := s.buildDataConnectionsNavLink(c); connectionsSection != nil {
|
treeRoot.AddSection(connectionsSection)
|
||||||
treeRoot.AddSection(connectionsSection)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
orgAdminNode, err := s.getAdminNode(c)
|
orgAdminNode, err := s.getAdminNode(c)
|
||||||
|
@ -1,21 +1,16 @@
|
|||||||
import { SafeDynamicImport } from 'app/core/components/DynamicImports/SafeDynamicImport';
|
import { SafeDynamicImport } from 'app/core/components/DynamicImports/SafeDynamicImport';
|
||||||
import { config } from 'app/core/config';
|
|
||||||
import { RouteDescriptor } from 'app/core/navigation/types';
|
import { RouteDescriptor } from 'app/core/navigation/types';
|
||||||
|
|
||||||
import { ROUTE_BASE_ID } from './constants';
|
import { ROUTE_BASE_ID } from './constants';
|
||||||
|
|
||||||
export function getRoutes(): RouteDescriptor[] {
|
export function getRoutes(): RouteDescriptor[] {
|
||||||
if (config.featureToggles.dataConnectionsConsole) {
|
return [
|
||||||
return [
|
{
|
||||||
{
|
path: `/${ROUTE_BASE_ID}`,
|
||||||
path: `/${ROUTE_BASE_ID}`,
|
exact: false,
|
||||||
exact: false,
|
component: SafeDynamicImport(
|
||||||
component: SafeDynamicImport(
|
() => import(/* webpackChunkName: "Connections"*/ 'app/features/connections/Connections')
|
||||||
() => import(/* webpackChunkName: "Connections"*/ 'app/features/connections/Connections')
|
),
|
||||||
),
|
},
|
||||||
},
|
];
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
return [];
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { DataSourcePluginMeta } from '@grafana/data';
|
import { DataSourcePluginMeta } from '@grafana/data';
|
||||||
import { config } from '@grafana/runtime';
|
|
||||||
import { LinkButton } from '@grafana/ui';
|
import { LinkButton } from '@grafana/ui';
|
||||||
import { DataSourcePluginCategory } from 'app/types';
|
import { DataSourcePluginCategory } from 'app/types';
|
||||||
|
|
||||||
@ -18,9 +17,7 @@ export type Props = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function DataSourceCategories({ categories, onClickDataSourceType }: Props) {
|
export function DataSourceCategories({ categories, onClickDataSourceType }: Props) {
|
||||||
const moreDataSourcesLink = config.featureToggles.dataConnectionsConsole
|
const moreDataSourcesLink = `${ROUTES.AddNewConnection}?cat=data-source`;
|
||||||
? `${ROUTES.AddNewConnection}?cat=data-source`
|
|
||||||
: '/plugins?filterBy=all&filterByType=datasource&utm_source=grafana_add_ds';
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { LinkButton, ButtonVariant } from '@grafana/ui';
|
import { LinkButton, ButtonVariant } from '@grafana/ui';
|
||||||
import { config } from 'app/core/config';
|
|
||||||
import { contextSrv } from 'app/core/core';
|
import { contextSrv } from 'app/core/core';
|
||||||
import { ROUTES as CONNECTIONS_ROUTES } from 'app/features/connections/constants';
|
import { ROUTES as CONNECTIONS_ROUTES } from 'app/features/connections/constants';
|
||||||
import { DATASOURCES_ROUTES } from 'app/features/datasources/constants';
|
|
||||||
import { AccessControlAction } from 'app/types';
|
import { AccessControlAction } from 'app/types';
|
||||||
|
|
||||||
interface AddNewDataSourceButtonProps {
|
interface AddNewDataSourceButtonProps {
|
||||||
@ -14,9 +12,7 @@ interface AddNewDataSourceButtonProps {
|
|||||||
|
|
||||||
export function AddNewDataSourceButton({ variant, onClick }: AddNewDataSourceButtonProps) {
|
export function AddNewDataSourceButton({ variant, onClick }: AddNewDataSourceButtonProps) {
|
||||||
const hasCreateRights = contextSrv.hasPermission(AccessControlAction.DataSourcesCreate);
|
const hasCreateRights = contextSrv.hasPermission(AccessControlAction.DataSourcesCreate);
|
||||||
const newDataSourceURL = config.featureToggles.dataConnectionsConsole
|
const newDataSourceURL = CONNECTIONS_ROUTES.DataSourcesNew;
|
||||||
? CONNECTIONS_ROUTES.DataSourcesNew
|
|
||||||
: DATASOURCES_ROUTES.New;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LinkButton
|
<LinkButton
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { config } from '@grafana/runtime';
|
|
||||||
import { Page } from 'app/core/components/Page/Page';
|
import { Page } from 'app/core/components/Page/Page';
|
||||||
import { ConnectionsRedirectNotice } from 'app/features/connections/components/ConnectionsRedirectNotice';
|
import { ConnectionsRedirectNotice } from 'app/features/connections/components/ConnectionsRedirectNotice';
|
||||||
import { StoreState, useSelector } from 'app/types';
|
import { StoreState, useSelector } from 'app/types';
|
||||||
@ -16,7 +15,7 @@ export function DataSourcesListPage() {
|
|||||||
return (
|
return (
|
||||||
<Page navId="datasources" actions={actions}>
|
<Page navId="datasources" actions={actions}>
|
||||||
<Page.Contents>
|
<Page.Contents>
|
||||||
{config.featureToggles.dataConnectionsConsole && <ConnectionsRedirectNotice />}
|
<ConnectionsRedirectNotice />
|
||||||
<DataSourcesList />
|
<DataSourcesList />
|
||||||
</Page.Contents>
|
</Page.Contents>
|
||||||
</Page>
|
</Page>
|
||||||
|
@ -298,9 +298,7 @@ export function deleteLoadedDataSource(): ThunkResult<void> {
|
|||||||
await api.deleteDataSource(uid);
|
await api.deleteDataSource(uid);
|
||||||
await getDatasourceSrv().reload();
|
await getDatasourceSrv().reload();
|
||||||
|
|
||||||
const datasourcesUrl = config.featureToggles.dataConnectionsConsole
|
const datasourcesUrl = CONNECTIONS_ROUTES.DataSources;
|
||||||
? CONNECTIONS_ROUTES.DataSources
|
|
||||||
: '/datasources';
|
|
||||||
|
|
||||||
locationService.push(datasourcesUrl);
|
locationService.push(datasourcesUrl);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -3,7 +3,7 @@ import React, { ReactElement } from 'react';
|
|||||||
import { useLocation } from 'react-router-dom';
|
import { useLocation } from 'react-router-dom';
|
||||||
|
|
||||||
import { SelectableValue, GrafanaTheme2, PluginType } from '@grafana/data';
|
import { SelectableValue, GrafanaTheme2, PluginType } from '@grafana/data';
|
||||||
import { config, locationSearchToObject } from '@grafana/runtime';
|
import { locationSearchToObject } from '@grafana/runtime';
|
||||||
import { LoadingPlaceholder, Select, RadioButtonGroup, useStyles2, Tooltip, Field } from '@grafana/ui';
|
import { LoadingPlaceholder, Select, RadioButtonGroup, useStyles2, Tooltip, Field } from '@grafana/ui';
|
||||||
import { Page } from 'app/core/components/Page/Page';
|
import { Page } from 'app/core/components/Page/Page';
|
||||||
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
|
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
|
||||||
@ -67,7 +67,7 @@ export default function Browse({ route }: GrafanaRouteComponentProps): ReactElem
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const subTitle = config.featureToggles.dataConnectionsConsole ? (
|
const subTitle = (
|
||||||
<div>
|
<div>
|
||||||
Extend the Grafana experience with panel plugins and apps. To find more data sources go to{' '}
|
Extend the Grafana experience with panel plugins and apps. To find more data sources go to{' '}
|
||||||
<a className="external-link" href={`${CONNECTIONS_ROUTES.AddNewConnection}?cat=data-source`}>
|
<a className="external-link" href={`${CONNECTIONS_ROUTES.AddNewConnection}?cat=data-source`}>
|
||||||
@ -75,8 +75,6 @@ export default function Browse({ route }: GrafanaRouteComponentProps): ReactElem
|
|||||||
</a>
|
</a>
|
||||||
.
|
.
|
||||||
</div>
|
</div>
|
||||||
) : (
|
|
||||||
<div>Extend the Grafana experience with panel plugins and apps.</div>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user