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

[ML] Replace useIsDarkTheme() with EUI's colorMode. #205079

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 0 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,6 @@ x-pack/platform/packages/private/ml/inference_integration_flyout @elastic/ml-ui
x-pack/platform/packages/private/ml/is_defined @elastic/ml-ui
x-pack/platform/packages/private/ml/is_populated_object @elastic/ml-ui
x-pack/platform/packages/private/ml/json_schemas @elastic/ml-ui
x-pack/platform/packages/private/ml/kibana_theme @elastic/ml-ui
x-pack/platform/packages/private/ml/local_storage @elastic/ml-ui
x-pack/platform/packages/private/ml/nested_property @elastic/ml-ui
x-pack/platform/packages/private/ml/number_utils @elastic/ml-ui
Expand Down Expand Up @@ -3171,7 +3170,6 @@ x-pack/platform/packages/private/ml/inference_integration_flyout @elastic/ml-ui
x-pack/platform/packages/private/ml/is_defined @elastic/ml-ui
x-pack/platform/packages/private/ml/is_populated_object @elastic/ml-ui
x-pack/platform/packages/private/ml/json_schemas @elastic/ml-ui
x-pack/platform/packages/private/ml/kibana_theme @elastic/ml-ui
x-pack/platform/packages/private/ml/local_storage @elastic/ml-ui
x-pack/platform/packages/private/ml/nested_property @elastic/ml-ui
x-pack/platform/packages/private/ml/number_utils @elastic/ml-ui
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,6 @@
"@kbn/ml-in-memory-table": "link:x-pack/platform/packages/private/ml/in_memory_table",
"@kbn/ml-is-defined": "link:x-pack/platform/packages/private/ml/is_defined",
"@kbn/ml-is-populated-object": "link:x-pack/platform/packages/private/ml/is_populated_object",
"@kbn/ml-kibana-theme": "link:x-pack/platform/packages/private/ml/kibana_theme",
"@kbn/ml-local-storage": "link:x-pack/platform/packages/private/ml/local_storage",
"@kbn/ml-nested-property": "link:x-pack/platform/packages/private/ml/nested_property",
"@kbn/ml-number-utils": "link:x-pack/platform/packages/private/ml/number_utils",
Expand Down
2 changes: 0 additions & 2 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -1258,8 +1258,6 @@
"@kbn/ml-is-defined/*": ["x-pack/platform/packages/private/ml/is_defined/*"],
"@kbn/ml-is-populated-object": ["x-pack/platform/packages/private/ml/is_populated_object"],
"@kbn/ml-is-populated-object/*": ["x-pack/platform/packages/private/ml/is_populated_object/*"],
"@kbn/ml-kibana-theme": ["x-pack/platform/packages/private/ml/kibana_theme"],
"@kbn/ml-kibana-theme/*": ["x-pack/platform/packages/private/ml/kibana_theme/*"],
"@kbn/ml-local-storage": ["x-pack/platform/packages/private/ml/local_storage"],
"@kbn/ml-local-storage/*": ["x-pack/platform/packages/private/ml/local_storage/*"],
"@kbn/ml-nested-property": ["x-pack/platform/packages/private/ml/nested_property"],
Expand Down
3 changes: 0 additions & 3 deletions x-pack/platform/packages/private/ml/kibana_theme/README.md

This file was deleted.

8 changes: 0 additions & 8 deletions x-pack/platform/packages/private/ml/kibana_theme/index.ts

This file was deleted.

12 changes: 0 additions & 12 deletions x-pack/platform/packages/private/ml/kibana_theme/jest.config.js

This file was deleted.

This file was deleted.

This file was deleted.

27 changes: 0 additions & 27 deletions x-pack/platform/packages/private/ml/kibana_theme/src/hooks.ts

This file was deleted.

19 changes: 0 additions & 19 deletions x-pack/platform/packages/private/ml/kibana_theme/tsconfig.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ import type { Category } from '@kbn/aiops-log-pattern-analysis/types';
import { useCreateFormattedExample } from './format_category';
import { renderHook } from '@testing-library/react';

jest.mock('../../hooks/use_is_dark_theme', () => ({
useIsDarkTheme: () => false,
}));

const categoryData: Array<{
category: Category;
elementCount: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@

import type { FC, PropsWithChildren } from 'react';
import React, { useCallback, useMemo } from 'react';
import { EuiText, EuiHorizontalRule } from '@elastic/eui';
import { useEuiTheme, EuiText, EuiHorizontalRule } from '@elastic/eui';
import type { SerializedStyles } from '@emotion/react';
import { css } from '@emotion/react';
import type { Category } from '@kbn/aiops-log-pattern-analysis/types';
import { useIsDarkTheme } from '../../hooks/use_is_dark_theme';

interface Props {
category: Category;
Expand All @@ -38,7 +37,8 @@ interface Styles {
}

const useStyles = (): Styles => {
const isDarkTheme = useIsDarkTheme();
const { colorMode } = useEuiTheme();
const isDarkTheme = colorMode === 'DARK';

return useMemo(
() =>
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion x-pack/platform/plugins/shared/aiops/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"@kbn/ml-in-memory-table",
"@kbn/ml-is-defined",
"@kbn/ml-is-populated-object",
"@kbn/ml-kibana-theme",
"@kbn/ml-local-storage",
"@kbn/ml-number-utils",
"@kbn/ml-query-utils",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import {
ML_SEVERITY_COLORS,
} from '@kbn/ml-anomaly-utils';
import { formatHumanReadableDateTime } from '@kbn/ml-date-utils';
import { useIsDarkTheme } from '@kbn/ml-kibana-theme';
import type { TimeBuckets as TimeBucketsClass } from '@kbn/ml-time-buckets';
import { SwimLanePagination } from './swimlane_pagination';
import type {
Expand All @@ -66,7 +65,6 @@ import { FormattedTooltip } from '../components/chart_tooltip/chart_tooltip';
import './_explorer.scss';
import { EMPTY_FIELD_VALUE_LABEL } from '../timeseriesexplorer/components/entity_control/entity_control';
import { SWIM_LANE_LABEL_WIDTH, Y_AXIS_LABEL_PADDING } from './constants';
import { useMlKibana } from '../contexts/kibana';

declare global {
interface Window {
Expand Down Expand Up @@ -204,12 +202,8 @@ export const SwimlaneContainer: FC<SwimlaneProps> = ({
}) => {
const [chartWidth, setChartWidth] = useState<number>(0);

const {
services: { theme: themeService },
} = useMlKibana();

const isDarkTheme = useIsDarkTheme(themeService);
const { euiTheme } = useEuiTheme();
const { colorMode, euiTheme } = useEuiTheme();
const isDarkTheme = colorMode === 'DARK';

// Holds the container height for previously fetched data
const containerHeightRef = useRef<number>();
Expand Down
1 change: 0 additions & 1 deletion x-pack/platform/plugins/shared/ml/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
"@kbn/ml-in-memory-table",
"@kbn/ml-is-defined",
"@kbn/ml-is-populated-object",
"@kbn/ml-kibana-theme",
"@kbn/ml-local-storage",
"@kbn/ml-nested-property",
"@kbn/ml-number-utils",
Expand Down
4 changes: 0 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6333,10 +6333,6 @@
version "0.0.0"
uid ""

"@kbn/ml-kibana-theme@link:x-pack/platform/packages/private/ml/kibana_theme":
version "0.0.0"
uid ""

"@kbn/ml-local-storage@link:x-pack/platform/packages/private/ml/local_storage":
version "0.0.0"
uid ""
Expand Down