Skip to content

Commit

Permalink
Merge branch 'main' into add-curly-brace-presence
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon committed Mar 15, 2023
2 parents d63620b + 2ebb0da commit 11d106d
Show file tree
Hide file tree
Showing 54 changed files with 586 additions and 563 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,37 @@

All notable changes to this project will be documented in this file.

## [0.6.20] - 2023-03-15

### 🚀 New Features and Enhancements

- Make section headers sticky [#3465](https://github.com/iterative/vscode-dvc/pull/3465) by [@sroy3](https://github.com/sroy3)
- Add show setup commands [#3474](https://github.com/iterative/vscode-dvc/pull/3474) by [@mattseddon](https://github.com/mattseddon)

### 🔨 Maintenance

- Update demo project and latest tested CLI version (2.50.0) [#3473](https://github.com/iterative/vscode-dvc/pull/3473) by [@mattseddon](https://github.com/mattseddon)

## [0.6.19] - 2023-03-15

### 🚀 New Features and Enhancements

- Make the plot sizing sliders sticky [#3443](https://github.com/iterative/vscode-dvc/pull/3443) by [@sroy3](https://github.com/sroy3)
- Add a slider to resize plots vertically [#3428](https://github.com/iterative/vscode-dvc/pull/3428) by [@sroy3](https://github.com/sroy3)
- Move Connect to Studio into Setup webview [#3452](https://github.com/iterative/vscode-dvc/pull/3452) by [@mattseddon](https://github.com/mattseddon)
- Provide option to open and focus relevant Setup section through UI [#3462](https://github.com/iterative/vscode-dvc/pull/3462) by [@mattseddon](https://github.com/mattseddon)
- Add show experiments button to final experiments screen [#3463](https://github.com/iterative/vscode-dvc/pull/3463) by [@mattseddon](https://github.com/mattseddon)

### 🐛 Bug Fixes

- Make className optional in SectionContainer [#3464](https://github.com/iterative/vscode-dvc/pull/3464) by [@sroy3](https://github.com/sroy3)

### 🔨 Maintenance

- Update demo project and latest tested CLI version (2.47.2) [#3451](https://github.com/iterative/vscode-dvc/pull/3451) by [@mattseddon](https://github.com/mattseddon)
- Update demo project and latest tested CLI version (2.48.0) [#3457](https://github.com/iterative/vscode-dvc/pull/3457) by [@mattseddon](https://github.com/mattseddon)
- Fix flaky integration tests [#3461](https://github.com/iterative/vscode-dvc/pull/3461) by [@mattseddon](https://github.com/mattseddon)

## [0.6.18] - 2023-03-12

### 🚀 New Features and Enhancements
Expand Down
35 changes: 29 additions & 6 deletions extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"extensionDependencies": [
"vscode.git"
],
"version": "0.6.18",
"version": "0.6.20",
"license": "Apache-2.0",
"readme": "./README.md",
"repository": {
Expand Down Expand Up @@ -421,6 +421,21 @@
"command": "dvc.showExperimentsAndPlots",
"category": "DVC"
},
{
"title": "Connect to Studio",
"command": "dvc.showStudioConnect",
"category": "DVC"
},
{
"title": "Show Studio Settings",
"command": "dvc.showStudioSettings",
"category": "DVC"
},
{
"title": "Show Setup",
"command": "dvc.showSetup",
"category": "DVC"
},
{
"title": "Stop All Running Experiments",
"command": "dvc.stopAllRunningExperiments",
Expand Down Expand Up @@ -841,6 +856,14 @@
"command": "dvc.showExperimentsAndPlots",
"when": "dvc.commands.available && dvc.project.available"
},
{
"command": "dvc.showStudioConnect",
"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.stopAllRunningExperiments",
"when": "dvc.commands.available && dvc.project.available && dvc.experiment.running"
Expand Down Expand Up @@ -1398,12 +1421,12 @@
},
{
"view": "dvc.views.studio",
"contents": "[$(plug) Connect](command:dvc.showStudioSetup)",
"contents": "[$(plug) Connect](command:dvc.showStudioConnect)",
"when": "!dvc.studio.connected"
},
{
"view": "dvc.views.studio",
"contents": "[$(settings-gear) Open Settings](command:dvc.showStudioSetup)",
"contents": "[$(settings-gear) Open Settings](command:dvc.showStudioSettings)",
"when": "dvc.studio.connected"
},
{
Expand Down Expand Up @@ -1636,8 +1659,8 @@
"@types/vscode": "1.64.0",
"@vscode/test-electron": "2.3.0",
"@vscode/vsce": "2.18.0",
"@wdio/cli": "8.5.6",
"@wdio/local-runner": "8.5.6",
"@wdio/cli": "8.5.7",
"@wdio/local-runner": "8.5.7",
"@wdio/mocha-framework": "8.5.6",
"@wdio/spec-reporter": "8.4.0",
"chai": "4.3.7",
Expand All @@ -1657,7 +1680,7 @@
"ts-loader": "9.4.2",
"vscode-uri": "3.0.7",
"wdio-vscode-service": "5.0.0",
"webdriverio": "8.5.6",
"webdriverio": "8.5.7",
"webpack": "5.76.0",
"webpack-cli": "5.0.1"
},
Expand Down
2 changes: 1 addition & 1 deletion extension/src/cli/dvc/contract.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Plot } from '../../plots/webview/contract'

export const MIN_CLI_VERSION = '2.30.0'
export const LATEST_TESTED_CLI_VERSION = '2.48.0'
export const LATEST_TESTED_CLI_VERSION = '2.50.0'
export const MAX_CLI_VERSION = '3'

type ErrorContents = { type: string; msg: string }
Expand Down
4 changes: 2 additions & 2 deletions extension/src/cli/dvc/discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import { getPythonBinPath } from '../../extensions/python'
import { getFirstWorkspaceFolder } from '../../vscode/workspaceFolders'
import { delay } from '../../util/time'
import { Section } from '../../setup/webview/contract'
import { SetupSection } from '../../setup/webview/contract'

export const warnUnableToVerifyVersion = () =>
Toast.warnWithOptions(
Expand Down Expand Up @@ -53,7 +53,7 @@ const warnUserCLIInaccessible = async (

switch (response) {
case Response.SHOW_SETUP:
return setup.showSetup(Section.EXPERIMENTS)
return setup.showSetup(SetupSection.EXPERIMENTS)
case Response.NEVER:
return setUserConfigValue(ConfigKey.DO_NOT_SHOW_CLI_UNAVAILABLE, true)
}
Expand Down
3 changes: 2 additions & 1 deletion extension/src/commands/external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,14 @@ export enum RegisteredCommands {

SETUP_SHOW = 'dvc.showSetup',
SETUP_SHOW_EXPERIMENTS = 'dvc.showExperimentsSetup',
SETUP_SHOW_STUDIO = 'dvc.showStudioSetup',
SELECT_FOCUSED_PROJECTS = 'dvc.selectFocusedProjects',

ADD_STUDIO_ACCESS_TOKEN = 'dvc.addStudioAccessToken',
UPDATE_STUDIO_ACCESS_TOKEN = 'dvc.updateStudioAccessToken',
REMOVE_STUDIO_ACCESS_TOKEN = 'dvc.removeStudioAccessToken',
EXPERIMENT_VIEW_SHARE_TO_STUDIO = 'dvc.views.experiments.shareExperimentToStudio',
SETUP_SHOW_STUDIO_CONNECT = 'dvc.showStudioConnect',
SETUP_SHOW_STUDIO_SETTINGS = 'dvc.showStudioSettings',

RESET_STATE = 'dvc.resetState'
}
4 changes: 2 additions & 2 deletions extension/src/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Section } from './setup/webview/contract'
import { SetupSection } from './setup/webview/contract'

export interface IExtensionSetup {
getCliVersion: (
Expand All @@ -9,7 +9,7 @@ export interface IExtensionSetup {
hasRoots: () => boolean
isPythonExtensionUsed: () => Promise<boolean>

showSetup: (focusedSection?: Section) => void
showSetup: (focusedSection?: SetupSection) => void
shouldWarnUserIfCLIUnavailable: () => boolean

initialize: () => Promise<void[]>
Expand Down
24 changes: 13 additions & 11 deletions extension/src/plots/model/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
DEFAULT_NB_ITEMS_PER_ROW,
DEFAULT_SECTION_COLLAPSED,
DEFAULT_SECTION_NB_ITEMS_PER_ROW,
Section
PlotsSection
} from '../webview/contract'
import { buildMockMemento } from '../../test/util'
import { Experiments } from '../../experiments'
Expand Down Expand Up @@ -68,26 +68,28 @@ describe('plotsModel', () => {
})

it('should change the plotSize when calling setPlotSize', () => {
expect(model.getNbItemsPerRow(Section.CHECKPOINT_PLOTS)).toStrictEqual(
expect(model.getNbItemsPerRow(PlotsSection.CHECKPOINT_PLOTS)).toStrictEqual(
DEFAULT_NB_ITEMS_PER_ROW
)

model.setNbItemsPerRow(Section.CHECKPOINT_PLOTS, 1)
model.setNbItemsPerRow(PlotsSection.CHECKPOINT_PLOTS, 1)

expect(model.getNbItemsPerRow(Section.CHECKPOINT_PLOTS)).toStrictEqual(1)
expect(model.getNbItemsPerRow(PlotsSection.CHECKPOINT_PLOTS)).toStrictEqual(
1
)
})

it('should update the persisted plot size when calling setPlotSize', () => {
const mementoUpdateSpy = jest.spyOn(memento, 'update')

model.setNbItemsPerRow(Section.CHECKPOINT_PLOTS, 2)
model.setNbItemsPerRow(PlotsSection.CHECKPOINT_PLOTS, 2)

expect(mementoUpdateSpy).toHaveBeenCalledTimes(1)
expect(mementoUpdateSpy).toHaveBeenCalledWith(
PersistenceKey.PLOT_NB_ITEMS_PER_ROW + exampleDvcRoot,
{
...DEFAULT_SECTION_NB_ITEMS_PER_ROW,
[Section.CHECKPOINT_PLOTS]: 2
[PlotsSection.CHECKPOINT_PLOTS]: 2
}
)
})
Expand All @@ -97,13 +99,13 @@ describe('plotsModel', () => {

expect(model.getSectionCollapsed()).toStrictEqual(DEFAULT_SECTION_COLLAPSED)

model.setSectionCollapsed({ [Section.CHECKPOINT_PLOTS]: true })
model.setSectionCollapsed({ [PlotsSection.CHECKPOINT_PLOTS]: true })

const expectedSectionCollapsed = {
[Section.CHECKPOINT_PLOTS]: true,
[Section.TEMPLATE_PLOTS]: false,
[Section.CUSTOM_PLOTS]: false,
[Section.COMPARISON_TABLE]: false
[PlotsSection.CHECKPOINT_PLOTS]: true,
[PlotsSection.TEMPLATE_PLOTS]: false,
[PlotsSection.CUSTOM_PLOTS]: false,
[PlotsSection.COMPARISON_TABLE]: false
}

expect(mementoUpdateSpy).toHaveBeenCalledTimes(1)
Expand Down
30 changes: 15 additions & 15 deletions extension/src/plots/model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
ComparisonRevisionData,
DEFAULT_SECTION_COLLAPSED,
DEFAULT_SECTION_NB_ITEMS_PER_ROW,
Section,
PlotsSection,
SectionCollapsed,
CustomPlotData,
DEFAULT_HEIGHT,
Expand Down Expand Up @@ -56,8 +56,8 @@ export type CustomPlotsOrderValue = { metric: string; param: string }
export class PlotsModel extends ModelWithPersistence {
private readonly experiments: Experiments

private nbItemsPerRow: Record<Section, number>
private height: Record<Section, PlotHeight>
private nbItemsPerRow: Record<PlotsSection, number>
private height: Record<PlotsSection, PlotHeight>
private customPlotsOrder: CustomPlotsOrderValue[]
private sectionCollapsed: SectionCollapsed
private commitRevisions: Record<string, string> = {}
Expand Down Expand Up @@ -182,8 +182,8 @@ export class PlotsModel extends ModelWithPersistence {

return {
colors,
height: this.getHeight(Section.CHECKPOINT_PLOTS),
nbItemsPerRow: this.getNbItemsPerRow(Section.CHECKPOINT_PLOTS),
height: this.getHeight(PlotsSection.CHECKPOINT_PLOTS),
nbItemsPerRow: this.getNbItemsPerRow(PlotsSection.CHECKPOINT_PLOTS),
plots: this.getPlots(this.checkpointPlots, selectedExperiments),
selectedMetrics: this.getSelectedMetrics()
}
Expand All @@ -194,8 +194,8 @@ export class PlotsModel extends ModelWithPersistence {
return
}
return {
height: this.getHeight(Section.CUSTOM_PLOTS),
nbItemsPerRow: this.getNbItemsPerRow(Section.CUSTOM_PLOTS),
height: this.getHeight(PlotsSection.CUSTOM_PLOTS),
nbItemsPerRow: this.getNbItemsPerRow(PlotsSection.CUSTOM_PLOTS),
plots: this.customPlots
}
}
Expand Down Expand Up @@ -403,24 +403,24 @@ export class PlotsModel extends ModelWithPersistence {
this.persist(PersistenceKey.PLOT_METRIC_ORDER, this.metricOrder)
}

public setNbItemsPerRow(section: Section, nbItemsPerRow: number) {
public setNbItemsPerRow(section: PlotsSection, nbItemsPerRow: number) {
this.nbItemsPerRow[section] = nbItemsPerRow
this.persist(PersistenceKey.PLOT_NB_ITEMS_PER_ROW, this.nbItemsPerRow)
}

public getNbItemsPerRow(section: Section) {
public getNbItemsPerRow(section: PlotsSection) {
if (this.nbItemsPerRow[section]) {
return this.nbItemsPerRow[section]
}
return DEFAULT_NB_ITEMS_PER_ROW
}

public setHeight(section: Section, height: PlotHeight) {
public setHeight(section: PlotsSection, height: PlotHeight) {
this.height[section] = height
this.persist(PersistenceKey.PLOT_HEIGHT, this.height)
}

public getHeight(section: Section) {
public getHeight(section: PlotsSection) {
return this.height[section]
}

Expand Down Expand Up @@ -511,8 +511,8 @@ export class PlotsModel extends ModelWithPersistence {
id,
title: truncateVerticalTitle(
id,
this.getNbItemsPerRow(Section.CHECKPOINT_PLOTS),
this.getHeight(Section.CHECKPOINT_PLOTS)
this.getNbItemsPerRow(PlotsSection.CHECKPOINT_PLOTS),
this.getHeight(PlotsSection.CHECKPOINT_PLOTS)
) as string,
values: values.filter(value =>
selectedExperiments.includes(value.group)
Expand Down Expand Up @@ -563,8 +563,8 @@ export class PlotsModel extends ModelWithPersistence {
selectedRevisions.map(({ revision }) => revision),
this.templates,
this.revisionData,
this.getNbItemsPerRow(Section.TEMPLATE_PLOTS),
this.getHeight(Section.TEMPLATE_PLOTS),
this.getNbItemsPerRow(PlotsSection.TEMPLATE_PLOTS),
this.getHeight(PlotsSection.TEMPLATE_PLOTS),
this.getRevisionColors(selectedRevisions),
this.multiSourceEncoding
)
Expand Down
38 changes: 19 additions & 19 deletions extension/src/plots/webview/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,42 @@ import { Color } from '../../experiments/model/status/colors'
export const DEFAULT_NB_ITEMS_PER_ROW = 2

export enum PlotHeight {
SMALLER = 0,
SMALL = 1,
REGULAR = 2,
SQUARE = 3,
VERTICAL_NORMAL = 4,
VERTICAL_LARGER = 5
SMALLER,
SMALL,
REGULAR,
SQUARE,
VERTICAL_NORMAL,
VERTICAL_LARGER
}

export const DEFAULT_PLOT_HEIGHT = PlotHeight.SMALL

export enum Section {
export enum PlotsSection {
CHECKPOINT_PLOTS = 'checkpoint-plots',
TEMPLATE_PLOTS = 'template-plots',
COMPARISON_TABLE = 'comparison-table',
CUSTOM_PLOTS = 'custom-plots'
}

export const DEFAULT_SECTION_NB_ITEMS_PER_ROW = {
[Section.CHECKPOINT_PLOTS]: DEFAULT_NB_ITEMS_PER_ROW,
[Section.TEMPLATE_PLOTS]: DEFAULT_NB_ITEMS_PER_ROW,
[Section.COMPARISON_TABLE]: DEFAULT_NB_ITEMS_PER_ROW,
[Section.CUSTOM_PLOTS]: DEFAULT_NB_ITEMS_PER_ROW
[PlotsSection.CHECKPOINT_PLOTS]: DEFAULT_NB_ITEMS_PER_ROW,
[PlotsSection.TEMPLATE_PLOTS]: DEFAULT_NB_ITEMS_PER_ROW,
[PlotsSection.COMPARISON_TABLE]: DEFAULT_NB_ITEMS_PER_ROW,
[PlotsSection.CUSTOM_PLOTS]: DEFAULT_NB_ITEMS_PER_ROW
}

export const DEFAULT_HEIGHT = {
[Section.CHECKPOINT_PLOTS]: DEFAULT_PLOT_HEIGHT,
[Section.TEMPLATE_PLOTS]: DEFAULT_PLOT_HEIGHT,
[Section.COMPARISON_TABLE]: DEFAULT_PLOT_HEIGHT,
[Section.CUSTOM_PLOTS]: DEFAULT_PLOT_HEIGHT
[PlotsSection.CHECKPOINT_PLOTS]: DEFAULT_PLOT_HEIGHT,
[PlotsSection.TEMPLATE_PLOTS]: DEFAULT_PLOT_HEIGHT,
[PlotsSection.COMPARISON_TABLE]: DEFAULT_PLOT_HEIGHT,
[PlotsSection.CUSTOM_PLOTS]: DEFAULT_PLOT_HEIGHT
}

export const DEFAULT_SECTION_COLLAPSED = {
[Section.CHECKPOINT_PLOTS]: false,
[Section.TEMPLATE_PLOTS]: false,
[Section.COMPARISON_TABLE]: false,
[Section.CUSTOM_PLOTS]: false
[PlotsSection.CHECKPOINT_PLOTS]: false,
[PlotsSection.TEMPLATE_PLOTS]: false,
[PlotsSection.COMPARISON_TABLE]: false,
[PlotsSection.CUSTOM_PLOTS]: false
}

export type SectionCollapsed = typeof DEFAULT_SECTION_COLLAPSED
Expand Down
Loading

0 comments on commit 11d106d

Please sign in to comment.