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 4 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,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 @@ -25,6 +25,9 @@ export const useStyles = ({ depth, hasAlerts, hasInvestigatedAlert }: StylesDeps

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

const searchHighlight = `
Expand Down Expand Up @@ -96,6 +99,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
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
233 changes: 119 additions & 114 deletions x-pack/plugins/session_view/public/components/session_view/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
EuiFlexItem,
EuiResizableContainer,
EuiPanel,
EuiHorizontalRule,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { SectionLoading } from '../../shared_imports';
Expand Down Expand Up @@ -92,127 +93,131 @@ export const SessionView = ({ sessionEntityId, height, jumpToEvent }: SessionVie

return (
<>
<EuiPanel color={'subdued'}>
<EuiFlexGroup>
<EuiFlexItem
data-test-subj="sessionView:sessionViewProcessEventsSearch"
css={styles.searchBar}
>
<SessionViewSearchBar
searchQuery={searchQuery}
setSearchQuery={setSearchQuery}
onProcessSelected={onProcessSelected}
searchResults={searchResults}
/>
</EuiFlexItem>

<EuiFlexItem grow={false} css={styles.buttonsEyeDetail}>
<SessionViewDisplayOptions
displayOptions={displayOptions}
onChange={handleOptionChange}
/>
</EuiFlexItem>

<EuiFlexItem grow={false} css={styles.buttonsEyeDetail}>
<EuiButton
onClick={toggleDetailPanel}
iconType="list"
data-test-subj="sessionView:sessionViewDetailPanelToggle"
<div css={styles.sessionViewerComponent}>
<EuiPanel css={styles.toolBar} hasShadow={false}>
<EuiFlexGroup>
<EuiFlexItem
data-test-subj="sessionView:sessionViewProcessEventsSearch"
css={styles.searchBar}
>
<FormattedMessage
id="xpack.sessionView.buttonOpenDetailPanel"
defaultMessage="Detail panel"
<SessionViewSearchBar
searchQuery={searchQuery}
setSearchQuery={setSearchQuery}
onProcessSelected={onProcessSelected}
searchResults={searchResults}
/>
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
<EuiResizableContainer>
{(EuiResizablePanel, EuiResizableButton) => (
<>
<EuiResizablePanel
initialSize={isDetailOpen ? 70 : 100}
minSize="600px"
paddingSize="none"
>
{renderIsLoading && (
<SectionLoading>
<FormattedMessage
id="xpack.sessionView.loadingProcessTree"
defaultMessage="Loading session…"
/>
</SectionLoading>
)}
</EuiFlexItem>

{error && (
<EuiEmptyPrompt
iconType="alert"
color="danger"
title={
<h2>
<FormattedMessage
id="xpack.sessionView.errorHeading"
defaultMessage="Error loading Session View"
/>
</h2>
}
body={
<p>
<FormattedMessage
id="xpack.sessionView.errorMessage"
defaultMessage="There was an error loading the Session View."
/>
</p>
}
<EuiFlexItem grow={false} css={styles.buttonsEyeDetail}>
<SessionViewDisplayOptions
displayOptions={displayOptions}
onChange={handleOptionChange}
/>
</EuiFlexItem>

<EuiFlexItem grow={false} css={styles.buttonsEyeDetail}>
<EuiButton
onClick={toggleDetailPanel}
iconType="list"
data-test-subj="sessionView:sessionViewDetailPanelToggle"
fill={isDetailOpen}
>
<FormattedMessage
id="xpack.sessionView.buttonOpenDetailPanel"
defaultMessage="Detail panel"
/>
)}
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
<EuiHorizontalRule margin="none" />
<EuiResizableContainer>
{(EuiResizablePanel, EuiResizableButton) => (
<>
<EuiResizablePanel
initialSize={isDetailOpen ? 70 : 100}
minSize="600px"
paddingSize="none"
>
{renderIsLoading && (
<SectionLoading>
<FormattedMessage
id="xpack.sessionView.loadingProcessTree"
defaultMessage="Loading session…"
/>
</SectionLoading>
)}

{hasData && (
<div css={styles.processTree}>
<ProcessTree
sessionEntityId={sessionEntityId}
data={data.pages}
searchQuery={searchQuery}
selectedProcess={selectedProcess}
onProcessSelected={onProcessSelected}
jumpToEvent={jumpToEvent}
isFetching={isFetching}
hasPreviousPage={hasPreviousPage}
hasNextPage={hasNextPage}
fetchNextPage={fetchNextPage}
fetchPreviousPage={fetchPreviousPage}
setSearchResults={setSearchResults}
timeStampOn={displayOptions.timestamp}
verboseModeOn={displayOptions.verboseMode}
{error && (
<EuiEmptyPrompt
iconType="alert"
color="danger"
title={
<h2>
<FormattedMessage
id="xpack.sessionView.errorHeading"
defaultMessage="Error loading Session View"
/>
</h2>
}
body={
<p>
<FormattedMessage
id="xpack.sessionView.errorMessage"
defaultMessage="There was an error loading the Session View."
/>
</p>
}
/>
</div>
)}
</EuiResizablePanel>
)}

{renderDetails ? (
<>
<EuiResizableButton />
<EuiResizablePanel
id="session-detail-panel"
initialSize={30}
minSize="200px"
paddingSize="none"
css={styles.detailPanel}
>
<SessionViewDetailPanel
selectedProcess={selectedProcess}
onProcessSelected={onProcessSelected}
/>
</EuiResizablePanel>
</>
) : (
<>
{/* Returning an empty element here (instead of false) to avoid a bug in EuiResizableContainer */}
</>
)}
</>
)}
</EuiResizableContainer>
{hasData && (
<div css={styles.processTree}>
<ProcessTree
sessionEntityId={sessionEntityId}
data={data.pages}
searchQuery={searchQuery}
selectedProcess={selectedProcess}
onProcessSelected={onProcessSelected}
jumpToEvent={jumpToEvent}
isFetching={isFetching}
hasPreviousPage={hasPreviousPage}
hasNextPage={hasNextPage}
fetchNextPage={fetchNextPage}
fetchPreviousPage={fetchPreviousPage}
setSearchResults={setSearchResults}
timeStampOn={displayOptions.timestamp}
Copy link
Contributor

Choose a reason for hiding this comment

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

note: think on the future we can replace to pass only one property displayOptions={displayOptions} to suit all display options (don't need to do it right now)

verboseModeOn={displayOptions.verboseMode}
/>
</div>
)}
</EuiResizablePanel>

{renderDetails ? (
<>
<EuiResizableButton />
<EuiResizablePanel
id="session-detail-panel"
initialSize={30}
minSize="200px"
paddingSize="none"
css={styles.detailPanel}
>
<SessionViewDetailPanel
selectedProcess={selectedProcess}
onProcessSelected={onProcessSelected}
/>
</EuiResizablePanel>
</>
) : (
<>
{/* Returning an empty element here (instead of false) to avoid a bug in EuiResizableContainer */}
</>
)}
</>
)}
</EuiResizableContainer>
</div>
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export const useStyles = ({ height = 500 }: StylesDeps) => {

const detailPanel: CSSObject = {
height: `${height}px`,
borderLeft: `${euiTheme.border.thin} !important`,
animehart marked this conversation as resolved.
Show resolved Hide resolved
boxShadow: '0px 0px 0px #D3DAE6 inset !important',
};

const searchBar: CSSObject = {
Expand All @@ -35,11 +37,22 @@ export const useStyles = ({ height = 500 }: StylesDeps) => {
margin: `${euiTheme.size.m} ${euiTheme.size.xs} !important`,
};

const sessionViewerComponent: CSSObject = {
border: euiTheme.border.thin,
borderRadius: euiTheme.border.radius.medium,
};

const toolBar: CSSObject = {
backgroundColor: `#EEF2F7 !important`,
animehart marked this conversation as resolved.
Show resolved Hide resolved
};

return {
processTree,
detailPanel,
searchBar,
buttonsEyeDetail,
sessionViewerComponent,
toolBar,
};
}, [height, euiTheme]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const SessionViewSearchBar = ({

return (
<div data-test-subj="sessionView:searchInput" css={{ position: 'relative' }}>
<EuiSearchBar query={searchQuery} onChange={onSearch} />
<EuiSearchBar query={searchQuery} onChange={onSearch} box={{ placeholder: 'Find...' }} />
animehart marked this conversation as resolved.
Show resolved Hide resolved
{showPagination && (
<EuiPagination
data-test-subj="sessionView:searchPagination"
Expand Down