-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds project-level executions view (#135)
* feat: adds project-level executions view * refactor: make table compatible with refresh logic from queryies * fix: rendering error when changing filters * chore: docs * test: adding test for createPaginationQuery * refactor: split executions table to make project executions testable * chore: docs
- Loading branch information
Showing
38 changed files
with
715 additions
and
309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { makeStyles, Theme } from "@material-ui/core"; | ||
import classnames from "classnames"; | ||
import { Execution } from "models"; | ||
import * as React from "react"; | ||
import { ListRowProps } from "react-virtualized"; | ||
import { ExpandableExecutionError } from "./ExpandableExecutionError"; | ||
import { useExecutionTableStyles } from "./styles"; | ||
import { WorkflowExecutionColumnDefinition, WorkflowExecutionsTableState } from "./types"; | ||
|
||
const useStyles = makeStyles((theme: Theme) => ({ | ||
row: { | ||
paddingLeft: theme.spacing(2) | ||
} | ||
})); | ||
|
||
export interface WorkflowExecutionRowProps extends Partial<ListRowProps> { | ||
columns: WorkflowExecutionColumnDefinition[]; | ||
errorExpanded?: boolean; | ||
execution: Execution; | ||
onExpandCollapseError?(expanded: boolean): void; | ||
state: WorkflowExecutionsTableState; | ||
} | ||
|
||
/** Renders a single `Execution` record as a row. Designed to be used as a child | ||
* of `WorkflowExecutionTable`. | ||
*/ | ||
export const WorkflowExecutionRow: React.FC<WorkflowExecutionRowProps> = ({ | ||
columns, | ||
errorExpanded, | ||
execution, | ||
onExpandCollapseError, | ||
state, | ||
style | ||
}) => { | ||
const { error } = execution.closure; | ||
const tableStyles = useExecutionTableStyles(); | ||
const styles = useStyles(); | ||
|
||
return ( | ||
<div | ||
className={classnames( | ||
tableStyles.row, | ||
styles.row, | ||
tableStyles.borderBottom | ||
)} | ||
style={style} | ||
> | ||
<div className={tableStyles.rowColumns}> | ||
{columns.map(({ className, key: columnKey, cellRenderer }) => ( | ||
<div | ||
key={columnKey} | ||
className={classnames(tableStyles.rowColumn, className)} | ||
> | ||
{cellRenderer({ | ||
execution, | ||
state | ||
})} | ||
</div> | ||
))} | ||
</div> | ||
{error ? ( | ||
<ExpandableExecutionError | ||
onExpandCollapse={onExpandCollapseError} | ||
initialExpansionState={errorExpanded} | ||
error={error} | ||
/> | ||
) : null} | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/components/Executions/Tables/__mocks__/WorkflowExecutionsTable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import * as classnames from 'classnames'; | ||
import { useCommonStyles } from 'components/common/styles'; | ||
import * as React from 'react'; | ||
import { ExecutionsTableHeader } from '../ExecutionsTableHeader'; | ||
import { useExecutionTableStyles } from '../styles'; | ||
import { useWorkflowExecutionsTableColumns } from '../useWorkflowExecutionsTableColumns'; | ||
import { useWorkflowExecutionsTableState } from '../useWorkflowExecutionTableState'; | ||
import { WorkflowExecutionRow } from '../WorkflowExecutionRow'; | ||
import { WorkflowExecutionsTableProps } from '../WorkflowExecutionsTable'; | ||
|
||
/** Mocked, simpler version of WorkflowExecutionsTable which does not use a DataList since | ||
* that will not work in a test environment. | ||
*/ | ||
export const WorkflowExecutionsTable: React.FC<WorkflowExecutionsTableProps> = props => { | ||
const { value: executions, showWorkflowName = false } = props; | ||
const state = useWorkflowExecutionsTableState(); | ||
const commonStyles = useCommonStyles(); | ||
const tableStyles = useExecutionTableStyles(); | ||
const columns = useWorkflowExecutionsTableColumns({ showWorkflowName }); | ||
|
||
return ( | ||
<div | ||
className={classnames( | ||
tableStyles.tableContainer, | ||
commonStyles.flexFill | ||
)} | ||
> | ||
<ExecutionsTableHeader columns={columns} /> | ||
{executions.map(execution => <WorkflowExecutionRow key={execution.id.name} execution={execution} columns={columns} state={state} /> )} | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.