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 UX][EUI Visual Refresh] Update theme usage #202746

Merged
merged 18 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 10 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
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import {
EuiTextTruncate,
EuiButtonEmpty,
EuiCopy,
useEuiTheme,
} from '@elastic/eui';
import { css } from '@emotion/react';
import { useBoolean } from '@kbn/react-hooks';
import { euiThemeVars } from '@kbn/ui-theme';
import type { DocViewFilterFn } from '@kbn/unified-doc-viewer/types';
import type { SharePluginStart } from '@kbn/share-plugin/public';
import type { CoreStart } from '@kbn/core-lifecycle-browser';
Expand All @@ -38,10 +38,6 @@ import {
openCellActionPopoverAriaText,
} from './translations';

const codeFontCSS = css`
font-family: ${euiThemeVars.euiCodeFontFamily};
`;

interface CellActionsPopoverProps {
onFilter?: DocViewFilterFn;
/* ECS mapping for the key */
Expand All @@ -67,6 +63,7 @@ export function CellActionsPopover({
renderValue,
renderPopoverTrigger,
}: CellActionsPopoverProps) {
const { euiTheme } = useEuiTheme();
const [isPopoverOpen, { toggle: togglePopover, off: closePopover }] = useBoolean(false);

const makeFilterHandlerByOperator = (operator: '+' | '-') => () => {
Expand Down Expand Up @@ -95,7 +92,12 @@ export function CellActionsPopover({
data-test-subj="dataTableCellActionPopoverTitle"
>
<EuiFlexItem style={{ maxWidth: '200px' }}>
<EuiText size="s" css={codeFontCSS}>
<EuiText
size="s"
css={css`
font-family: ${euiTheme.font.familyCode};
`}
>
<strong>{property}</strong>{' '}
{typeof renderValue === 'function' ? renderValue(value) : value}
</EuiText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { dynamic } from '@kbn/shared-ux-utility';
import React from 'react';
import { css } from '@emotion/react';
import { AgentName } from '@kbn/elastic-agent-utils';
import { euiThemeVars } from '@kbn/ui-theme';
import type { SharePluginStart } from '@kbn/share-plugin/public';
import type { CoreStart } from '@kbn/core-lifecycle-browser';
import {
Expand All @@ -28,6 +27,7 @@ import {
} from '@kbn/discover-utils';
import { DataTableRecord, getFieldValue } from '@kbn/discover-utils';
import { LogDocument, ResourceFields, getAvailableResourceFields } from '@kbn/discover-utils/src';
import { useEuiTheme } from '@elastic/eui';
import { FieldBadgeWithActions, FieldBadgeWithActionsProps } from '../cell_actions_popover';
import { ServiceNameBadgeWithActions } from '../service_name_badge_with_actions';
/**
Expand Down Expand Up @@ -94,15 +94,18 @@ export const createResourceFields = (
value: resourceDoc[name] as string,
ResourceBadge: resourceBadgeComponentWithDependencies,
...(name === SERVICE_NAME_FIELD && {
Icon: () => (
<AgentIcon
agentName={resourceDoc[AGENT_NAME_FIELD] as AgentName}
size="m"
css={css`
margin-right: ${euiThemeVars.euiSizeXS};
`}
/>
),
Icon: () => {
const { euiTheme } = useEuiTheme();
return (
<AgentIcon
agentName={resourceDoc[AGENT_NAME_FIELD] as AgentName}
size="m"
css={css`
margin-right: ${euiTheme.size.xs};
`}
/>
);
},
}),
};
});
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-discover-contextual-components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"@kbn/router-utils",
"@kbn/management-settings-ids",
"@kbn/share-plugin",
"@kbn/ui-theme",
"@kbn/unified-data-table",
"@kbn/unified-doc-viewer",
"@kbn/react-hooks",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { EuiBadge, EuiFlexGroup, EuiText, EuiTitle } from '@elastic/eui';
import { EuiBadge, EuiFlexGroup, EuiText, EuiTitle, useEuiTheme } from '@elastic/eui';
import { css } from '@emotion/react';
import React, { ReactNode } from 'react';
import { dynamic } from '@kbn/shared-ux-utility';
import { euiThemeVars } from '@kbn/ui-theme';
import { PartialFieldMetadataPlain } from '@kbn/fields-metadata-plugin/common';
import { HoverActionPopover } from './hover_popover_action';

Expand Down Expand Up @@ -39,12 +38,19 @@ export function HighlightField({
children,
...props
}: HighlightFieldProps) {
const { euiTheme } = useEuiTheme();

const hasFieldDescription = !!fieldMetadata?.short;

return formattedValue && value ? (
<div {...props}>
<EuiFlexGroup responsive={false} alignItems="center" gutterSize="xs">
<EuiTitle css={fieldNameStyle} size="xxxs">
<EuiTitle
css={css`
color: ${euiTheme.colors.textHeading};
tonyghiani marked this conversation as resolved.
Show resolved Hide resolved
`}
size="xxxs"
>
<span>{label}</span>
</EuiTitle>
{hasFieldDescription ? <HighlightFieldDescription fieldMetadata={fieldMetadata} /> : null}
Expand Down Expand Up @@ -80,7 +86,3 @@ const FormattedValue = ({ value }: { value: string }) => (
dangerouslySetInnerHTML={{ __html: value }}
/>
);

const fieldNameStyle = css`
color: ${euiThemeVars.euiColorDarkShade};
`;
1 change: 0 additions & 1 deletion src/plugins/unified_doc_viewer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"@kbn/code-editor-mock",
"@kbn/custom-icons",
"@kbn/react-field",
"@kbn/ui-theme",
"@kbn/discover-shared-plugin",
"@kbn/fields-metadata-plugin",
"@kbn/core-notifications-browser",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* 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 { useEuiTheme } from '@elastic/eui';
import { css } from '@emotion/react';
import React from 'react';

export const VerticalRule = (props: React.ComponentProps<'span'>) => {
const { euiTheme } = useEuiTheme();

return (
<span
css={css`
width: 1px;
tonyghiani marked this conversation as resolved.
Show resolved Hide resolved
height: 63px;
background-color: ${euiTheme.colors.borderBaseSubdued};
`}
{...props}
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export function IntegrationsSelector({
<EuiFilterButton
data-test-subj="datasetQualityIntegrationsSelectableButton"
iconType="arrowDown"
badgeColor="success"
badgeColor="accentSecondary"
tonyghiani marked this conversation as resolved.
Show resolved Hide resolved
onClick={onButtonClick}
isSelected={isPopoverOpen}
numFilters={integrations.length}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function NamespacesSelector({
<EuiFilterButton
data-test-subj="datasetQualityNamespacesSelectableButton"
iconType="arrowDown"
badgeColor="success"
badgeColor="accentSecondary"
onClick={onButtonClick}
isSelected={isPopoverOpen}
numFilters={namespaces.length}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function QualitiesSelector({
<EuiFilterButton
data-test-subj="datasetQualityQualitiesSelectableButton"
iconType="arrowDown"
badgeColor="success"
badgeColor="accentSecondary"
onClick={onButtonClick}
isSelected={isPopoverOpen}
numFilters={qualities.length}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function Selector({
<EuiFilterButton
data-test-subj={`${dataTestSubj}Button`}
iconType="arrowDown"
badgeColor="success"
badgeColor="accentSecondary"
onClick={onButtonClick}
isSelected={isPopoverOpen}
numFilters={options.length}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
*/

import React from 'react';
import { euiThemeVars } from '@kbn/ui-theme';
import { css } from '@emotion/react';

import {
EuiFlexGroup,
Expand All @@ -30,6 +28,7 @@ import {
summaryPanelQualityTooltipText,
} from '../../../../common/translations';
import { mapPercentagesToQualityCounts } from '../../quality_indicator';
import { VerticalRule } from '../../common/vertical_rule';

export function DatasetsQualityIndicators() {
const { onPageReady } = usePerformanceContext();
Expand Down Expand Up @@ -71,14 +70,14 @@ export function DatasetsQualityIndicators() {
description={summaryPanelQualityPoorText}
isLoading={isDatasetsQualityLoading}
/>
<span css={verticalRule} />
<VerticalRule />
<QualityIndicator
value={qualityCounts.degraded}
quality="warning"
description={summaryPanelQualityDegradedText}
isLoading={isDatasetsQualityLoading}
/>
<span css={verticalRule} />
<VerticalRule />
<QualityIndicator
value={qualityCounts.good + datasetsWithoutIgnoredField}
quality="success"
Expand Down Expand Up @@ -125,9 +124,3 @@ const QualityIndicator = ({
</EuiFlexGroup>
);
};

const verticalRule = css`
width: 1px;
height: 63px;
background-color: ${euiThemeVars.euiColorLightShade};
`;
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
EuiTitle,
EuiToolTip,
formatNumber,
useEuiTheme,
} from '@elastic/eui';
import { ES_FIELD_TYPES, KBN_FIELD_TYPES } from '@kbn/field-types';

Expand All @@ -33,6 +34,8 @@ import { SparkPlot } from '../../common/spark_plot';
import { DegradedField } from '../../../../common/api_types';

export const DegradedFieldInfo = ({ fieldList }: { fieldList?: DegradedField }) => {
const { euiTheme } = useEuiTheme();

const {
fieldFormats,
degradedFieldValues,
Expand Down Expand Up @@ -164,7 +167,7 @@ export const DegradedFieldInfo = ({ fieldList }: { fieldList?: DegradedField })
<EuiBadgeGroup gutterSize="s">
{degradedFieldValues?.values.map((value, idx) => (
<EuiBadge color="hollow" key={idx}>
<EuiTextColor color="#765B96">
<EuiTextColor color={euiTheme.colors.vis.euiColorVis3}>
<strong>{value}</strong>
</EuiTextColor>
</EuiBadge>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,9 @@

import React from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiSkeletonTitle, EuiText } from '@elastic/eui';
import { css } from '@emotion/react';
import { euiThemeVars } from '@kbn/ui-theme';
import { PrivilegesWarningIconWrapper } from '../../../common';
import { notAvailableLabel } from '../../../../../common/translations';

const verticalRule = css`
width: 1px;
height: 65px;
background-color: ${euiThemeVars.euiColorLightShade};
`;

const verticalRuleHidden = css`
width: 1px;
height: 65px;
visibility: hidden;
`;
import { VerticalRule } from '../../../common/vertical_rule';

export function Panel({
title,
Expand All @@ -38,14 +25,14 @@ export function Panel({
return panelChildren.map((panelChild, index) => (
<React.Fragment key={index}>
{panelChild}
{index < panelChildren.length - 1 && <span css={verticalRule} />}
{index < panelChildren.length - 1 && <VerticalRule />}
</React.Fragment>
));
}
return (
<>
{panelChildren}
<span css={verticalRuleHidden} />
<VerticalRule style={{ visibility: 'hidden' }} />
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"@kbn/router-utils",
"@kbn/xstate-utils",
"@kbn/shared-ux-utility",
"@kbn/ui-theme",
"@kbn/data-service",
"@kbn/observability-shared-plugin",
"@kbn/data-plugin",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
import React from 'react';
import { AnnotationDomainType, LineAnnotation, Position } from '@elastic/charts';
import moment from 'moment';
import { EuiIcon } from '@elastic/eui';
import { EuiIcon, useEuiTheme } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { euiThemeVars } from '@kbn/ui-theme';
import { UI_SETTINGS } from '@kbn/data-plugin/public';
import { useKibanaContextForPlugin } from '../../../../../hooks/use_kibana';
export function AlertAnnotation({ alertStarted }: { alertStarted: number }) {
const { euiTheme } = useEuiTheme();
const { uiSettings } = useKibanaContextForPlugin().services;

return (
Expand All @@ -32,7 +32,7 @@ export function AlertAnnotation({ alertStarted }: { alertStarted: number }) {
style={{
line: {
strokeWidth: 3,
stroke: euiThemeVars.euiColorDangerText,
stroke: euiTheme.colors.borderStrongDanger,
opacity: 1,
},
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import React, { FC, PropsWithChildren, useEffect, useMemo, useState } from 'react';
import { i18n } from '@kbn/i18n';
import { EuiCallOut, EuiLink } from '@elastic/eui';
import { EuiCallOut, EuiLink, useEuiTheme } from '@elastic/eui';
import { ReactEmbeddableFactory } from '@kbn/embeddable-plugin/public';
import {
initializeTimeRange,
Expand All @@ -19,7 +19,6 @@ 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 { FormattedMessage } from '@kbn/i18n-react';
import type { LogStreamApi, LogStreamSerializedState, Services } from './types';
Expand Down Expand Up @@ -112,6 +111,7 @@ const SAVED_SEARCH_DOCS_URL =
'https://www.elastic.co/guide/en/kibana/current/save-open-search.html';

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

if (isDismissed) {
Expand All @@ -125,8 +125,8 @@ const DeprecationCallout = () => {
onDismiss={() => setDismissed(true)}
css={{
position: 'absolute',
bottom: euiThemeVars.euiSizeM,
right: euiThemeVars.euiSizeM,
bottom: euiTheme.size.m,
right: euiTheme.size.m,
width: 'min(100%, 40ch)',
}}
>
Expand Down
Loading