[Logs / Metrics UI] Remove path prefix from ViewSourceConfigur… (#58238)
In the NP the routes have already the app name on them. Adding it to this button made the app name double /app/metrics/metrics/settings /app/logs/logs/settings The button only needs to go to the settings page within the app where it's being loaded, so we can safely drop the prefix. Closes #58233
This commit is contained in:
parent
6fc6cb8b36
commit
db276d1894
|
@ -5,7 +5,4 @@
|
|||
*/
|
||||
|
||||
export { SourceConfigurationSettings } from './source_configuration_settings';
|
||||
export {
|
||||
ViewSourceConfigurationButton,
|
||||
ViewSourceConfigurationButtonHrefBase,
|
||||
} from './view_source_configuration_button';
|
||||
export { ViewSourceConfigurationButton } from './view_source_configuration_button';
|
||||
|
|
|
@ -8,23 +8,16 @@ import { EuiButton } from '@elastic/eui';
|
|||
import React from 'react';
|
||||
import { Route } from 'react-router-dom';
|
||||
|
||||
export enum ViewSourceConfigurationButtonHrefBase {
|
||||
infrastructure = 'infrastructure',
|
||||
logs = 'logs',
|
||||
}
|
||||
|
||||
interface ViewSourceConfigurationButtonProps {
|
||||
'data-test-subj'?: string;
|
||||
hrefBase: ViewSourceConfigurationButtonHrefBase;
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export const ViewSourceConfigurationButton = ({
|
||||
'data-test-subj': dataTestSubj,
|
||||
hrefBase,
|
||||
children,
|
||||
}: ViewSourceConfigurationButtonProps) => {
|
||||
const href = `/${hrefBase}/settings`;
|
||||
const href = '/settings';
|
||||
|
||||
return (
|
||||
<Route
|
||||
|
|
|
@ -18,10 +18,7 @@ import { ColumnarPage } from '../../../components/page';
|
|||
|
||||
import { SourceErrorPage } from '../../../components/source_error_page';
|
||||
import { SourceLoadingPage } from '../../../components/source_loading_page';
|
||||
import {
|
||||
ViewSourceConfigurationButton,
|
||||
ViewSourceConfigurationButtonHrefBase,
|
||||
} from '../../../components/source_configuration';
|
||||
import { ViewSourceConfigurationButton } from '../../../components/source_configuration';
|
||||
import { Source } from '../../../containers/source';
|
||||
import { WithWaffleFilterUrlState } from '../../../containers/waffle/with_waffle_filters';
|
||||
import { WithWaffleOptionsUrlState } from '../../../containers/waffle/with_waffle_options';
|
||||
|
@ -92,10 +89,7 @@ export const SnapshotPage = () => {
|
|||
</EuiFlexItem>
|
||||
{uiCapabilities?.infrastructure?.configureSource ? (
|
||||
<EuiFlexItem>
|
||||
<ViewSourceConfigurationButton
|
||||
data-test-subj="configureSourceButton"
|
||||
hrefBase={ViewSourceConfigurationButtonHrefBase.infrastructure}
|
||||
>
|
||||
<ViewSourceConfigurationButton data-test-subj="configureSourceButton">
|
||||
{i18n.translate('xpack.infra.configureSourceActionLabel', {
|
||||
defaultMessage: 'Change source configuration',
|
||||
})}
|
||||
|
|
|
@ -10,10 +10,7 @@ import { identity } from 'fp-ts/lib/function';
|
|||
import React from 'react';
|
||||
|
||||
import { NoIndices } from '../../../components/empty_states/no_indices';
|
||||
import {
|
||||
ViewSourceConfigurationButton,
|
||||
ViewSourceConfigurationButtonHrefBase,
|
||||
} from '../../../components/source_configuration';
|
||||
import { ViewSourceConfigurationButton } from '../../../components/source_configuration';
|
||||
import { useKibana } from '../../../../../../../src/plugins/kibana_react/public';
|
||||
|
||||
export const LogsPageNoIndicesContent = () => {
|
||||
|
@ -49,10 +46,7 @@ export const LogsPageNoIndicesContent = () => {
|
|||
</EuiFlexItem>
|
||||
{canConfigureSource ? (
|
||||
<EuiFlexItem>
|
||||
<ViewSourceConfigurationButton
|
||||
data-test-subj="configureSourceButton"
|
||||
hrefBase={ViewSourceConfigurationButtonHrefBase.logs}
|
||||
>
|
||||
<ViewSourceConfigurationButton data-test-subj="configureSourceButton">
|
||||
{i18n.translate('xpack.infra.configureSourceActionLabel', {
|
||||
defaultMessage: 'Change source configuration',
|
||||
})}
|
||||
|
|
|
@ -10,10 +10,7 @@ import { identity } from 'fp-ts/lib/function';
|
|||
import React from 'react';
|
||||
|
||||
import { euiStyled } from '../../../../../observability/public';
|
||||
import {
|
||||
ViewSourceConfigurationButton,
|
||||
ViewSourceConfigurationButtonHrefBase,
|
||||
} from '../../../components/source_configuration';
|
||||
import { ViewSourceConfigurationButton } from '../../../components/source_configuration';
|
||||
import { useKibana } from '../../../../../../../src/plugins/kibana_react/public';
|
||||
|
||||
interface InvalidNodeErrorProps {
|
||||
|
@ -59,10 +56,7 @@ export const InvalidNodeError: React.FunctionComponent<InvalidNodeErrorProps> =
|
|||
</EuiButton>
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem>
|
||||
<ViewSourceConfigurationButton
|
||||
data-test-subj="configureSourceButton"
|
||||
hrefBase={ViewSourceConfigurationButtonHrefBase.infrastructure}
|
||||
>
|
||||
<ViewSourceConfigurationButton data-test-subj="configureSourceButton">
|
||||
<FormattedMessage
|
||||
id="xpack.infra.configureSourceActionLabel"
|
||||
defaultMessage="Change source configuration"
|
||||
|
|
Loading…
Reference in a new issue