diff --git a/webview/src/experiments/components/Experiments.tsx b/webview/src/experiments/components/Experiments.tsx index 5add4ab4bd..4426905285 100644 --- a/webview/src/experiments/components/Experiments.tsx +++ b/webview/src/experiments/components/Experiments.tsx @@ -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' @@ -49,20 +49,17 @@ const getDefaultColumnWithIndicatorsPlaceHolder = () => cell: (cell: CellContext) => { const { row: { - original: { label, description, commit, sha } + original: { label, description, commit, sha, error } } } = cell as unknown as CellContext return ( -
- {label} - {description && ( - - )} -
+ ) }, header: ExperimentHeader, diff --git a/webview/src/experiments/components/table/content/CommitCell.tsx b/webview/src/experiments/components/table/content/CommitCell.tsx new file mode 100644 index 0000000000..d4b95bb0cc --- /dev/null +++ b/webview/src/experiments/components/table/content/CommitCell.tsx @@ -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 ( + } + > +
+ {label} + + {' '} + {description} + +
+
+ ) +} diff --git a/webview/src/experiments/components/table/body/CellSecondaryName.tsx b/webview/src/experiments/components/table/content/CommitTooltipContent.tsx similarity index 59% rename from webview/src/experiments/components/table/body/CellSecondaryName.tsx rename to webview/src/experiments/components/table/content/CommitTooltipContent.tsx index 9331f6f86e..872186c15a 100644 --- a/webview/src/experiments/components/table/body/CellSecondaryName.tsx +++ b/webview/src/experiments/components/table/content/CommitTooltipContent.tsx @@ -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 = ( - - {commit && }{' '} - {description} - - ) - if (!commit) { - return children - } - + commit: CommitData +}> = ({ sha, commit }) => { const { tags, author, message, date } = commit - const tooltipContent = ( + return (

@@ -44,15 +32,4 @@ export const CellSecondaryName: React.FC<{

{message}

) - - return ( - - {children} - - ) } diff --git a/webview/src/experiments/components/table/content/ExperimentCell.tsx b/webview/src/experiments/components/table/content/ExperimentCell.tsx new file mode 100644 index 0000000000..6fa24888e3 --- /dev/null +++ b/webview/src/experiments/components/table/content/ExperimentCell.tsx @@ -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 = ({ + commit, + description, + error, + label, + sha +}) => { + if (!description) { + return ( +
+ {label} +
+ ) + } + + return commit ? ( + + ) : ( +
+ + {label} + + + {description} + +
+ ) +} diff --git a/webview/src/experiments/components/table/styles.module.scss b/webview/src/experiments/components/table/styles.module.scss index f5107b8c3d..a49f63ac55 100644 --- a/webview/src/experiments/components/table/styles.module.scss +++ b/webview/src/experiments/components/table/styles.module.scss @@ -686,6 +686,7 @@ $badge-size: 0.85rem; left: 2px; position: relative; width: 16px; + margin-right: 4px; } .rowArrowContainer { @@ -729,15 +730,12 @@ $badge-size: 0.85rem; .experimentCellText { @extend .cellContents; - display: flex; - flex-flow: row wrap; + display: block; line-height: normal; direction: ltr; - align-items: center; cursor: text; > * { - margin: 0 0.5em; overflow: hidden; text-overflow: ellipsis; } @@ -746,6 +744,7 @@ $badge-size: 0.85rem; .experimentCellSecondaryName { color: $meta-cell-color; font-size: 0.75em; + display: block; > * { vertical-align: middle;