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

[LogsUI] Add UI setting to hide Logs Stream and dashboard panel option #194519

Merged
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1b79825
feeat(logs): add new logs stream enabled setting
Sep 30, 2024
0a26bac
feat(logs): conditionally register logs stream panel
Sep 30, 2024
8d6bf83
refactor(logs): use xstate utils package
Sep 30, 2024
89896be
refactor(logs): use xstate utils package
Sep 30, 2024
06e9f65
feat(logs): conditionally load logs stream app
Sep 30, 2024
c3ed920
feat(logs): set default value when setting is not registered for serv…
Oct 1, 2024
2e241e3
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine Oct 1, 2024
b640655
fix(translations): remove unused translations
Oct 1, 2024
013cfea
fix(infra): udpate translations and remove unused hook
Oct 1, 2024
1b5bc92
Merge branch '193320-advance-setting-to-show-logs-ui' of github.com:t…
Oct 1, 2024
709169d
feat(infra): add embeddable deprecation callout
Oct 1, 2024
8732dbe
Merge branch 'main' into 193320-advance-setting-to-show-logs-ui
tonyghiani Oct 1, 2024
3113f7b
test(infra): update tests for log stream
Oct 1, 2024
50ba6e8
Merge branch 'main' into 193320-advance-setting-to-show-logs-ui
tonyghiani Oct 1, 2024
a107aaa
fix(infra): update types
Oct 1, 2024
02a6e81
fix(infra): update usage collector
Oct 1, 2024
1fedc03
Update x-pack/plugins/observability_solution/infra/common/ui_settings.ts
tonyghiani Oct 1, 2024
aa1159f
refactor(infra): update deprecation callout warning
Oct 1, 2024
0bfb149
Merge branch 'main' into 193320-advance-setting-to-show-logs-ui
tonyghiani Oct 1, 2024
bc8ef2c
Merge branch 'main' into 193320-advance-setting-to-show-logs-ui
tonyghiani Oct 2, 2024
e97f35b
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Oct 2, 2024
4b02294
feat(infra): add logs settings page navigation entry and deprecation …
Oct 2, 2024
987e59a
Merge branch '193320-advance-setting-to-show-logs-ui' of github.com:t…
Oct 2, 2024
0254c2c
Update x-pack/plugins/observability_solution/infra/public/components/…
tonyghiani Oct 3, 2024
f87c4b2
Merge branch 'main' into 193320-advance-setting-to-show-logs-ui
tonyghiani Oct 3, 2024
e413fbb
Merge branch 'main' into 193320-advance-setting-to-show-logs-ui
tonyghiani Oct 4, 2024
6f73452
Merge branch 'main' into 193320-advance-setting-to-show-logs-ui
tonyghiani Oct 4, 2024
2d9d15b
Merge branch 'main' into 193320-advance-setting-to-show-logs-ui
tonyghiani Oct 7, 2024
1778b8e
refactor(infra): redirect to logs explorer once accessing /stream route
Oct 8, 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
1 change: 1 addition & 0 deletions packages/kbn-management/settings/setting_ids/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export const OBSERVABILITY_LOGS_EXPLORER_ALLOWED_DATA_VIEWS_ID =
'observability:logsExplorer:allowedDataViews';
export const OBSERVABILITY_ENTITY_CENTRIC_EXPERIENCE = 'observability:entityCentricExperience';
export const OBSERVABILITY_LOGS_DATA_ACCESS_LOG_SOURCES_ID = 'observability:logSources';
export const OBSERVABILITY_ENABLE_LOGS_STREAM = 'observability:enableLogsStream';
export const OBSERVABILITY_AI_ASSISTANT_SIMULATED_FUNCTION_CALLING =
'observability:aiAssistantSimulatedFunctionCalling';
export const OBSERVABILITY_AI_ASSISTANT_SEARCH_CONNECTOR_INDEX_PATTERN =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import expect from '@kbn/expect';

