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

Move Connect to Studio into Setup webview #3452

Merged
merged 6 commits into from
Mar 14, 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
22 changes: 2 additions & 20 deletions extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -399,16 +399,6 @@
"command": "dvc.showCommands",
"category": "DVC"
},
{
"title": "Connect to Studio",
Copy link
Member Author

Choose a reason for hiding this comment

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

[F] I'll replace these in a follow-up.

Copy link
Member Author

@mattseddon mattseddon Mar 14, 2023

Choose a reason for hiding this comment

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

The current behaviour is back UX but I will fix it in the next PR.

Screen.Recording.2023-03-14.at.12.29.42.pm.mov

The best idea at the moment seems to be to collapse all of the non-relevant sections.

"command": "dvc.showConnect",
"category": "DVC"
},
{
"title": "Open Studio Settings",
"command": "dvc.showStudioSettings",
"category": "DVC"
},
{
"title": "Show Experiments",
"command": "dvc.showExperiments",
Expand Down Expand Up @@ -819,14 +809,6 @@
"command": "dvc.stopQueuedExperiments",
"when": "dvc.commands.available && dvc.project.available"
},
{
"command": "dvc.showConnect",
"when": "dvc.commands.available && dvc.project.available && !dvc.studio.connected"
},
{
"command": "dvc.showStudioSettings",
"when": "dvc.commands.available && dvc.project.available && dvc.studio.connected"
},
{
"command": "dvc.selectForCompare",
"when": "false"
Expand Down Expand Up @@ -1416,12 +1398,12 @@
},
{
"view": "dvc.views.studio",
"contents": "[$(plug) Connect](command:dvc.showConnect)",
"contents": "[$(plug) Connect](command:dvc.showSetup)",
"when": "!dvc.studio.connected"
},
{
"view": "dvc.views.studio",
"contents": "[$(settings-gear) Open Settings](command:dvc.showConnect)",
"contents": "[$(settings-gear) Open Settings](command:dvc.showSetup)",
"when": "dvc.studio.connected"
},
{
Expand Down
2 changes: 0 additions & 2 deletions extension/src/commands/external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ export enum RegisteredCommands {
SETUP_SHOW = 'dvc.showSetup',
SELECT_FOCUSED_PROJECTS = 'dvc.selectFocusedProjects',

CONNECT_SHOW = 'dvc.showConnect',
OPEN_STUDIO_SETTINGS = 'dvc.showStudioSettings',
ADD_STUDIO_ACCESS_TOKEN = 'dvc.addStudioAccessToken',
UPDATE_STUDIO_ACCESS_TOKEN = 'dvc.updateStudioAccessToken',
REMOVE_STUDIO_ACCESS_TOKEN = 'dvc.removeStudioAccessToken',
Expand Down
167 changes: 0 additions & 167 deletions extension/src/connect/index.ts

This file was deleted.

33 changes: 0 additions & 33 deletions extension/src/connect/register.ts

This file was deleted.

6 changes: 0 additions & 6 deletions extension/src/connect/webview/contract.ts

This file was deleted.

8 changes: 4 additions & 4 deletions extension/src/experiments/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Progress, commands } from 'vscode'
import { AvailableCommands, InternalCommands } from '../../commands/internal'
import { Toast } from '../../vscode/toast'
import { WorkspaceExperiments } from '../workspace'
import { Connect } from '../../connect'
import { Setup } from '../../setup'
import { RegisteredCommands } from '../../commands/external'

export const getBranchExperimentCommand =
Expand Down Expand Up @@ -108,11 +108,11 @@ export const getShareExperimentAsCommitCommand =
}

export const getShareExperimentToStudioCommand =
(internalCommands: InternalCommands, connect: Connect) =>
(internalCommands: InternalCommands, setup: Setup) =>
Copy link
Member Author

Choose a reason for hiding this comment

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

[F] All of the externals of Connect have been moved directly onto Setup to reduce the size of this change. Will work out a smarter split once the dust settles.

