Skip to content

Commit

Permalink
rename share to push
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon committed Apr 30, 2023
1 parent 7d66fe5 commit 8a445fd
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 30 deletions.
8 changes: 4 additions & 4 deletions extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
},
Expand Down Expand Up @@ -888,7 +888,7 @@
"when": "false"
},
{
"command": "dvc.views.experiments.shareExperimentToStudio",
"command": "dvc.views.experiments.pushExperiment",
"when": "false"
},
{
Expand Down Expand Up @@ -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"
},
Expand Down
2 changes: 1 addition & 1 deletion extension/src/commands/external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 3 additions & 3 deletions extension/src/experiments/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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

Expand Down
9 changes: 3 additions & 6 deletions extension/src/experiments/commands/register.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions extension/src/experiments/webview/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
)

Expand Down
2 changes: 1 addition & 1 deletion extension/src/telemetry/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions extension/src/test/suite/experiments/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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,
Expand All @@ -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])
Expand All @@ -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)
Expand All @@ -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])
Expand Down
4 changes: 2 additions & 2 deletions extension/src/webview/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -154,7 +154,7 @@ export type MessageFromWebview =
}
| { type: MessageFromWebviewType.SHOW_EXPERIMENT_LOGS; payload: string }
| {
type: MessageFromWebviewType.SHARE_EXPERIMENT
type: MessageFromWebviewType.PUSH_EXPERIMENT
payload: string
}
| {
Expand Down
8 changes: 4 additions & 4 deletions webview/src/experiments/components/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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()
Expand All @@ -1035,7 +1035,7 @@ describe('App', () => {

expect(sendMessage).toHaveBeenCalledWith({
payload: 'exp-e7a67',
type: MessageFromWebviewType.SHARE_EXPERIMENT
type: MessageFromWebviewType.PUSH_EXPERIMENT
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ const getSingleSelectMenuOptions = (
MessageFromWebviewType.CREATE_BRANCH_FROM_EXPERIMENT
),
hideIfRunningOrNotExperiment(
'Share',
MessageFromWebviewType.SHARE_EXPERIMENT,
'Push',
MessageFromWebviewType.PUSH_EXPERIMENT,
true
),
...getRunResumeOptions(
Expand Down

0 comments on commit 8a445fd

Please sign in to comment.