import { OBSERVABILITY_ENABLE_LOGS_STREAM } from '@kbn/management-settings-ids';
import { VisualizeConstants } from '@kbn/visualizations-plugin/common/constants';
import { FtrProviderContext } from '../../../ftr_provider_context';

Expand All @@ -28,6 +28,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
});
await kibanaServer.uiSettings.update({ [OBSERVABILITY_ENABLE_LOGS_STREAM]: true });
});

after(async () => {
await kibanaServer.savedObjects.cleanStandardList();
await kibanaServer.uiSettings.update({ [OBSERVABILITY_ENABLE_LOGS_STREAM]: false });
});

it('ensure toolbar popover closes on add', async () => {
Expand All @@ -39,10 +45,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboardAddPanel.expectEditorMenuClosed();
});

after(async () => {
await kibanaServer.savedObjects.cleanStandardList();
});

describe('add new visualization link', () => {
before(async () => {
await dashboard.navigateToApp();
Expand Down
1 change: 1 addition & 0 deletions test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,6 @@
"@kbn/default-nav-management",
"@kbn/default-nav-devtools",
"@kbn/core-saved-objects-import-export-server-internal",
"@kbn/management-settings-ids",
]
}
31 changes: 31 additions & 0 deletions x-pack/plugins/observability_solution/infra/common/ui_settings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* 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.
*/

/**
* uiSettings definitions for the logs_data_access plugin.
*/
import { schema } from '@kbn/config-schema';
import { UiSettingsParams } from '@kbn/core-ui-settings-common';
import { i18n } from '@kbn/i18n';
import { OBSERVABILITY_ENABLE_LOGS_STREAM } from '@kbn/management-settings-ids';

export const uiSettings: Record<string, UiSettingsParams> = {
[OBSERVABILITY_ENABLE_LOGS_STREAM]: {
category: ['observability'],
name: i18n.translate('xpack.infra.enableLogsStream', {
defaultMessage: 'Logs Stream',
}),
value: false,
description: i18n.translate('xpack.infra.enableLogsStreamDescription', {
defaultMessage:
'Enables the legacy Logs Stream application. When enabled, the dashboard panel for legacy logs streams is also available. ',
tonyghiani marked this conversation as resolved.
Show resolved Hide resolved
}),
type: 'boolean',
schema: schema.boolean(),
requiresPageReload: true,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*/

import React, { FC, PropsWithChildren, useEffect, useMemo, useState } from 'react';
import { i18n } from '@kbn/i18n';
import { EuiCallOut } from '@elastic/eui';
import { ReactEmbeddableFactory } from '@kbn/embeddable-plugin/public';
import {
initializeTimeRange,
Expand All @@ -17,6 +19,8 @@ import { AppMountParameters, CoreStart } from '@kbn/core/public';
import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common';
import { Query } from '@kbn/es-query';
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
import { euiThemeVars } from '@kbn/ui-theme';
import useLocalStorage from 'react-use/lib/useLocalStorage';
import type { LogStreamApi, LogStreamSerializedState, Services } from './types';
import { datemathToEpochMillis } from '../../utils/datemath';
import { LOG_STREAM_EMBEDDABLE } from './constants';
Expand Down Expand Up @@ -81,7 +85,7 @@ export function getLogStreamEmbeddableFactory(services: Services) {
theme$={services.coreStart.theme.theme$}
>
<EuiThemeProvider darkMode={darkMode}>
<div style={{ width: '100%' }}>
<div style={{ width: '100%', position: 'relative' }}>
<LogStream
logView={{ type: 'log-view-reference', logViewId: 'default' }}
startTimestamp={startTimestamp}
Expand All @@ -90,6 +94,7 @@ export function getLogStreamEmbeddableFactory(services: Services) {
query={query as Query | undefined}
filters={filters}
/>
<DeprecationCallout />
</div>
</EuiThemeProvider>
</LogStreamEmbeddableProviders>
Expand All @@ -101,6 +106,37 @@ export function getLogStreamEmbeddableFactory(services: Services) {
return factory;
}

const DISMISSAL_STORAGE_KEY = 'observability:logStreamEmbeddableDeprecationCalloutDismissed';

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

if (isDismissed) {
return null;
}

return (
<EuiCallOut
color="warning"
iconType="help"
onDismiss={() => setDismissed(true)}
css={{
position: 'absolute',
bottom: euiThemeVars.euiSizeM,
right: euiThemeVars.euiSizeM,
width: 'min(100%, 40ch)',
}}
>
<p>
{i18n.translate('xpack.infra.logsStreamEmbeddable.deprecationWarningDescription', {
defaultMessage:
'This panel is not longer actively maintained. You might prefer using saved searches for this visualization.',
tonyghiani marked this conversation as resolved.
Show resolved Hide resolved
})}
</p>
</EuiCallOut>
);
};

export interface LogStreamEmbeddableProvidersProps {
core: CoreStart;
pluginStart: InfraClientStartExports;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* 2.0.
*/

import { MatchedStateFromActor } from '@kbn/xstate-utils';
import { LogStreamQueryActorRef } from '../../../log_stream_query_state';
import { MatchedStateFromActor } from '../../../xstate_helpers';
import { LogStreamPageActorRef } from './state_machine';

type LogStreamPageStateWithLogViewIndices =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import { TimeRange } from '@kbn/es-query';
import { actions, ActorRefFrom, createMachine, EmittedFrom } from 'xstate';
import { DEFAULT_REFRESH_INTERVAL } from '@kbn/logs-shared-plugin/common';
import type { LogViewNotificationChannel } from '@kbn/logs-shared-plugin/public';
import { OmitDeprecatedState } from '@kbn/xstate-utils';
import { datemathToEpochMillis } from '../../../../utils/datemath';
import { createLogStreamPositionStateMachine } from '../../../log_stream_position_state/src/state_machine';
import {
createLogStreamQueryStateMachine,
DEFAULT_TIMERANGE,
LogStreamQueryStateMachineDependencies,
} from '../../../log_stream_query_state';
import { OmitDeprecatedState } from '../../../xstate_helpers';
import {
waitForInitialQueryParameters,
waitForInitialPositionParameters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { IKbnUrlStateStorage } from '@kbn/kibana-utils-plugin/public';
import { convertISODateToNanoPrecision } from '@kbn/logs-shared-plugin/common';
import moment from 'moment';
import { actions, ActorRefFrom, createMachine, EmittedFrom, SpecialTargets } from 'xstate';
import { OmitDeprecatedState, sendIfDefined } from '@kbn/xstate-utils';
import { isSameTimeKey } from '../../../../common/time';
import { OmitDeprecatedState, sendIfDefined } from '../../xstate_helpers';
import { DESIRED_BUFFER_PAGES, RELATIVE_END_UPDATE_DELAY } from './defaults';
import { LogStreamPositionNotificationEventSelectors } from './notifications';
import type {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { EsQueryConfig } from '@kbn/es-query';
import { IKbnUrlStateStorage } from '@kbn/kibana-utils-plugin/public';
import { actions, ActorRefFrom, createMachine, SpecialTargets, send } from 'xstate';
import { DEFAULT_REFRESH_INTERVAL } from '@kbn/logs-shared-plugin/common';
import { OmitDeprecatedState, sendIfDefined } from '../../xstate_helpers';
import { OmitDeprecatedState, sendIfDefined } from '@kbn/xstate-utils';
import { logStreamQueryNotificationEventSelectors } from './notifications';
import {
subscribeToFilterSearchBarChanges,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,4 @@
*/

export * from './invalid_state_callout';
export * from './notification_channel';
export * from './send_actions';
export * from './types';
export * from './state_machine_playground';

This file was deleted.

This file was deleted.

This file was deleted.

Loading