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

Migrate Session View to Borealis #207710

Merged
merged 7 commits into from
Jan 23, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface StylesDeps {
}

export const useStyles = ({ isDisplayedAbove }: StylesDeps) => {
const { euiTheme, euiVars } = useEuiTheme();
const { euiTheme } = useEuiTheme();

const cached = useMemo(() => {
const { size, font } = euiTheme;
Expand Down Expand Up @@ -44,18 +44,18 @@ export const useStyles = ({ isDisplayedAbove }: StylesDeps) => {

if (isDisplayedAbove) {
container.top = 0;
container.background = `linear-gradient(180deg, ${euiVars.euiColorLightestShade} 0%, transparent 100%)`;
container.background = `linear-gradient(180deg, ${euiTheme.colors.lightestShade} 0%, transparent 100%)`;
} else {
container.bottom = 0;
container.background = `linear-gradient(360deg, ${euiVars.euiColorLightestShade} 0%, transparent 100%)`;
container.background = `linear-gradient(360deg, ${euiTheme.colors.lightestShade} 0%, transparent 100%)`;
}

return {
container,
jumpBackBadge,
buttonStyle,
};
}, [isDisplayedAbove, euiTheme, euiVars]);
}, [isDisplayedAbove, euiTheme]);

return cached;
};

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ export const DetailPanelProcessTab = ({ selectedProcess, index }: DetailPanelPro
const [exec, eventAction] = execTuple;
return (
<div key={`executable-${idx}`} css={styles.ellipsis}>
<EuiTextColor color="subdued" css={styles.descriptionSemibold}>
<EuiTextColor color="default" css={styles.descriptionSemibold}>
{exec}
</EuiTextColor>
{eventAction && (
<EuiTextColor color="subdued" css={styles.executableAction}>
<EuiTextColor color="default" css={styles.executableAction}>
Copy link
Contributor

@alexreal1314 alexreal1314 Jan 23, 2025

Choose a reason for hiding this comment

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

@maxcold general question - why do we have EuiTextColor and EuiText? looks like EuiText supports everything EuiTextColor does and more.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alexreal1314 I don't know tbh, a good question for EUI team. Seems like a convenience sugar according to the docs https://eui.elastic.co/#/display/text#coloring-text EuiTextColor is meant to color parts of the text and translate into span, but the same can be achieved by passing component and color props to EuiText as it seems

{eventAction}
</EuiTextColor>
)}
Expand Down Expand Up @@ -131,9 +131,7 @@ export const DetailPanelProcessTab = ({ selectedProcess, index }: DetailPanelPro
textToCopy={`${LEADER_FIELD_PREFIX[idx]}.entity_id: "${id}"`}
tooltipContent={id}
>
<EuiTextColor color="subdued" css={styles.descriptionSemibold}>
{id}
</EuiTextColor>
{id}
</DetailPanelCopy>
),
},
Expand Down Expand Up @@ -166,9 +164,7 @@ export const DetailPanelProcessTab = ({ selectedProcess, index }: DetailPanelPro
textToCopy={`${LEADER_FIELD_PREFIX[idx]}.interactive: "${interactive}"`}
tooltipContent={interactive}
>
<EuiTextColor color="subdued" css={styles.descriptionSemibold}>
{interactive}
</EuiTextColor>
{interactive}
</DetailPanelCopy>
),
},
Expand All @@ -179,9 +175,7 @@ export const DetailPanelProcessTab = ({ selectedProcess, index }: DetailPanelPro
textToCopy={`${LEADER_FIELD_PREFIX[idx]}.working_directory: "${workingDirectory}"`}
tooltipContent={workingDirectory}
>
<EuiTextColor color="subdued" css={styles.descriptionSemibold}>
{workingDirectory}
</EuiTextColor>
{workingDirectory}
</DetailPanelCopy>
),
},
Expand All @@ -192,9 +186,7 @@ export const DetailPanelProcessTab = ({ selectedProcess, index }: DetailPanelPro
textToCopy={`${LEADER_FIELD_PREFIX[idx]}.pid: "${pid}"`}
tooltipContent={pid}
>
<EuiTextColor color="subdued" css={styles.descriptionSemibold}>
{pid}
</EuiTextColor>
{pid}
</DetailPanelCopy>
),
},
Expand Down Expand Up @@ -227,9 +219,7 @@ export const DetailPanelProcessTab = ({ selectedProcess, index }: DetailPanelPro
textToCopy={`${LEADER_FIELD_PREFIX[idx]}.exit_code: "${exitCode}"`}
tooltipContent={exitCode}
>
<EuiTextColor color="subdued" css={styles.descriptionSemibold}>
{exitCode}
</EuiTextColor>
{exitCode}
</DetailPanelCopy>
),
},
Expand Down Expand Up @@ -288,9 +278,7 @@ export const DetailPanelProcessTab = ({ selectedProcess, index }: DetailPanelPro
textToCopy={`${LEADER_FIELD_PREFIX[idx]}.entry_meta.type: "${entryMetaType}"`}
tooltipContent={entryMetaType}
>
<EuiTextColor color="subdued" css={styles.descriptionSemibold}>
{entryMetaType}
</EuiTextColor>
{entryMetaType}
</DetailPanelCopy>
),
},
Expand Down Expand Up @@ -343,9 +331,7 @@ export const DetailPanelProcessTab = ({ selectedProcess, index }: DetailPanelPro
textToCopy={`${PROCESS_FIELD_PREFIX}.entity_id: "${id}"`}
tooltipContent={id}
>
<EuiTextColor color="subdued" css={styles.descriptionSemibold}>
{id}
</EuiTextColor>
{id}
</DetailPanelCopy>
),
},
Expand Down Expand Up @@ -379,9 +365,7 @@ export const DetailPanelProcessTab = ({ selectedProcess, index }: DetailPanelPro
textToCopy={`${PROCESS_FIELD_PREFIX}.interactive: "${interactive}"`}
tooltipContent={interactive}
>
<EuiTextColor color="subdued" css={styles.descriptionSemibold}>
{interactive}
</EuiTextColor>
{interactive}
</DetailPanelCopy>
),
},
Expand All @@ -392,9 +376,7 @@ export const DetailPanelProcessTab = ({ selectedProcess, index }: DetailPanelPro
textToCopy={`${PROCESS_FIELD_PREFIX}.working_directory: "${workingDirectory}"`}
tooltipContent={workingDirectory}
>
<EuiTextColor color="subdued" css={styles.descriptionSemibold}>
{workingDirectory}
</EuiTextColor>
{workingDirectory}
</DetailPanelCopy>
),
},
Expand All @@ -405,9 +387,7 @@ export const DetailPanelProcessTab = ({ selectedProcess, index }: DetailPanelPro
textToCopy={`${PROCESS_FIELD_PREFIX}.pid: "${pid}"`}
tooltipContent={pid}
>
<EuiTextColor color="subdued" css={styles.descriptionSemibold}>
{pid}
</EuiTextColor>
{pid}
</DetailPanelCopy>
),
},
Expand Down Expand Up @@ -440,9 +420,7 @@ export const DetailPanelProcessTab = ({ selectedProcess, index }: DetailPanelPro
textToCopy={`${PROCESS_FIELD_PREFIX}.exit_code: "${exitCode}"`}
tooltipContent={exitCode}
>
<EuiTextColor color="subdued" css={styles.descriptionSemibold}>
{exitCode}
</EuiTextColor>
{exitCode}
</DetailPanelCopy>
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const useStyles = () => {
};

const executableAction: CSSObject = {
fontWeight: euiTheme.font.weight.semiBold,
fontWeight: euiTheme.font.weight.bold,
paddingLeft: euiTheme.size.xs,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { CSSObject } from '@emotion/react';
import { useEuiTheme } from '../../hooks';

export const useStyles = () => {
const { euiTheme, euiVars } = useEuiTheme();
const { euiTheme } = useEuiTheme();

const cached = useMemo(() => {
const { font } = euiTheme;
Expand All @@ -20,13 +20,13 @@ export const useStyles = () => {
fontFamily: font.familyCode,
overflow: 'auto',
height: '100%',
backgroundColor: euiVars.euiColorLightestShade,
backgroundColor: euiTheme.colors.lightestShade,
};

return {
sessionViewProcessTree,
};
}, [euiTheme, euiVars]);
}, [euiTheme]);

return cached;
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface StylesDeps {
}

export const useStyles = ({ isInvestigated, isSelected }: StylesDeps) => {
const { euiTheme, euiVars } = useEuiTheme();
const { euiTheme } = useEuiTheme();

const cached = useMemo(() => {
const { size, colors, font, border } = euiTheme;
Expand Down Expand Up @@ -56,7 +56,7 @@ export const useStyles = ({ isInvestigated, isSelected }: StylesDeps) => {
flexShrink: 0,
marginRight: size.xs,
'&:hover, &:focus, &:focus-within': {
backgroundColor: transparentize(euiVars.buttonsBackgroundNormalDefaultPrimary, 0.2), // TODO: Borealis migration - replace transparentize with color token
backgroundColor: transparentize(euiTheme.colors.backgroundFilledPrimary, 0.2), // TODO: Borealis migration - replace transparentize with color token
},
},
'&& .euiFlexItem': {
Expand Down Expand Up @@ -100,7 +100,7 @@ export const useStyles = ({ isInvestigated, isSelected }: StylesDeps) => {
processPanel,
processAlertDisplayContainer,
};
}, [euiTheme, isInvestigated, isSelected, euiVars]);
}, [euiTheme, isInvestigated, isSelected]);

return cached;
};
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const useStyles = ({
isSelected,
isSessionLeader,
}: StylesDeps) => {
const { euiTheme, euiVars } = useEuiTheme();
const { euiTheme } = useEuiTheme();

const cached = useMemo(() => {
const { colors, border, size, font } = euiTheme;
Expand All @@ -50,7 +50,7 @@ export const useStyles = ({
};

const icon: CSSObject = {
color: euiVars.euiColorDarkShade,
color: euiTheme.colors.darkShade,
};

/**
Expand Down Expand Up @@ -142,7 +142,7 @@ export const useStyles = ({
processNode.top = '-' + size.base;
processNode.zIndex = 1;
processNode.borderTop = `${size.base} solid transparent`;
processNode.backgroundColor = euiVars.euiColorLightestShade;
processNode.backgroundColor = euiTheme.colors.lightestShade;
processNode.borderBottom = border.editable;
}

Expand All @@ -156,7 +156,7 @@ export const useStyles = ({
paddingLeft: size.s,
position: 'relative',
verticalAlign: 'middle',
color: euiVars.euiTextSubduedColor,
color: euiTheme.colors.textSubdued,
wordBreak: 'break-all',
padding: `${size.xs} 0px`,
button: {
Expand Down Expand Up @@ -203,7 +203,7 @@ export const useStyles = ({
sessionLeader,
jumpToTop,
};
}, [depth, euiTheme, hasAlerts, hasInvestigatedAlert, isSelected, euiVars, isSessionLeader]);
}, [depth, euiTheme, hasAlerts, hasInvestigatedAlert, isSelected, isSessionLeader]);

return cached;
};
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ export const useButtonStyles = () => {
transform: `rotate(180deg)`,
},
'&.isExpanded': {
color: colors.ghost,
color: colors.textInverse,
background: colors.backgroundFilledPrimary,
borderColor: colors.borderStrongPrimary,
'&:hover, &:focus': {
background: colors.backgroundFilledPrimary,
borderColor: colors.borderStrongPrimary,
},
},
};
Expand All @@ -64,10 +66,12 @@ export const useButtonStyles = () => {
textDecoration: 'none',
},
'&.isExpanded': {
color: colors.ghost,
color: colors.textInverse,
background: colors.backgroundFilledDanger,
borderColor: colors.borderStrongDanger,
'&:hover, &:focus': {
background: `${colors.backgroundFilledDanger}`,
borderColor: colors.borderStrongDanger,
},
},

Expand All @@ -82,31 +86,31 @@ export const useButtonStyles = () => {

const outputButton: CSSObject = {
...button,
color: colors.textAccent,
background: colors.backgroundBaseAccent,
border: `${border.width.thin} solid ${colors.borderBaseAccent}`,
color: colors.textAccentSecondary,
background: colors.backgroundBaseAccentSecondary,
border: `${border.width.thin} solid ${colors.borderBaseAccentSecondary}`,
'&&:hover, &&:focus': {
background: colors.backgroundLightAccent,
background: colors.backgroundLightAccentSecondary,
textDecoration: 'none',
},
'&.isExpanded': {
color: colors.ghost,
background: colors.backgroundFilledAccent,
background: colors.backgroundFilledAccentSecondary,
'&:hover, &:focus': {
background: `${colors.backgroundFilledAccent}`,
background: `${colors.backgroundFilledAccentSecondary}`,
},
},
};

const userChangedButton: CSSObject = {
...button,
cursor: 'default',
color: colors.textAccentSecondary,
background: colors.backgroundBaseAccentSecondary,
border: `${border.width.thin} solid ${colors.borderBaseAccentSecondary}`,
color: colors.textAccent,
background: colors.backgroundBaseAccent,
border: `${border.width.thin} solid ${colors.borderBaseAccent}`,
'&&:hover, &&:focus': {
color: colors.textAccentSecondary,
background: colors.backgroundBaseAccentSecondary,
color: colors.textAccent,
background: colors.backgroundBaseAccent,
textDecoration: 'none',
transform: 'none',
animation: 'none',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface StylesDeps {
}

export const useStyles = ({ height = 500, isFullScreen }: StylesDeps) => {
const { euiTheme, euiVars } = useEuiTheme();
const { euiTheme } = useEuiTheme();

const cached = useMemo(() => {
const { border, size } = euiTheme;
Expand Down Expand Up @@ -50,13 +50,13 @@ export const useStyles = ({ height = 500, isFullScreen }: StylesDeps) => {
border: border.thin,
borderRadius: border.radius.medium,
'> .sessionViewerToolbar': {
backgroundColor: `${euiVars.euiFormBackgroundDisabledColor}`,
backgroundColor: `${euiTheme.components.forms.backgroundDisabled}`,
padding: `${size.m} ${size.base}`,
},
};

const fakeDisabled: CSSObject = {
color: euiVars.euiButtonColorDisabledText,
color: euiTheme.colors.disabled,
};

return {
Expand All @@ -67,7 +67,7 @@ export const useStyles = ({ height = 500, isFullScreen }: StylesDeps) => {
fakeDisabled,
sessionViewerComponent,
};
}, [euiTheme, isFullScreen, height, euiVars]);
}, [euiTheme, isFullScreen, height]);

return cached;
};
Loading
Loading