Skip to content

Commit

Permalink
[ResponseOps][UI] - EUI Visual Refresh integration and QA (#204352)
Browse files Browse the repository at this point in the history
## Summary

Closes: #202551
Closes: #202550
Closes: #202549
Closes: #202548

Meta: #202547

Summary

- Buttons with `success` color have been updated to `primary`
- Replaced "textSuccess" to "successText"
example: Edit connector -> **Save** button
<img width="756" alt="Screenshot 2024-12-17 at 15 32 14"
src="https://github.com/user-attachments/assets/5d953c7a-6855-4718-98ab-fc89c516ff8d"
/>

- All references to renamed tokens have been updated to use the new
token name
- Replaced the color utility functions with EUI color tokens as they
will be deprecated
- All usage of color palette tokens and functions now pull from the
theme
- changed severity colors in Borealis

Amsterdam:
<img width="1931" alt="Screenshot 2024-12-18 at 11 50 51"
src="https://github.com/user-attachments/assets/401465b5-b589-47c7-82a6-8211f06c13a5"
/>

Borealis: 
<img width="1925" alt="Screenshot 2024-12-18 at 11 50 06"
src="https://github.com/user-attachments/assets/47ebcba7-70b0-4875-906a-55f509e0b5ca"
/>

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
3 people authored Jan 15, 2025
1 parent 112acc1 commit 10cc891
Show file tree
Hide file tree
Showing 58 changed files with 368 additions and 294 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import {
EuiTabbedContentProps,
useEuiOverflowScroll,
EuiBasicTableColumn,
useEuiTheme,
useEuiFontSize,
} from '@elastic/eui';
import { css } from '@emotion/react';
import React, { memo, useMemo } from 'react';
import { Alert } from '@kbn/alerting-types';
import { euiThemeVars } from '@kbn/ui-theme';
import { useEuiTablePersist } from '@kbn/shared-ux-table-persist';

export const search = {
Expand Down Expand Up @@ -90,6 +91,8 @@ export interface AlertFieldsTableProps {
* A paginated, filterable table to show alert object fields
*/
export const AlertFieldsTable = memo(({ alert, fields }: AlertFieldsTableProps) => {
const { euiTheme } = useEuiTheme();
const xsFontSize = useEuiFontSize('xs').fontSize;
const { pageSize, sorting, onTableChange } = useEuiTablePersist<AlertField>({
tableId: 'obltAlertFields',
initialPageSize: 25,
Expand Down Expand Up @@ -122,8 +125,8 @@ export const AlertFieldsTable = memo(({ alert, fields }: AlertFieldsTableProps)
search={search}
css={css`
& .euiTableRow {
font-size: ${euiThemeVars.euiFontSizeXS};
font-family: ${euiThemeVars.euiCodeFontFamily};
font-size: ${xsFontSize};
font-family: ${euiTheme.font.familyCode};
}
`}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"@kbn/data-views-plugin",
"@kbn/unified-search-plugin",
"@kbn/es-query",
"@kbn/ui-theme",
"@kbn/controls-plugin",
"@kbn/embeddable-plugin",
"@kbn/core-http-browser",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ import {
EuiFlexItem,
EuiPopover,
EuiToolTip,
useEuiTheme,
useEuiFontSize,
} from '@elastic/eui';
import React, { Fragment, useCallback, useMemo, useState } from 'react';
import { Filter } from '@kbn/es-query';
import { css } from '@emotion/react';
import { euiThemeVars } from '@kbn/ui-theme';
import { GroupStatsItem } from '../types';
import { statsContainerCss } from '../styles';
import { TAKE_ACTION } from '../translations';

interface GroupStatsProps<T> {
Expand All @@ -34,14 +34,15 @@ interface GroupStatsProps<T> {
}

const Separator = () => {
const { euiTheme } = useEuiTheme();
return (
<EuiFlexItem
grow={false}
role="separator"
css={css`
align-self: center;
height: 20px;
border-right: ${euiThemeVars.euiBorderThin};
border-right: ${euiTheme.border.thin};
`}
/>
);
Expand All @@ -55,6 +56,9 @@ const GroupStatsComponent = <T,>({
stats,
takeActionItems: getTakeActionItems,
}: GroupStatsProps<T>) => {
const { euiTheme } = useEuiTheme();
const xsFontSize = useEuiFontSize('xs').fontSize;

const [isPopoverOpen, setPopover] = useState(false);
const takeActionItems = useMemo(() => {
return getTakeActionItems?.(groupFilter, groupNumber) ?? [];
Expand Down Expand Up @@ -86,14 +90,28 @@ const GroupStatsComponent = <T,>({

return (
<EuiFlexItem grow={false} key={stat.title}>
<span css={statsContainerCss} data-test-subj={dataTestSubj}>
<span
css={css`
font-size: ${xsFontSize};
font-weight: ${euiTheme.font.weight.semiBold};
.smallDot {
width: 3px !important;
display: inline-block;
}
.euiBadge__text {
text-align: center;
width: 100%;
}
`}
data-test-subj={dataTestSubj}
>
{stat.title}
{component}
</span>
</EuiFlexItem>
);
}) ?? [],
[stats]
[stats, euiTheme, xsFontSize]
);

const takeActionMenu = useMemo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ const testProps = {
},
],
title: 'Group alerts by',
euiTheme: {
border: {
thin: '1px solid #E3E8F2',
},
},
};
describe('group selector', () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import type {
import {
EuiContextMenuPanelDescriptor,
EuiContextMenuPanelItemDescriptor,
useEuiTheme,
} from '@elastic/eui';
import { EuiPopover } from '@elastic/eui';
import React, { useCallback, useMemo, useState } from 'react';
Expand Down Expand Up @@ -44,6 +45,8 @@ const GroupSelectorComponent = ({
[groupsSelected]
);

const { euiTheme } = useEuiTheme();

const panels: EuiContextMenuPanelDescriptor[] = useMemo(() => {
const isOptionDisabled = (key?: string) => {
// Do not disable when maxGroupingLevels is 1 to allow toggling between groups
Expand Down Expand Up @@ -147,6 +150,7 @@ const GroupSelectorComponent = ({
data-test-subj="groupByContextMenu"
initialPanelId="firstPanel"
panels={panels}
euiTheme={euiTheme}
/>
</EuiPopover>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import {
EuiProgress,
EuiSpacer,
EuiTablePagination,
useEuiTheme,
useEuiFontSize,
} from '@elastic/eui';
import { css } from '@emotion/react';
import type { Filter } from '@kbn/es-query';
import React, { useMemo, useState } from 'react';
import { METRIC_TYPE, UiCounterMetricType } from '@kbn/analytics';
Expand All @@ -22,7 +25,7 @@ import { createGroupFilter, getNullGroupFilter } from '../containers/query/helpe
import { GroupPanel } from './accordion_panel';
import { GroupStats } from './accordion_panel/group_stats';
import { EmptyGroupingComponent } from './empty_results_panel';
import { countCss, groupingContainerCss, groupingContainerCssLevel } from './styles';
import { groupingContainerCss, groupingContainerCssLevel } from './styles';
import { GROUPS_UNIT, NULL_GROUP } from './translations';
import type { ParsedGroupingAggregation, GroupPanelRenderer, GetGroupStats } from './types';
import { GroupingBucket, OnGroupToggle } from './types';
Expand Down Expand Up @@ -78,6 +81,17 @@ const GroupingComponent = <T,>({
unit = defaultUnit,
groupsUnit = GROUPS_UNIT,
}: GroupingProps<T>) => {
const { euiTheme } = useEuiTheme();
const xsFontSize = useEuiFontSize('xs').fontSize;

const countCss = css`
font-size: ${xsFontSize};
font-weight: ${euiTheme.font.weight.semiBold};
border-right: ${euiTheme.border.thin};
margin-right: 16px;
padding-right: 16px;
`;

const [trigger, setTrigger] = useState<Record<string, { state: 'open' | 'closed' | undefined }>>(
{}
);
Expand Down Expand Up @@ -219,7 +233,9 @@ const GroupingComponent = <T,>({
</EuiFlexGroup>
)}
<div
css={groupingLevel > 0 ? groupingContainerCssLevel : groupingContainerCss}
css={
groupingLevel > 0 ? groupingContainerCssLevel(euiTheme) : groupingContainerCss(euiTheme)
}
className="eui-xScroll"
>
{isLoading ? (
Expand Down
50 changes: 14 additions & 36 deletions src/platform/packages/shared/kbn-grouping/src/components/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,30 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { EuiButtonEmpty, EuiContextMenu } from '@elastic/eui';
import { EuiButtonEmpty, EuiContextMenu, type EuiThemeComputed } from '@elastic/eui';
import { euiStyled } from '@kbn/kibana-react-plugin/common';
import { css } from '@emotion/react';
import { euiThemeVars } from '@kbn/ui-theme';

export const countCss = css`
font-size: ${euiThemeVars.euiFontSizeXS};
font-weight: ${euiThemeVars.euiFontWeightSemiBold};
border-right: ${euiThemeVars.euiBorderThin};
margin-right: 16px;
padding-right: 16px;
`;

export const statsContainerCss = css`
font-size: ${euiThemeVars.euiFontSizeXS};
font-weight: ${euiThemeVars.euiFontWeightSemiBold};
.smallDot {
width: 3px !important;
display: inline-block;
}
.euiBadge__text {
text-align: center;
width: 100%;
}
`;

export const groupingContainerCss = css`
export const groupingContainerCss = (euiTheme: EuiThemeComputed<{}>) => css`
.groupingAccordionForm .euiAccordion__childWrapper .euiAccordion__children {
margin-left: 8px;
margin-right: 8px;
border-left: ${euiThemeVars.euiBorderThin};
border-right: ${euiThemeVars.euiBorderThin};
border-bottom: ${euiThemeVars.euiBorderThin};
border-left: ${euiTheme.border.thin};
border-right: ${euiTheme.border.thin};
border-bottom: ${euiTheme.border.thin};
border-radius: 0 0 6px 6px;
}
.groupingAccordionForm .euiAccordion__triggerWrapper {
border-bottom: ${euiThemeVars.euiBorderThin};
border-left: ${euiThemeVars.euiBorderThin};
border-right: ${euiThemeVars.euiBorderThin};
border-bottom: ${euiTheme.border.thin};
border-left: ${euiTheme.border.thin};
border-right: ${euiTheme.border.thin};
border-radius: 6px;
min-height: 78px;
padding-left: 16px;
padding-right: 16px;
}
.groupingAccordionForm {
border-top: ${euiThemeVars.euiBorderThin};
border-top: ${euiTheme.border.thin};
border-bottom: none;
border-radius: 6px;
min-width: 1090px;
Expand All @@ -65,17 +43,17 @@ export const groupingContainerCss = css`
}
`;

export const groupingContainerCssLevel = css`
export const groupingContainerCssLevel = (euiTheme: EuiThemeComputed<{}>) => css`
.groupingAccordionFormLevel .euiAccordion__childWrapper .euiAccordion__children {
margin-left: 8px;
margin-right: 8px;
border-left: none;
border-right: none;
border-bottom: ${euiThemeVars.euiBorderThin};
border-bottom: ${euiTheme.border.thin};
border-radius: 0;
}
.groupingAccordionFormLevel .euiAccordion__triggerWrapper {
border-bottom: ${euiThemeVars.euiBorderThin};
border-bottom: ${euiTheme.border.thin};
border-left: none;
border-right: none;
min-height: 78px;
Expand All @@ -97,14 +75,14 @@ export const groupingContainerCssLevel = css`
}
`;

export const StyledContextMenu = euiStyled(EuiContextMenu)`
export const StyledContextMenu = euiStyled(EuiContextMenu)<{ euiTheme: EuiThemeComputed }>`
width: 250px;
& .euiContextMenuItem__text {
overflow: hidden;
text-overflow: ellipsis;
}
.euiContextMenuItem {
border-bottom: ${euiThemeVars.euiBorderThin};
border-bottom: ${(props) => props.euiTheme.border.thin};
}
.euiContextMenuItem:last-child {
border: none;
Expand Down
1 change: 0 additions & 1 deletion src/platform/packages/shared/kbn-grouping/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"@kbn/i18n-react",
"@kbn/kibana-react-plugin",
"@kbn/shared-svg",
"@kbn/ui-theme",
"@kbn/analytics",
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
EuiPanel,
EuiButtonIcon,
useEuiTheme,
useEuiBackgroundColor,
EuiIcon,
EuiText,
EuiTabs,
Expand Down Expand Up @@ -110,9 +109,9 @@ export const RuleActionsItem = (props: RuleActionsItemProps) => {
} = useRuleFormState();

const [tab, setTab] = useState<string>(MESSAGES_TAB);
const subdued = useEuiBackgroundColor('subdued');
const plain = useEuiBackgroundColor('plain');
const { euiTheme } = useEuiTheme();
const subdued = euiTheme.colors.lightestShade;
const plain = euiTheme.colors.backgroundBasePlain;

const [availableActionVariables, setAvailableActionVariables] = useState<ActionVariable[]>(() => {
if (!selectedRuleType.actionVariables) {
Expand Down Expand Up @@ -692,7 +691,7 @@ export const RuleActionsItem = (props: RuleActionsItemProps) => {
}
buttonContentClassName="eui-fullWidth"
buttonContent={
<EuiPanel color="subdued" paddingSize="m">
<EuiPanel color="transparent" paddingSize="m">
<EuiFlexGroup alignItems="center" responsive={false}>
{accordionIcon}
{connectorTitle}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ export const RuleActionsSystemActionsItem = (props: RuleActionsSystemActionsItem
>({});
const [warning, setWarning] = useState<string | null>(null);

const subdued = useEuiBackgroundColor('subdued');
const { euiTheme } = useEuiTheme();
const subdued = euiTheme.colors.lightestShade;

const dispatch = useRuleFormDispatch();
const actionTypeModel = actionTypeRegistry.get(action.actionTypeId);
Expand Down Expand Up @@ -267,7 +267,7 @@ export const RuleActionsSystemActionsItem = (props: RuleActionsSystemActionsItem
buttonContent={
<EuiPanel
data-test-subj="ruleActionsSystemActionsItemAccordionButton"
color="subdued"
color="transparent"
paddingSize="m"
>
<EuiFlexGroup alignItems="center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import React from 'react';
import { useEuiBackgroundColorCSS, EuiPageTemplate } from '@elastic/eui';
import { EuiPageTemplate } from '@elastic/eui';

interface RuleFormErrorPromptWrapperProps {
hasBorder?: boolean;
Expand All @@ -18,7 +18,9 @@ interface RuleFormErrorPromptWrapperProps {
export const RuleFormErrorPromptWrapper: React.FC<
React.PropsWithChildren<RuleFormErrorPromptWrapperProps>
> = ({ children, hasBorder, hasShadow }) => {
const styles = useEuiBackgroundColorCSS().transparent;
const styles = {
backgroundColor: 'transparent',
};
return (
<EuiPageTemplate offset={0} css={styles}>
<EuiPageTemplate.EmptyPrompt paddingSize="none" hasBorder={hasBorder} hasShadow={hasShadow}>
Expand Down
Loading

0 comments on commit 10cc891

Please sign in to comment.