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

Make whole row clickable to open TaskExecutionDetails panel #444

Merged
merged 2 commits into from
May 2, 2022
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 @@ -35,7 +35,11 @@ const ChildFetchErrorIcon: React.FC<{
disableTouchRipple={true}
size="small"
title={titleStrings.childGroupFetchFailed}
onClick={() => query.refetch()}
onClick={(e: React.MouseEvent<HTMLElement>) => {
// prevent the parent row body onClick event trigger
e.stopPropagation();
query.refetch();
}}
>
<ErrorOutline />
</IconButton>
Expand Down Expand Up @@ -102,13 +106,18 @@ export const NodeExecutionRow: React.FC<NodeExecutionRowProps> = ({
</div>
) : null;

// open the side panel for selected execution's detail
// use null in case if there is no execution provided - when it is null, will close side panel
const onClickRow = () => state.setSelectedExecution(nodeExecution?.id ?? null);

return (
<div
role="listitem"
className={classnames(tableStyles.row, {
className={classnames(tableStyles.row, tableStyles.clickableRow, {
[selectedClassName]: selected,
})}
style={style}
onClick={onClickRow}
>
<div
className={classnames(tableStyles.rowContent, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ export const RowExpander: React.FC<{
disableTouchRipple={true}
size="small"
title={titleStrings.expandRow}
onClick={onClick}
onClick={(e: React.MouseEvent<HTMLElement>) => {
// prevent the parent row body onClick event trigger
e.stopPropagation();
onClick();
}}
>
{expanded ? <ExpandMore /> : <ChevronRight />}
</IconButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ export const SelectNodeExecutionLink: React.FC<{
linkText: string;
state: NodeExecutionsTableState;
}> = ({ className, execution, linkText, state }) => {
// use null in case if there is no execution provied - to close panel
const onClick = () => state.setSelectedExecution(execution?.id ?? null);
// open the side panel for selected execution's detail
const onClick = (e: React.MouseEvent<HTMLElement>) => {
// prevent the parent row body onClick event trigger
e.stopPropagation();
// use null in case if there is no execution provided - when it is null will close panel
state.setSelectedExecution(execution?.id ?? null);
};

return (
<Link component="button" className={className} onClick={onClick} variant="body1">
{linkText}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ export const useExecutionTableStyles = makeStyles((theme: Theme) => ({
backgroundColor: listhoverColor,
},
},
clickableRow: {
cursor: 'pointer',
},
rowContent: {},
rowColumns: {
alignItems: 'center',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,20 @@ export const ExpandableMonospaceText: React.FC<ExpandableMonospaceTextProps> = (
}) => {
const [expanded, setExpanded] = React.useState(initialExpansionState);
const styles = useExpandableMonospaceTextStyles();
const onClickExpand = () => {
const onClickExpand = (e: React.MouseEvent<HTMLElement>) => {
// prevent the parent row body onClick event trigger
e.stopPropagation();

setExpanded(!expanded);
if (onExpandCollapse) {
onExpandCollapse(!expanded);
}
};
const onClickCopy = () => copyToClipboard(text);
const onClickCopy = (e: React.MouseEvent<HTMLElement>) => {
// prevent the parent row body onClick event trigger
e.stopPropagation();
copyToClipboard(text);
};

const expandButtonText = expanded ? 'Collapse' : 'Click to expand inline';

Expand Down