-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flatten table on sort #4685
Flatten table on sort #4685
Conversation
import { Experiment } from 'dvc/src/experiments/webview/contract' | ||
import { TableBody } from './TableBody' | ||
|
||
interface SortedTableContentProps { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
@@ -0,0 +1,348 @@ | |||
import { join } from '../../../util/path' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should have moved the storybook changes in a separate chain pr 😅
import { TableData } from '../../../../experiments/webview/contract' | ||
|
||
const data: TableData = { | ||
...defaultData, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorted/tableData
is a slightly simplified (no deps and no selected exps) version of base/tableData
. We could simplify further though if preferred.
@@ -61,10 +62,7 @@ const tableData = getTableState({ | |||
selectedBranches: [], | |||
selectedForPlotsCount: 2, | |||
showOnlyChanged: false, | |||
sorts: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorts used to be a default addition to the storybooks but since tableData
rows are different when there are sorted, I removed the default sorts array (sorts are still shown in our new sorted fixture and in the deeplyNested
fixture).
this.applyFiltersToFlattenedCommits() | ||
const rows = [] | ||
|
||
for (const { branch, sha } of this.rowOrder) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing that will differ between records will be the branch/tags. I think we should consider concatenating the information on multiple lines into a single cell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense! I will open a followup issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be fixed before moving on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be fixed before moving on.
Oh, ok! Apologies, I misunderstood your comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #4735
webview/src/experiments/components/table/body/TableContent.test.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work.
One item for follow up.
@tapadipti, @dberenbaum we might want to consider flattening the table for sorting in Studio: Screen.Recording.2023-09-26.at.12.12.39.PM.mov |
Currently flattening the rows is the only way to sort the table, but that could change depending on user feedback. |
The extension uses different filtering logic in that it will keep a parent commit in the table if any of its children are unfiltered. We do however change the filtering logic when the table is flat. Each record is filtered individually.
That is also how the extension sorts experiments. All the user feedback that we have gotten is that this does not really help. |
} | ||
} = cell as unknown as CellContext<Experiment, CellValue> | ||
|
||
if (!branch) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
) | ||
} | ||
|
||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
) | ||
} | ||
|
||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
minSize: 115, | ||
size: 115 | ||
}), | ||
columnHelper.accessor(() => COMMIT_COLUMN_ID, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
|
||
if (flattenTable) { | ||
columns.push( | ||
columnHelper.accessor(() => BRANCH_COLUMN_ID, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, going to merge this! Last things left to do are:
- Remove possible duplicate rows (Flatten table on sort #4685 (comment)) (done in Collapse duplicate rows when table is flattened #4735)
- Make "Parent" and "Branch/Tags" columns sticky (Add "Parents" Columns #4691 (comment))
I'll open a followup issue and start looking into the second task this sprint :)
minSize: 230, | ||
size: 240 | ||
}) | ||
const getDefaultColumns = (flattenTable: boolean) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function getDefaultColumns
has 47 lines of code (exceeds 40 allowed). Consider refactoring.
Code Climate has analyzed commit abf9707 and detected 11 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 98.1% (85% is the threshold). This pull request will bring the total coverage in the repository to 95.0% (0.0% change). View more on Code Climate. |
1/2
main
<= this <= #4691Demo
Screen.Recording.2023-09-19.at.10.50.32.AM.mov
To Do
Fixes #4620