diff --git a/extension/package.json b/extension/package.json index 1aff2dc9f8..274f5570eb 100644 --- a/extension/package.json +++ b/extension/package.json @@ -506,8 +506,8 @@ "icon": "$(play)" }, { - "title": "Share", - "command": "dvc.views.experiments.shareExperimentToStudio", + "title": "Push", + "command": "dvc.views.experiments.pushExperiment", "category": "DVC", "icon": "$(repo-push)" }, @@ -888,7 +888,7 @@ "when": "false" }, { - "command": "dvc.views.experiments.shareExperimentToStudio", + "command": "dvc.views.experiments.pushExperiment", "when": "false" }, { @@ -1152,7 +1152,7 @@ "when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem =~ /^(experiment|queued)$/ && !dvc.experiment.running" }, { - "command": "dvc.views.experiments.shareExperimentToStudio", + "command": "dvc.views.experiments.pushExperiment", "group": "1_share@0", "when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem == experiment && !dvc.experiment.running" }, diff --git a/extension/src/commands/external.ts b/extension/src/commands/external.ts index 95ad4eaeb6..1e951c0d54 100644 --- a/extension/src/commands/external.ts +++ b/extension/src/commands/external.ts @@ -14,7 +14,7 @@ export enum RegisteredCliCommands { EXPERIMENT_VIEW_APPLY = 'dvc.views.experiments.applyExperiment', EXPERIMENT_VIEW_BRANCH = 'dvc.views.experiments.branchExperiment', - EXPERIMENT_VIEW_SHARE = 'dvc.views.experiments.shareExperiment', + EXPERIMENT_VIEW_PUSH = 'dvc.views.experiments.pushExperiment', EXPERIMENT_VIEW_REMOVE = 'dvc.views.experiments.removeExperiment', EXPERIMENT_VIEW_SHOW_LOGS = 'dvc.views.experiments.showLogs', EXPERIMENT_VIEW_STOP = 'dvc.views.experiments.stopQueueExperiment', diff --git a/extension/src/experiments/commands/index.ts b/extension/src/experiments/commands/index.ts index d3641c3223..dc0fdff5fc 100644 --- a/extension/src/experiments/commands/index.ts +++ b/extension/src/experiments/commands/index.ts @@ -42,7 +42,7 @@ const convertUrlTextToLink = (stdout: string) => { return stdout.replace(match[0], ` in [Studio](${match[1]})`) } -export const getShareExperimentToStudioCommand = +export const getPushExperimentCommand = (internalCommands: InternalCommands, setup: Setup) => ({ dvcRoot, id }: { dvcRoot: string; id: string }) => { const studioAccessToken = setup.getStudioAccessToken() @@ -55,10 +55,10 @@ export const getShareExperimentToStudioCommand = void promptToAddStudioToken() } - return Toast.showProgress(`Sharing ${id}`, async progress => { + return Toast.showProgress('exp push', async progress => { progress.report({ increment: 0 }) - progress.report({ increment: 25, message: 'Running exp push...' }) + progress.report({ increment: 25, message: `Pushing ${id}...` }) const remainingProgress = 75 diff --git a/extension/src/experiments/commands/register.ts b/extension/src/experiments/commands/register.ts index 3c1b76693d..dcb54486dd 100644 --- a/extension/src/experiments/commands/register.ts +++ b/extension/src/experiments/commands/register.ts @@ -1,7 +1,4 @@ -import { - getBranchExperimentCommand, - getShareExperimentToStudioCommand -} from '.' +import { getBranchExperimentCommand, getPushExperimentCommand } from '.' import { pickGarbageCollectionFlags } from '../quickPick' import { WorkspaceExperiments } from '../workspace' import { AvailableCommands, InternalCommands } from '../../commands/internal' @@ -293,8 +290,8 @@ export const registerExperimentCommands = ( ) internalCommands.registerExternalCliCommand( - RegisteredCliCommands.EXPERIMENT_VIEW_SHARE, - getShareExperimentToStudioCommand(internalCommands, setup) + RegisteredCliCommands.EXPERIMENT_VIEW_PUSH, + getPushExperimentCommand(internalCommands, setup) ) internalCommands.registerExternalCliCommand( diff --git a/extension/src/experiments/webview/messages.ts b/extension/src/experiments/webview/messages.ts index 209c793e62..a43297c480 100644 --- a/extension/src/experiments/webview/messages.ts +++ b/extension/src/experiments/webview/messages.ts @@ -194,9 +194,9 @@ export class WebviewMessages { case MessageFromWebviewType.ADD_CONFIGURATION: { return this.addConfiguration() } - case MessageFromWebviewType.SHARE_EXPERIMENT: + case MessageFromWebviewType.PUSH_EXPERIMENT: return commands.executeCommand( - RegisteredCliCommands.EXPERIMENT_VIEW_SHARE, + RegisteredCliCommands.EXPERIMENT_VIEW_PUSH, { dvcRoot: this.dvcRoot, id: message.payload } ) diff --git a/extension/src/telemetry/constants.ts b/extension/src/telemetry/constants.ts index 6d59a1ed5a..9fae16fd43 100644 --- a/extension/src/telemetry/constants.ts +++ b/extension/src/telemetry/constants.ts @@ -143,7 +143,7 @@ export interface IEventNamePropertyMapping { [EventName.EXPERIMENT_VIEW_APPLY]: undefined [EventName.EXPERIMENT_VIEW_BRANCH]: undefined [EventName.EXPERIMENT_VIEW_REMOVE]: undefined - [EventName.EXPERIMENT_VIEW_SHARE]: undefined + [EventName.EXPERIMENT_VIEW_PUSH]: undefined [EventName.EXPERIMENT_VIEW_SHOW_LOGS]: undefined [EventName.EXPERIMENT_VIEW_STOP]: undefined [EventName.QUEUE_EXPERIMENT]: undefined diff --git a/extension/src/test/suite/experiments/index.test.ts b/extension/src/test/suite/experiments/index.test.ts index df861417da..8efd84fe9d 100644 --- a/extension/src/test/suite/experiments/index.test.ts +++ b/extension/src/test/suite/experiments/index.test.ts @@ -637,7 +637,7 @@ suite('Experiments Test Suite', () => { ) }).timeout(WEBVIEW_TEST_TIMEOUT) - it('should handle a message to share an experiment', async () => { + it('should handle a message to push an experiment', async () => { const { experiments } = buildExperiments(disposable) await experiments.isReady() @@ -647,6 +647,7 @@ suite('Experiments Test Suite', () => { const mockMessageReceived = getMessageReceivedEmitter(webview) const executeCommandSpy = spy(commands, 'executeCommand') + const mockExpPush = stub(DvcExecutor.prototype, 'expPush') const mockGetStudioAccessToken = stub( Setup.prototype, @@ -671,7 +672,7 @@ suite('Experiments Test Suite', () => { mockMessageReceived.fire({ payload: mockExpId, - type: MessageFromWebviewType.SHARE_EXPERIMENT + type: MessageFromWebviewType.PUSH_EXPERIMENT }) await Promise.all([tokenNotFound, userPrompted]) @@ -689,14 +690,13 @@ suite('Experiments Test Suite', () => { }) ) - const mockExpPush = stub(DvcExecutor.prototype, 'expPush') const mockShowProgress = stub(Toast, 'showProgress') bypassProgressCloseDelay() const mockReport = stub() mockShowProgress.callsFake((title, callback) => { - expect(title).to.equal(`Sharing ${mockExpId}`) + expect(title).to.equal('exp push') const progress = { report: mockReport } return callback(progress, {} as CancellationToken) @@ -713,7 +713,7 @@ suite('Experiments Test Suite', () => { mockMessageReceived.fire({ payload: mockExpId, - type: MessageFromWebviewType.SHARE_EXPERIMENT + type: MessageFromWebviewType.PUSH_EXPERIMENT }) await Promise.all([tokenFound, commandExecuted]) diff --git a/extension/src/webview/contract.ts b/extension/src/webview/contract.ts index 5caeecbb70..4ae7329feb 100644 --- a/extension/src/webview/contract.ts +++ b/extension/src/webview/contract.ts @@ -25,6 +25,7 @@ export enum MessageFromWebviewType { OPEN_PLOTS_WEBVIEW = 'open-plots-webview', OPEN_STUDIO = 'open-studio', OPEN_STUDIO_PROFILE = 'open-studio-profile', + PUSH_EXPERIMENT = 'push-experiment', REMOVE_COLUMN_SORT = 'remove-column-sort', REMOVE_EXPERIMENT = 'remove-experiment', REORDER_COLUMNS = 'reorder-columns', @@ -36,7 +37,6 @@ export enum MessageFromWebviewType { RESIZE_COLUMN = 'resize-column', RESIZE_PLOTS = 'resize-plots', SAVE_STUDIO_TOKEN = 'save-studio-token', - SHARE_EXPERIMENT = 'share-experiment', SHOW_EXPERIMENT_LOGS = 'show-experiment-logs', STOP_EXPERIMENT = 'stop-experiment', SORT_COLUMN = 'sort-column', @@ -154,7 +154,7 @@ export type MessageFromWebview = } | { type: MessageFromWebviewType.SHOW_EXPERIMENT_LOGS; payload: string } | { - type: MessageFromWebviewType.SHARE_EXPERIMENT + type: MessageFromWebviewType.PUSH_EXPERIMENT payload: string } | { diff --git a/webview/src/experiments/components/App.test.tsx b/webview/src/experiments/components/App.test.tsx index a410989062..7cb43dc8f1 100644 --- a/webview/src/experiments/components/App.test.tsx +++ b/webview/src/experiments/components/App.test.tsx @@ -862,7 +862,7 @@ describe('App', () => { 'Show Logs', 'Apply to Workspace', 'Create new Branch', - 'Share', + 'Push', 'Modify and Run', 'Modify and Resume', 'Modify and Queue', @@ -1023,10 +1023,10 @@ describe('App', () => { advanceTimersByTime(100) const menuitems = screen.getAllByRole('menuitem') const itemLabels = menuitems.map(item => item.textContent) - expect(itemLabels).toContain('Share') + expect(itemLabels).toContain('Push') const shareOption = menuitems.find(item => - item.textContent?.includes('Share') + item.textContent?.includes('Push') ) expect(shareOption).toBeDefined() @@ -1035,7 +1035,7 @@ describe('App', () => { expect(sendMessage).toHaveBeenCalledWith({ payload: 'exp-e7a67', - type: MessageFromWebviewType.SHARE_EXPERIMENT + type: MessageFromWebviewType.PUSH_EXPERIMENT }) }) diff --git a/webview/src/experiments/components/table/body/RowContextMenu.tsx b/webview/src/experiments/components/table/body/RowContextMenu.tsx index a4cc0b3939..0d81ac6947 100644 --- a/webview/src/experiments/components/table/body/RowContextMenu.tsx +++ b/webview/src/experiments/components/table/body/RowContextMenu.tsx @@ -201,8 +201,8 @@ const getSingleSelectMenuOptions = ( MessageFromWebviewType.CREATE_BRANCH_FROM_EXPERIMENT ), hideIfRunningOrNotExperiment( - 'Share', - MessageFromWebviewType.SHARE_EXPERIMENT, + 'Push', + MessageFromWebviewType.PUSH_EXPERIMENT, true ), ...getRunResumeOptions(