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

Add rowgroup, row and cell attributes to log stream components #192841

Merged
merged 5 commits into from
Sep 26, 2024
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 @@ -63,21 +63,28 @@ export class LogTextStreamLoadingItemView extends React.PureComponent<
onStreamStart,
} = this.props;

const shouldShowCta = !hasMore && !isStreaming;
const shouldShowCta = !hasMore && !isStreaming && !isLoading;

const extra = (
<LoadingItemViewExtra justifyContent="center" alignItems="center" gutterSize="m">
{isLoading || isStreaming ? (
<LoadingItemViewExtra
justifyContent="center"
alignItems="center"
gutterSize="m"
{...(shouldShowCta ? { role: 'row' } : {})}
>
{(isLoading || isStreaming) && (
<ProgressSpinner kind={isStreaming ? 'streaming' : 'loading'} />
) : shouldShowCta ? (
)}

{shouldShowCta && (
<ProgressCta
position={position}
onStreamStart={onStreamStart}
onExtendRange={onExtendRange}
startDateExpression={startDateExpression}
endDateExpression={endDateExpression}
/>
) : null}
)}
</LoadingItemViewExtra>
);

Expand Down Expand Up @@ -181,9 +188,15 @@ const ProgressCta: React.FC<ProgressCtaProps> = ({

if (rangeEdge === 'now' && position === 'end') {
return (
<EuiButton data-test-subj="infraProgressCtaStreamLiveButton" onClick={onStreamStart} size="s">
<FormattedMessage id="xpack.logsShared.logs.streamLive" defaultMessage="Stream live" />
</EuiButton>
<div role="cell">
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

EuiButton accepts the role attribute, do you think we can directly pass it there to not change the rendered markdown and avoid CSS side effects?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to avoid changing the markup tbh but I followed the same suggestion with the other button displayed at the top of the log stream. I think the idea was to have a wrapper with a cell role, and then a button as a child element with a button role by default.

image

<EuiButton
data-test-subj="infraProgressCtaStreamLiveButton"
onClick={onStreamStart}
size="s"
>
<FormattedMessage id="xpack.logsShared.logs.streamLive" defaultMessage="Stream live" />
</EuiButton>
</div>
);
}

Expand All @@ -197,19 +210,20 @@ const ProgressCta: React.FC<ProgressCtaProps> = ({
}

return (
<EuiButton
data-test-subj="infraProgressCtaButton"
onClick={() => {
if (typeof onExtendRange === 'function') {
onExtendRange(extendedRange.value);
}
}}
iconType={iconType}
size="s"
role="cell"
>
<ProgressExtendMessage amount={extendedRange.diffAmount} unit={extendedRange.diffUnit} />
</EuiButton>
<div role="cell">
<EuiButton
data-test-subj="infraProgressCtaButton"
onClick={() => {
if (typeof onExtendRange === 'function') {
onExtendRange(extendedRange.value);
}
}}
iconType={iconType}
size="s"
>
<ProgressExtendMessage amount={extendedRange.diffAmount} unit={extendedRange.diffUnit} />
</EuiButton>
</div>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ import { EuiFlexGroup, EuiFlexItem, EuiHorizontalRule } from '@elastic/eui';
*/
export const LogTextSeparator: FC<PropsWithChildren<unknown>> = ({ children }) => {
return (
<EuiFlexGroup alignItems="center" gutterSize="s">
<EuiFlexItem grow={false}>{children}</EuiFlexItem>
<EuiFlexItem>
<EuiFlexGroup alignItems="center" gutterSize="s" role="row">
<EuiFlexItem grow={false} role="cell">
{children}
</EuiFlexItem>
<EuiFlexItem role="cell">
<EuiHorizontalRule aria-hidden="true" />
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ export class VerticalScrollPanel<Child> extends React.PureComponent<
ref={this.scrollRef}
tabIndex={0}
className="eui-scrollBar"
role="rowgroup"
>
{typeof children === 'function' ? children(this.registerChild) : null}
</ScrollPanelWrapper>
Expand Down