({ dvcRoot, id }: { dvcRoot: string; id: string }) => {
const studioAccessToken = connect.getStudioAccessToken()
const studioAccessToken = setup.getStudioAccessToken()
if (!studioAccessToken) {
return commands.executeCommand(RegisteredCommands.CONNECT_SHOW)
return commands.executeCommand(RegisteredCommands.SETUP_SHOW)
}

return internalCommands.executeCommand(
Expand Down
6 changes: 2 additions & 4 deletions extension/src/experiments/commands/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { Title } from '../../vscode/title'
import { Context, getDvcRootFromContext } from '../../vscode/context'
import { Setup } from '../../setup'
import { showSetupOrExecuteCommand } from '../../commands/util'
import { Connect } from '../../connect'

type ExperimentDetails = { dvcRoot: string; id: string }

Expand Down Expand Up @@ -331,8 +330,7 @@ const registerExperimentRunCommands = (
export const registerExperimentCommands = (
experiments: WorkspaceExperiments,
internalCommands: InternalCommands,
setup: Setup,
connect: Connect
setup: Setup
) => {
registerExperimentCwdCommands(experiments, internalCommands)
registerExperimentNameCommands(experiments, internalCommands)
Expand All @@ -348,7 +346,7 @@ export const registerExperimentCommands = (

internalCommands.registerExternalCommand(
RegisteredCommands.EXPERIMENT_VIEW_SHARE_TO_STUDIO,
getShareExperimentToStudioCommand(internalCommands, connect)
getShareExperimentToStudioCommand(internalCommands, setup)
)

internalCommands.registerExternalCliCommand(
Expand Down
15 changes: 3 additions & 12 deletions extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import { DvcExecutor } from './cli/dvc/executor'
import { DvcRunner } from './cli/dvc/runner'
import { DvcReader } from './cli/dvc/reader'
import { Config } from './config'
import { Connect } from './connect'
import { registerConnectCommands } from './connect/register'
import { Context } from './context'
import { WorkspaceExperiments } from './experiments/workspace'
import { registerExperimentCommands } from './experiments/commands/register'
Expand Down Expand Up @@ -65,7 +63,6 @@ export class Extension extends Disposable {

private readonly resourceLocator: ResourceLocator
private readonly repositories: WorkspaceRepositories
private readonly connect: Connect
private readonly experiments: WorkspaceExperiments
private readonly plots: WorkspacePlots
private readonly setup: Setup
Expand Down Expand Up @@ -94,14 +91,10 @@ export class Extension extends Disposable {

const config = this.dispose.track(new Config())

this.connect = this.dispose.track(
new Connect(context, this.resourceLocator.dvcIcon)
)

this.gitExecutor = this.dispose.track(new GitExecutor())
this.gitReader = this.dispose.track(new GitReader())

const getStudioLiveShareToken = () => this.connect.getStudioLiveShareToken()
const getStudioLiveShareToken = () => this.setup.getStudioLiveShareToken()

this.dvcExecutor = this.dispose.track(
new DvcExecutor(config, getStudioLiveShareToken, cwd =>
Expand Down Expand Up @@ -189,6 +182,7 @@ export class Extension extends Disposable {

this.setup = this.dispose.track(
new Setup(
context,
config,
this.internalCommands,
this.experiments,
Expand All @@ -207,14 +201,11 @@ export class Extension extends Disposable {
)
)

registerConnectCommands(this.connect, this.internalCommands)

registerPatchCommand(this.internalCommands)
registerExperimentCommands(
this.experiments,
this.internalCommands,
this.setup,
this.connect
this.setup
)
registerPlotsCommands(this.plots, this.internalCommands, this.setup)
registerSetupCommands(this.setup, this.internalCommands)
Expand Down
2 changes: 1 addition & 1 deletion extension/src/patch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const showUnauthorized = async () => {
UserResponse.SHOW
)
if (response === UserResponse.SHOW) {
return commands.executeCommand(RegisteredCommands.CONNECT_SHOW)
return commands.executeCommand(RegisteredCommands.SETUP_SHOW)
}
}

Expand Down
Loading