Skip to content

Commit b68246b

Browse files
authored
Consolidate Setup and "Get Started" walkthrough (#3993)
1 parent 8572ef0 commit b68246b

File tree

19 files changed

+174
-204
lines changed

19 files changed

+174
-204
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,16 @@ These are the VS Code [settings] available for the Extension:
146146

147147
[settings]: https://code.visualstudio.com/docs/getstarted/settings
148148

149-
| **Option** | **Description** |
150-
| -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
151-
| `dvc.dvcPath` | Path or shell command to the DVC binary. Required unless Microsoft's [Python extension] is installed and the `dvc` package found in its environment. |
152-
| `dvc.pythonPath` | Path to the desired Python interpreter to use with DVC. Should only be utilized when using a virtual environment without Microsoft's [Python extension]. |
153-
| `dvc.experimentsTableHeadMaxHeight` | Maximum height of experiment table head rows. |
154-
| `dvc.focusedProjects` | A subset of paths to the workspace's available DVC projects. Using this option will override project auto-discovery. |
155-
| `dvc.doNotShowWalkthroughAfterInstall` | Do not prompt to show the Get Started page after installing. Useful for pre-configured development environments |
156-
| `dvc.doNotRecommendAddStudioToken` | Do not prompt to add a [studio.token] to the global DVC config, which enables automatic sharing of experiments to [Studio]. |
157-
| `dvc.doNotRecommendRedHatExtension` | Do not prompt to install the Red Hat YAML extension, which helps with DVC YAML schema validation (`dvc.yaml` and `.dvc` files). |
158-
| `dvc.doNotShowCliUnavailable` | Do not warn when the workspace contains a DVC project but the DVC binary is unavailable. |
149+
| **Option** | **Description** |
150+
| ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
151+
| `dvc.dvcPath` | Path or shell command to the DVC binary. Required unless Microsoft's [Python extension] is installed and the `dvc` package found in its environment. |
152+
| `dvc.pythonPath` | Path to the desired Python interpreter to use with DVC. Should only be utilized when using a virtual environment without Microsoft's [Python extension]. |
153+
| `dvc.experimentsTableHeadMaxHeight` | Maximum height of experiment table head rows. |
154+
| `dvc.focusedProjects` | A subset of paths to the workspace's available DVC projects. Using this option will override project auto-discovery. |
155+
| `dvc.doNotShowSetupAfterInstall` | Do not prompt to show the setup page after installing. Useful for pre-configured development environments |
156+
| `dvc.doNotRecommendAddStudioToken` | Do not prompt to add a [studio.token] to the global DVC config, which enables automatic sharing of experiments to [Studio]. |
157+
| `dvc.doNotRecommendRedHatExtension` | Do not prompt to install the Red Hat YAML extension, which helps with DVC YAML schema validation (`dvc.yaml` and `.dvc` files). |
158+
| `dvc.doNotShowCliUnavailable` | Do not warn when the workspace contains a DVC project but the DVC binary is unavailable. |
159159

160160
> **Note** that the `Setup The Workspace` command helps you set up the basic
161161
> ones at the [Workspace level] (saved to `.vscode/setting.json`).

extension/package.json

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -615,8 +615,8 @@
615615
"type": "boolean",
616616
"default": null
617617
},
618-
"dvc.doNotShowWalkthroughAfterInstall": {
619-
"description": "Do not prompt to show the Get Started page after installing. Useful for pre-configured development environments.",
618+
"dvc.doNotShowSetupAfterInstall": {
619+
"description": "Do not prompt to show the setup page after installing. Useful for pre-configured development environments.",
620620
"type": "boolean",
621621
"default": null
622622
},
@@ -1512,32 +1512,6 @@
15121512
"title": "Get Started",
15131513
"description": "Your first steps to build better models faster with experiment tracking and dataset versioning",
15141514
"steps": [
1515-
{
1516-
"id": "dvc.installDVC",
1517-
"title": "Install DVC",
1518-
"description": "This extension requires DVC to be installed.\n\n[Show Setup](command:dvc.showDvcSetup)\n",
1519-
"media": {
1520-
"markdown": "resources/walkthrough/install-dvc.md"
1521-
},
1522-
"completionEvents": [
1523-
"onLink:https://dvc.org",
1524-
"onLink:https://dvc.org/doc/install",
1525-
"onCommand:dvc.setupWorkspace"
1526-
]
1527-
},
1528-
{
1529-
"id": "dvc.setupProject",
1530-
"title": "Setup a DVC Project",
1531-
"description": "Try an example DVC project or set one up quickly, and start tracking datasets, models, metrics, and plots\n\n[Example Project](https://github.com/iterative/example-get-started)\n",
1532-
"media": {
1533-
"markdown": "resources/walkthrough/setup-project.md"
1534-
},
1535-
"completionEvents": [
1536-
"onLink:https://github.com/iterative/example-get-started",
1537-
"onLink:https://github.com/iterative/vscode-dvc-demo",
1538-
"onLink:https://dvc.org/doc/dvclive"
1539-
]
1540-
},
15411515
{
15421516
"id": "dvc.showCommands",
15431517
"title": "Available Commands",

extension/resources/walkthrough/command-palette.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
> ℹ️ The extension's features cannot be accessed until DVC is installed and a
2+
> DVC project is available in the workspace. Please refer to the
3+
> [setup page](command:dvc.dvc.showDvcSetup) if you have not setup DVC yet.
4+
15
# Command Palette
26

37
This extension makes extensive use of the

extension/resources/walkthrough/experiments-table.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# Experiments Table
22

3-
> ❗ DVC should be installed and DVC project available in the workspace for this
4-
> and the next steps to work properly. Please refer to first two steps of this
5-
> guide.
6-
73
As you change code, parameters, data and run new experiments this table will
84
keep all the details about your iterations. It can be manipulated and configured
95
using the [DVC side panel](command:workbench.view.extension.dvc-views). This is
Binary file not shown.

extension/resources/walkthrough/install-dvc.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

extension/resources/walkthrough/setup-project.md

Lines changed: 0 additions & 60 deletions
This file was deleted.

extension/src/extension.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ import {
2929
} from './telemetry'
3030
import { RegisteredCommands } from './commands/external'
3131
import { StopWatch } from './util/time'
32-
import {
33-
registerWalkthroughCommands,
34-
showWalkthroughOnFirstUse
35-
} from './vscode/walkthrough'
32+
import { registerWalkthroughCommands } from './vscode/walkthrough'
33+
import { showSetupOnFirstUse } from './setup/util'
3634
import { WorkspaceRepositories } from './repository/workspace'
3735
import { recommendRedHatExtensionOnce } from './vscode/recommend'
3836
import { WorkspacePlots } from './plots/workspace'
@@ -258,7 +256,7 @@ class Extension extends Disposable {
258256

259257
registerPersistenceCommands(context.workspaceState, this.internalCommands)
260258

261-
void showWalkthroughOnFirstUse(env.isNewAppInstall)
259+
void showSetupOnFirstUse(env.isNewAppInstall)
262260
this.dispose.track(recommendRedHatExtensionOnce())
263261

264262
this.dispose.track(new LanguageClient())

extension/src/vscode/walkthrough.test.ts renamed to extension/src/setup/util.test.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { commands } from 'vscode'
2-
import { showWalkthroughOnFirstUse } from './walkthrough'
3-
import { ConfigKey, getConfigValue, setUserConfigValue } from './config'
4-
import { Toast } from './toast'
5-
import { Response } from './response'
2+
import { showSetupOnFirstUse } from './util'
3+
import { ConfigKey, getConfigValue, setUserConfigValue } from '../vscode/config'
4+
import { Toast } from '../vscode/toast'
5+
import { Response } from '../vscode/response'
66
import { RegisteredCommands } from '../commands/external'
77

88
jest.mock('vscode')
9-
jest.mock('./toast')
10-
jest.mock('./config')
9+
jest.mock('../vscode/toast')
10+
jest.mock('../vscode/config')
1111

1212
const mockedCommands = jest.mocked(commands)
1313
const mockedExecuteCommand = jest.fn()
@@ -24,59 +24,59 @@ beforeEach(() => {
2424
jest.resetAllMocks()
2525
})
2626

27-
describe('showWalkthroughOnFirstUse', () => {
28-
it('should ask to show the walkthrough after a new install', async () => {
29-
await showWalkthroughOnFirstUse(true)
27+
describe('showSetupOnFirstUse', () => {
28+
it('should ask to show the setup page after a new install', async () => {
29+
await showSetupOnFirstUse(true)
3030
expect(mockedAskShowOrCloseOrNever).toHaveBeenCalledTimes(1)
3131
})
3232

33-
it('should not ask to show the walkthrough when the install is not new', async () => {
34-
await showWalkthroughOnFirstUse(false)
33+
it('should not ask to show the setup page when the install is not new', async () => {
34+
await showSetupOnFirstUse(false)
3535
expect(mockedAskShowOrCloseOrNever).not.toHaveBeenCalled()
3636
})
3737

38-
it('should not ask to show the walkthrough when the user has set a config option', async () => {
38+
it('should not ask to show the setup page when the user has set a config option', async () => {
3939
mockedGetConfigValue.mockReturnValueOnce(true)
40-
await showWalkthroughOnFirstUse(true)
40+
await showSetupOnFirstUse(true)
4141
expect(mockedAskShowOrCloseOrNever).not.toHaveBeenCalled()
4242
expect(mockedGetConfigValue).toHaveBeenCalledTimes(1)
4343
expect(mockedGetConfigValue).toHaveBeenCalledWith(
44-
ConfigKey.DO_NOT_SHOW_WALKTHROUGH_AFTER_INSTALL
44+
ConfigKey.DO_NOT_SHOW_SETUP_AFTER_INSTALL
4545
)
4646
})
4747

4848
it('should set the config option if the user responds with never', async () => {
4949
mockedAskShowOrCloseOrNever.mockResolvedValueOnce(Response.NEVER)
50-
await showWalkthroughOnFirstUse(true)
50+
await showSetupOnFirstUse(true)
5151

5252
expect(mockedSetConfigValue).toHaveBeenCalledTimes(1)
5353
expect(mockedSetConfigValue).toHaveBeenCalledWith(
54-
ConfigKey.DO_NOT_SHOW_WALKTHROUGH_AFTER_INSTALL,
54+
ConfigKey.DO_NOT_SHOW_SETUP_AFTER_INSTALL,
5555
true
5656
)
5757
})
5858

59-
it('should show the walkthrough if the user responds with show', async () => {
59+
it('should show the setup page if the user responds with show', async () => {
6060
mockedAskShowOrCloseOrNever.mockResolvedValueOnce(Response.SHOW)
61-
await showWalkthroughOnFirstUse(true)
61+
await showSetupOnFirstUse(true)
6262

6363
expect(mockedSetConfigValue).not.toHaveBeenCalled()
6464
expect(mockedExecuteCommand).toHaveBeenCalledWith(
65-
RegisteredCommands.EXTENSION_GET_STARTED
65+
RegisteredCommands.SETUP_SHOW
6666
)
6767
})
6868

6969
it('should take no action if the user closes the dialog', async () => {
7070
mockedAskShowOrCloseOrNever.mockResolvedValueOnce(undefined)
71-
await showWalkthroughOnFirstUse(true)
71+
await showSetupOnFirstUse(true)
7272

7373
expect(mockedSetConfigValue).not.toHaveBeenCalled()
7474
expect(mockedExecuteCommand).not.toHaveBeenCalled()
7575
})
7676

7777
it('should take no action if the user respond with close', async () => {
7878
mockedAskShowOrCloseOrNever.mockResolvedValueOnce(Response.CLOSE)
79-
await showWalkthroughOnFirstUse(true)
79+
await showSetupOnFirstUse(true)
8080

8181
expect(mockedSetConfigValue).not.toHaveBeenCalled()
8282
expect(mockedExecuteCommand).not.toHaveBeenCalled()

extension/src/setup/util.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { commands } from 'vscode'
2+
import { RegisteredCommands } from '../commands/external'
3+
import { ConfigKey, getConfigValue, setUserConfigValue } from '../vscode/config'
4+
import { Response } from '../vscode/response'
5+
import { Toast } from '../vscode/toast'
6+
7+
export const showSetupOnFirstUse = async (
8+
isNewAppInstall: boolean
9+
): Promise<void> => {
10+
if (
11+
!isNewAppInstall ||
12+
getConfigValue<boolean>(ConfigKey.DO_NOT_SHOW_SETUP_AFTER_INSTALL)
13+
) {
14+
return
15+
}
16+
17+
const response = await Toast.askShowOrCloseOrNever(
18+
'Need help? Go to our setup view.'
19+
)
20+
21+
if (response === Response.SHOW) {
22+
void commands.executeCommand(RegisteredCommands.SETUP_SHOW)
23+
}
24+
if (response === Response.NEVER) {
25+
void setUserConfigValue(ConfigKey.DO_NOT_SHOW_SETUP_AFTER_INSTALL, true)
26+
}
27+
}

0 commit comments

Comments
 (0)