-
Notifications
You must be signed in to change notification settings - Fork 29
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
Highlight experiments with errors #2072
Changes from 11 commits
d873169
04cbe8f
30efa06
2b2076a
7a50b8a
ce9a0c2
139eabc
f4a6852
4a4735b
7620541
0077849
6008904
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
"conda", | ||
"datapoint", | ||
"datapoints", | ||
"Decoratable", | ||
"dvcignore", | ||
"DVCLIVE", | ||
"DVCPATH", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { extractColumns } from './extract' | ||
|
||
describe('extractColumns', () => { | ||
it('should handle concatenating errors', () => { | ||
const data = { | ||
metrics: { | ||
'summary.json': { | ||
error: { msg: 'metrics file is busted', type: 'fatal' } | ||
} | ||
}, | ||
params: { | ||
'params.yaml': { | ||
error: { msg: 'this is also broken', type: 'impossible' } | ||
} | ||
} | ||
} | ||
|
||
const { error } = extractColumns(data) | ||
expect(error).toStrictEqual('metrics file is busted\nthis is also broken') | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ import { ExperimentsData } from './data' | |
import { askToDisableAutoApplyFilters } from './toast' | ||
import { Experiment, ColumnType, TableData } from './webview/contract' | ||
import { WebviewMessages } from './webview/messages' | ||
import { DecorationProvider } from './model/filterBy/decorationProvider' | ||
import { DecorationProvider } from './model/decorationProvider' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [F] Move to a more central location as the decorations are now for both errors and filtered experiments |
||
import { ResourceLocator } from '../resourceLocator' | ||
import { AvailableCommands, InternalCommands } from '../commands/internal' | ||
import { ExperimentsOutput } from '../cli/reader' | ||
|
@@ -425,7 +425,8 @@ export class Experiments extends BaseRepository<TableData> { | |
private notifyChanged(data?: ExperimentsOutput) { | ||
this.decorationProvider.setState( | ||
this.experiments.getLabels(), | ||
this.experiments.getLabelsToDecorate() | ||
this.experiments.getLabelsToDecorate(), | ||
this.experiments.getErrors() | ||
) | ||
this.experimentsChanged.fire(data) | ||
this.notifyColumnsChanged() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ import { | |
Uri, | ||
window | ||
} from 'vscode' | ||
import { Disposable } from '../../../class/dispose' | ||
import { Disposable } from '../../class/dispose' | ||
|
||
export const getDecoratableUri = (label: string): Uri => | ||
Uri.from({ path: label, scheme: 'dvc.experiments' }) | ||
|
@@ -16,6 +16,10 @@ export class DecorationProvider | |
extends Disposable | ||
implements FileDecorationProvider | ||
{ | ||
private static DecorationError: FileDecoration = { | ||
color: new ThemeColor('errorForeground') | ||
} | ||
|
||
private static DecorationFiltered: FileDecoration = { | ||
color: new ThemeColor('gitDecoration.ignoredResourceForeground'), | ||
tooltip: 'Filtered' | ||
|
@@ -24,6 +28,7 @@ export class DecorationProvider | |
public readonly onDidChangeFileDecorations: Event<Uri[]> | ||
private readonly decorationsChanged: EventEmitter<Uri[]> | ||
|
||
private errors = new Set<string>() | ||
private filtered = new Set<string>() | ||
|
||
constructor(decorationsChanged?: EventEmitter<Uri[]>) { | ||
|
@@ -38,19 +43,27 @@ export class DecorationProvider | |
} | ||
|
||
public provideFileDecoration(uri: Uri): FileDecoration | undefined { | ||
if (this.errors.has(uri.fsPath)) { | ||
return DecorationProvider.DecorationError | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [F] Take priority but under the current implementation, we can't have both. |
||
} | ||
if (this.filtered.has(uri.fsPath)) { | ||
return DecorationProvider.DecorationFiltered | ||
} | ||
} | ||
|
||
public setState(labels: string[], filtered: Set<string>) { | ||
public setState( | ||
labels: string[], | ||
filtered: Set<string>, | ||
errors: Set<string> | ||
) { | ||
const urisToUpdate: Uri[] = [] | ||
|
||
for (const label of labels) { | ||
urisToUpdate.push(getDecoratableUri(label)) | ||
} | ||
|
||
this.filtered = filtered | ||
this.errors = errors | ||
this.decorationsChanged.fire(urisToUpdate) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[I] Test this bit and the tooltip showing up in the UI as markdown.