[Logs UI] Fix base path in tutorial URLs (#55459)
This fixes the way the base path is prepended to several tutorial URLs, which broke with #52867. fixes #55350
This commit is contained in:
parent
a75436d93e
commit
4bd329e589
|
@ -6,8 +6,9 @@
|
|||
|
||||
import { EuiButton, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { identity } from 'fp-ts/lib/function';
|
||||
import React, { useContext } from 'react';
|
||||
|
||||
import { SnapshotPageContent } from './page_content';
|
||||
import { SnapshotToolbar } from './toolbar';
|
||||
|
||||
|
@ -38,10 +39,11 @@ export const SnapshotPage = () => {
|
|||
loadSource,
|
||||
metricIndicesExist,
|
||||
} = useContext(Source.Context);
|
||||
const basePath = useKibana().services.http?.basePath || '';
|
||||
useTrackPageview({ app: 'infra_metrics', path: 'inventory' });
|
||||
useTrackPageview({ app: 'infra_metrics', path: 'inventory', delay: 15000 });
|
||||
|
||||
const prependBasePath = useKibana().services.http?.basePath.prepend ?? identity;
|
||||
|
||||
return (
|
||||
<ColumnarPage>
|
||||
<DocumentTitle
|
||||
|
@ -78,7 +80,7 @@ export const SnapshotPage = () => {
|
|||
<EuiFlexGroup>
|
||||
<EuiFlexItem>
|
||||
<EuiButton
|
||||
href={`${basePath}/app/kibana#/home/tutorial_directory/metrics`}
|
||||
href={prependBasePath('/app/kibana#/home/tutorial_directory/metrics')}
|
||||
color="primary"
|
||||
fill
|
||||
data-test-subj="infrastructureViewSetupInstructionsButton"
|
||||
|
|
|
@ -6,19 +6,24 @@
|
|||
|
||||
import { EuiButton, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { identity } from 'fp-ts/lib/function';
|
||||
import React from 'react';
|
||||
|
||||
import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public';
|
||||
import { NoIndices } from '../../../components/empty_states/no_indices';
|
||||
import {
|
||||
ViewSourceConfigurationButton,
|
||||
ViewSourceConfigurationButtonHrefBase,
|
||||
} from '../../../components/source_configuration';
|
||||
import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public';
|
||||
|
||||
export const LogsPageNoIndicesContent = () => {
|
||||
const basePath = useKibana().services.http?.basePath || '';
|
||||
const uiCapabilities = useKibana().services.application?.capabilities;
|
||||
const {
|
||||
services: { application, http },
|
||||
} = useKibana<{}>();
|
||||
|
||||
const canConfigureSource = application?.capabilities?.logs?.configureSource ? true : false;
|
||||
const prependBasePath = http?.basePath.prepend ?? identity;
|
||||
|
||||
return (
|
||||
<NoIndices
|
||||
data-test-subj="noLogsIndicesPrompt"
|
||||
|
@ -32,7 +37,7 @@ export const LogsPageNoIndicesContent = () => {
|
|||
<EuiFlexGroup>
|
||||
<EuiFlexItem>
|
||||
<EuiButton
|
||||
href={`${basePath}/app/kibana#/home/tutorial_directory/logging`}
|
||||
href={prependBasePath('/app/kibana#/home/tutorial_directory/logging')}
|
||||
color="primary"
|
||||
fill
|
||||
data-test-subj="logsViewSetupInstructionsButton"
|
||||
|
@ -42,7 +47,7 @@ export const LogsPageNoIndicesContent = () => {
|
|||
})}
|
||||
</EuiButton>
|
||||
</EuiFlexItem>
|
||||
{uiCapabilities?.logs?.configureSource ? (
|
||||
{canConfigureSource ? (
|
||||
<EuiFlexItem>
|
||||
<ViewSourceConfigurationButton
|
||||
data-test-subj="configureSourceButton"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
import { EuiButton, EuiEmptyPrompt, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { identity } from 'fp-ts/lib/function';
|
||||
import React from 'react';
|
||||
|
||||
import euiStyled from '../../../../../../common/eui_styled_components';
|
||||
|
@ -20,7 +21,8 @@ interface InvalidNodeErrorProps {
|
|||
}
|
||||
|
||||
export const InvalidNodeError: React.FunctionComponent<InvalidNodeErrorProps> = ({ nodeName }) => {
|
||||
const basePath = useKibana().services.http?.basePath || '';
|
||||
const prependBasePath = useKibana().services.http?.basePath.prepend ?? identity;
|
||||
|
||||
return (
|
||||
<CenteredEmptyPrompt
|
||||
title={
|
||||
|
@ -46,7 +48,7 @@ export const InvalidNodeError: React.FunctionComponent<InvalidNodeErrorProps> =
|
|||
<EuiFlexGroup>
|
||||
<EuiFlexItem>
|
||||
<EuiButton
|
||||
href={`${basePath}/app/kibana#/home/tutorial_directory/metrics`}
|
||||
href={prependBasePath('/app/kibana#/home/tutorial_directory/metrics')}
|
||||
color="primary"
|
||||
fill
|
||||
>
|
||||
|
|
Loading…
Reference in a new issue