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

UI Polish for Session viewer frame + buttons #128188

Merged
merged 16 commits into from
Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from 15 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 @@ -22,6 +22,9 @@ export const useStyles = () => {
'&:last-child': {
borderBottom: euiTheme.border.thin,
},
dl: {
paddingTop: '0px',
},
};

const accordionButton: CSSObject = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,21 @@ export const useStyles = () => {

const cached = useMemo(() => {
const descriptionList: CSSObject = {
padding: euiTheme.size.s,
padding: `${euiTheme.size.base} ${euiTheme.size.s} `,
};

const tabListTitle = {
width: '40%',
display: 'flex',
alignItems: 'center',
marginTop: '0px',
};

const tabListDescription = {
width: '60%',
display: 'flex',
alignItems: 'center',
marginTop: '0px',
};

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ export const useStyles = ({ display }: StylesDeps) => {
const item: CSSObject = {
display,
alignItems: 'center',
padding: euiTheme.size.s,
padding: `0px ${euiTheme.size.s} `,
width: '100%',
fontSize: 'inherit',
fontWeight: 'inherit',
minHeight: '36px',
height: '32px',
animehart marked this conversation as resolved.
Show resolved Hide resolved
lineHeight: euiTheme.size.l,
letterSpacing: '0px',
textAlign: 'left',
};

const copiableItem: CSSObject = {
Expand All @@ -34,6 +36,7 @@ export const useStyles = ({ display }: StylesDeps) => {
'&:hover': {
background: transparentize(euiTheme.colors.primary, 0.1),
},
height: '100%',
};

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export const useStyles = () => {
overflow: 'auto',
height: '100%',
backgroundColor: colors.lightestShade,
paddingTop: size.base,
paddingLeft: size.s,
};

const selectionArea: CSSObject = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ export function ProcessTreeNode({
),
[hasAlerts, alerts, jumpToAlertID]
);
const styles = useStyles({ depth, hasAlerts, hasInvestigatedAlert });
const isSelected = selectedProcessId === process.id;
const styles = useStyles({ depth, hasAlerts, hasInvestigatedAlert, isSelected });
const buttonStyles = useButtonStyles({});

const nodeRef = useVisible({
Expand Down Expand Up @@ -237,15 +238,12 @@ export function ProcessTreeNode({
[exit_code: {exitCode}]
</small>
)}
{timeStampOn && (
<span
data-test-subj="sessionView:processTreeNodeTimestamp"
css={styles.timeStamp}
>
{timeStampsNormal}
</span>
)}
</span>
{timeStampOn && (
<span data-test-subj="sessionView:processTreeNodeTimestamp" css={styles.timeStamp}>
{timeStampsNormal}
</span>
)}
</span>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ interface StylesDeps {
depth: number;
hasAlerts: boolean;
hasInvestigatedAlert: boolean;
isSelected: boolean;
}

export const useStyles = ({ depth, hasAlerts, hasInvestigatedAlert }: StylesDeps) => {
export const useStyles = ({ depth, hasAlerts, hasInvestigatedAlert, isSelected }: StylesDeps) => {
const { euiTheme } = useEuiTheme();

const cached = useMemo(() => {
Expand All @@ -25,14 +26,11 @@ export const useStyles = ({ depth, hasAlerts, hasInvestigatedAlert }: StylesDeps

const darkText: CSSObject = {
color: colors.text,
fontFamily: font.familyCode,
paddingLeft: size.xxs,
paddingRight: size.xs,
};

const searchHighlight = `
background-color: ${colors.highlight};
color: ${colors.fullShade};
border-radius: ${border.radius.medium};
`;

const children: CSSObject = {
position: 'relative',
color: colors.ghost,
Expand All @@ -48,6 +46,7 @@ export const useStyles = ({ depth, hasAlerts, hasInvestigatedAlert }: StylesDeps
let bgColor = 'none';
const hoverColor = transparentize(colors.primary, 0.04);
let borderColor = 'transparent';
let searchResColor = transparentize(colors.warning, 0.32);

if (hasAlerts) {
borderColor = colors.danger;
Expand All @@ -57,10 +56,14 @@ export const useStyles = ({ depth, hasAlerts, hasInvestigatedAlert }: StylesDeps
bgColor = transparentize(colors.danger, 0.04);
}

return { bgColor, borderColor, hoverColor };
if (isSelected) {
searchResColor = colors.warning;
}

return { bgColor, borderColor, hoverColor, searchResColor };
};

const { bgColor, borderColor, hoverColor } = getHighlightColors();
const { bgColor, borderColor, hoverColor, searchResColor } = getHighlightColors();

const processNode: CSSObject = {
display: 'block',
Expand All @@ -84,6 +87,12 @@ export const useStyles = ({ depth, hasAlerts, hasInvestigatedAlert }: StylesDeps
},
};

const searchHighlight = `
color: ${colors.fullShade};
border-radius: '0px';
background-color: ${searchResColor};
`;

const wrapper: CSSObject = {
paddingLeft: size.s,
position: 'relative',
Expand All @@ -96,6 +105,10 @@ export const useStyles = ({ depth, hasAlerts, hasInvestigatedAlert }: StylesDeps

const workingDir: CSSObject = {
color: colors.successText,
fontFamily: font.familyCode,
fontWeight: font.weight.medium,
paddingLeft: size.s,
paddingRight: size.xxs,
};

const timeStamp: CSSObject = {
Expand Down Expand Up @@ -124,7 +137,7 @@ export const useStyles = ({ depth, hasAlerts, hasInvestigatedAlert }: StylesDeps
timeStamp,
alertDetails,
};
}, [depth, euiTheme, hasAlerts, hasInvestigatedAlert]);
}, [depth, euiTheme, hasAlerts, hasInvestigatedAlert, isSelected]);

return cached;
};
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,29 @@ export const useButtonStyles = ({ isExpanded }: ButtonStylesDeps) => {
const { euiTheme } = useEuiTheme();

const cached = useMemo(() => {
const { colors, border, size } = euiTheme;
const { colors, border, size, font } = euiTheme;

const button: CSSObject = {
background: transparentize(theme.euiColorVis6, 0.04),
border: `${border.width.thin} solid ${transparentize(theme.euiColorVis6, 0.48)}`,
lineHeight: '18px',
height: '20px',
fontSize: size.m,
borderRadius: border.radius.medium,
fontFamily: font.family,
fontWeight: font.weight.medium,
borderRadius: border.radius.small,
color: shade(theme.euiColorVis6, 0.25),
marginLeft: size.s,
marginLeft: size.xs,
marginRight: size.xs,
minWidth: 0,
padding: `${size.s} ${size.xxs}`,
span: {
animehart marked this conversation as resolved.
Show resolved Hide resolved
padding: `0px ${size.xxs} !important`,
},
};

const buttonArrow: CSSObject = {
marginLeft: size.s,
marginLeft: size.xs,
};

const alertButton: CSSObject = {
Expand Down Expand Up @@ -72,6 +79,10 @@ export const useButtonStyles = ({ isExpanded }: ButtonStylesDeps) => {
textTransform: 'capitalize',
};

const buttonSize: CSSObject = {
padding: `0px ${euiTheme.size.xs}`,
};

const expandedIcon = isExpanded ? 'arrowUp' : 'arrowDown';

return {
Expand All @@ -81,6 +92,7 @@ export const useButtonStyles = ({ isExpanded }: ButtonStylesDeps) => {
alertsCountNumber,
userChangedButton,
userChangedButtonUsername,
buttonSize,
expandedIcon,
};
}, [euiTheme, isExpanded]);
Expand Down
Loading