diff --git a/extension/src/experiments/columns/constants.ts b/extension/src/experiments/columns/constants.ts index 6516663d9c..3cdb2984a8 100644 --- a/extension/src/experiments/columns/constants.ts +++ b/extension/src/experiments/columns/constants.ts @@ -9,3 +9,5 @@ export const timestampColumn: Column = { type, types: [type] } + +export const EXPERIMENT_COLUMN_ID = 'id' diff --git a/extension/src/experiments/columns/model.test.ts b/extension/src/experiments/columns/model.test.ts index 05ab84452b..15bfe53832 100644 --- a/extension/src/experiments/columns/model.test.ts +++ b/extension/src/experiments/columns/model.test.ts @@ -42,13 +42,13 @@ beforeEach(() => { describe('ColumnsModel', () => { const exampleDvcRoot = 'test' - const mockedColumnsOrderChanged = buildMockedEventEmitter() + const mockedColumnsOrderOrStatusChanged = buildMockedEventEmitter() it('should return the expected columns when given the default output fixture', async () => { const model = new ColumnsModel( '', buildMockMemento(), - mockedColumnsOrderChanged + mockedColumnsOrderOrStatusChanged ) await model.transformAndSet(outputFixture) expect(mockedGetConfigValue).toHaveBeenCalled() @@ -59,7 +59,7 @@ describe('ColumnsModel', () => { const model = new ColumnsModel( '', buildMockMemento(), - mockedColumnsOrderChanged + mockedColumnsOrderOrStatusChanged ) await model.transformAndSet(survivalOutputFixture) expect(model.getSelected()).toStrictEqual(survivalColumnsFixture) @@ -69,7 +69,7 @@ describe('ColumnsModel', () => { const model = new ColumnsModel( '', buildMockMemento(), - mockedColumnsOrderChanged + mockedColumnsOrderOrStatusChanged ) await model.transformAndSet(deeplyNestedOutputFixture) expect(mockedGetConfigValue).toHaveBeenCalled() @@ -81,7 +81,7 @@ describe('ColumnsModel', () => { const model = new ColumnsModel( '', buildMockMemento(), - mockedColumnsOrderChanged + mockedColumnsOrderOrStatusChanged ) await model.transformAndSet(deeplyNestedOutputFixture) expect(mockedGetConfigValue).toHaveBeenCalled() @@ -93,7 +93,7 @@ describe('ColumnsModel', () => { const model = new ColumnsModel( '', buildMockMemento(), - mockedColumnsOrderChanged + mockedColumnsOrderOrStatusChanged ) await model.transformAndSet(deeplyNestedOutputFixture) expect(mockedGetConfigValue).toHaveBeenCalled() @@ -105,7 +105,7 @@ describe('ColumnsModel', () => { const model = new ColumnsModel( '', buildMockMemento(), - mockedColumnsOrderChanged + mockedColumnsOrderOrStatusChanged ) await model.transformAndSet(deeplyNestedOutputFixture) expect(mockedGetConfigValue).toHaveBeenCalled() @@ -117,7 +117,7 @@ describe('ColumnsModel', () => { const model = new ColumnsModel( '', buildMockMemento(), - mockedColumnsOrderChanged + mockedColumnsOrderOrStatusChanged ) await model.transformAndSet(deeplyNestedOutputFixture) expect(mockedGetConfigValue).toHaveBeenCalled() @@ -129,7 +129,7 @@ describe('ColumnsModel', () => { const model = new ColumnsModel( '', buildMockMemento(), - mockedColumnsOrderChanged + mockedColumnsOrderOrStatusChanged ) await model.transformAndSet(deeplyNestedOutputFixture) expect(mockedGetConfigValue).toHaveBeenCalled() @@ -141,7 +141,7 @@ describe('ColumnsModel', () => { const model = new ColumnsModel( '', buildMockMemento(), - mockedColumnsOrderChanged + mockedColumnsOrderOrStatusChanged ) await model.transformAndSet(deeplyNestedOutputFixture) expect(mockedGetConfigValue).toHaveBeenCalled() @@ -152,7 +152,7 @@ describe('ColumnsModel', () => { const model = new ColumnsModel( '', buildMockMemento(), - mockedColumnsOrderChanged + mockedColumnsOrderOrStatusChanged ) await model.transformAndSet(dataTypesOutputFixture) expect(model.getSelected()).toStrictEqual(dataTypesColumnsFixture) @@ -183,7 +183,7 @@ describe('ColumnsModel', () => { const model = new ColumnsModel( exampleDvcRoot, buildMockMemento(), - mockedColumnsOrderChanged + mockedColumnsOrderOrStatusChanged ) await model.transformAndSet(exampleData) expect(model.getSelected()).toStrictEqual([ @@ -217,7 +217,7 @@ describe('ColumnsModel', () => { [testParamPath]: Status.UNSELECTED } }), - mockedColumnsOrderChanged + mockedColumnsOrderOrStatusChanged ) await model.transformAndSet(exampleData) expect(model.getSelected()).toStrictEqual([ @@ -246,19 +246,20 @@ describe('ColumnsModel', () => { [PersistenceKey.METRICS_AND_PARAMS_COLUMN_ORDER + exampleDvcRoot]: persistedState }), - mockedColumnsOrderChanged + mockedColumnsOrderOrStatusChanged ) expect(model.getColumnOrder()).toStrictEqual(persistedState) }) - it('should return the first three columns from the persisted state', () => { + it('should return the first three none hidden columns from the persisted state', async () => { const persistedState = [ - { path: 'A', width: 0 }, - { path: 'B', width: 0 }, - { path: 'C', width: 0 }, - { path: 'D', width: 0 }, - { path: 'E', width: 0 }, - { path: 'F', width: 0 } + 'id', + 'Created', + 'params:params.yaml:dvc_logs_dir', + 'params:params.yaml:process.threshold', + 'params:params.yaml:process.test_arg', + 'deps:src/prepare.py', + 'deps:src/featurization.py' ] const model = new ColumnsModel( @@ -267,19 +268,26 @@ describe('ColumnsModel', () => { [PersistenceKey.METRICS_AND_PARAMS_COLUMN_ORDER + exampleDvcRoot]: persistedState }), - mockedColumnsOrderChanged + mockedColumnsOrderOrStatusChanged ) + await model.transformAndSet(outputFixture) expect(model.getFirstThreeColumnOrder()).toStrictEqual( persistedState.slice(1, 4) ) + + model.toggleStatus('Created') + + expect(model.getFirstThreeColumnOrder()).toStrictEqual( + persistedState.slice(2, 5) + ) }) - it('should return first three columns collected from data if state is empty', async () => { + it('should return the first three none hidden columns collected from data if state is empty', async () => { const model = new ColumnsModel( exampleDvcRoot, buildMockMemento(), - mockedColumnsOrderChanged + mockedColumnsOrderOrStatusChanged ) await model.transformAndSet(outputFixture) @@ -288,6 +296,14 @@ describe('ColumnsModel', () => { 'metrics:summary.json:loss', 'metrics:summary.json:accuracy' ]) + + model.toggleStatus('Created') + + expect(model.getFirstThreeColumnOrder()).toStrictEqual([ + 'metrics:summary.json:loss', + 'metrics:summary.json:accuracy', + 'metrics:summary.json:val_loss' + ]) }) it('should re-order the columns if a new columnOrder is set', () => { @@ -300,7 +316,7 @@ describe('ColumnsModel', () => { { path: 'C', width: 0 } ] }), - mockedColumnsOrderChanged + mockedColumnsOrderOrStatusChanged ) const newState = ['C', 'B', 'A'] model.setColumnOrder(newState) @@ -321,7 +337,7 @@ describe('ColumnsModel', () => { [PersistenceKey.METRICS_AND_PARAMS_COLUMN_ORDER + exampleDvcRoot]: persistedState }), - mockedColumnsOrderChanged + mockedColumnsOrderOrStatusChanged ) expect(model.getColumnOrder()).toStrictEqual(persistedState) }) @@ -338,7 +354,7 @@ describe('ColumnsModel', () => { [PersistenceKey.METRICS_AND_PARAMS_COLUMN_ORDER + exampleDvcRoot]: persistedState }), - mockedColumnsOrderChanged + mockedColumnsOrderOrStatusChanged ) const changedColumnId = 'C' const expectedWidth = 77 diff --git a/extension/src/experiments/columns/model.ts b/extension/src/experiments/columns/model.ts index fcd1b03255..e097198a1a 100644 --- a/extension/src/experiments/columns/model.ts +++ b/extension/src/experiments/columns/model.ts @@ -1,12 +1,12 @@ import { EventEmitter, Memento } from 'vscode' import { collectChanges, collectColumns, collectParamsFiles } from './collect' +import { EXPERIMENT_COLUMN_ID, timestampColumn } from './constants' import { Column, ColumnType } from '../webview/contract' import { ExperimentsOutput } from '../../cli/dvc/contract' import { PersistenceKey } from '../../persistence/constants' import { PathSelectionModel } from '../../path/selection/model' export class ColumnsModel extends PathSelectionModel { - private columnsOrderChanged: EventEmitter private columnOrderState: string[] = [] private columnWidthsState: Record = {} private columnsChanges: string[] = [] @@ -15,9 +15,14 @@ export class ColumnsModel extends PathSelectionModel { constructor( dvcRoot: string, workspaceState: Memento, - columnsOrderChanged: EventEmitter + columnsOrderOrStatusChanged: EventEmitter ) { - super(dvcRoot, workspaceState, PersistenceKey.METRICS_AND_PARAMS_STATUS) + super( + dvcRoot, + workspaceState, + PersistenceKey.METRICS_AND_PARAMS_STATUS, + columnsOrderOrStatusChanged + ) this.columnOrderState = this.revive( PersistenceKey.METRICS_AND_PARAMS_COLUMN_ORDER, @@ -27,7 +32,6 @@ export class ColumnsModel extends PathSelectionModel { PersistenceKey.METRICS_AND_PARAMS_COLUMN_WIDTHS, {} ) - this.columnsOrderChanged = columnsOrderChanged } public getColumnOrder(): string[] { @@ -35,9 +39,9 @@ export class ColumnsModel extends PathSelectionModel { } public getFirstThreeColumnOrder(): string[] { - return this.columnOrderState.length === 0 - ? this.getFirstThreeColumnOrderFromData() - : this.columnOrderState.slice(1, 4) + return this.columnOrderState + .filter(path => this.status[path] && this.status[path] === 2) + .slice(0, 3) } public getColumnWidths(): Record { @@ -65,7 +69,7 @@ export class ColumnsModel extends PathSelectionModel { PersistenceKey.METRICS_AND_PARAMS_COLUMN_ORDER, this.getColumnOrder() ) - this.columnsOrderChanged.fire() + this.statusChanged?.fire() } public setColumnWidth(id: string, width: number) { @@ -91,13 +95,6 @@ export class ColumnsModel extends PathSelectionModel { return this.data.length > 1 } - private getFirstThreeColumnOrderFromData(): string[] { - return this.data - .filter(({ hasChildren }) => !hasChildren) - .slice(0, 3) - .map(({ path }) => path) - } - private filterChildren(path?: string) { return this.data.filter(element => path @@ -108,6 +105,40 @@ export class ColumnsModel extends PathSelectionModel { ) } + private findChildrenColumns( + parent: string, + columns: Column[], + childrenColumns: string[] + ) { + const filteredColumns = columns.filter( + ({ parentPath }) => parentPath === parent + ) + for (const column of filteredColumns) { + if (column.hasChildren) { + this.findChildrenColumns(column.path, columns, childrenColumns) + } else { + childrenColumns.push(column.path) + } + } + } + + private getColumnsFromType(type: string): string[] { + const childrenColumns: string[] = [] + const dataWithType = this.data.filter(({ path }) => path.startsWith(type)) + this.findChildrenColumns(type, dataWithType, childrenColumns) + return childrenColumns + } + + private getColumnOrderFromData() { + return [ + EXPERIMENT_COLUMN_ID, + timestampColumn.path, + ...this.getColumnsFromType(ColumnType.METRICS), + ...this.getColumnsFromType(ColumnType.PARAMS), + ...this.getColumnsFromType(ColumnType.DEPS) + ] + } + private async transformAndSetColumns(data: ExperimentsOutput) { const [columns, paramsFiles] = await Promise.all([ collectColumns(data), @@ -117,6 +148,11 @@ export class ColumnsModel extends PathSelectionModel { this.setNewStatuses(columns) this.data = columns + + if (this.columnOrderState.length === 0) { + this.setColumnOrder(this.getColumnOrderFromData()) + } + this.paramsFiles = paramsFiles } diff --git a/extension/src/experiments/index.ts b/extension/src/experiments/index.ts index 6fffbbe492..7418bf712b 100644 --- a/extension/src/experiments/index.ts +++ b/extension/src/experiments/index.ts @@ -54,7 +54,7 @@ export class Experiments extends BaseRepository { public readonly onDidChangeIsParamsFileFocused: Event public readonly onDidChangeExperiments: Event public readonly onDidChangeColumns: Event - public readonly onDidChangeColumnOrder: Event + public readonly onDidChangeColumnOrderOrStatus: Event public readonly onDidChangeCheckpoints: Event public readonly viewKey = ViewKey.EXPERIMENTS @@ -79,7 +79,7 @@ export class Experiments extends BaseRepository { ) private readonly columnsChanged = this.dispose.track(new EventEmitter()) - private readonly columnsOrderChanged = this.dispose.track( + private readonly columnsOrderOrStatusChanged = this.dispose.track( new EventEmitter() ) @@ -106,7 +106,7 @@ export class Experiments extends BaseRepository { this.onDidChangeIsParamsFileFocused = this.paramsFileFocused.event this.onDidChangeExperiments = this.experimentsChanged.event this.onDidChangeColumns = this.columnsChanged.event - this.onDidChangeColumnOrder = this.columnsOrderChanged.event + this.onDidChangeColumnOrderOrStatus = this.columnsOrderOrStatusChanged.event this.onDidChangeCheckpoints = this.checkpointsChanged.event this.experiments = this.dispose.track( @@ -114,7 +114,11 @@ export class Experiments extends BaseRepository { ) this.columns = this.dispose.track( - new ColumnsModel(dvcRoot, workspaceState, this.columnsOrderChanged) + new ColumnsModel( + dvcRoot, + workspaceState, + this.columnsOrderOrStatusChanged + ) ) this.checkpoints = this.dispose.track(new CheckpointsModel()) diff --git a/extension/src/experiments/model/quickPick.test.ts b/extension/src/experiments/model/quickPick.test.ts index 96c9e30347..df51076f42 100644 --- a/extension/src/experiments/model/quickPick.test.ts +++ b/extension/src/experiments/model/quickPick.test.ts @@ -5,6 +5,7 @@ import { MAX_SELECTED_EXPERIMENTS } from './status' import { quickPickLimitedValues } from '../../vscode/quickPick' import { Experiment } from '../webview/contract' import { Title } from '../../vscode/title' +import { formatDate } from '../../util/date' jest.mock('../../vscode/quickPick') @@ -135,19 +136,25 @@ describe('pickExperiments', () => { [ { description: '[exp-123]', - detail: 'Created:Aug 19, 2022, split:0, data/data.xml:22a1a29', + detail: `Created:${formatDate( + mockedExperiments[0].Created as string + )}, split:0, data/data.xml:22a1a29`, label: '123fsf4', value: mockedExperiments[0] }, { description: '[exp-456]', - detail: 'Created:Aug 19, 2022, split:0.2, data/data.xml:22a1a29', + detail: `Created:${formatDate( + mockedExperiments[1].Created as string + )}, split:0.2, data/data.xml:22a1a29`, label: '456fsf4', value: mockedExperiments[1] }, { description: '[exp-789]', - detail: 'Created:Sep 15, 2022, split:0.3, data/data.xml:22a1a29', + detail: `Created:${formatDate( + mockedExperiments[2].Created as string + )}, split:0.3, data/data.xml:22a1a29`, label: '789fsf4', value: mockedExperiments[2] } diff --git a/extension/src/experiments/model/tree.test.ts b/extension/src/experiments/model/tree.test.ts index ef32e6909e..149b66b14f 100644 --- a/extension/src/experiments/model/tree.test.ts +++ b/extension/src/experiments/model/tree.test.ts @@ -16,6 +16,7 @@ import { RegisteredCommands } from '../../commands/external' import { getMarkdownString } from '../../vscode/markdownString' import { DecoratableTreeItemScheme, getDecoratableUri } from '../../tree' import { ExperimentStatus } from '../webview/contract' +import { formatDate } from '../../util/date' const mockedCommands = jest.mocked(commands) mockedCommands.registerCommand = jest.fn() @@ -483,8 +484,9 @@ describe('ExperimentsTree', () => { iconPath: expect.anything(), id: 'exp-123', label: 'a123', - tooltip: - '|||\n|:--|--|\n| Created | Aug 19, 2022 |\n| data/data.xml | 22a1a29 |\n| ...ms.yaml:featurize.random_value | undefined |\n', + tooltip: `|||\n|:--|--|\n| Created | ${formatDate( + experiments[0].Created + )} |\n| data/data.xml | 22a1a29 |\n| ...ms.yaml:featurize.random_value | undefined |\n`, type: ExperimentType.EXPERIMENT }, { @@ -499,8 +501,9 @@ describe('ExperimentsTree', () => { iconPath: expect.anything(), id: 'exp-456', label: 'b456', - tooltip: - '|||\n|:--|--|\n| Created | Sep 15, 2022 |\n| data/data.xml | 22a1a29 |\n| ...ms.yaml:featurize.random_value | [rbf,linear] |\n', + tooltip: `|||\n|:--|--|\n| Created | ${formatDate( + experiments[1].Created + )} |\n| data/data.xml | 22a1a29 |\n| ...ms.yaml:featurize.random_value | [rbf,linear] |\n`, type: ExperimentType.EXPERIMENT }, { @@ -515,8 +518,9 @@ describe('ExperimentsTree', () => { iconPath: expect.anything(), id: 'exp-789', label: 'c789', - tooltip: - '|||\n|:--|--|\n| Created | Jul 3, 2022 |\n| data/data.xml | 22a1a29 |\n| ...ms.yaml:featurize.random_value | false |\n', + tooltip: `|||\n|:--|--|\n| Created | ${formatDate( + experiments[2].Created + )} |\n| data/data.xml | 22a1a29 |\n| ...ms.yaml:featurize.random_value | false |\n`, type: ExperimentType.EXPERIMENT } ]) diff --git a/extension/src/experiments/model/tree.ts b/extension/src/experiments/model/tree.ts index c052153f15..6bb2660571 100644 --- a/extension/src/experiments/model/tree.ts +++ b/extension/src/experiments/model/tree.ts @@ -358,7 +358,8 @@ export class ExperimentsTree return value !== null ? `| ${truncatedKey} | ${value} |\n` : '' }) .join('') - return getMarkdownString(`|||\n|:--|--|\n${data}`) + + return data === '' ? undefined : getMarkdownString(`|||\n|:--|--|\n${data}`) } private getTooltip( diff --git a/extension/src/experiments/workspace.ts b/extension/src/experiments/workspace.ts index a6b28d342b..4408b60d42 100644 --- a/extension/src/experiments/workspace.ts +++ b/extension/src/experiments/workspace.ts @@ -22,7 +22,7 @@ export class WorkspaceExperiments extends BaseWorkspaceWebviews< public readonly onDidChangeExperiments = this.experimentsChanged.event public readonly columnsChanged = this.dispose.track(new EventEmitter()) - public readonly columnsOrderChanged = this.dispose.track( + public readonly columnsOrderOrStatusChanged = this.dispose.track( new EventEmitter() ) @@ -314,7 +314,7 @@ export class WorkspaceExperiments extends BaseWorkspaceWebviews< ) experiments.dispose.track( - experiments.onDidChangeColumnOrder(() => { + experiments.onDidChangeColumnOrderOrStatus(() => { this.experimentsChanged.fire() }) ) diff --git a/extension/src/path/selection/model.ts b/extension/src/path/selection/model.ts index 1d577dd352..8f132c044e 100644 --- a/extension/src/path/selection/model.ts +++ b/extension/src/path/selection/model.ts @@ -1,4 +1,4 @@ -import { Memento } from 'vscode' +import { EventEmitter, Memento } from 'vscode' import { PersistenceKey } from '../../persistence/constants' import { ModelWithPersistence } from '../../persistence/model' import { Column } from '../../experiments/webview/contract' @@ -17,17 +17,22 @@ export abstract class PathSelectionModel< protected data: T[] = [] + protected statusChanged?: EventEmitter private readonly statusKey: PersistenceKey constructor( dvcRoot: string, workspaceState: Memento, - statusKey: PersistenceKey + statusKey: PersistenceKey, + statusChanged?: EventEmitter ) { super(dvcRoot, workspaceState) this.statusKey = statusKey this.status = workspaceState.get(this.statusKey + dvcRoot, {}) + if (statusChanged) { + this.statusChanged = statusChanged + } } public getSelected() { @@ -50,6 +55,7 @@ export abstract class PathSelectionModel< this.setAreChildrenSelected(path, status) this.setAreParentsSelected(path) this.persistStatus() + this.statusChanged?.fire() return this.status[path] } diff --git a/extension/src/test/fixtures/expShow/base/columns.ts b/extension/src/test/fixtures/expShow/base/columns.ts index 6b8e3a12bf..3d49be4357 100644 --- a/extension/src/test/fixtures/expShow/base/columns.ts +++ b/extension/src/test/fixtures/expShow/base/columns.ts @@ -1,4 +1,4 @@ -import { join } from '../../../util/path' +import { join } from 'path' import { Column, ColumnType } from '../../../../experiments/webview/contract' import { buildDepPath, @@ -8,6 +8,32 @@ import { timestampColumn } from '../../../../experiments/columns/constants' const nestedParamsFile = join('nested', 'params.yaml') +export const dataColumnOrder: string[] = [ + 'id', + 'Created', + 'metrics:summary.json:loss', + 'metrics:summary.json:accuracy', + 'metrics:summary.json:val_loss', + 'metrics:summary.json:val_accuracy', + 'params:params.yaml:code_names', + 'params:params.yaml:epochs', + 'params:params.yaml:learning_rate', + 'params:params.yaml:dvc_logs_dir', + 'params:params.yaml:log_file', + 'params:params.yaml:dropout', + 'params:params.yaml:process.threshold', + 'params:params.yaml:process.test_arg', + join('params:nested', 'params.yaml:test'), + join('deps:data', 'data.xml'), + join('deps:data', 'prepared'), + join('deps:data', 'features'), + join('deps:src', 'prepare.py'), + join('deps:src', 'featurization.py'), + join('deps:src', 'train.py'), + join('deps:src', 'evaluate.py'), + 'deps:model.pkl' +] + const data: Column[] = [ timestampColumn, { diff --git a/extension/src/test/suite/experiments/index.test.ts b/extension/src/test/suite/experiments/index.test.ts index f6aa8dd707..3834e378f6 100644 --- a/extension/src/test/suite/experiments/index.test.ts +++ b/extension/src/test/suite/experiments/index.test.ts @@ -15,7 +15,9 @@ import { buildExperiments, stubWorkspaceExperimentsGetters } from './util' import { Disposable } from '../../../extension' import expShowFixture from '../../fixtures/expShow/base/output' import rowsFixture from '../../fixtures/expShow/base/rows' -import columnsFixture from '../../fixtures/expShow/base/columns' +import columnsFixture, { + dataColumnOrder as columnsOrderFixture +} from '../../fixtures/expShow/base/columns' import workspaceChangesFixture from '../../fixtures/expShow/base/workspaceChanges' import { Experiments } from '../../../experiments' import { ResourceLocator } from '../../../resourceLocator' @@ -127,7 +129,7 @@ suite('Experiments Test Suite', () => { const expectedTableData: TableData = { changes: workspaceChangesFixture, - columnOrder: [], + columnOrder: columnsOrderFixture, columnWidths: {}, columns: columnsFixture, filteredCounts: { checkpoints: 0, experiments: 0 }, @@ -807,7 +809,7 @@ suite('Experiments Test Suite', () => { const allColumnsUnselected: TableData = { changes: workspaceChangesFixture, - columnOrder: [], + columnOrder: columnsOrderFixture, columnWidths: {}, columns: [], filteredCounts: { checkpoints: 0, experiments: 0 }, @@ -1314,8 +1316,8 @@ suite('Experiments Test Suite', () => { ).to.deep.equal([]) expect( mockMemento.keys(), - 'Memento starts with the status key' - ).to.deep.equal(['experimentsStatus:test']) + 'Memento starts with the status keys' + ).to.deep.equal(['experimentsStatus:test', 'columnsColumnOrder:test']) expect( mockMemento.get('experimentsStatus:test'), @@ -1340,6 +1342,11 @@ suite('Experiments Test Suite', () => { workspace: colors[0] }) + expect( + mockMemento.get('columnsColumnOrder:test'), + 'the columns order is added to memento' + ).to.deep.equal(columnsOrderFixture) + const mockPickSort = stub(SortQuickPicks, 'pickSortToAdd') mockPickSort.onFirstCall().resolves(firstSortDefinition) diff --git a/extension/src/test/suite/experiments/model/filterBy/tree.test.ts b/extension/src/test/suite/experiments/model/filterBy/tree.test.ts index b523807044..31054debaf 100644 --- a/extension/src/test/suite/experiments/model/filterBy/tree.test.ts +++ b/extension/src/test/suite/experiments/model/filterBy/tree.test.ts @@ -4,7 +4,9 @@ import { stub, spy, restore } from 'sinon' import { window, commands, MessageItem, EventEmitter, TreeView } from 'vscode' import { addFilterViaQuickInput, mockQuickInputFilter } from './util' import { Disposable } from '../../../../../extension' -import columnsFixture from '../../../../fixtures/expShow/base/columns' +import columnsFixture, { + dataColumnOrder as columnsOrderFixture +} from '../../../../fixtures/expShow/base/columns' import rowsFixture from '../../../../fixtures/expShow/base/rows' import workspaceChangesFixture from '../../../../fixtures/expShow/base/workspaceChanges' import { WorkspaceExperiments } from '../../../../../experiments/workspace' @@ -115,7 +117,7 @@ suite('Experiments Filter By Tree Test Suite', () => { const filteredTableData: TableData = { changes: workspaceChangesFixture, - columnOrder: [], + columnOrder: columnsOrderFixture, columnWidths: {}, columns: columnsFixture, filteredCounts: { checkpoints: 4, experiments: 1 }, @@ -146,7 +148,7 @@ suite('Experiments Filter By Tree Test Suite', () => { const unfilteredTableData: TableData = { changes: workspaceChangesFixture, - columnOrder: [], + columnOrder: columnsOrderFixture, columnWidths: {}, columns: columnsFixture, filteredCounts: { checkpoints: 0, experiments: 0 }, @@ -476,7 +478,7 @@ suite('Experiments Filter By Tree Test Suite', () => { const filteredTableData: TableData = { changes: workspaceChangesFixture, - columnOrder: [], + columnOrder: columnsOrderFixture, columnWidths: {}, columns: columnsFixture, filteredCounts: { checkpoints: 9, experiments: 6 }, diff --git a/extension/src/test/util/jest/index.ts b/extension/src/test/util/jest/index.ts index 9f41286f56..4426b73427 100644 --- a/extension/src/test/util/jest/index.ts +++ b/extension/src/test/util/jest/index.ts @@ -27,7 +27,7 @@ export const buildMockedEventEmitter = () => { export const buildMockedExperiments = () => { const mockedColumnsChanged = buildMockedEventEmitter() - const mockedColumnsOrderChanged = buildMockedEventEmitter() + const mockedColumnsOrderOrStatusChanged = buildMockedEventEmitter() const mockedExperimentsChanged = buildMockedEventEmitter() const mockedGetChildColumns = jest.fn() const mockedGetDvcRoots = jest.fn() @@ -60,7 +60,7 @@ export const buildMockedExperiments = () => { return { mockedColumnsChanged, - mockedColumnsOrderChanged, + mockedColumnsOrderOrStatusChanged, mockedExperiments, mockedExperimentsChanged, mockedGetBranchExperiments,