Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Logs UI] Mark Log Stream for deprecation #186510

Merged
merged 22 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a8f44c0
refactor(logs): mark log stream for deprecation
Jun 20, 2024
633161f
refactor(logs): update button and icon
Jun 20, 2024
5dedeea
refactor(logs): update redirect logic
Jun 20, 2024
9171705
Merge branch 'main' into 184992-log-stream-soft-deprecation
tonyghiani Jun 20, 2024
7bcbcb9
test(logs): fix tests
Jun 20, 2024
a0e1238
test(logs): remove legacy test
Jun 21, 2024
0eb0004
Merge branch 'main' into 184992-log-stream-soft-deprecation
tonyghiani Jun 21, 2024
1d0b435
test(logs): remove legacy test
Jun 21, 2024
b819751
refactor(logs): move back beta badge
Jun 21, 2024
cf7e78c
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Jun 21, 2024
18c5681
refactor(logs): update test
Jun 21, 2024
01d4384
Merge branch 'main' into 184992-log-stream-soft-deprecation
tonyghiani Jun 26, 2024
8c069db
refactor(logs): remove panel badge
Jun 26, 2024
59607a7
Merge branch '184992-log-stream-soft-deprecation' of github.com:tonyg…
Jun 26, 2024
c7419ee
refactor(logs): remove tsx file
Jun 26, 2024
3a23feb
Update x-pack/plugins/observability_solution/infra/public/components/…
tonyghiani Jun 27, 2024
2f10671
Update x-pack/plugins/observability_solution/infra/public/components/…
tonyghiani Jun 27, 2024
c5b5dbd
Update x-pack/plugins/observability_solution/infra/public/components/…
tonyghiani Jun 27, 2024
64aeaa4
Update x-pack/plugins/observability_solution/infra/public/components/…
tonyghiani Jun 27, 2024
ec22858
Merge branch 'main' into 184992-log-stream-soft-deprecation
tonyghiani Jun 27, 2024
fb59e67
refactor(logs): fix copies
Jun 27, 2024
6add771
refactor(logs): update callout
Jun 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import ReactDOM from 'react-dom';
import { Router, Routes, Route } from '@kbn/shared-ux-router';
import { AppMountParameters } from '@kbn/core/public';
import { Storage } from '@kbn/kibana-utils-plugin/public';
import { AllDatasetsLocatorParams, ALL_DATASETS_LOCATOR_ID } from '@kbn/deeplinks-observability';
import { LinkToLogsPage } from '../pages/link_to/link_to_logs';
import { LogsPage } from '../pages/logs';
import { InfraClientStartDeps, InfraClientStartExports } from '../types';
Expand Down Expand Up @@ -73,6 +74,15 @@ const LogsApp: React.FC<{
toastsService={core.notifications.toasts}
>
<Routes>
<Route
path="/"
exact
render={() =>
plugins.share.url.locators
.get<AllDatasetsLocatorParams>(ALL_DATASETS_LOCATOR_ID)
?.navigate({})
}
/>
<Route path="/link-to" component={LinkToLogsPage} />
{uiCapabilities?.logs?.show && <Route path="/" component={LogsPage} />}
</Routes>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { EuiCallOut } from '@elastic/eui';
import React from 'react';
import { i18n } from '@kbn/i18n';
import { EuiButton } from '@elastic/eui';
import { AllDatasetsLocatorParams, ALL_DATASETS_LOCATOR_ID } from '@kbn/deeplinks-observability';
import { getRouterLinkProps } from '@kbn/router-utils';
import useLocalStorage from 'react-use/lib/useLocalStorage';

import { euiThemeVars } from '@kbn/ui-theme';
import { css } from '@emotion/css';
import { SharePublicStart } from '@kbn/share-plugin/public/plugin';
import { useKibanaContextForPlugin } from '../hooks/use_kibana';

const DISMISSAL_STORAGE_KEY = 'log_stream_deprecation_callout_dismissed';

export const LogsDeprecationCallout = () => {
const {
services: { share },
} = useKibanaContextForPlugin();

const [isDismissed, setDismissed] = useLocalStorage(DISMISSAL_STORAGE_KEY, false);

if (isDismissed) {
return null;
}

return (
<EuiCallOut
title={i18n.translate('xpack.infra.logsDeprecationCallout.euiCallOut.discoverANewLogLabel', {
defaultMessage: "There's a new, better way to explore your logs!",
})}
color="warning"
iconType="iInCircle"
heading="h2"
onDismiss={() => setDismissed(true)}
className={calloutStyle}
>
<p>
{i18n.translate('xpack.infra.logsDeprecationCallout.p.theNewLogsExplorerLabel', {
defaultMessage:
'The new Logs Explorer makes viewing and inspecting your logs easier with more features, better performance, and more intuitive navigation. We recommend switching to Logs Explorer, as it will replace Logs Stream in a future version.',
})}
</p>
<EuiButton
fill
data-test-subj="infraLogsDeprecationCalloutTryLogsExplorerButton"
color="warning"
{...getLogsExplorerLinkProps(share)}
>
{i18n.translate('xpack.infra.logsDeprecationCallout.tryLogsExplorerButtonLabel', {
defaultMessage: 'Try Logs Explorer',
})}
</EuiButton>
</EuiCallOut>
);
};

const getLogsExplorerLinkProps = (share: SharePublicStart) => {
const locator = share.url.locators.get<AllDatasetsLocatorParams>(ALL_DATASETS_LOCATOR_ID)!;

return getRouterLinkProps({
href: locator.getRedirectUrl({}),
onClick: () => locator.navigate({}),
});
};

const calloutStyle = css`
margin-bottom: ${euiThemeVars.euiSizeL};
`;
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ export const LogsPageContent: React.FunctionComponent = () => {
)}
<RedirectWithQueryParams from={'/analysis'} to={anomaliesTab.pathname} exact />
<RedirectWithQueryParams from={'/log-rate'} to={anomaliesTab.pathname} exact />
<RedirectWithQueryParams from={'/'} to={streamTab.pathname} exact />
<Route
render={() => (
<NotFoundPage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { useSelector } from '@xstate/react';
import stringify from 'json-stable-stringify';
import React, { useCallback, useEffect, useMemo } from 'react';
import usePrevious from 'react-use/lib/usePrevious';
import { LogsDeprecationCallout } from '../../../components/logs_deprecation_callout';
import { TimeKey } from '../../../../common/time';
import { AutoSizer } from '../../../components/auto_sizer';
import { LogMinimap } from '../../../components/logging/log_minimap';
Expand Down Expand Up @@ -228,6 +229,7 @@ export const StreamPageLogsContent = React.memo<{

return (
<>
<LogsDeprecationCallout />
<WithLogTextviewUrlState />
<WithFlyoutOptionsUrlState />
<LogsToolbar />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const registerFeatures = (homePlugin: HomePublicPluginSetup) => {
});

homePlugin.featureCatalogue.register({
id: 'logs',
id: 'observability-logs-explorer',
title: i18n.translate('xpack.infra.registerFeatures.logsTitle', {
defaultMessage: 'Logs',
}),
Expand All @@ -34,7 +34,7 @@ export const registerFeatures = (homePlugin: HomePublicPluginSetup) => {
'Stream logs in real time or scroll through historical views in a console-like experience.',
}),
icon: 'logsApp',
path: `/app/logs`,
path: `/app/observability-logs-explorer`,
showOnHomePage: false,
category: 'data',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ const ControlGroupContainer = euiStyled.div`
display: none;
}

[data-test-subj='controls-group-wrapper'] {
min-height: 32px;
}

[data-test-subj='optionsListControl__sortingOptionsButton'] {
display: none;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const kibanaServer = getService('kibanaServer');
const security = getService('security');
const PageObjects = getPageObjects(['common', 'error', 'infraHome', 'security']);
const testSubjects = getService('testSubjects');
const appsMenu = getService('appsMenu');
const globalNav = getService('globalNav');

Expand Down Expand Up @@ -64,15 +63,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
});

describe('logs landing page without data', () => {
it(`shows the 'No data' page`, async () => {
await PageObjects.common.navigateToUrlWithBrowserHistory('infraLogs', '', undefined, {
ensureCurrentUrl: true,
shouldLoginIfPrompted: false,
});
await testSubjects.existOrFail('~infraLogsPage');
await testSubjects.existOrFail('~noDataPage');
});

it(`doesn't show read-only badge`, async () => {
await globalNav.badgeMissingOrFail();
});
Expand Down Expand Up @@ -125,21 +115,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const navLinks = (await appsMenu.readLinks()).map((link) => link.text);
expect(navLinks).to.contain('Logs');
});

