mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Serverless Search] Create anchor to ingest data section in Get started (#169871)
## Summary
Creates an anchor `/#ingestData` to Ingest Data section in Get started
page.
### Screen Recording
58e52abb
-4c66-4a41-a827-d34810d84c3d
---------
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
6698810958
commit
b601f9af7b
3 changed files with 31 additions and 2 deletions
|
@ -5,9 +5,15 @@
|
|||
* 2.0.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { render, core } from '../../test/test_utils';
|
||||
import { ElasticsearchOverview as Overview } from './overview';
|
||||
|
||||
jest.mock('react-router-dom', () => ({
|
||||
...jest.requireActual('react-router-dom'),
|
||||
useLocation: jest.fn(),
|
||||
}));
|
||||
|
||||
describe('<Overview />', () => {
|
||||
beforeEach(() => {
|
||||
core.http.fetch.mockImplementation((url) => {
|
||||
|
@ -29,6 +35,10 @@ describe('<Overview />', () => {
|
|||
}
|
||||
});
|
||||
});
|
||||
const pathname = '/app/elasticsearch';
|
||||
(useLocation as jest.Mock).mockImplementationOnce(() => ({
|
||||
pathname,
|
||||
}));
|
||||
});
|
||||
|
||||
test('renders without throwing an error', () => {
|
||||
|
|
|
@ -32,13 +32,14 @@ import {
|
|||
getConsoleRequest,
|
||||
} from '@kbn/search-api-panels';
|
||||
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import type {
|
||||
LanguageDefinition,
|
||||
LanguageDefinitionSnippetArguments,
|
||||
} from '@kbn/search-api-panels';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { Connector } from '@kbn/search-connectors';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { docLinks } from '../../../common/doc_links';
|
||||
import { PLUGIN_ID } from '../../../common';
|
||||
import { useKibanaServices } from '../hooks/use_kibana';
|
||||
|
@ -70,6 +71,16 @@ export const ElasticsearchOverview = () => {
|
|||
apiKey: clientApiKey,
|
||||
cloudId,
|
||||
};
|
||||
const { hash } = useLocation();
|
||||
useEffect(() => {
|
||||
if (hash) {
|
||||
const id = hash.replace('#', '');
|
||||
const element = document.getElementById(id);
|
||||
if (element) {
|
||||
element.scrollIntoView({ behavior: 'smooth' });
|
||||
}
|
||||
}
|
||||
}, [hash]);
|
||||
|
||||
const { data: _data } = useQuery({
|
||||
queryKey: ['fetchConnectors'],
|
||||
|
@ -279,6 +290,7 @@ export const ElasticsearchOverview = () => {
|
|||
/>
|
||||
</EuiPageTemplate.Section>
|
||||
<EuiPageTemplate.Section
|
||||
id="ingestData"
|
||||
color="subdued"
|
||||
bottomBorder="extended"
|
||||
data-test-subj="ingest-client-section"
|
||||
|
|
|
@ -13,6 +13,7 @@ import { I18nProvider } from '@kbn/i18n-react';
|
|||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
|
||||
import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme';
|
||||
import { Route, Router, Routes } from '@kbn/shared-ux-router';
|
||||
import { ServerlessSearchContext } from './hooks/use_kibana';
|
||||
|
||||
export async function renderApp(
|
||||
|
@ -28,7 +29,13 @@ export async function renderApp(
|
|||
<QueryClientProvider client={queryClient}>
|
||||
<ReactQueryDevtools initialIsOpen={false} />
|
||||
<I18nProvider>
|
||||
<ElasticsearchOverview />
|
||||
<Router history={services.history}>
|
||||
<Routes>
|
||||
<Route>
|
||||
<ElasticsearchOverview />
|
||||
</Route>
|
||||
</Routes>
|
||||
</Router>
|
||||
</I18nProvider>
|
||||
</QueryClientProvider>
|
||||
</KibanaContextProvider>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue