Skip to content

Commit

Permalink
Merge branch 'main' into sticky-shadows
Browse files Browse the repository at this point in the history
  • Loading branch information
rogermparent authored Jun 10, 2022
2 parents 2f0d51d + 8eecddf commit 8efd216
Show file tree
Hide file tree
Showing 22 changed files with 362 additions and 133 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@

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

## [0.3.0] - 2022-06-10

### 🚀 New Features and Enhancements

- Sort and Filter indicators for the Experiments Table [#1760](https://github.com/iterative/vscode-dvc/pull/1760) by [@wolmir](https://github.com/wolmir)
- Add filtered counts to Filter By tree [#1866](https://github.com/iterative/vscode-dvc/pull/1866) by [@mattseddon](https://github.com/mattseddon)
- Setup workspace config: change copy to be more explicit [#1865](https://github.com/iterative/vscode-dvc/pull/1865) by [@shcheklein](https://github.com/shcheklein)

### 🐛 Bug Fixes

- Use primary button color as accent color [#1859](https://github.com/iterative/vscode-dvc/pull/1859) by [@sroy3](https://github.com/sroy3)
- Explicitly set icons in DVC Tracked tree [#1869](https://github.com/iterative/vscode-dvc/pull/1869) by [@mattseddon](https://github.com/mattseddon)

### 🔨 Maintenance

- Remove preview tag from marketplace listing [#1860](https://github.com/iterative/vscode-dvc/pull/1860) by [@mattseddon](https://github.com/mattseddon)
- Add init to command palette when there is no DVC project in the workspace [#1861](https://github.com/iterative/vscode-dvc/pull/1861) by [@mattseddon](https://github.com/mattseddon)
- Upgrade dev dependencies and resolutions (security) [#1864](https://github.com/iterative/vscode-dvc/pull/1864) by [@mattseddon](https://github.com/mattseddon)
- Bump min required version of DVC to new release [#1867](https://github.com/iterative/vscode-dvc/pull/1867) by [@mattseddon](https://github.com/mattseddon)

## [0.2.25] - 2022-06-08

### 🐛 Bug Fixes
Expand Down
22 changes: 21 additions & 1 deletion extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"extensionDependencies": [
"vscode.git"
],
"version": "0.2.25",
"version": "0.3.0",
"license": "Apache-2.0",
"readme": "./README.md",
"repository": {
Expand Down Expand Up @@ -471,6 +471,12 @@
"command": "dvc.views.plotsPathsTree.selectPlots",
"category": "DVC",
"icon": "$(list-filter)"
},
{
"title": "%command.views.plotsPathsTree.refreshPlots%",
"command": "dvc.views.plotsPathsTree.refreshPlots",
"category": "DVC",
"icon": "$(refresh)"
}
],
"configuration": {
Expand Down Expand Up @@ -778,6 +784,10 @@
{
"command": "dvc.views.plotsPathsTree.selectPlots",
"when": "dvc.commands.available && dvc.project.available"
},
{
"command": "dvc.views.plotsPathsTree.refreshPlots",
"when": "dvc.commands.available && dvc.project.available"
}
],
"scm/title": [
Expand Down Expand Up @@ -1058,6 +1068,11 @@
"command": "dvc.views.plotsPathsTree.selectPlots",
"group": "inline",
"when": "view == dvc.views.plotsPathsTree && dvc.commands.available && viewItem == dvcRoot"
},
{
"command": "dvc.views.plotsPathsTree.refreshPlots",
"group": "inline",
"when": "view == dvc.views.plotsPathsTree && dvc.commands.available && viewItem == dvcRoot"
}
],
"view/title": [
Expand Down Expand Up @@ -1210,6 +1225,11 @@
"command": "dvc.views.plotsPathsTree.selectPlots",
"when": "view == dvc.views.plotsPathsTree",
"group": "navigation@2"
},
{
"command": "dvc.views.plotsPathsTree.refreshPlots",
"when": "view == dvc.views.plotsPathsTree",
"group": "navigation@3"
}
]
},
Expand Down
1 change: 1 addition & 0 deletions extension/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"command.views.experimentsTree.resetAndRunCheckpointExperiment": "Modify Param(s), Reset and Run",
"command.views.experimentsTree.selectExperiments": "Select Experiments to Display in Plots",
"command.views.plotsPathsTree.selectPlots": "Select Plots to Display",
"command.views.plotsPathsTree.refreshPlots": "Refresh Plots for Selected Experiments",
"config.doNotRecommendRedHatExtension.description": "Do not prompt to install the Red Hat YAML extension to assist with DVC YAML schema validation.",
"config.doNotRecommendRedHatExtension.title": "Do not prompt to install the Red Hat YAML extension.",
"config.doNotShowCliUnavailable.description": "Do not warn when the workspace contains a DVC project but the CLI is inaccessible.",
Expand Down
1 change: 1 addition & 0 deletions extension/src/__mocks__/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export enum TreeItemCollapsibleState {
}
export const Uri = {
file: URI.file,
from: URI.from,
joinPath: Utils.joinPath
}
export const window = {
Expand Down
1 change: 1 addition & 0 deletions extension/src/commands/external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export enum RegisteredCommands {
PLOTS_PATH_TOGGLE = 'dvc.views.plotsPathsTree.toggleStatus',
PLOTS_SHOW = 'dvc.showPlots',
PLOTS_SELECT = 'dvc.views.plotsPathsTree.selectPlots',
PLOTS_REFRESH = 'dvc.views.plotsPathsTree.refreshPlots',

EXTENSION_CHECK_CLI_COMPATIBLE = 'dvc.checkCLICompatible',
EXTENSION_GET_STARTED = 'dvc.getStarted',
Expand Down
14 changes: 11 additions & 3 deletions extension/src/experiments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { CheckpointsModel } from './checkpoints/model'
import { ExperimentsData } from './data'
import { askToDisableAutoApplyFilters } from './toast'
import { Experiment, ColumnType, TableData } from './webview/contract'
import { DecorationProvider } from './model/filterBy/decorationProvider'
import { SortDefinition } from './model/sortBy'
import { splitColumnPath } from './columns/paths'
import { ResourceLocator } from '../resourceLocator'
Expand Down Expand Up @@ -74,6 +75,9 @@ export class Experiments extends BaseRepository<TableData> {
)

private readonly columnsChanged = this.dispose.track(new EventEmitter<void>())
private readonly decorationProvider = this.dispose.track(
new DecorationProvider()
)

private readonly internalCommands: InternalCommands

Expand Down Expand Up @@ -257,8 +261,8 @@ export class Experiments extends BaseRepository<TableData> {
return this.notifyChanged()
}

public getFilteredCounts() {
return this.experiments.getFilteredCounts()
public getFilteredExperiments() {
return this.experiments.getFilteredExperiments()
}

public getExperimentCount() {
Expand Down Expand Up @@ -295,7 +299,7 @@ export class Experiments extends BaseRepository<TableData> {

if (useFilters) {
const filteredExperiments = this.experiments
.getFilteredExperiments()
.getUnfilteredExperiments()
.filter(exp => !exp.queued)
if (tooManySelected(filteredExperiments)) {
await this.warnAndDoNotAutoApply(filteredExperiments)
Expand Down Expand Up @@ -425,6 +429,10 @@ export class Experiments extends BaseRepository<TableData> {
}

private notifyChanged(data?: ExperimentsOutput) {
this.decorationProvider.setState(
this.experiments.getLabels(),
this.experiments.getLabelsToDecorate()
)
this.experimentsChanged.fire(data)
this.notifyColumnsChanged()
}
Expand Down
48 changes: 48 additions & 0 deletions extension/src/experiments/model/filterBy/collect.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import {
FilterDefinition,
filterExperiment,
splitExperimentsByFilters
} from '.'
import { ExperimentType } from '..'
import { definedAndNonEmpty } from '../../../util/array'
import { Experiment } from '../../webview/contract'

export type ExperimentWithType = Experiment & { type: ExperimentType }

export const collectFilteredCounts = (
experiments: { type: ExperimentType }[]
) => {
const filtered = { checkpoints: 0, experiments: 0 }

for (const { type } of experiments) {
if (type === ExperimentType.CHECKPOINT) {
filtered.checkpoints = filtered.checkpoints + 1
}
if (type === ExperimentType.EXPERIMENT) {
filtered.experiments = filtered.experiments + 1
}
}

return filtered
}

export const collectFiltered = (
acc: ExperimentWithType[],
filters: FilterDefinition[],
experiment: Experiment,
checkpoints: ExperimentWithType[]
): ExperimentWithType[] => {
const { filtered, unfiltered } = splitExperimentsByFilters(
filters,
checkpoints
)
acc.push(...filtered)
const hasUnfilteredCheckpoints = definedAndNonEmpty(unfiltered)
if (hasUnfilteredCheckpoints) {
return acc
}
if (!filterExperiment(filters, experiment)) {
acc.push({ ...experiment, type: ExperimentType.EXPERIMENT })
}
return acc
}
56 changes: 56 additions & 0 deletions extension/src/experiments/model/filterBy/decorationProvider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import {
Event,
EventEmitter,
FileDecoration,
FileDecorationProvider,
ThemeColor,
Uri,
window
} from 'vscode'
import { Disposable } from '../../../class/dispose'

export const getDecoratableUri = (label: string): Uri =>
Uri.from({ path: label, scheme: 'dvc.experiments' })

export class DecorationProvider
extends Disposable
implements FileDecorationProvider
{
private static DecorationFiltered: FileDecoration = {
color: new ThemeColor('gitDecoration.ignoredResourceForeground'),
tooltip: 'Filtered'
}

public readonly onDidChangeFileDecorations: Event<Uri[]>
private readonly decorationsChanged: EventEmitter<Uri[]>

private filtered = new Set<string>()

constructor(decorationsChanged?: EventEmitter<Uri[]>) {
super()

this.decorationsChanged = this.dispose.track(
decorationsChanged || new EventEmitter()
)
this.onDidChangeFileDecorations = this.decorationsChanged.event

this.dispose.track(window.registerFileDecorationProvider(this))
}

public provideFileDecoration(uri: Uri): FileDecoration | undefined {
if (this.filtered.has(uri.fsPath)) {
return DecorationProvider.DecorationFiltered
}
}

public setState(labels: string[], filtered: Set<string>) {
const urisToUpdate: Uri[] = []

for (const label of labels) {
urisToUpdate.push(getDecoratableUri(label))
}

this.filtered = filtered
this.decorationsChanged.fire(urisToUpdate)
}
}
Loading

0 comments on commit 8efd216

Please sign in to comment.