-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
128 additions
and
112 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
webview/src/experiments/components/table/ExperimentGroup.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,48 @@ | ||
import React from 'react' | ||
import cx from 'classnames' | ||
import styles from './styles.module.scss' | ||
import { BatchSelectionProp } from './Row' | ||
import { InstanceProp, RowProp } from './interfaces' | ||
import { NestedRow } from './NestedRow' | ||
|
||
export const ExperimentGroup: React.FC< | ||
RowProp & InstanceProp & BatchSelectionProp | ||
> = ({ | ||
row, | ||
instance, | ||
contextMenuDisabled, | ||
projectHasCheckpoints, | ||
hasRunningExperiment, | ||
batchRowSelection | ||
}) => { | ||
instance.prepareRow(row) | ||
return ( | ||
<div | ||
className={cx( | ||
styles.experimentGroup, | ||
row.isExpanded && row.subRows.length > 0 && styles.expandedGroup | ||
)} | ||
> | ||
<NestedRow | ||
row={row} | ||
instance={instance} | ||
contextMenuDisabled={contextMenuDisabled} | ||
projectHasCheckpoints={projectHasCheckpoints} | ||
hasRunningExperiment={hasRunningExperiment} | ||
batchRowSelection={batchRowSelection} | ||
/> | ||
{row.isExpanded && | ||
row.subRows.map(row => ( | ||
<NestedRow | ||
row={row} | ||
instance={instance} | ||
key={row.id} | ||
contextMenuDisabled={contextMenuDisabled} | ||
projectHasCheckpoints={projectHasCheckpoints} | ||
hasRunningExperiment={hasRunningExperiment} | ||
batchRowSelection={batchRowSelection} | ||
/> | ||
))} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react' | ||
import styles from './styles.module.scss' | ||
import { BatchSelectionProp, RowContent } from './Row' | ||
import { InstanceProp, RowProp } from './interfaces' | ||
|
||
export const NestedRow: React.FC< | ||
RowProp & InstanceProp & BatchSelectionProp | ||
> = ({ | ||
row, | ||
instance, | ||
contextMenuDisabled, | ||
projectHasCheckpoints, | ||
hasRunningExperiment, | ||
batchRowSelection | ||
}) => { | ||
instance.prepareRow(row) | ||
return ( | ||
<RowContent | ||
row={row} | ||
className={styles.nestedRow} | ||
contextMenuDisabled={contextMenuDisabled} | ||
projectHasCheckpoints={projectHasCheckpoints} | ||
hasRunningExperiment={hasRunningExperiment} | ||
batchRowSelection={batchRowSelection} | ||
/> | ||
) | ||
} |
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,52 @@ | ||
import React from 'react' | ||
import cx from 'classnames' | ||
import styles from './styles.module.scss' | ||
import { BatchSelectionProp, RowContent } from './Row' | ||
import { InstanceProp, RowProp } from './interfaces' | ||
import { ExperimentGroup } from './ExperimentGroup' | ||
|
||
export const TableBody: React.FC< | ||
RowProp & InstanceProp & BatchSelectionProp | ||
> = ({ | ||
row, | ||
instance, | ||
contextMenuDisabled, | ||
projectHasCheckpoints, | ||
hasRunningExperiment, | ||
batchRowSelection | ||
}) => { | ||
instance.prepareRow(row) | ||
return ( | ||
<div | ||
{...instance.getTableBodyProps({ | ||
className: cx( | ||
styles.rowGroup, | ||
styles.tbody, | ||
row.values.id === 'workspace' | ||
? styles.workspaceRowGroup | ||
: styles.normalRowGroup | ||
) | ||
})} | ||
> | ||
<RowContent | ||
row={row} | ||
projectHasCheckpoints={projectHasCheckpoints} | ||
hasRunningExperiment={hasRunningExperiment} | ||
contextMenuDisabled={contextMenuDisabled} | ||
batchRowSelection={batchRowSelection} | ||
/> | ||
{row.isExpanded && | ||
row.subRows.map(subRow => ( | ||
<ExperimentGroup | ||
row={subRow} | ||
instance={instance} | ||
key={subRow.values.id} | ||
contextMenuDisabled={contextMenuDisabled} | ||
projectHasCheckpoints={projectHasCheckpoints} | ||
hasRunningExperiment={hasRunningExperiment} | ||
batchRowSelection={batchRowSelection} | ||
/> | ||
))} | ||
</div> | ||
) | ||
} |