describe('logs landing page without data', () => {
it(`Shows the 'No data' page`, async () => {
await PageObjects.common.navigateToUrlWithBrowserHistory('infraLogs', '', undefined, {
ensureCurrentUrl: true,
shouldLoginIfPrompted: false,
});
await testSubjects.existOrFail('~infraLogsPage');
await testSubjects.existOrFail('~noDataPage');
});

it(`shows read-only badge`, async () => {
await globalNav.badgeExistsOrFail('Read only');
});
});
});

describe('global logs no privileges', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const kibanaServer = getService('kibanaServer');
const spacesService = getService('spaces');
const PageObjects = getPageObjects(['common', 'infraHome', 'security', 'spaceSelector']);
const testSubjects = getService('testSubjects');
const appsMenu = getService('appsMenu');

describe('logs spaces', () => {
Expand Down Expand Up @@ -41,18 +40,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const navLinks = (await appsMenu.readLinks()).map((link) => link.text);
expect(navLinks).to.contain('Logs');
});

describe('logs landing page without data', () => {
it(`shows 'No data' page`, async () => {
await PageObjects.common.navigateToUrlWithBrowserHistory('infraLogs', '', undefined, {
basePath: '/s/custom_space',
ensureCurrentUrl: true,
shouldLoginIfPrompted: false,
});
await testSubjects.existOrFail('~infraLogsPage');
await testSubjects.existOrFail('~noDataPage');
});
});
});

describe('space with Logs disabled', () => {
Expand Down
11 changes: 0 additions & 11 deletions x-pack/test/functional/apps/infra/logs/log_stream_date_nano.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
*/

import expect from '@kbn/expect';
import { URL } from 'url';
import { FtrProviderContext } from '../../../ftr_provider_context';
import { DATES } from '../constants';

export default ({ getPageObjects, getService }: FtrProviderContext) => {
const retry = getService('retry');
const browser = getService('browser');
const esArchiver = getService('esArchiver');
const logsUi = getService('logsUi');
const find = getService('find');
Expand Down Expand Up @@ -63,15 +61,6 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
expect(entryTimestamp).to.be('19:43:22.111');
});

it('should properly sync logPosition in url', async () => {
const currentUrl = await browser.getCurrentUrl();
const parsedUrl = new URL(currentUrl);

expect(parsedUrl.searchParams.get('logPosition')).to.contain(
`time:\'2018-10-17T19:46:22.333333333Z\'`
);
});

it('should properly render timestamp in flyout with nano precision', async () => {
await logsUi.logStreamPage.navigateTo({ logFilter });

Expand Down