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 1 commit
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 @@ -14,7 +14,7 @@ import { ExpandableExecutionError } from './ExpandableExecutionError';
import { NodeExecutionChildren } from './NodeExecutionChildren';
import { RowExpander } from './RowExpander';
import { selectedClassName, useExecutionTableStyles } from './styles';
import { calculateNodeExecutionRowLeftSpacing } from './utils';
import { calculateNodeExecutionRowLeftSpacing, selectExecution } from './utils';

interface NodeExecutionRowProps {
abortMetadata?: Admin.IAbortMetadata;
Expand Down Expand Up @@ -102,13 +102,16 @@ export const NodeExecutionRow: React.FC<NodeExecutionRowProps> = ({
</div>
) : null;

const onClick = () => selectExecution(state, nodeExecution);

return (
<div
role="listitem"
className={classnames(tableStyles.row, {
className={classnames(tableStyles.row, tableStyles.clickableRow, {
[selectedClassName]: selected,
})}
style={style}
onClick={onClick}
>
<div
className={classnames(tableStyles.rowContent, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Link } from '@material-ui/core';
import { NodeExecution } from 'models/Execution/types';
import * as React from 'react';
import { NodeExecutionsTableState } from './types';
import { selectExecution } from './utils';

/** Renders a link that, when clicked, will trigger selection of the
* given NodeExecution.
Expand All @@ -12,8 +13,8 @@ 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);
const onClick = () => selectExecution(state, execution);

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 @@ -4,3 +4,8 @@ import { nameColumnLeftMarginGridWidth } from './styles';
export function calculateNodeExecutionRowLeftSpacing(level: number, spacing: Spacing) {
return spacing(nameColumnLeftMarginGridWidth + 3 * level);
}

export function selectExecution(state, nodeExecution) {
// use null in case if there is no execution provied - to close panel
anrusina marked this conversation as resolved.
Show resolved Hide resolved
state.setSelectedExecution(nodeExecution?.id ?? null);
}
anrusina marked this conversation as resolved.
Show resolved Hide resolved