-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure experiment summary info (columns) are always availabe in the e…
…xperiment table data
- Loading branch information
1 parent
e6e0dac
commit 5acf18a
Showing
8 changed files
with
231 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Column, ColumnType } from '../../webview/contract' | ||
import { EXPERIMENT_COLUMN_ID } from '../constants' | ||
|
||
export const collectColumnOrder = async ( | ||
existingColumnOrder: string[], | ||
terminalNodes: Column[] | ||
): Promise<string[]> => { | ||
const acc: { [columnType: string]: string[] } = { | ||
[ColumnType.DEPS]: [], | ||
[ColumnType.METRICS]: [], | ||
[ColumnType.PARAMS]: [], | ||
[ColumnType.TIMESTAMP]: [] | ||
} | ||
for (const { type, path } of terminalNodes) { | ||
if (existingColumnOrder.includes(path)) { | ||
continue | ||
} | ||
acc[type].push(path) | ||
} | ||
|
||
// eslint-disable-next-line etc/no-assign-mutated-array | ||
await Promise.all([acc.metrics.sort(), acc.params.sort(), acc.deps.sort()]) | ||
|
||
if (!existingColumnOrder.includes(EXPERIMENT_COLUMN_ID)) { | ||
existingColumnOrder.unshift(EXPERIMENT_COLUMN_ID) | ||
} | ||
|
||
return [ | ||
...existingColumnOrder, | ||
...acc.timestamp, | ||
...acc.metrics, | ||
...acc.params, | ||
...acc.deps | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.