Skip to content
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

Add Setup DVC Section #3655

Merged
merged 10 commits into from
Apr 11, 2023
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
4 changes: 2 additions & 2 deletions extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,7 @@
},
{
"view": "dvc.views.welcome",
"contents": "New to the extension?\n[Show Walkthrough](command:dvc.getStarted)\n\nThe extension is currently unable to initialize.\n[Show Setup](command:dvc.showExperimentsSetup)",
"contents": "New to the extension?\n[Show Walkthrough](command:dvc.getStarted)\n\nThe extension is currently unable to initialize.\n[Show Setup](command:dvc.showDvcSetup)",
julieg18 marked this conversation as resolved.
Show resolved Hide resolved
"when": "true"
},
{
Expand Down Expand Up @@ -1491,7 +1491,7 @@
{
"id": "dvc.installDVC",
"title": "Install DVC",
"description": "This extension requires DVC to be installed.\n\n[Show Setup](command:dvc.showExperimentsSetup)\n",
"description": "This extension requires DVC to be installed.\n\n[Show Setup](command:dvc.showDvcSetup)\n",
"media": {
"markdown": "resources/walkthrough/install-dvc.md"
},
Expand Down
2 changes: 1 addition & 1 deletion extension/resources/walkthrough/install-dvc.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ DVC icon like this in the status bar:
</p>

If you see instead the crossed circle icon, click on the icon or follow the
[Setup](command:dvc.showExperimentsSetup) wizard.
[Setup](command:dvc.showDvcSetup) wizard.

> **Note**: The correct Python interpreter must be set for the current workspace
> when relying on the Python extension for auto environment activation.
1 change: 1 addition & 0 deletions extension/src/commands/external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export enum RegisteredCommands {

SETUP_SHOW = 'dvc.showSetup',
SETUP_SHOW_EXPERIMENTS = 'dvc.showExperimentsSetup',
SETUP_SHOW_DVC = 'dvc.showDvcSetup',
SELECT_FOCUSED_PROJECTS = 'dvc.selectFocusedProjects',

ADD_STUDIO_ACCESS_TOKEN = 'dvc.addStudioAccessToken',
Expand Down
2 changes: 1 addition & 1 deletion extension/src/commands/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export const showSetupOrExecuteCommand =
<T>(setup: Setup, callback: (context: Context) => Promise<T | undefined>) =>
(context: Context) =>
setup.shouldBeShown()
? commands.executeCommand(RegisteredCommands.SETUP_SHOW_EXPERIMENTS)
? commands.executeCommand(RegisteredCommands.SETUP_SHOW_DVC)
: callback(context)
7 changes: 7 additions & 0 deletions extension/src/setup/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ const registerSetupShowCommands = (
}
)

internalCommands.registerExternalCommand(
RegisteredCommands.SETUP_SHOW_DVC,
async () => {
await setup.showSetup(SetupSection.DVC)
}
)

internalCommands.registerExternalCommand(
RegisteredCommands.SETUP_SHOW_STUDIO_CONNECT,
async () => {
Expand Down
6 changes: 4 additions & 2 deletions extension/src/setup/webview/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ export type SetupData = {

export enum SetupSection {
EXPERIMENTS = 'experiments',
STUDIO = 'studio'
STUDIO = 'studio',
DVC = 'dvc'
}

export const DEFAULT_SECTION_COLLAPSED = {
[SetupSection.EXPERIMENTS]: false,
[SetupSection.STUDIO]: false
[SetupSection.STUDIO]: false,
[SetupSection.DVC]: false
}

export type SectionCollapsed = typeof DEFAULT_SECTION_COLLAPSED
Expand Down
1 change: 1 addition & 0 deletions extension/src/telemetry/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ export interface IEventNamePropertyMapping {

[EventName.SETUP_SHOW]: undefined
[EventName.SETUP_SHOW_EXPERIMENTS]: undefined
[EventName.SETUP_SHOW_DVC]: undefined
[EventName.SELECT_FOCUSED_PROJECTS]: undefined
[EventName.SETUP_SHOW_STUDIO_SETTINGS]: undefined
[EventName.SETUP_SHOW_STUDIO_CONNECT]: undefined
Expand Down
6 changes: 2 additions & 4 deletions extension/src/test/suite/experiments/workspace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -975,9 +975,7 @@ suite('Workspace Experiments Test Suite', () => {

await commands.executeCommand(RegisteredCommands.EXPERIMENT_SHOW)

expect(executeCommandSpy).to.have.been.calledWithMatch(
'dvc.showExperimentsSetup'
)
expect(executeCommandSpy).to.have.been.calledWithMatch('dvc.showDvcSetup')
})

it('should not show the experiments webview if the setup should be shown', async () => {
Expand All @@ -1001,7 +999,7 @@ suite('Workspace Experiments Test Suite', () => {

await commands.executeCommand(RegisteredCommands.EXPERIMENT_SHOW)

expect(executeCommandSpy).not.to.be.calledWith('dvc.showExperimentsSetup')
expect(executeCommandSpy).not.to.be.calledWith('dvc.showDvcSetup')
})

it('should show the experiments webview if the setup should not be shown', async () => {
Expand Down
Loading