-
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
Experiment table open to the side #1796
Conversation
9cfdfa9
to
337bbbb
Compare
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.
👍🏻
LGTM, just need to add an event for open openParamsFileToTheSide
. The logic from that function could also be moved out to somewhere in the columns
folder but that is just personal preference for me.
@@ -380,6 +382,13 @@ export class Experiments extends BaseRepository<TableData> { | |||
) | |||
} | |||
|
|||
private async openParamsFileToTheSide(path: string) { | |||
const [, fileSegment] = splitColumnPath(path) | |||
await window.showTextDocument(Uri.file(join(this.dvcRoot, fileSegment)), { |
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.
[I] Potentially we could rename and re-use RegisteredCommands.TRACKED_EXPLORER_OPEN_TO_THE_SIDE
here. If not this should have its own analytics event.
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 better to just give this its own event.
webview/src/util/array.ts
Outdated
@@ -0,0 +1,3 @@ | |||
export function pushIf<T>(array: T[], condition: boolean, elements: T[]) { |
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.
[N] We only use function
instead of const/arrow function if we have to.
} | ||
} | ||
] | ||
|
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.
[C] Would be good to get a divider between these two. Same for row context menus, we can follow up though.
337bbbb
to
2a8c56e
Compare
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.
Looks good so far! I decided to manually test non-default param file names to ensure we won't run into issues in the future, and everything looks solid!
Scenarios I tried:
- additional param file named
otherparams.yaml
- nested additional param file names
nested/params.yaml
- param file name with a space in it
- removing the
params
key entirely fromdvc.yaml
and relying on default behavior
All of these scenarios work perfectly fine! We may want to add automated tests for these scenarios for future refactors, though.
Aside from that, I confirmed that what @sroy3 pointed out with params.yaml
headers also happens on my machine, and think it should be fixed either in this PR or an immediate follow-up, preferably the former since the issue doesn't exist on main
.
it('should be able to handle a message to open the source params file from a column path', async () => { | ||
const { experiments } = setupExperimentsAndMockCommands() | ||
|
||
const mockShowTextDocument = stub(window, 'showTextDocument') | ||
const webview = await experiments.showWebview() | ||
const mockMessageReceived = getMessageReceivedEmitter(webview) | ||
const mockColumnId = 'params:params.yaml:lr' | ||
|
||
mockMessageReceived.fire({ | ||
payload: mockColumnId, | ||
type: MessageFromWebviewType.OPEN_PARAMS_FILE_TO_THE_SIDE | ||
}) | ||
|
||
expect(mockShowTextDocument).to.be.calledOnce | ||
expect(mockShowTextDocument).to.be.calledWithExactly( | ||
Uri.file(join(dvcDemoPath, 'params.yaml')), | ||
{ | ||
viewColumn: ViewColumn.Beside | ||
} | ||
) | ||
}) |
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.
Could be good to test non-default params file names, just in case we refactor in the future.
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.
Thanks! I already changed this test to use paths with appended numbers like React table does so I can simulate this issue you guys found.
I will also add a test for non-default files now because it's easy to do.
@mattseddon @rogermparent @sroy3 To clarify:
|
cc9c6bb
to
f45831d
Compare
I would say definitely option 2 as it would be the least unexpecting thing to do. I would suggest that we limit "Hide Column" to leaves only as the first step. |
f45831d
to
e0e6ad8
Compare
Code Climate has analyzed commit a58ed20 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (85% is the threshold). This pull request will bring the total coverage in the repository to 96.8% (0.0% change). View more on Code Climate. |
This PR will add the option
Open to the side
to experiment table columns that represent parameters. This option will open the corresponding params file in a new side-by-side editor area.Screen.Recording.2022-05-30.at.16.31.45.mov