Skip to content
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
21 changes: 9 additions & 12 deletions webview/src/experiments/components/Experiments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import styles from './table/styles.module.scss'
import { AddColumns, Welcome } from './GetStarted'
import { RowSelectionProvider } from './table/RowSelectionContext'
import { CellValue } from './table/content/Cell'
import { CellSecondaryName } from './table/body/CellSecondaryName'
import { AddStage } from './AddStage'
import { ExperimentCell } from './table/content/ExperimentCell'
import { buildColumns, columnHelper } from '../util/buildColumns'
import { sendMessage } from '../../shared/vscode'
import { WebviewWrapper } from '../../shared/components/webviewWrapper/WebviewWrapper'
Expand All @@ -49,20 +49,17 @@ const getDefaultColumnWithIndicatorsPlaceHolder = () =>
cell: (cell: CellContext<Column, CellValue>) => {
const {
row: {
original: { label, description, commit, sha }
original: { label, description, commit, sha, error }
}
} = cell as unknown as CellContext<Experiment, CellValue>
return (
<div className={styles.experimentCellText}>
<span>{label}</span>
{description && (
<CellSecondaryName
sha={sha}
description={description}
commit={commit}
/>
)}
</div>
<ExperimentCell
commit={commit}
description={description}
error={error}
label={label}
sha={sha}
/>
)
},
header: ExperimentHeader,
Expand Down
30 changes: 30 additions & 0 deletions webview/src/experiments/components/table/content/CommitCell.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react'
import { CommitData } from 'dvc/src/experiments/webview/contract'
import { CommitTooltipContent } from './CommitTooltipContent'
import styles from '../styles.module.scss'
import Tooltip from '../../../../shared/components/tooltip/Tooltip'
import { Icon } from '../../../../shared/components/Icon'
import { GitCommit } from '../../../../shared/components/icons'

export const CommitCell: React.FC<{
commit: CommitData
description: string
label: string
sha?: string
}> = ({ commit, description, label, sha }) => {
return (
<Tooltip
placement="bottom-start"
appendTo={document.body}
content={<CommitTooltipContent commit={commit} sha={sha} />}
>
<div className={styles.experimentCellText}>
<span>{label}</span>
<span className={styles.experimentCellSecondaryName}>
<Icon width={14} height={14} icon={GitCommit} />{' '}
<span>{description}</span>
</span>
</div>
</Tooltip>
)
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
import React from 'react'
import { VSCodeTag } from '@vscode/webview-ui-toolkit/react'
import { CommitData } from 'dvc/src/experiments/webview/contract'
import { VSCodeTag } from '@vscode/webview-ui-toolkit/react'
import styles from '../styles.module.scss'
import Tooltip from '../../../../shared/components/tooltip/Tooltip'
import { Icon } from '../../../../shared/components/Icon'
import { GitCommit } from '../../../../shared/components/icons'

export const CellSecondaryName: React.FC<{
description: string
commit?: CommitData
export const CommitTooltipContent: React.FC<{
sha?: string
}> = ({ description, commit, sha }) => {
const children = (
<span className={styles.experimentCellSecondaryName}>
{commit && <Icon width={14} height={14} icon={GitCommit} />}{' '}
<span>{description}</span>
</span>
)
if (!commit) {
return children
}

commit: CommitData
}> = ({ sha, commit }) => {
const { tags, author, message, date } = commit
const tooltipContent = (
return (
<div className={styles.experimentCellSecondaryNameTooltip}>
<div>
<p className={styles.sha}>
Expand All @@ -44,15 +32,4 @@ export const CellSecondaryName: React.FC<{
<p className={styles.message}>{message}</p>
</div>
)

return (
<Tooltip
placement="bottom-start"
appendTo={document.body}
content={tooltipContent}
interactive
>
{children}
</Tooltip>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React from 'react'
import cx from 'classnames'
import { CommitData } from 'dvc/src/experiments/webview/contract'
import { CommitCell } from './CommitCell'
import styles from '../styles.module.scss'

type ExperimentCellProps = {
commit?: CommitData
description?: string
error?: string
label: string
sha?: string
}

export const ExperimentCell: React.FC<ExperimentCellProps> = ({
commit,
description,
error,
label,
sha
}) => {
if (!description) {
return (
<div className={styles.experimentCellText}>
<span>{label}</span>
</div>
)
}

return commit ? (
<CommitCell
commit={commit}
description={description}
label={label}
sha={sha}
/>
) : (
<div className={styles.experimentCellText}>
<span
className={cx(styles.experimentCellSecondaryName, {
[styles.errorText]: error
})}
>
{label}
</span>
<span className={styles.experimentCellText}>
<span>{description}</span>
</span>
</div>
)
}
7 changes: 3 additions & 4 deletions webview/src/experiments/components/table/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ $badge-size: 0.85rem;
left: 2px;
position: relative;
width: 16px;
margin-right: 4px;
}

.rowArrowContainer {
Expand Down Expand Up @@ -729,15 +730,12 @@ $badge-size: 0.85rem;

.experimentCellText {
@extend .cellContents;
display: flex;
flex-flow: row wrap;
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're going to keep things stacked on top of each other, I think we need to give the rows more height. Things look pretty crowded vertically when they're wrapped:

image

display: block;
line-height: normal;
direction: ltr;
align-items: center;
cursor: text;

> * {
margin: 0 0.5em;
overflow: hidden;
text-overflow: ellipsis;
}
Expand All @@ -746,6 +744,7 @@ $badge-size: 0.85rem;
.experimentCellSecondaryName {
color: $meta-cell-color;
font-size: 0.75em;
display: block;

> * {
vertical-align: middle;
Expand Down