Skip to content

[ObsUX][Infra] Fix broken storybook stories #218090

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

Merged
merged 7 commits into from
Apr 18, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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 @@ -88,7 +88,7 @@ const AlertDetailsAppSection = ({ rule, alert }: AlertDetailsAppSectionProps) =>
</EuiFlexItem>
</EuiFlexGroup>
<EuiFlexGroup>
<EuiFlexItem style={{ maxHeight: 120 }} grow={1}>
<EuiFlexItem css={{ maxHeight: 120 }} grow={1}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

<EuiSpacer size="s" />
<Threshold
title={`Threshold breached`}
Expand Down Expand Up @@ -155,7 +155,7 @@ const AlertDetailsAppSection = ({ rule, alert }: AlertDetailsAppSectionProps) =>
</EuiFlexGroup>
<EuiSpacer size="l" />
<EuiFlexGroup>
<EuiFlexItem style={{ maxHeight: 120 }} grow={1}>
<EuiFlexItem css={{ maxHeight: 120 }} grow={1}>
<EuiSpacer size="s" />
<Threshold
title={`Threshold breached`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,3 @@ export const CustomEquationEditorWithEquationErrors = {
},
},
};

export const CustomEquationEditorWithFieldError = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no point on having this story since we don't use field error, that's why it was removed

render: CustomEquationEditorTemplate,
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type { Observable } from 'rxjs';
import { of } from 'rxjs';
import { action } from '@storybook/addon-actions';
import type { Decorator } from '@storybook/react';
import { useParameter } from '@storybook/manager-api';
import { useParameter } from '@storybook/preview-api';
import type { DeepPartial } from 'utility-types';
import type { LocatorPublic } from '@kbn/share-plugin/public';
import type { IKibanaSearchRequest, ISearchOptions } from '@kbn/search-types';
Expand All @@ -24,6 +24,8 @@ import type { Theme } from '@elastic/charts/dist/utils/themes/theme';
import { defaultLogViewAttributes } from '@kbn/logs-shared-plugin/common';
import type { DataView, DataViewField } from '@kbn/data-views-plugin/common';
import { MemoryRouter } from 'react-router-dom';
import type { ChromeStyle } from '@kbn/core-chrome-browser';
import { ReloadRequestTimeProvider } from '../../../hooks/use_reload_request_time';
import { AlertPrefillProvider } from '../../../alerting/use_alert_prefill';
import { PluginConfigProvider } from '../../../containers/plugin_config_context';
import type { PluginKibanaContextValue } from '../../../hooks/use_kibana';
Expand All @@ -33,6 +35,7 @@ import { assetDetailsProps, getLogEntries } from './context/fixtures';
import { ContextProviders } from '../context_providers';
import { DataViewsProvider } from '../hooks/use_data_views';
import type { InfraConfig } from '../../../../server';
import { TabSwitcherProvider } from '../hooks/use_tab_switcher';

const settings: Record<string, any> = {
'dateFormat:scaled': [['', 'HH:mm:ss.SSS']],
Expand All @@ -58,6 +61,13 @@ export const DecorateWithKibanaContext: Decorator = (story) => {
},
getUrlForApp: (url: string) => url,
},
docLinks: {
links: {
observability: {
guide: 'https://www.elastic.co/guide/en/observability/current/index.html',
},
},
},
chrome: {
docTitle: {
change(newTitle) {
Expand All @@ -66,6 +76,7 @@ export const DecorateWithKibanaContext: Decorator = (story) => {
},
},
setBreadcrumbs: () => {},
getChromeStyle$: () => of({} as ChromeStyle),
setBreadcrumbsAppendExtension: () => () => {},
},
data: {
Expand Down Expand Up @@ -159,6 +170,7 @@ export const DecorateWithKibanaContext: Decorator = (story) => {
reportAssetDetailsFlyoutViewed: () => {},
reportAssetDetailsPageViewed: () => {},
reportAssetDashboardLoaded: () => {},
reportPerformanceMetricEvent: () => {},
},
observabilityShared: {
navigation: { PageTemplate: ({ children }: { children?: any }) => <>{children}</> },
Expand Down Expand Up @@ -206,7 +218,11 @@ export const DecorateWithKibanaContext: Decorator = (story) => {
<KibanaContextProvider services={mockServices}>
<SourceProvider sourceId="default">
<MetricsDataViewProvider>
<AlertPrefillProvider>{story()} </AlertPrefillProvider>
<TabSwitcherProvider>
<ReloadRequestTimeProvider>
<AlertPrefillProvider>{story()} </AlertPrefillProvider>
</ReloadRequestTimeProvider>
</TabSwitcherProvider>
</MetricsDataViewProvider>
</SourceProvider>
</KibanaContextProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React, { useState } from 'react';
import { EuiButton, EuiCallOut, EuiSelect, EuiSpacer } from '@elastic/eui';
import type { Meta, StoryFn } from '@storybook/react';
import { MemoryRouter } from 'react-router-dom';
import { useArgs } from '@storybook/manager-api';
import { useArgs } from '@storybook/preview-api';
import { AssetDetails } from './asset_details';
import { decorateWithGlobalStorybookThemeProviders } from '../../test_utils/use_global_storybook_theme';
import { type TabIds, type AssetDetailsProps } from './types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ import type { Meta } from '@storybook/react';
import React from 'react';
import { decorateWithGlobalStorybookThemeProviders } from '../../../../test_utils/use_global_storybook_theme';
import { InitialConfigurationStep } from './initial_configuration_step';
import { DecorateWithKibanaContext } from '../../../asset_details/__stories__/decorator';

export default {
title: 'infra/logAnalysis/SetupInitialConfigurationStep',

decorators: [
(renderStory) => <div style={{ maxWidth: 800 }}>{renderStory()}</div>,
decorateWithGlobalStorybookThemeProviders,
],
decorators: [decorateWithGlobalStorybookThemeProviders, DecorateWithKibanaContext],
} as Meta;

export const ReconfigurationWithPartitionedWarnings = {
Expand Down Expand Up @@ -86,25 +84,10 @@ export const ReconfigurationWithUnpartitionedWarnings = {
},
{
name: 'index-2-*',
validity: 'invalid',
errors: [{ index: 'index-2-*', error: 'INDEX_NOT_FOUND' }],
},
]}
previousQualityWarnings={[
{
type: 'categoryQualityWarning',
jobId: 'job-1',
dataset: '',
reasons: [
{ type: 'noFrequentCategories' },
{ type: 'manyDeadCategories', deadCategoriesRatio: 0.9 },
],
},
{
type: 'categoryQualityWarning',
jobId: 'job-1',
dataset: '',
reasons: [{ type: 'singleCategory' }],
validity: 'valid',
isSelected: false,
datasetFilter: { type: 'includeAll' },
availableDatasets: ['first', 'second', 'third'],
},
]}
/>
Expand Down