mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
# Backport This will backport the following commits from `main` to `8.x`: - [[Dataset Quality] Hide unreachable links (#196302)](https://github.com/elastic/kibana/pull/196302) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"mohamedhamed-ahmed","email":"mohamed.ahmed@elastic.co"},"sourceCommit":{"committedDate":"2024-10-15T22:07:38Z","message":"[Dataset Quality] Hide unreachable links (#196302)\n\ncloses5cec1296
-a17a-43bb-8530-99e7261a189a","sha":"5fbec1febc0050b2faaba7a25cf4aba9bf0cea1f","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-logs"],"title":"[Dataset Quality] Hide unreachable links","number":196302,"url":"https://github.com/elastic/kibana/pull/196302","mergeCommit":{"message":"[Dataset Quality] Hide unreachable links (#196302)\n\ncloses5cec1296
-a17a-43bb-8530-99e7261a189a","sha":"5fbec1febc0050b2faaba7a25cf4aba9bf0cea1f"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196302","number":196302,"mergeCommit":{"message":"[Dataset Quality] Hide unreachable links (#196302)\n\ncloses5cec1296
-a17a-43bb-8530-99e7261a189a","sha":"5fbec1febc0050b2faaba7a25cf4aba9bf0cea1f"}}]}] BACKPORT--> Co-authored-by: mohamedhamed-ahmed <mohamed.ahmed@elastic.co>
This commit is contained in:
parent
9513867b11
commit
2a288431d3
3 changed files with 29 additions and 18 deletions
|
@ -270,13 +270,12 @@ const DatasetQualityLink = React.memo(
|
|||
urlService: BrowserUrlService;
|
||||
dataStream: string | undefined;
|
||||
}) => {
|
||||
if (!dataStream) {
|
||||
return null;
|
||||
}
|
||||
const locator = urlService.locators.get<DataQualityDetailsLocatorParams>(
|
||||
DATA_QUALITY_DETAILS_LOCATOR_ID
|
||||
);
|
||||
|
||||
if (!locator || !dataStream) return null;
|
||||
|
||||
const datasetQualityUrl = locator?.getRedirectUrl({ dataStream });
|
||||
|
||||
const navigateToDatasetQuality = () => {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { EuiHeaderLink } from '@elastic/eui';
|
||||
import { LogsExplorerPublicState } from '@kbn/logs-explorer-plugin/public';
|
||||
import { getRouterLinkProps } from '@kbn/router-utils';
|
||||
import { BrowserUrlService } from '@kbn/share-plugin/public';
|
||||
import { LocatorPublic } from '@kbn/share-plugin/public';
|
||||
import { MatchedStateFromActor } from '@kbn/xstate-utils';
|
||||
import { useActor } from '@xstate/react';
|
||||
import React from 'react';
|
||||
|
@ -20,20 +20,28 @@ import {
|
|||
} from '../state_machines/observability_logs_explorer/src';
|
||||
import { useKibanaContextForPlugin } from '../utils/use_kibana';
|
||||
|
||||
export const ConnectedDatasetQualityLink = React.memo(() => {
|
||||
export const ConnectedDatasetQualityLink = () => {
|
||||
const {
|
||||
services: {
|
||||
share: { url },
|
||||
},
|
||||
} = useKibanaContextForPlugin();
|
||||
const [pageState] = useActor(useObservabilityLogsExplorerPageStateContext());
|
||||
const locator = url.locators.get<DataQualityLocatorParams>(DATA_QUALITY_LOCATOR_ID);
|
||||
|
||||
if (pageState.matches({ initialized: 'validLogsExplorerState' })) {
|
||||
return <DatasetQualityLink urlService={url} pageState={pageState} />;
|
||||
} else {
|
||||
return <DatasetQualityLink urlService={url} />;
|
||||
if (!locator) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<DatasetQualityLink
|
||||
locator={locator}
|
||||
pageState={
|
||||
pageState.matches({ initialized: 'validLogsExplorerState' }) ? pageState : undefined
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
type InitializedPageState = MatchedStateFromActor<
|
||||
ObservabilityLogsExplorerService,
|
||||
|
@ -62,14 +70,12 @@ const constructLocatorParams = (
|
|||
|
||||
export const DatasetQualityLink = React.memo(
|
||||
({
|
||||
urlService,
|
||||
locator,
|
||||
pageState,
|
||||
}: {
|
||||
urlService: BrowserUrlService;
|
||||
locator: LocatorPublic<DataQualityLocatorParams>;
|
||||
pageState?: InitializedPageState;
|
||||
}) => {
|
||||
const locator = urlService.locators.get<DataQualityLocatorParams>(DATA_QUALITY_LOCATOR_ID);
|
||||
|
||||
const locatorParams: DataQualityLocatorParams = pageState
|
||||
? constructLocatorParams(pageState.context.logsExplorerState)
|
||||
: {};
|
||||
|
|
|
@ -70,8 +70,7 @@ const ProjectTopNav = () => {
|
|||
<EuiHeaderSectionItem>
|
||||
<EuiHeaderLinks gutterSize="xs">
|
||||
<ConnectedDiscoverLink />
|
||||
<VerticalRule />
|
||||
<ConnectedDatasetQualityLink />
|
||||
<ConditionalVerticalRule Component={ConnectedDatasetQualityLink()} />
|
||||
<VerticalRule />
|
||||
<FeedbackLink />
|
||||
<VerticalRule />
|
||||
|
@ -147,8 +146,7 @@ const ClassicTopNav = () => {
|
|||
<EuiHeaderSectionItem>
|
||||
<EuiHeaderLinks gutterSize="xs">
|
||||
<ConnectedDiscoverLink />
|
||||
<VerticalRule />
|
||||
<ConnectedDatasetQualityLink />
|
||||
<ConditionalVerticalRule Component={ConnectedDatasetQualityLink()} />
|
||||
<VerticalRule />
|
||||
<AlertsPopover />
|
||||
<VerticalRule />
|
||||
|
@ -165,3 +163,11 @@ const VerticalRule = styled.span`
|
|||
height: 20px;
|
||||
background-color: ${euiThemeVars.euiColorLightShade};
|
||||
`;
|
||||
|
||||
const ConditionalVerticalRule = ({ Component }: { Component: JSX.Element | null }) =>
|
||||
Component && (
|
||||
<>
|
||||
<VerticalRule />
|
||||
{Component}
|
||||
</>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue