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
8 changes: 6 additions & 2 deletions webview/src/experiments/components/table/Row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,21 @@ const getRunResumeOptions = (
) => {
const isNotCheckpoint = depth <= 1 || isWorkspace

const resetNeedsSeparator = !hideVaryAndRun && projectHasCheckpoints
const runNeedsSeparator = !hideVaryAndRun && !projectHasCheckpoints

return [
withId(
'Modify, Reset and Run',
MessageFromWebviewType.VARY_EXPERIMENT_PARAMS_RESET_AND_RUN,
!isNotCheckpoint || !projectHasCheckpoints
!isNotCheckpoint || !projectHasCheckpoints,
resetNeedsSeparator
),
withId(
projectHasCheckpoints ? 'Modify and Resume' : 'Modify and Run',
MessageFromWebviewType.VARY_EXPERIMENT_PARAMS_AND_RUN,
!isNotCheckpoint,
!hideVaryAndRun
runNeedsSeparator
),
withId(
'Modify and Queue',
Expand Down
72 changes: 56 additions & 16 deletions webview/src/stories/Table.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,37 @@ const tableData: TableData = {
]
}

const noRunningExperiments = {
...tableData,
hasRunningExperiment: false,
rows: rowsFixture.map(row => ({
...row,
running: false,
subRows: row.subRows?.map(experiment => ({
...experiment,
running: false,
subRows: experiment.subRows?.map(checkpoint => ({
...checkpoint,
running: false
}))
}))
}))
}

const noRunningExperimentsNoCheckpoints = {
...noRunningExperiments,
hasCheckpoints: false,
rows: rowsFixture.map(row => ({
...row,
running: false,
subRows: row.subRows?.map(experiment => ({
...experiment,
running: false,
subRows: []
}))
}))
}

export default {
args: {
tableData
Expand Down Expand Up @@ -101,23 +132,32 @@ WithMiddleStates.play = async ({ canvasElement }) => {

export const WithNoRunningExperiments = Template.bind({})
WithNoRunningExperiments.args = {
tableData: {
...tableData,
hasRunningExperiment: false,
rows: rowsFixture.map(row => ({
...row,
running: false,
subRows: row.subRows?.map(experiment => ({
...experiment,
running: false,
subRows: experiment.subRows?.map(checkpoint => ({
...checkpoint,
running: false
}))
}))
}))
}
tableData: noRunningExperiments
}

const contextMenuPlay = async ({
canvasElement
}: {
canvasElement: HTMLElement
}) => {
const experiment = await within(canvasElement).findByText('[exp-e7a67]')
userEvent.click(experiment, {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The context menu appears to the left of the element clicked on. I spent about 30 minutes looking into a fix. I don't think there is much value in spending any more time looking.

bubbles: true,
button: 2
})
}

export const WithContextMenu = Template.bind({})
WithContextMenu.args = {
tableData: noRunningExperiments
}
WithContextMenu.play = contextMenuPlay

export const WithContextMenuNoCheckpoints = Template.bind({})
WithContextMenuNoCheckpoints.args = {
tableData: noRunningExperimentsNoCheckpoints
}
WithContextMenuNoCheckpoints.play = contextMenuPlay

export const WithAllDataTypes = Template.bind({})
WithAllDataTypes.args = { tableData: dataTypesTableData }
Expand Down